refactor: 重构市场数据接口和移除敏感信息

- 创建 MarketController,将市场相关接口从 AccountController 移出
- 添加 /api/copy-trading/markets/latest-price 接口供前端获取最新价
- 在 PolymarketClobService 中封装获取订单表和最优价的逻辑
- 支持多元市场(二元、三元及以上)的最优价获取
- 市价单价格添加调整系数(买单+0.01,卖单-0.02)
- 移除所有测试文件中的真实私钥和API凭证
- 更新前端API服务,添加markets相关接口
This commit is contained in:
WrBug
2025-11-29 11:08:01 +08:00
parent b4fb16af9e
commit 4e89f53c24
15 changed files with 1400 additions and 166 deletions
+4 -2
View File
@@ -163,7 +163,8 @@ export interface AccountPosition {
marketTitle?: string
marketSlug?: string
marketIcon?: string // 市场图标 URL
side: string // YES 或 NO
side: string // 结果名称(如 "YES", "NO", "Pakistan" 等)
outcomeIndex?: number // 结果索引(0, 1, 2...),用于计算 tokenId
quantity: string
avgPrice: string
currentPrice: string
@@ -193,7 +194,8 @@ export interface PositionListResponse {
export interface PositionSellRequest {
accountId: number
marketId: string
side: 'YES' | 'NO'
side: string // 结果名称(如 "YES", "NO", "Pakistan" 等)
outcomeIndex?: number // 结果索引(0, 1, 2...),用于计算 tokenId(推荐提供)
orderType: 'MARKET' | 'LIMIT'
quantity: string
price?: string // 限价订单必需