WebSocket 账户接口
一般信息
- 通过使用 API Key 订阅 WebSocket API。
- 支持 SBE 和 JSON 输出格式。
- 账户事件以 实时 方式推送。
- JSON 数据中的所有时间戳默认均为 毫秒。
- 如果您持有或交易任何名称包含非 ASCII 字符的资产或交易对,那么事件中可能包含以 UTF-8 编码的非 ASCII 字符。
用户数据流事件
账户更新
每当帐户余额发生更改时,都会发送一个事件outboundAccountPosition,其中包含可能由生成余额变动的事件而变动的资产。
Schema:
outboundAccountPosition
Loading schema...
余额更新
当下列情形发生时更新:
- 账户发生充值或提取
- 交易账户之间发生划转(例如 现货向杠杆账户划转)
Payload
Schema:
balanceUpdate
Loading schema...
订单更新
订单通过executionReport事件进行更新。
Payload:
Schema:
executionReport
Loading schema...
备注: 通过将Z除以z可以找到平均价格。
executionReport 中的特定条件时才会出现的字段
这些字段仅在满足特定条件时才会出现。有关这些参数的更多信息,请参阅 现货交易API术语表。
| 字段 | 名称 | 描述 | 示例 |
|---|---|---|---|
d | Trailing Delta | 出现在追踪止损订单中。 | "d": 4 |
D | Trailing Time | 出现在追踪止损订单中。 | "D": 1668680518494 |
j | Strategy Id | 如果在请求中添加了strategyId参数,则会出现。 | "j": 1 |
J | Strategy Type | 如果在请求中添加了strategyType参数,则会出现。 | "J": 1000000 |
v | Prevented Match Id | 只有在因为 STP 导致订单失效时可见。 | "v": 3 |
A | Prevented Quantity | 只有在因为 STP 导致订单失效时可见。 | "A": "3.000000" |
B | Last Prevented Quantity | 只有在因为 STP 导致订单失效时可见。 | "B": "3.000000" |
u | Trade Group Id | 只有在因为 STP 导致订单失效时可见。 | "u": 1 |
U | Counter Order Id | 只有在因为 STP 导致订单失效时可见。 | "U": 37 |
Cs | Counter Symbol | 只有在因为 STP 导致订单失效时可见。 | "Cs": "BTCUSDT" |
pl | Prevented Execution Quantity | 只有在因为 STP 导致订单失效时可见。 | "pl": "2.123456" |
pL | Prevented Execution Price | 只有在因为 STP 导致订单失效时可见。 | "pL": "0.10000001" |
pY | Prevented Execution Quote Qty | 只有在因为 STP 导致订单失效时可见。 | "pY": "0.21234562" |
W | Working Time | 只有在订单在订单簿上时可见 | "W": 1668683798379 |
b | Match Type | 只有在订单有分配时可见 | "b": "ONE_PARTY_TRADE_REPORT" |
a | Allocation ID | 只有在订单有分配时可见 | "a": 1234 |
k | Working Floor | 只有在订单可能有分配时可见 | "k": "SOR" |
uS | UsedSor | 只有在订单使用 SOR 时可见 | "uS": true |
gP | Pegged Price Type | 仅出现在挂钩订单中 | "gP": "PRIMARY_PEG" |
gOT | Pegged Offset Type | 仅出现在挂钩订单中 | "gOT": "PRICE_LEVEL" |
gOV | Pegged Offset Value | 仅出现在挂钩订单中 | "gOV": 5 |
gp | Pegged Price | 仅出现在挂钩订单中 | "gp": "1.00000000" |
eR | Expiry Reason | 出现在订单已过期时。 | "eR": "INSUFFICIENT_LIQUIDITY" |
订单拒绝原因
有关更多详细信息,请查阅 错误代码汇总 文档中的错误消息。
拒绝原因 (r) | 错误信息 |
|---|---|
NONE | N/A (i.e. The order was not rejected.) |
INSUFFICIENT_BALANCES | "Account has insufficient balance for requested action." |
STOP_PRICE_WOULD_TRIGGER_IMMEDIATELY | "Order would trigger immediately." |
WOULD_MATCH_IMMEDIATELY | "Order would immediately match and take." |
OCO_BAD_PRICES | "The relationship of the prices for the orders is not correct." |
如果是一个订单组,则除了显示 executionReport 事件外,还将显示一个名为 ListStatus 的事件。
Payload
Schema:
listStatus
Loading schema...
可能的执行类型:
每个 x / X 值的含义请参阅枚举定义页面的 可能的执行类型。
订单过期原因
每个 eR 值的含义请参阅枚举定义页面的 订单过期原因。
请查阅 枚举定义 文档获取更多枚举定义。
事件流已终止
eventStreamTerminated 会在以下情况下发送:
- 当 Listen Token 订阅 因 Token 过期而失效时。
- 在发送
session.logout方法后,登录订阅 结束时。 - 通过
userDataStream.unsubscribe方法终止订阅时。
Payload:
Schema:
eventStreamTerminated
Loading schema...
外部锁定更新
当您的现货钱包余额被外部系统锁定/解锁时 (例如,当用作保证金抵押品时),新事件 externalLockUpdate
将会被发送。
Payload:
Schema:
externalLockUpdate
Loading schema...
此页面是否有帮助?
Last modified on