2026-03-02 11:47:34 +08:00

24 lines
870 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# order.ts
**路径**`src/api/order.ts`
## 功能用途
订单相关 API获取订单列表、取消订单以及将 `ClobOrderItem` 映射为展示项History、Open Orders`PageResult``ApiResponse` 来自 `@/api/types`,通过 `buildQuery` 构建请求参数。
## 使用方式
```typescript
import { getOrderList, mapOrderToOpenOrderItem, mapOrderToHistoryItem, cancelOrder } from '@/api/order'
```
## 数据单位约定
- **price**:整数,已乘 10000bps`priceCents = price / 100`
- **originalSize / sizeMatched**:按 6 位小数传1_000_000 = 1 share展示时除以 `ORDER_SIZE_SCALE` 转为实际份额
## 扩展方式
1. 新增订单状态或筛选参数时,更新 `GetOrderListParams``getOrderList`
2. 展示格式变更时,调整 `mapOrderToOpenOrderItem``mapOrderToHistoryItem` 的格式化逻辑