跳轉到內容

成交訂單

接口信息

接口: POST /api/v1/orders/fill

描述: 執行訂單成交(部分或全部)。此接口需要 Taker 認證。

鑑權: API Key憑據認證

請求參數

字段類型必填說明
orderobject訂單信息
order.makerstring訂單創建者地址
order.principalstring接收者地址
order.is_buybool是否是買入
order.tickerstring股票代碼
order.exchangeint交易所ID
order.assetstring資產代幣地址
order.pricestring價格
order.quantitystring數量
order.incentivestring激勵金額
order.deadlinelong截止時間戳
order.noncelong防重放數字
signaturestring訂單簽名
fill_quantitystring成交數量
taker_incentivestring實際成交手續費

響應參數

字段類型說明
successboolean成交是否成功
tx_hashstring交易哈希
order_hashstring訂單哈希值
filled_quantitystring成交數量
filled_amountstring成交金額
fee_amountstring手續費金額
incentive_amountstring激勵金額
statusenum訂單狀態(見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