All push channels are activated automatically after a successful login. No explicit subscription is required.
User data stream.
Response
Orders data:
Pushed whenever an order changes state (e.g. NEW → OPEN → PARTIALLY_FILLED → FILLED / CANCELLED). Each push reflects the latest snapshot of that order.
{
"channel":"Orders",
"instId":"BINANCE_PERP_ETH_USDT",
"data":{
"portfolioId":"1702884522340000",
"orderId":"1703213979730000",
"clientOrderId":"1703213979730000",
"exchangeType":"BINANCE",
"businessType":"PERP",
"sym":"BINANCE_PERP_ETH_USDT",
"limitPrice":"2346",
"orderQty":"0.01",
"quoteOrderQty":"0",
"side":"BUY",
"exchangeOrderType":"LIMIT",
"timeInForce":"GTC",
"executedQty":"0",
"executedAmount":"0",
"executedAvgPrice":"0",
"lastExecutedQty":"0",
"lastExecutedPrice":"0",
"lastExecutedAmount":"0",
"fee":"0",
"orderState":"NEW",
"updateAt":"1703213979731",
"createAt":"1703213979731",
"borrowAmount":"0",
"borrowAsset":null,
"reason":"",
"action": "",
"actionMsg": "",
"cancelType": "",
"amendType": ""
}
}
| Field | Type | remark |
|---|---|---|
| channel | String | Channel name:Orders |
| instId | String | Trading unique identifier, example: BINANCE_SPOT_BTC_USDT, BINANCE_PERP_BTC_USDT If you want to know other trading unique identifiers, please go to the introduction page. |
| data | Array | Data |
| >portfolioId | String | Portfolio ID |
| >orderId | String | Order ID |
| >clientOrderId | String | Customer defined order ID |
| >exchangeType | String | Exchange type(BINANCE, OKX) |
| >businessType | String | Business type(SPOT, PERP) |
| >sym | String | Trading unique identifier, example: BINANCE_SPOT_BTC_USDT, BINANCE_PERP_BTC_USDT If you want to know other trading unique identifiers, please go to the introduction page. |
| >limitPrice | String | Order price |
| >orderQty | String | Order quantity, note: trading unit of OKX is the number of contracts/ trading unit of Binance is the number of coin Note: The trading unit on OKX is measured in the number of contracts, while the trading unit on Binance is measured in the number of coins. |
| >quoteOrderQty | String | Order quote quantity, applicable only for spot market buy orders. |
| >side | String | Side(BUY,SELL) |
| >exchangeOrderType | String | Exchange order type(LIMIT, MARKET) |
| >timeInForce | String | Default GTC, enums:GTC,IOC,FOK,GTX |
| >executedQty | String | Transaction quantity Note: The trading unit on OKX is measured in the number of contracts, while the trading unit on Binance is measured in the number of coins. |
| >executedAmount | String | Transaction amount |
| >executedAvgPrice | String | Average transaction price |
| >lastExecutedQty | String | Last transaction quantity |
| >lastExecutedPrice | String | Last transaction price |
| >lastExecutedAmount | String | Last transaction amount |
| >fee | String | Executed transaction fee |
| >orderState | String | Order state(NEW, OPEN, CANCELLED, FILLED, PARTIALLY_FILLED, REJECT, FAIL) |
| >updateAt | String | Update time |
| >createAt | String | Create time |
| >reason | String | Fail reason |
| >borrowAmount | String | Borrow amount |
| >borrowAsset | String | Borrow asset |
| >action | String | AMEND_PENDING AMEND_COMPLETED AMEND_FAILED CANCEL_PENDING CANCEL_COMPLETE CANCEL_FAILED |
| >actionMsg | String | action msg |
| >cancelType | String | USER EXPIRE REDUCE_ONLY LIQUIDATING SYSTEM SYM_DELIST |
| >amendType | String | USER REDUCE_ONLY |
Trades data:
Pushed for each individual fill event. A single order may generate multiple Trades pushes if it is filled in multiple transactions.
{
"channel":"Trades",
"instId":"OKX_PERP_BTC_USDT",
"data":{
"transactionId":"1703832204600001",
"portfolioId":"1702884522340000",
"orderId":"1703832204506000",
"clientOrderId":"100001",
"sym":"OKX_PERP_BTC_USDT",
"exchangeType":"OKX",
"businessType":"PERP",
"price":"42703.4",
"quantity":"1",
"tradingFee":"0.0640551",
"tradingFeeCoin":"USDT",
"side":"SELL",
"createAt":"1703832204600",
"execType":"TAKER"
}
}
| Field | Type | remark |
|---|---|---|
| channel | String | Channel name:Trades |
| instId | String | Trading pair unique identifier, example: BINANCE_SPOT_BTC_USDT, BINANCE_PERP_BTC_USDT |
| data | Array | Data |
| >transactionId | String | Transaction ID |
| >portfolioId | String | Portfolio ID |
| >orderId | String | Order ID |
| >clientOrderId | String | Customer defined order ID |
| >sym | String | Trading unique identifier, example: BINANCE_SPOT_BTC_USDT, BINANCE_PERP_BTC_USDT |
| >exchangeType | String | Exchange type (example: BINANCE,OKX) |
| >businessType | String | Business type |
| >price | String | Filled price |
| >quantity | String | Filled quantity, note: trading unit of OKX is the number of contracts/ trading unit of Binance is the number of coin |
| >tradingFee | String | Trading fee |
| >tradingFeeCoin | String | Trading fee coin |
| >side | String | Side(BUY,SELL) |
| >createAt | String | Execution time |
| >execType | String | TAKER or MAKER |
Asset data:
Pushed whenever the balance of any coin changes (e.g. after a fill, deposit, withdrawal, or funding fee). Each push covers only the coin(s) whose balance changed.
{
"channel": "Assets",
"data": [{
"portfolioId": "1711075287090000",
"coin": "USDT",
"exchangeType": "OKX",
"businessType": "UNI",
"balance": "99.012100925",
"equity": "99.012100925",
"available": "99.012100925",
"frozen": "0",
"overdraw": "0",
"marginValue": "96.536798401875",
"debt": "0",
"virtualBorrow": "0",
"debtMargin": "0",
"perpMargin": "0",
"maxTransferable":"0",
"equityValue":"0"
"borrow":"0",
"upnl":"0",
"updateAt": "1711955466958",
"balanceDelta": "0",
"eventType": "trading",
"loan": "20",
"loanValue": "20",
"netEquity": "109.598539562734535877",
"netEquityValue": "109.598539562734535877",
"netMarginValue": "106.858576073666172481"
}]
}
| Field | Type | remark |
|---|---|---|
| channel | String | Channel name:Assets |
| data | Array | Data |
| >portfolioId | String | Portfolio ID |
| >coin | String | Coin |
| >exchangeType | String | Exchange type(example: BINANCE, OKX) |
| >businessType | String | UNI |
| >balance | String | Transferable amount |
| >equity | String | Equity |
| >available | String | Available |
| >frozen | String | Frozen |
| >overdraw | String | OverDraw |
| >debt | String | Debt |
| >marginValue | String | Margin value |
| >virtualBorrow | String | Virtual Borrow |
| >debtMargin | String | Debt Margin |
| >perpMargin | String | Perp Margin |
| >maxTransferable | String | Maximum transfer amount |
| >equityValue | String | Equity value |
| >borrow | String | Borrow |
| >upnl | String | Unrealized Profit and Loss |
| >updateAt | String | Update time |
| > balanceDelta | String | Balance change that triggered this push. "0" when the push is caused by a position or order event with no direct balance movement. Negative value indicates a deduction (e.g. fee charged).. |
| > eventType | String | Event that triggered this push. trading indicates a trade-related event. |
| > loanValue | String | This field is included only when loan > 0. loan × indexPrice |
| > netEquity | String | This field is included only when loan > 0. Asset equity minus loan. |
| > netEquityValue | String | This field is included only when loan > 0. netEquity × indexPrice |
| > netMarginValue | String | This field is included only when loan > 0. netEquityValue × discountRate |
Positon data:
Pushed whenever a position changes (e.g. after a fill, funding fee, or mark price update). Each push is a full snapshot of the affected position.
{
"channel":"Positions",
"instId":"OKX_PERP_BTC_USDT",
"data":{
"portfolioId":"1702884522340000",
"positionId":"1704179813908000",
"sym":"OKX_PERP_BTC_USDT",
"positionSide":"NET",
"positionMargin":"226.586",
"positionMM":"4.53172",
"positionQty":"1",
"positionValue":"453.172",
"entryValue":"453.194",
"unrealizedPNL":"-0.022",
"unrealizedPNLRate":"-0.000097088664015851",
"avgPrice":"45319.4",
"markPrice":"45317.2",
"leverage":"2",
"maxLeverage":"20",
"riskLevel":"1",
"fee":"0.0679791",
"fundingFee":"0",
"createAt":"1704179813908",
"updateAt":"1704179813908"
}
}
| Field | Type | remark |
|---|---|---|
| channel | String | Channel name:Positions |
| data | Array | Data |
| >portfolioId | String | Portfolio ID |
| >positionId | String | Position ID |
| >sym | String | Trading unique identifier, example: BINANCE_PERP_BTC_USDT |
| >positionSide | String | NET |
| >positionMargin | String | Position margin |
| >positionMM | String | Position maintain margin |
| >positionQty | String | Position quantity, note: trading unit of OKX is the number of contracts/ trading unit of Binance is the number of coin |
| >positionValue | String | Position value |
| >entryValue | String | Position init value |
| >unrealizedPNL | String | Unrealized PNL |
| >unrealizedPNLRate | String | Unrealized PNL rate |
| >avgPrice | String | Average price |
| >markPrice | String | Mark price |
| >leverage | String | Leverage |
| >maxLeverage | String | Max leverage |
| >riskLevel | String | Risk level |
| >fee | String | Trading fee |
| >fundingFee | String | Funding fee |
| >createAt | String | Create time |
| >updateAt | String | Update time |
MarginCall data:
Pushed when the account's margin ratio approaches or crosses the liquidation threshold.
{
"channel":"MarginCall",
"data":{
"portfolioId":"1702884522340000",
"exchangeType":"OKX",
"margin":"141.598333333333333333",
"maintainMargin":"4.24795",
"uniMMR":"-0.220583246036323403",
"accountStatus":"LIQUIDATED",
"updateAt":"1703834254274"
}
}
| Field | Type | remark |
|---|---|---|
| channel | String | Channel name:MarginCall |
| data | Array | Margin call snapshot |
| >portfolioId | String | Portfolio ID |
| >exchangeType | String | Exchange this margin status applies to: BINANCE, OKX, EDX |
| >margin | String | Current total margin balance of the account |
| >maintainMargin | String | Minimum margin required across all positions to avoid liquidation |
| >uniMMR | String | validMargin/maintainMargin. Unified maintenance margin rate, used to measure risk, a forced liquidation is triggered when the value is below 100%. |
| >accountStatus | String | Current account status: NORMAL (healthy), MARGIN_CALL (approaching liquidation threshold), LIQUIDATED (liquidation in progress) |
| >updateAt | String | Timestamp of this update (milliseconds) |
MarginCall is the warning. Once liquidation actually starts, the Liquidation channels report every step of the process and every liquidation order.
Accounts
Push whenever the account status changes. Each push contains a full snapshot of the account information.
{
"channel": "Accounts",
"data": {
"portfolioId": "2178424043067202",
"exchangeType": "BINANCE",
"equity": "135.997795254213646297",
"marginValue": "126.3772437379809635842714751341",
"frozenMargin": "7.972976138666666667",
"perpMargin": "1.306309472",
"debtMargin": "0",
"openLossMargin": "0.002286041576",
"validMargin": "126.3749576964049635842714751341",
"availableMargin": "118.4019815577382969172714751341",
"maintainMargin": "1.08491011568",
"positionValue": "6.53154736",
"uniMMR": "116.484265258413286347",
"riskRatio": "0.0086",
"accountStatus": "NORMAL",
"upnl": "-0.01245264",
"perpAvailableMargin": "118.4019815577382969172714751341",
"createAt": "1782288534085",
"updateAt": "1782732414466",
"totalLoanValue": "20",
"netEquity": "115.997795254213646297",
"netMarginValue": "106.8772437379809635851964751341",
"netValidMargin": "106.8749576964049635851964751341",
"netAvailableMargin": "98.9019815577382969181964751341",
"loanMargin": "6.666666666666666667",
"loanMM": "1",
"ltv": "0.158259202333793917"
}
}
| Field | Type | remark |
|---|---|---|
| channel | String | Channel name:Accounts |
| data | Array | Margin call snapshot |
| >portfolioId | String | Portfolio ID |
| >exchangeType | String | Exchange this margin status applies to: BINANCE, OKX, EDX |
| >equity | String | Total account equity on this venue, valued in USDT-equivalent (including cash balance and P&L). |
| >marginValue | String | Total margin value on this venue. |
| >frozenMargin | String | Locked margin (e.g. for open orders or positions) and unavailable for new trades or withdrawal. |
| >perpMargin | String | Margin allocated specifically to perpetual contracts. |
| >debtMargin | String | Margin used to cover borrowing and negative balances. |
| >openLossMargin | String | Margin portion reserved to cover current open losses. |
| >validMargin | String | marginValue-openLossMargin |
| >availableMargin | String | Margin available for opening new positions or for withdrawal. |
| >maintainMargin | String | Minimum margin required across all positions to avoid liquidation. |
| >positionValue | String | Notional value of all open positions on this venue. |
| >uniMMR | String | validMargin/maintainMargin.Unified maintenance margin rate, used to measure risk, a forced liquidation is triggered when the value is below 100%. |
| >riskRatio | String | 1/uniMMR. |
| >accountStatus | String | Current account status: NORMAL (healthy), MARGIN_CALL (approaching liquidation threshold), LIQUIDATED (liquidation in progress) |
| >upnl | String | Unrealized profit and loss of the account in USDT. |
| >perpAvailableMargin | String | Available margin for perpetual trading. |
| >createAt | String | Timestamp when the position was first opened (milliseconds). |
| >updateAt | String | Timestamp of this update (milliseconds). |
| >totalLoanValue | String | Total loan value in USDT. Pushed only if the account has any asset with loan > 0. |
| >netEquity | String | Asset equity minus loan. Pushed only if the account has any asset with loan > 0. |
| >netMarginValue | String | netEquityValue × discountRate. Pushed only if the account has any asset with loan > 0. |
| >netValidMargin | String | netMarginValue - openLossMargin. Pushed only if the account has any asset with loan > 0. |
| >netAvailableMargin | String | netValidMargin - frozenMargin. Pushed only if the account has any asset with loan > 0. |
| >loanMargin | String | Σ loan × indexPrice / loanLeverage. Pushed only if the account has any asset with loan > 0. |
| >loanMM | String | Σ loan × indexPrice × loanMMR. Pushed only if the account has any asset with loan > 0. |
| >ltv | String | LTV = totalLoanValue / VaildMargin, returns "0" when no loan is outstanding. Pushed only if the account has any asset with loan > 0. |
