跳轉到內容

查詢訂單列表

接口信息

接口: GET /api/v1/orders

描述: 靈活查詢訂單列表,支持多種過濾條件、分頁和排序

鑑權: Authorization請求頭附加JWT令牌

查詢參數

參數類型必填說明
order_hashstring訂單哈希值(精確匹配)
principalstring接收者地址(精確匹配)
tickerstring股票代碼(精確匹配或模糊搜索)
ticker_likeboolean是否啟用模糊搜索,默認false
exchangeint交易所ID(精確匹配)
assetstring資產代幣地址(精確匹配)
is_buyboolean是否為買單(精確匹配)
nonceint防重放數字(精確匹配)
price_minstring最小價格
price_maxstring最大價格
quantity_minstring最小數量
quantity_maxstring最大數量
incentive_minstring最小激勵金額
incentive_maxstring最大激勵金額
filled_quantity_minstring最小已成交數量
filled_quantity_maxstring最大已成交數量
statusstring訂單狀態,支持多個(逗號分隔,如"pending,filled")
deadline_afterint最早截止時間(Unix時間戳)
deadline_beforeint最晚截止時間(Unix時間戳)
created_afterint最早創建時間(Unix時間戳)
created_beforeint最晚創建時間(Unix時間戳)
sort_bystring排序字段(price, quantity, incentive, deadline, created_at),默認created_at
sort_orderstring排序方向(asc, desc),默認desc
pageint頁碼,默認1
page_sizeint每頁數量,默認20,最大100

響應參數

字段類型說明
totalint總記錄數
pageint當前頁碼
page_sizeint每頁數量
total_pagesint總頁數
ordersarray訂單列表

訂單對象字段

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

成交明細對象字段

字段類型說明
idstring成交記錄ID(UUID)
order_idstring訂單ID
order_hashstring訂單哈希值
takerstringTaker地址
fill_quantitystring成交數量(wei單位)
fill_amountstring成交金額(wei單位)
fee_amountstring手續費金額(wei單位)
incentive_amountstring激勵金額(wei單位)
taker_incentivestringTaker激勵(wei單位)
tx_hashstring交易哈希
block_numberint區塊號
statusstring成交狀態
reference_idstring參考ID(可選)
created_atstring創建時間(ISO 8601格式)

請求示例

bash
# 基礎查詢
curl -X GET "/api/v1/orders?ticker=AAPL&page=1&page_size=20" \
     -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
     -H "Content-Type: application/json"

# 多狀態查詢
curl -X GET "/api/v1/orders?status=pending,partially_filled" \
     -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
     -H "Content-Type: application/json"

# 價格範圍查詢
curl -X GET "/api/v1/orders?price_min=100000000000000000000&price_max=200000000000000000000" \
     -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." \
     -H "Content-Type: application/json"

響應示例

json
{
    "code": 0,
    "data": {
        "total": 3,
        "page": 1,
        "page_size": 20,
        "total_pages": 1,
        "orders": [
            {
                "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"
            },
            {
                "id": "660e8400-e29b-41d4-a716-446655440001",
                "maker": "0x1234567890123456789012345678901234567890",
                "principal": "0x1234567890123456789012345678901234567890",
                "is_buy": false,
                "ticker": "TSLA",
                "exchange": 0,
                "asset": "0x09671802Cc9Bbf6402f2e7a07b220Aa7b43D8c91",
                "price": "245000000000000000000",
                "quantity": "5000000000000000000",
                "incentive": "50000000000000000",
                "deadline": 1735747200,
                "nonce": 2,
                "signature": "0x789012fedcba...",
                "order_hash": "0x789012fedcba...",
                "status": "locked",
                "filled_quantity": "0",
                "notes": null,
                "created_at": "2025-01-17T05:30:00Z",
                "updated_at": "2025-01-17T06:15:00Z"
            },
            {
                "id": "770e8400-e29b-41d4-a716-446655440002",
                "maker": "0x1234567890123456789012345678901234567890",
                "principal": "0x1234567890123456789012345678901234567890",
                "is_buy": true,
                "ticker": "GOOGL",
                "exchange": 0,
                "asset": "0x09671802Cc9Bbf6402f2e7a07b220Aa7b43D8c91",
                "price": "138500000000000000000",
                "quantity": "20000000000000000000",
                "incentive": "200000000000000000",
                "deadline": 1735833600,
                "nonce": 3,
                "signature": "0xfedcba987654...",
                "order_hash": "0xfedcba987654...",
                "status": "filled",
                "filled_quantity": "20000000000000000000",
                "notes": null,
                "created_at": "2025-01-16T10:00:00Z",
                "updated_at": "2025-01-17T08:45:00Z",
                "fills": [
                    {
                        "id": "880e8400-e29b-41d4-a716-446655440003",
                        "order_id": "770e8400-e29b-41d4-a716-446655440002",
                        "order_hash": "0xfedcba987654...",
                        "taker": "0x9876543210987654321098765432109876543210",
                        "fill_quantity": "20000000000000000000",
                        "fill_amount": "2770000000000000000000",
                        "fee_amount": "13850000000000000000",
                        "incentive_amount": "200000000000000000",
                        "taker_incentive": "200000000000000000",
                        "tx_hash": "0xabcdef123456789...",
                        "block_number": 12345678,
                        "status": "confirmed",
                        "reference_id": "Taker-1737105945abc",
                        "created_at": "2025-01-17T08:45:00Z"
                    }
                ]
            }
        ]
    }
}