API Reference

User Data(orders, trades, asset, positions)

User data stream.

Response

Orders data:

{ "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":"10", "feeCoin":"USDT", "rebate":"0.1", "rebateCoin":"USDT", "orderState":"NEW", "updateAt":"1703213979731", "createAt":"1703213979731", "borrowAmount":"0", "borrowAsset":null, "reason":"", "leverage":"1" } }
FieldTyperemark
channelStringChannel name:Orders
instIdStringTrading 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.
dataArrayData
>portfolioIdStringPortfolio ID
>orderIdStringOrder ID
>clientOrderIdStringCustomer defined order ID
>exchangeTypeStringExchange type(BINANCE, OKX)
>businessTypeStringBusiness type(SPOT, PERP)
>symStringTrading 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.
>limitPriceStringOrder price
>orderQtyStringOrder 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.
>quoteOrderQtyStringOrder quote quantity, applicable only for spot market buy orders.
>sideStringSide(BUY,SELL)
>exchangeOrderTypeStringExchange order type(LIMIT, MARKET)
>timeInForceStringDefault GTC, enums:GTC,IOC,FOK,GTX
>executedQtyStringTransaction 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.
>executedAmountStringTransaction amount
>executedAvgPriceStringAverage transaction price
>lastExecutedQtyStringLast transaction quantity
>lastExecutedPriceStringLast transaction price
>lastExecutedAmountStringLast transaction amount
>feeStringTransaction fee amount
>feeCoinStringTransaction fee coin
>rebateStringRabate amount
>rebateCoinStringRebate coin
>orderStateStringOrder state(NEW, OPEN, CANCELLED, FILLED, PARTIALLY_FILLED, REJECT, FAIL)
>updateAtStringUpdate time
>createAtStringCreate time
>reasonStringFail reason
>borrowAmountStringBorrow amount
>borrowAssetStringBorrow asset
>leverageStringOrder leverage
>positionSideStringPosition side

Trades data:

{ "channel":"Trades", "instId":"OKX_PERP_BTC_USDT", "data":{ "transactionId":"1703832204600001", "portfolioId":"1702884522340000", "orderId":"1703832204506000", "clientOrderId":"1000981", "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", "rpnl":"101" } }
FieldTyperemark
channelStringChannel name:Trades
instIdStringTrading pair unique identifier, example: BINANCE_SPOT_BTC_USDT, BINANCE_PERP_BTC_USDT
dataArrayData
>transactionIdStringTransaction ID
>portfolioIdStringPortfolio ID
>orderIdStringOrder ID
>clientOrderIdStringCustomer defined order ID
>symStringTrading unique identifier, example: BINANCE_SPOT_BTC_USDT, BINANCE_PERP_BTC_USDT
>exchangeTypeStringExchange type (example: BINANCE,OKX)
>businessTypeStringBusiness type
>priceStringFilled price
>quantityStringFilled quantity, note: trading unit of OKX is the number of contracts/ trading unit of Binance is the number of coin
>tradingFeeStringTrading fee
>tradingFeeCoinStringTrading fee coin
>sideStringSide(BUY,SELL)
>createAtStringExecution time
>execTypeStringTAKER or MAKER
>rpnlStringRealized PNL

Asset data:

{ "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" }] }
FieldTyperemark
channelStringChannel name:Assets
dataArrayData
>portfolioIdStringPortfolio ID
>coinStringCoin
>exchangeTypeStringExchange type(example: BINANCE, OKX)
>businessTypeStringUNI
>balanceStringTransferable amount
>equityStringEquity
>availableStringAvailable
>frozenStringFrozen
>overdrawStringOverDraw
>debtStringDebt
>marginValueStringMargin value
>virtualBorrowStringVirtual Borrow
>debtMarginStringDebt Margin
>perpMarginStringPerp Margin
>maxTransferableStringMaximum transfer amount
>equityValueStringEquity value
>borrowStringBorrow
>upnlStringUnrealized Profit and Loss
>updateAtStringUpdate time

Positon data:

{ "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" } }
FieldTyperemark
channelStringChannel name:Positions
dataArrayData
>portfolioIdStringPortfolio ID
>positionIdStringPosition ID
>symStringTrading unique identifier, example: BINANCE_PERP_BTC_USDT
>positionSideStringNET
>positionMarginStringPosition margin
>positionMMStringPosition maintain margin
>positionQtyStringPosition quantity, note: trading unit of OKX is the number of contracts/ trading unit of Binance is the number of coin
>positionValueStringPosition value
>entryValueStringPosition init value
>unrealizedPNLStringUnrealized PNL
>unrealizedPNLRateStringUnrealized PNL rate
>avgPriceStringAverage price
>markPriceStringMark price
>leverageStringLeverage
>maxLeverageStringMax leverage
>riskLevelStringRisk level
>feeStringTrading fee
>fundingFeeStringFunding fee
>liqPriceStringEstimated liquidation price of position. If the data is null, it means there will be no forced liquidation
>createAtStringCreate time
>updateAtStringUpdate time

MarginCall data:

{ "channel":"MarginCall", "data":{ "portfolioId":"1702884522340000", "exchangeType":"OKX", "margin":"141.598333333333333333", "maintainMargin":"4.24795", "uniMMR":"-0.220583246036323403", "accountStatus":"LIQUIDATED", "updateAt":"1703834254274" } }
FieldTyperemark
channelStringChannel name:MarginCall
dataArrayData
>portfolioIdStringPortfolio ID
>exchangeTypeStringBINANCE, OKX
>marginStringMargin
>maintainMarginStringMaintain margin
>uniMMRStringuniMMR
>accountStatusStringAccount status
>updateAtStringUpdate time