跳轉到內容

發現新訂單

接口信息

接口: GET /api/v1/orders/available

描述: 獲取所有可用的待處理訂單列表,作為WebSocket訂單推送的備用方式

鑑權: API Key憑據認證

查詢參數

響應參數

返回訂單數組,每個訂單包含以下字段:

字段類型說明
idstring訂單ID(UUID)
makerstring訂單創建者地址
principalstring接收者地址
is_buyboolean是否為買單
tickerstring股票代碼
exchangeint交易所ID
assetstring資產代幣地址
pricestring價格(wei單位)
quantitystring數量(wei單位)
incentivestring激勵金額(wei單位)
deadlineint截止時間(Unix時間戳)
nonceint防重放數字
signaturestring訂單簽名
order_hashstring訂單哈希值
statusstring訂單狀態(固定為"pending")
filled_quantitystring已成交數量(wei單位)
notesstring備註(可選)
created_atstring創建時間(ISO 8601格式)
updated_atstring更新時間(ISO 8601格式)

請求示例

bash
curl -X GET "/api/v1/orders/available" \
     -H "X-API-Key: YOUR_API_KEY" \
     -H "Content-Type: application/json"

響應示例

json
{
    "code": 0,
    "data": [
        {
            "id": "550e8400-e29b-41d4-a716-446655440000",
            "maker": "0x1234567890123456789012345678901234567890",
            "principal": "0x1234567890123456789012345678901234567890",
            "is_buy": true,
            "ticker": "AAPL",
            "exchange": 0,
            "asset": "0x09671802Cc9Bbf6402f2e7a07b220Aa7b43D8c91",
            "price": "150250000000000000000",
            "quantity": "10000000000000000000",
            "incentive": "100000000000000000",
            "deadline": 1735660800,
            "nonce": 1,
            "signature": "0xabcdef123456...",
            "order_hash": "0x123456abcdef...",
            "status": "pending",
            "filled_quantity": "0",
            "notes": null,
            "created_at": "2025-01-17T03:00:24Z",
            "updated_at": "2025-01-17T03:00:24Z"
        }
    ]
}

注意事項

  • 此接口返回所有pending狀態的訂單
  • 建議優先使用WebSocket接收訂單推送,此接口作為備用輪詢方式
  • 輪詢間隔建議不少於5秒,避免對服務器造成過大壓力
  • 返回的訂單列表可能較大,建議根據需要進行過濾