User Data Streams for Binance
General information
- Subscribe via the WebSocket API using an API Key.
- Both SBE and JSON output are supported.
- Account events are pushed in real-time.
- All timestamps in JSON payloads are in milliseconds by default.
- Events may contain non-ASCII characters encoded in UTF-8 if you own or trade any assets or symbols whose names contain non-ASCII characters.
User Data Stream Events
Account Update
outboundAccountPosition is sent any time an account balance has changed and contains the assets
that were possibly changed by the event that generated the balance change.
Schema:
outboundAccountPosition
Balance Update
Balance Update occurs during the following:
- Deposits or withdrawals from the account
- Transfer of funds between accounts (e.g. Spot to Margin)
Payload
Schema:
balanceUpdate
Order Update
Orders are updated with the executionReport event.
Payload:
Schema:
executionReport
Note: Average price can be found by doing Z divided by z.
Conditional Fields in Execution Report
These are fields that appear in the payload only if certain conditions are met.
For additional information on these parameters, please refer to the Spot Glossary.
| Field | Name | Description |
|---|---|---|
d | Trailing Delta | Appears only for trailing stop orders. |
D | Trailing Time | Appears only for trailing stop orders. |
j | Strategy Id | Appears only if the strategyId parameter was provided upon order placement. |
J | Strategy Type | Appears only if the strategyType parameter was provided upon order placement. |
v | Prevented Match Id | Appears only for orders that expired due to STP. |
A | Prevented Quantity | Appears only for orders that expired due to STP. |
B | Last Prevented Quantity | Appears only for orders that expired due to STP. |
u | Trade Group Id | Appears only for orders that expired due to STP. |
U | Counter Order Id | Appears only for orders that expired due to STP. |
Cs | Counter Symbol | Appears only for orders that expired due to STP. |
pl | Prevented Execution Quantity | Appears only for orders that expired due to STP. |
pL | Prevented Execution Price | Appears only for orders that expired due to STP. |
pY | Prevented Execution Quote Qty | Appears only for orders that expired due to STP. |
W | Working Time | Appears when the order is working on the book |
b | Match Type | Appears for orders that have allocations |
a | Allocation ID | Appears for orders that have allocations |
k | Working Floor | Appears for orders that potentially have allocations |
uS | UsedSor | Appears for orders that used SOR |
gP | Pegged Price Type | Appears only for Pegged Orders |
gOT | Pegged Offset Type | Appears only for Pegged Orders |
gOV | Pegged Offset Value | Appears only for Pegged Orders |
gp | Pegged Price | Appears only for Pegged Orders |
Order Reject Reason
For additional details, look up the Error Message in the Errors documentation.
Rejection Reason (r) | Error Message |
|---|---|
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." |
If the order is an order list, an event named ListStatus will be sent in addition to the
executionReport event.
Payload
Schema:
listStatus
Execution types:
NEW- The order has been accepted into the engine.CANCELED- The order has been canceled by the user.REPLACED- The order has been amended.REJECTED- The order has been rejected and was not processed (e.g. Cancel Replace Orders wherein the new order placement is rejected but the request to cancel request succeeds.)TRADE- Part of the order or all of the order's quantity has filled.EXPIRED- The order was canceled according to the order type's rules (e.g. LIMIT FOK orders with no fill, LIMIT IOC or MARKET orders that partially fill) or by the exchange, (e.g. orders canceled during liquidation, orders canceled during maintenance).TRADE_PREVENTION- The order has expired due to STP.
Check the Enums page for more relevant enum definitions.
Event Stream Terminated
eventStreamTerminated is sent when:
- A listen token subscription expires due to token expiration.
- A logon subscription ends after
sending
session.logoutmethod. - The subscription is stopped via the
userDataStream.unsubscribemethod.
Payload:
Schema:
eventStreamTerminated
External Lock Update
externalLockUpdate is sent when part of your spot wallet balance is locked/unlocked by an external
system, for example when used as margin collateral.
Payload:
Schema:
externalLockUpdate