feat: 改进下单错误处理和市场价格接口

- 修复市场价格接口:移除side参数,使用outcomeIndex判断方向
- 添加规范:禁止使用YES/NO字符串判断side,必须使用outcomeIndex
- 改进所有下单错误处理:所有错误都打印详细日志并存入数据库
  - AccountService.sellPosition: 添加完整错误日志
  - CopyOrderTrackingService.createOrderWithRetry: 所有失败都记录详细日志
  - recordFailedTrade: 改进错误信息存储,包含堆栈信息
  - PolymarketClobService.createSignedOrder: 添加完整错误日志
- 前端:更新市场价格接口调用,使用outcomeIndex替代side参数
- 清理:删除过时的i18n文档
This commit is contained in:
WrBug
2025-12-05 00:23:44 +08:00
parent 1a9407c544
commit 41596887c9
18 changed files with 215 additions and 1841 deletions
+4 -1
View File
@@ -367,7 +367,10 @@ const PositionList: React.FC = () => {
// 加载市场价格
try {
const response = await apiService.markets.getMarketPrice({ marketId: position.marketId })
const response = await apiService.markets.getMarketPrice({
marketId: position.marketId,
outcomeIndex: position.outcomeIndex // 传递结果索引,用于确定需要查询哪个 outcome 的价格
})
if (response.data.code === 0 && response.data.data) {
setMarketPrice(response.data.data)
// 默认使用最优买价作为限价
+1 -1
View File
@@ -239,7 +239,7 @@ export const apiService = {
/**
* 获取市场价格(通过 Gamma API)
*/
getMarketPrice: (data: { marketId: string }) =>
getMarketPrice: (data: { marketId: string; outcomeIndex?: number }) =>
apiClient.post<ApiResponse<any>>('/copy-trading/markets/price', data),
/**