跳到主要内容

订单列表

描述

分页返回调用方的订单列表,按最新优先排序。支持按市场、状态和时间范围过滤。

HTTP 请求

GET /spot/orders(JWT 或 API Key)

权重

0——订单接口不受按 IP 权重限制约束。

请求参数

名称类型必填描述
symbolSTRING可选过滤至单一市场(例如 DFUSDT)。区分大小写。不传则返回所有市场的订单。
statusENUM可选按订单状态过滤。有效值参见订单状态openpartially_filledfilledcanceledrejectedexpired
startLONG可选返回 created_at >= start 的订单(UNIX 秒)。
endLONG可选返回 created_at <= end 的订单(UNIX 秒)。
limitNUMBER可选返回记录数。默认 50;最大 200。超出范围的值服务端会自动截断。

提示: 若只需获取当前挂单,请使用 ?status=open?status=partially_filled——这两个状态均为非终态。如需在单个列表中获取所有活跃订单,可分别请求两次并在客户端合并。

响应示例

200 OK

[
{
"id": "a1b2c3d4-1234-5678-abcd-ef0123456789",
"symbol": "DFUSDT",
"side": "sell",
"type": "limit",
"tif": "gtc",
"price": "0.6000",
"quantity": "200",
"quote_quantity": null,
"filled_qty": "200",
"avg_fill_price": "0.6000",
"status": "filled",
"reject_reason": null,
"created_at": 1778400200,
"updated_at": 1778400250
},
{
"id": "9f2a1c4e-5b67-4d8a-bf93-2e1f4a6c8d10",
"symbol": "DFUSDT",
"side": "buy",
"type": "limit",
"tif": "gtc",
"price": "0.5000",
"quantity": "100",
"quote_quantity": null,
"filled_qty": "0",
"avg_fill_price": "0",
"status": "open",
"reject_reason": null,
"created_at": 1778400000,
"updated_at": 1778400000
}
]
字段说明
status参见订单状态。非终态:openpartially_filled;终态:filledcanceledrejected
filled_qty该订单所有成交累计的基础资产成交数量。
avg_fill_price所有成交的成交量加权平均价格。若无成交则为 "0"
quote_quantity仅市价买单时不为 null;反映请求中的原始 quote_quantity
reject_reasonstatus=rejected 时不为 null;包含拒绝原因的错误码字符串。
created_at, updated_atUNIX 。结果按 created_at 降序排列(最新优先)。

错误响应

HTTPerror触发条件
500DB_ERROR服务端故障。

完整列表:错误码

代码示例

cURL(JWT)

JWT="your_jwt_token"

# List open orders for DFUSDT
curl -s "https://api-sepolia.p99.world/api/v1/spot/orders?symbol=DFUSDT&status=open" \
-H "Authorization: Bearer ${JWT}"

# List last 10 orders of any status
curl -s "https://api-sepolia.p99.world/api/v1/spot/orders?limit=10" \
-H "Authorization: Bearer ${JWT}"

cURL(HMAC API Key)

API_KEY="your_api_key"
API_SECRET="your_api_secret"
TIMESTAMP=$(date +%s%3N)
QUERY="symbol=DFUSDT&status=open&limit=50&timestamp=${TIMESTAMP}"
SIGNATURE=$(echo -n "${QUERY}" | openssl dgst -sha256 -hmac "${API_SECRET}" | awk '{print $2}')

curl -s \
-H "X-MBX-APIKEY: ${API_KEY}" \
"https://api-sepolia.p99.world/api/v1/spot/orders?${QUERY}&signature=${SIGNATURE}"

Python

import time, hmac, hashlib, requests
from urllib.parse import urlencode

API_KEY = "your_api_key"
API_SECRET = "your_api_secret"
BASE_URL = "https://api-sepolia.p99.world/api/v1"

def signed_get(path: str, params: dict = None) -> list | dict:
ts = int(time.time() * 1000)
qs_params = {**(params or {}), "timestamp": ts}
qs = urlencode(qs_params)
sig = hmac.new(API_SECRET.encode(), qs.encode(), hashlib.sha256).hexdigest()
r = requests.get(
f"{BASE_URL}{path}?{qs}&signature={sig}",
headers={"X-MBX-APIKEY": API_KEY},
timeout=5,
)
r.raise_for_status()
return r.json()

# Fetch all currently-open DFUSDT orders
open_orders = signed_get("/spot/orders", {"symbol": "DFUSDT", "status": "open", "limit": 200})
print(f"{len(open_orders)} open order(s)")
for o in open_orders:
print(f" {o['id']} {o['side']:4} {o['quantity']} @ {o['price']}")

# Fetch partially-filled orders too
partial = signed_get("/spot/orders", {"symbol": "DFUSDT", "status": "partially_filled", "limit": 200})
print(f"{len(partial)} partially-filled order(s)")