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
+15 -3
View File
@@ -105,11 +105,23 @@ export const apiService = {
sellPosition: (data: any) =>
apiClient.post<ApiResponse<any>>('/copy-trading/accounts/positions/sell', data),
},
/**
* 市场数据 API
*/
markets: {
/**
* 获取市场价格
* 获取市场价格(通过 Gamma API
*/
getMarketPrice: (data: any) =>
apiClient.post<ApiResponse<any>>('/copy-trading/accounts/markets/price', data)
getMarketPrice: (data: { marketId: string }) =>
apiClient.post<ApiResponse<any>>('/copy-trading/markets/price', data),
/**
* 获取最新价(从订单表获取,供前端下单时显示)
*/
getLatestPrice: (data: { tokenId: string }) =>
apiClient.post<ApiResponse<any>>('/copy-trading/markets/latest-price', data)
},
/**