feat: 实现仓位出售功能并修复价格接口
- 新增仓位出售功能,支持市价和限价卖出 - 添加卖出模态框,包含订单类型选择、数量快捷按钮、限价输入 - 实现实时平仓收益计算和显示 - 修复价格接口:改用Gamma API获取价格(支持condition_ids参数) - 优化价格选择逻辑:卖出使用bestBid,买入使用bestAsk - 添加提交订单的加载状态和错误处理 - 优化UI提示,明确标注价格用途(买入/卖出参考)
This commit is contained in:
@@ -187,6 +187,50 @@ export interface PositionListResponse {
|
||||
historyPositions: AccountPosition[]
|
||||
}
|
||||
|
||||
/**
|
||||
* 仓位卖出请求
|
||||
*/
|
||||
export interface PositionSellRequest {
|
||||
accountId: number
|
||||
marketId: string
|
||||
side: 'YES' | 'NO'
|
||||
orderType: 'MARKET' | 'LIMIT'
|
||||
quantity: string
|
||||
price?: string // 限价订单必需
|
||||
}
|
||||
|
||||
/**
|
||||
* 仓位卖出响应
|
||||
*/
|
||||
export interface PositionSellResponse {
|
||||
orderId: string
|
||||
marketId: string
|
||||
side: string
|
||||
orderType: string
|
||||
quantity: string
|
||||
price?: string
|
||||
status: string
|
||||
createdAt: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 市场价格请求
|
||||
*/
|
||||
export interface MarketPriceRequest {
|
||||
marketId: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 市场价格响应
|
||||
*/
|
||||
export interface MarketPriceResponse {
|
||||
marketId: string
|
||||
lastPrice?: string
|
||||
bestBid?: string
|
||||
bestAsk?: string
|
||||
midpoint?: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 仓位推送消息类型
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user