Skip to main content

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.

{
"subscriptionId": 0,
"event": {
"e": "outboundAccountPosition", // Event type
"E": 1564034571105, // Event Time
"u": 1564034571073, // Time of last account update
// Balances Array
"B": [
{
"a": "ETH", // Asset
"f": "10000.000000", // Free
"l": "0.000000" // Locked
}
]
}
}

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

{
"subscriptionId": 0,
"event": {
"e": "balanceUpdate", // Event Type
"E": 1573200697110, // Event Time
"a": "BTC", // Asset
"d": "100.00000000", // Balance Delta
"T": 1573200697068 // Clear Time
}
}

Order Update​

Orders are updated with the executionReport event.

Payload:

{
"subscriptionId": 0,
"event": {
"e": "executionReport", // Event type
"E": 1499405658658, // Event time
"s": "ETHBTC", // Symbol
"c": "mUvoqJxFIILMdfAW5iGSOW", // Client order ID
"S": "BUY", // Side
"o": "LIMIT", // Order type
"f": "GTC", // Time in force
"q": "1.00000000", // Order quantity
"p": "0.10264410", // Order price
"P": "0.00000000", // Stop price
"F": "0.00000000", // Iceberg quantity
"g": -1, // OrderListId
"C": "", // Original client order ID; This is the ID of the order being canceled
"x": "NEW", // Current execution type
"X": "NEW", // Current order status
"r": "NONE", // Order reject reason; Please see Order Reject Reason for more information.
"i": 4293153, // Order ID
"l": "0.00000000", // Last executed quantity
"z": "0.00000000", // Cumulative filled quantity
"L": "0.00000000", // Last executed price
"n": "0", // Commission amount
"N": null, // Commission asset
"T": 1499405658657, // Transaction time
"t": -1, // Trade ID
"v": 3, // Prevented Match Id; This is only visible if the order expired due to STP
"I": 8641984, // Execution Id
"w": true, // Is the order on the book?
"m": false, // Is this trade the maker side?
"M": false, // Ignore
"O": 1499405658657, // Order creation time
"Z": "0.00000000", // Cumulative quote asset transacted quantity
"Y": "0.00000000", // Last quote asset transacted quantity (i.e. lastPrice * lastQty)
"Q": "0.00000000", // Quote Order Quantity
"W": 1499405658657, // Working Time; This is only visible if the order has been placed on the book.
"V": "NONE", // SelfTradePreventionMode
"d": 4, // Trailing Delta
"D": 1668680518494, // Trailing Time
"j": 1, // Strategy Id
"J": 1000000, // Strategy Type
"A": "3.000000", // Prevented Quantity
"B": "3.000000", // Last Prevented Quantity
"u": 1, // Trade Group Id
"U": 37, // Counter Order Id
"Cs": "BTCUSDT", // Counter Symbol
"pl": "2.123456", // Prevented Execution Quantity
"pL": "0.10000001", // Prevented Execution Price
"pY": "0.21234562", // Prevented Execution Quote Qty
"b": "ONE_PARTY_TRADE_REPORT", // Match Type
"a": 1234, // Allocation ID
"k": "SOR", // Working Floor
"uS": true, // UsedSor
"gP": "PRIMARY_PEG", // Pegged Price Type
"gOT": "PRICE_LEVEL", // Pegged Offset Type
"gOV": 5, // Pegged Offset Value
"gp": "1.00000000", // Pegged Price
"eR": "INSUFFICIENT_LIQUIDITY" // Expiry Reason. Appears when the order has expired.
}
}

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.

FieldNameDescriptionExamples
dTrailing DeltaAppears only for trailing stop orders."d": 4
DTrailing TimeAppears only for trailing stop orders."D": 1668680518494
jStrategy IdAppears only if the strategyId parameter was provided upon order placement."j": 1
JStrategy TypeAppears only if the strategyType parameter was provided upon order placement."J": 1000000
vPrevented Match IdAppears only for orders that expired due to STP."v": 3
APrevented QuantityAppears only for orders that expired due to STP."A": "3.000000"
BLast Prevented QuantityAppears only for orders that expired due to STP."B": "3.000000"
uTrade Group IdAppears only for orders that expired due to STP."u": 1
UCounter Order IdAppears only for orders that expired due to STP."U": 37
CsCounter SymbolAppears only for orders that expired due to STP."Cs": "BTCUSDT"
plPrevented Execution QuantityAppears only for orders that expired due to STP."pl": "2.123456"
pLPrevented Execution PriceAppears only for orders that expired due to STP."pL": "0.10000001"
pYPrevented Execution Quote QtyAppears only for orders that expired due to STP."pY": "0.21234562"
WWorking TimeAppears when the order is working on the book"W": 1668683798379
bMatch TypeAppears for orders that have allocations"b": "ONE_PARTY_TRADE_REPORT"
aAllocation IDAppears for orders that have allocations"a": 1234
kWorking FloorAppears for orders that potentially have allocations"k": "SOR"
uSUsedSorAppears for orders that used SOR"uS": true
gPPegged Price TypeAppears only for Pegged Orders"gP": "PRIMARY_PEG"
gOTPegged Offset TypeAppears only for Pegged Orders"gOT": "PRICE_LEVEL"
gOVPegged Offset ValueAppears only for Pegged Orders"gOV": 5
gpPegged PriceAppears only for Pegged Orders"gp": "1.00000000"
eRExpiry ReasonAppears when the order has expired."eR": "INSUFFICIENT_LIQUIDITY"

Order Reject Reason​

For additional details, look up the Error Message in the Errors documentation.

Rejection Reason (r)Error Message
NONEN/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

{
"subscriptionId": 0,
"event": {
"e": "listStatus", // Event Type
"E": 1564035303637, // Event Time
"s": "ETHBTC", // Symbol
"g": 2, // OrderListId
"c": "OCO", // Contingency Type
"l": "EXEC_STARTED", // List Status Type
"L": "EXECUTING", // List Order Status
"r": "NONE", // List Reject Reason
"C": "F4QN4G8DlFATFlIUQ0cjdD", // List Client Order ID
"T": 1564035303625, // Transaction Time
// An array of objects
"O": [
{
"s": "ETHBTC", // Symbol
"i": 17, // OrderId
"c": "AJYsMjErWJesZvqlJCTUgL" // ClientOrderId
},
{
"s": "ETHBTC",
"i": 18,
"c": "bfYPSQdLoqAJeNrOr9adzq"
}
]
}
}

Execution types:

See Execution types on the Enums page for what each x / X value means.

Order Expiry Reason​

See Expiry Reasons on the Enums page for what each eR value means.

Check the Enums page for more relevant enum definitions.

Event Stream Terminated​

eventStreamTerminated is sent when:

Payload:

{
"subscriptionId": 0,
"event": {
"e": "eventStreamTerminated", // Event Type
"E": 1728973001334 // Event Time
}
}

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:

{
"subscriptionId": 0,
"event": {
"e": "externalLockUpdate", // Event Type
"E": 1581557507324, // Event Time
"a": "NEO", // Asset
"d": "10.00000000", // Delta
"T": 1581557507268 // Transaction Time
}
}