feat: 改进下单错误处理和市场价格接口
- 修复市场价格接口:移除side参数,使用outcomeIndex判断方向 - 添加规范:禁止使用YES/NO字符串判断side,必须使用outcomeIndex - 改进所有下单错误处理:所有错误都打印详细日志并存入数据库 - AccountService.sellPosition: 添加完整错误日志 - CopyOrderTrackingService.createOrderWithRetry: 所有失败都记录详细日志 - recordFailedTrade: 改进错误信息存储,包含堆栈信息 - PolymarketClobService.createSignedOrder: 添加完整错误日志 - 前端:更新市场价格接口调用,使用outcomeIndex替代side参数 - 清理:删除过时的i18n文档
This commit is contained in:
@@ -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)
|
||||
// 默认使用最优买价作为限价
|
||||
|
||||
@@ -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),
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user