feat: 实现仓位出售功能并修复价格接口

- 新增仓位出售功能,支持市价和限价卖出
- 添加卖出模态框,包含订单类型选择、数量快捷按钮、限价输入
- 实现实时平仓收益计算和显示
- 修复价格接口:改用Gamma API获取价格(支持condition_ids参数)
- 优化价格选择逻辑:卖出使用bestBid,买入使用bestAsk
- 添加提交订单的加载状态和错误处理
- 优化UI提示,明确标注价格用途(买入/卖出参考)
This commit is contained in:
WrBug
2025-11-28 04:11:13 +08:00
parent 5b458b9b0c
commit b4fb16af9e
8 changed files with 709 additions and 19 deletions
+13 -1
View File
@@ -97,7 +97,19 @@ export const apiService = {
* 查询所有账户的仓位列表
*/
positionsList: () =>
apiClient.post<ApiResponse<any>>('/copy-trading/accounts/positions/list', {})
apiClient.post<ApiResponse<any>>('/copy-trading/accounts/positions/list', {}),
/**
* 卖出仓位
*/
sellPosition: (data: any) =>
apiClient.post<ApiResponse<any>>('/copy-trading/accounts/positions/sell', data),
/**
* 获取市场价格
*/
getMarketPrice: (data: any) =>
apiClient.post<ApiResponse<any>>('/copy-trading/accounts/markets/price', data)
},
/**