User data stream.
Response
Orders
{
"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",
"orderType": "DMA",
"timeInForce":"GTC",
"executedQty":"0",
"executedAmount":"0",
"executedAvgPrice":"0",
"lastExecutedQty":"0",
"lastExecutedPrice":"0",
"lastExecutedAmount":"0",
"fee":"10",
"feeCoin":"USDT",
"rebate":"0.1",
"rebateCoin":"USDT",
"orderState":"NEW",
"updateAt":"1703213979731",
"createAt":"1703213979731",
"borrowAmount":"0",
"borrowAsset":null,
"reason":"",
"leverage":"1",
"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) |
| >orderType | String | Please see ENUM Definitions for supported values. |
| >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 | Transaction fee amount |
| >feeCoin | String | Transaction fee coin |
| >rebate | String | Rabate amount |
| >rebateCoin | String | Rebate coin |
| >orderState | String | Please see ENUM Definitions for supported values. |
| >updateAt | String | Update time |
| >createAt | String | Create time |
| >reason | String | Fail reason |
| >borrowAmount | String | Borrow amount |
| >borrowAsset | String | Borrow asset |
| >leverage | String | Order leverage |
| >positionSide | String | Position side |
| >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
{
"channel":"Trades",
"instId":"OKX_PERP_BTC_USDT",
"data":{
"transactionId": "38132969466022978",
"portfolioId": "2066376093138754",
"orderId": "2104172237333826",
"exchangeType": "BINANCE",
"businessType": "PERP",
"sym": "BINANCE_PERP_APT_USDT",
"side": "BUY",
"quantity": "4",
"price": "2.24509925",
"tradingFee": "0.00089804",
"tradingFeeCoin": "USDT",
"rpnl": "0",
"clientOrderId": "2104172237333826",
"createAt": "1763977805203",
"execType": "MAKER"
}
}
| Name | Type | Description |
|---|---|---|
| channel | String | Channel name of the subscription. For this stream the value is Trades. |
| instId | String | Trading pair unique identifier for the stream, e.g. OKX_PERP_BTC_USDT. |
| data | Object | Trade execution payload. The following fields are contained inside the data object. |
| > transactionId | String | Unique identifier of this trade execution record. One order may generate multiple executions. |
| > portfolioId | String | Identifier of the portfolio or sub-account to which this trade belongs. |
| > orderId | String | System-generated order ID associated with this execution. |
| > exchangeType | String | Venue where the trade was executed (e.g. BINANCE, OKX, EDX). |
| > businessType | String | Business type of the trade, such as SPOT, PERP, MARGIN. |
| > sym | String | Internal unique identifier of the trading pair or instrument. |
| > side | String | Trade side, such as BUY or SELL (or other venue-specific side values). |
| > quantity | String | Executed quantity for this trade. |
| > price | String | Executed price for this trade. |
| > tradingFee | String | Trading fee charged for this execution. |
| > tradingFeeCoin | String | Currency in which the trading fee is charged (e.g. USDT, BTC). |
| > rpnl | String | Realized PnL generated by this execution. |
| > clientOrderId | String | Client-defined order ID passed when placing the order (used for idempotency and client-side tracking). |
| > createAt | String | Timestamp when this trade execution was created, in milliseconds since Unix epoch. |
| > execType | String | Liquidity role of this execution: "MAKER" or "TAKER". |
Assets
{
"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"
}]
}
| 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 |
Positons
{
"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",
"liqPrice":"1.1",
"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 |
| >liqPrice | String | Estimated liquidation price of position. If the data is null, it means there will be no forced liquidation |
| >createAt | String | Create time |
| >updateAt | String | Update time |
MarginCall
{
"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 | Data |
| >portfolioId | String | Portfolio ID |
| >exchangeType | String | BINANCE, OKX |
| >margin | String | Margin |
| >maintainMargin | String | Maintain margin |
| >uniMMR | String | uniMMR |
| >accountStatus | String | Account status |
| >updateAt | String | Update time |
