API Reference

User Data (orders, trades, asset, positions)

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": ""
    }
}
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)
>orderTypeStringPlease see ENUM Definitions for supported values.
>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
>orderStateStringPlease see ENUM Definitions for supported values.
>updateAtStringUpdate time
>createAtStringCreate time
>reasonStringFail reason
>borrowAmountStringBorrow amount
>borrowAssetStringBorrow asset
>leverageStringOrder leverage
>positionSideStringPosition side
>actionStringAMEND_PENDING
AMEND_COMPLETED
AMEND_FAILED
CANCEL_PENDING
CANCEL_COMPLETE
CANCEL_FAILED
>actionMsgStringaction msg
>cancelTypeStringUSER
EXPIRE
REDUCE_ONLY
LIQUIDATING
SYSTEM
SYM_DELIST
>amendTypeStringUSER
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"
    }
}
NameTypeDescription
channelStringChannel name of the subscription. For this stream the value is Trades.
instIdStringTrading pair unique identifier for the stream, e.g. OKX_PERP_BTC_USDT.
dataObjectTrade execution payload. The following fields are contained inside the data object.
> transactionIdStringUnique identifier of this trade execution record. One order may generate multiple executions.
> portfolioIdStringIdentifier of the portfolio or sub-account to which this trade belongs.
> orderIdStringSystem-generated order ID associated with this execution.
> exchangeTypeStringVenue where the trade was executed (e.g. BINANCE, OKX, EDX).
> businessTypeStringBusiness type of the trade, such as SPOT, PERP, MARGIN.
> symStringInternal unique identifier of the trading pair or instrument.
> sideStringTrade side, such as BUY or SELL (or other venue-specific side values).
> quantityStringExecuted quantity for this trade.
> priceStringExecuted price for this trade.
> tradingFeeStringTrading fee charged for this execution.
> tradingFeeCoinStringCurrency in which the trading fee is charged (e.g. USDT, BTC).
> rpnlStringRealized PnL generated by this execution.
> clientOrderIdStringClient-defined order ID passed when placing the order (used for idempotency and client-side tracking).
> createAtStringTimestamp when this trade execution was created, in milliseconds since Unix epoch.
> execTypeStringLiquidity 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"
    }]
}
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

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"
    }
}
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

{
    "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