成交訂單
接口信息
接口: POST /api/v1/orders/fill
描述: 執行訂單成交(部分或全部)。此接口需要 Taker 認證。
鑑權: API Key憑據認證
請求參數
| 字段 | 類型 | 必填 | 說明 |
|---|---|---|---|
| order | object | 是 | 訂單信息 |
| order.maker | string | 是 | 訂單創建者地址 |
| order.principal | string | 是 | 接收者地址 |
| order.is_buy | bool | 是 | 是否是買入 |
| order.ticker | string | 是 | 股票代碼 |
| order.exchange | int | 是 | 交易所ID |
| order.asset | string | 是 | 資產代幣地址 |
| order.price | string | 是 | 價格 |
| order.quantity | string | 是 | 數量 |
| order.incentive | string | 是 | 激勵金額 |
| order.deadline | long | 是 | 截止時間戳 |
| order.nonce | long | 是 | 防重放數字 |
| signature | string | 是 | 訂單簽名 |
| fill_quantity | string | 是 | 成交數量 |
| taker_incentive | string | 是 | 實際成交手續費 |
響應參數
| 字段 | 類型 | 說明 |
|---|---|---|
| success | boolean | 成交是否成功 |
| tx_hash | string | 交易哈希 |
| order_hash | string | 訂單哈希值 |
| filled_quantity | string | 成交數量 |
| filled_amount | string | 成交金額 |
| fee_amount | string | 手續費金額 |
| incentive_amount | string | 激勵金額 |
| status | enum | 訂單狀態(見OrderStatus) |
請求示例
bash
curl -X POST "/api/v1/orders/fill" \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"order": {
"maker": "0x1234567890123456789012345678901234567890",
"principal": "0xabcdefabcdefabcdefabcdefabcdefabcdefabcd",
"is_buy": true,
"ticker": "AAPL",
"exchange": 0,
"asset": "0x0000000000000000000000000000000000000001",
"price": "150250000000000000000",
"quantity": "100",
"incentive": "1000000000000000000",
"deadline": 1735689600,
"nonce": 1
},
"signature": "0x...",
"fill_quantity": "50",
"taker_incentive": "500000000000000000"
}'響應示例
json
{
"code": 0,
"data": {
"success": true,
"tx_hash": "0xabcdef1234567890...",
"order_hash": "0x1234567890abcdef...",
"filled_quantity": "50",
"filled_amount": "7512500000000000000000",
"fee_amount": "75125000000000000000",
"incentive_amount": "500000000000000000",
"status": "partially_filled"
}
}枚舉類型
OrderStatus - 訂單狀態
| 枚舉項 | 說明 |
|---|---|
| partially_filled | 部分成交 |
| filled | 完全成交 |
注意事項
- 成交數量不能超過訂單剩餘數量
- 訂單必須處於鎖定狀態才能成交
- 部分成交後訂單狀態變為 partially_filled
- 完全成交後訂單狀態變為 filled