JSON

Order management API

Overview.

All order new, replace, cancel and query requests are performed via a web socket. The order update and trade messages are delivered via the same web socket. All message timestamps have the nanoseconds resolution. All client's open orders are not cancelled on a client's web socket disconnection (will be a feauture option in future). The web socket server sends a ping frame every 10 seconds. If the web socket server does not receive a pong frame within 30 seconds, the web socket connection is closed. The unsolicited pong frames are allowed.

Logon request.

{
  "msg" : "LogonRequest",
  "ts" : 1618930734676777,
  "seqn" : 177,
  "clientId" : 777,
  "token" : "TOKEN_CLIENT_1",
  "account" : "default",
  "lastTs" : 1669032206397567
}

This must the very first client's message sent. Any client's message sent before it is rejected with the “User not logged on” error.

Only a single user with a certain clientId can be logged on at a time. All repeated logons from the same clientId are rejected with the “User already logged on” error and result in disconnection.

Name Type Mandatory Description
msg string Y Message type: “LogonRequest”
ts timestamp [usec] Y Client's timestamp (microseconds)
seqn int64 Y Client's sequence number (max: 16 digits)
clientId int64 Y Client id
token string Y Authentication token
account string N Account name
lastTs timestamp [usec] N Last transaction timestamp (microseconds)

Logon reply.

{
  "msg" : "LogonReply",
  "ts" : 1618930734676777,
  "seqn" : 277,
  "clientId" : 777,
  "account" : "default",
  "feeTier" : 9,
  "totalVolumeNotional" : "11644021.02",
  "result" : "success"
}

{
  "msg" : "LogonReply",
  "ts" : 1618930734676777,
  "seqn" : 277,
  "clientId" : 777,
  "account" : "default",
  "result" : "error"
  "errCode" : 73,
  "errMessage" : "Invalid user"
}
Name Type Mandatory Description
msg string Y Message type: “LogonReply”
ts timestamp [usec] Y Processing timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
clientId int64 Y Client id
account string Y Account name
feeTier int32 N Current fee tier (sent only on success)
totalVolumeNotional float64 N Current total traded volume in USD (sent only on success)
result string Y Result: “success”, “error”
errCode int32 N Error code
errMessage string N Error message

New order request.

Instrument and synthetic orders may be placed with new order request.

Instrument order

Synthetic orders/Swaps


{
  "msg" : "NewOrder",
  "ts" : 1618930734676777,
  "seqn" : 177,
  "symbol" : "BTCUSDT",
  "clientOrderId" : 7777777,
  "type" : "limit",
  "side" : "buy",
  "tif" : "gtc",
  "price" : "17333.14",
  "totalQty" : "2.05"
}

{
  "msg": "NewOrder",
  "ts": 1693820169434690,
  "symbol": "BTC/ETH",
  "clientOrderId": 1693820169434690740,
  "type": "market",
  "tif": "ioc",
  "totalQty": "0.012",
  "side": "buy",
  "seqn": 15
}

Name Type Mandatory Description
msg string Y Message type: “NewOrder”
ts timestamp [usec] Y Client's timestamp (microseconds)
seqn int64 Y Client's sequence number (max: 16 digits)
symbol string Y Symbol or a synthetic pair
clientOrderId int64 Y Client's order id
type order type Y Order type
side side Y Order side
tif time in force Y Time in force
price price N Order price
totalQty quantity N Order quantity (mandatory for limit orders)
quoteTotalQty quantity N Quote order quantity (market orders only)
maxSlippage double N Max slippage [%], when exceeded, a remaining portion of market order is cancelled (market orders only)

New order confirmation.

{
  "msg" : "NewOrderStatus",
  "ts" : 1618930734686777,
  "createTs" : 1618930734686777,
  "seqn" : 277,
  "symbol" : "BTCUSDT",
  "clientOrderId" : 7777777,
  "orderId" : 6189307346867771,
  "execId" : 6189307346867771,
  "type" : "limit",
  "status" : "new",
  "side" : "buy",
  "tif" : "gtc",
  "maker" : false,
  "price" : "17333.14",
  "totalQty" : "2.05"
}
Name Type Mandatory Description
msg string Y Message type: “NewOrderStatus”
ts timestamp [usec] Y Transaction timestamp (microseconds)
createTs timestamp [usec] Y Order creation timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
symbol string Y Symbol
clientOrderId int64 Y Client's order id
orderId int64 Y Matching engine's order id (max: 16 digits)
execId int64 Y Unique execution/transaction id (max: 16 digits)
type order type Y Order type
status order status Y Order status
side side Y Order side
tif time in force Y Time in force
maker boolean Y True for maker, false for taker
price price N Order price
totalQty quantity Y Order quantity
quoteTotalQty quantity N Quote order quantity (original unmatched market orders only)

New order reject.

{
  "msg" : "NewOrderStatus",
  "ts" : 1618930734686777,
  "seqn" : 277,
  "symbol" : "BTCUSDT",
  "clientOrderId" : 7777777,
  "type" : "limit",
  "status" : "rejected",
  "side" : "buy",
  "tif" : "gtc",
  "price" : "17333.14",
  "totalQty" : "2.05",
  "errCode" : 160,
  "errMessage" : "Insufficient funds"
}
Name Type Mandatory Description
msg string Y Message type: “NewOrderStatus”
ts timestamp [usec] Y Processing timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
symbol string Y Symbol
clientOrderId int64 Y Client's order id
type order type Y Order type
status order status Y Order status
side side Y Order side
tif time in force Y Time in force
price price N Order price
totalQty quantity N Order quantity (mandatory for limit orders)
quoteTotalQty quantity N Quote order quantity (market orders only)
errCode int32 Y Error code
errMessage string Y Error message

Order replace request.

{
  "msg" : "ReplaceOrder",
  "ts" : 1618930735676777,
  "seqn" : 177,
  "symbol" : "BTCUSDT",
  "clientOrderId" : 7777777,
  "orderId" : 6189307346867771,
  "price" : "17334.87"
}

{
  "msg" : "ReplaceOrder",
  "ts" : 1618930735676777,
  "seqn" : 177,
  "symbol" : "BTCUSDT",
  "clientOrderId" : 7777777,
  "orderId" : 6189307346867771,
  "totalQty" : "3.05"
}

{
  "msg" : "ReplaceOrder",
  "ts" : 1618930735676777,
  "seqn" : 177,
  "symbol" : "BTCUSDT",
  "clientOrderId" : 7777777,
  "origClientOrderId" : 7777776,
  "totalQty" : "3.05"
}

Only order price and/or order total qty may be changed/presented in a replace request.

Order id or/and original client order id must be provided. If both are provided, order id takes precedence and used.

Order priority is changed (order is removed and re-inserted into order book), if order price changes or total qty increases, otherwise priority is not changed.

Order id is not changed.

Client order id is always changed and original/previous client order id is copied into original client order id.

Requests to replace the total quantity to a level less than the cumulated traded quantity will be interpreted as requests to stop executing (cancel) the order.

Name Type Mandatory Description
msg string Y Message type: “ReplaceOrder”
ts timestamp [usec] Y Client's timestamp (microseconds)
seqn int64 Y Client's sequence number (max: 16 digits)
symbol string Y Symbol
clientOrderId int64 Y Client's order id (different from original clientOrderId) for the replaced order. Must be different to original client order id.
origClientOrderId int64 N Original (before replacement) clientOrderId. This field is set in case you want to replace order by client order id.
orderId int64 N Matching engine's order id (max: 16 digits). This field is set in case you want to replace order by order id.
price price N Order price
totalQty quantity N Order quantity

Order replace confirmation.

{
  "msg" : "OrderReplaceStatus",
  "ts" : 1618930735686777,
  "createTs" : 1618930734686777,
  "seqn" : 277,
  "symbol" : "BTCUSDT",
  "clientOrderId" : 7777777,
  "origClientOrderId" : 7777776,
  "orderId" : 6189307356867771,
  "execId" : 6189307356867771,
  "type" : "limit",
  "status" : "new",
  "side" : "buy",
  "tif" : "gtc",
  "maker" : true,
  "price" : "17333.14",
  "totalQty" : "3.05",
  "remainingQty" : "1.027"
}
Name Type Mandatory Description
msg string Y Message type: “OrderReplaceStatus”
ts timestamp [usec] Y Transaction timestamp (microseconds)
createTs timestamp [usec] Y Order creation timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
symbol string Y Symbol
clientOrderId int64 Y Client's order id
origClientOrderId int64 Y Original client's order id
orderId int64 Y Matching engine's order id (max: 16 digits)
execId int64 Y Unique execution/transaction id (max: 16 digits)
type order type Y Order type
status order status Y Order status
side side Y Order side
tif time in force Y Time in force
maker boolean Y True for maker, false for taker
price price Y Order price
totalQty quantity Y Order quantity
remainingQty quantity Y Order remaining quantity

Order replace reject.

{
  "msg" : "OrderReplaceStatus",
  "ts" : 1618930735686777,
  "seqn" : 277,
  "symbol" : "BTCUSDT",
  "clientOrderId" : 7777777,
  "origClientOrderId" : 7777776,
  "orderId" : 6189307356867771,
  "errCode" : 157,
  "errMessage" : "Order not found"
}
Name Type Mandatory Description
msg string Y Message type: “OrderReplaceStatus”
ts timestamp [usec] Y Processing timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
symbol string Y Symbol
clientOrderId int64 Y Client's order id
origClientOrderId int64 Y Original client's order id
orderId int64 Y Matching engine's order id (max: 16 digits)
errCode int32 Y Error code
errMessage string Y Error message

Single order cancel request.

{
  "msg" : "CancelOrder",
  "ts" : 1618930735676777,
  "seqn" : 177,
  "symbol" : "BTCUSDT",
  "orderId" : 6189307346867771
}

{
  "msg" : "CancelOrder",
  "ts" : 1618930735676777,
  "seqn" : 177,
  "symbol" : "BTCUSDT",
  "clientOrderId" : 7777777
}
Name Type Mandatory Description
msg string Y Message type: “CancelOrder”
ts timestamp [usec] Y Client's timestamp (microseconds)
seqn int64 Y Client's sequence number (max: 16 digits)
symbol string Y Symbol
orderId int64 N Matching engine's order id (max: 16 digits)
clientOrderId int64 N Client's order id

List of orders (across all symbols) cancel request.

{
  "msg" : "CancelOrderList",
  "ts" : 1618930735676777,
  "seqn" : 177,
  "orderIds" : [
    6189307346867771,
    6189307346867787
  ]
}

{
  "msg" : "CancelOrderList",
  "ts" : 1618930735676777,
  "seqn" : 177,
  "clientOrderIds" : [
    1111111,
    2222222
  ]
}
Name Type Mandatory Description
msg string Y Message type: “CancelOrderList”
ts timestamp [usec] Y Client's timestamp (microseconds)
seqn int64 Y Client's sequence number (max: 16 digits)
orderIds list of int64 N Matching engine's order ids (max: 16 digits)
clientOrderIds list of int64 N Client's order ids (max: 16 digits)

All orders for a symbol cancel request.

{
  "msg" : "CancelSymbolOrders",
  "ts" : 1618930735676777,
  "seqn" : 177,
  "symbol" : "BTCUSDT"
}
Name Type Mandatory Description
msg string Y Message type: “CancelSymbolOrders”
ts timestamp [usec] Y Client's timestamp (microseconds)
seqn int64 Y Client's sequence number (max: 16 digits)
symbol string Y Symbol

All orders cancel request.

{
  "msg" : "CancelAllOrders",
  "ts" : 1618930735676777,
  "seqn" : 177
}
Name Type Mandatory Description
msg string Y Message type: “CancelAllOrders”
ts timestamp [usec] Y Client's timestamp (microseconds)
seqn int64 Y Client's sequence number (max: 16 digits)

Order cancel confirmation.

{
  "msg" : "OrderCancelStatus",
  "ts" : 1618930735686777,
  "createTs" : 1618930734356111,
  "seqn" : 277,
  "symbol" : "BTCUSDT",
  "orderId" : 6189307346867771,
  "clientOrderId" : 7777777,
  "execId" : 6189307356867771,
  "status" : "cancelled"
}

A separate order cancel confirmation is sent for all individual order id.

Name Type Mandatory Description
msg string Y Message type: “OrderCancelStatus”
ts timestamp [usec] Y Transaction timestamp (microseconds)
createTs timestamp [usec] Y Order creation timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
symbol string Y Symbol
orderId int64 Y Matching engine's order id (max: 16 digits)
clientOrderId int64 Y Client's order id
execId int64 Y Unique execution/transaction id (max: 16 digits)
status order status Y Order status

Order cancel reject.

{
  "msg" : "OrderCancelStatus",
  "ts" : 1618930735686777,
  "seqn" : 277,
  "symbol" : "BTCUSDT",
  "orderId" : 6189307346867771,
  "errCode" : 157,
  "errMessage" : "Order not found"
}

A separate order cancel reject is sent for all individual order ids.

Name Type Mandatory Description
msg string Y Message type: “OrderCancelStatus”
ts timestamp [usec] Y Processing timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
symbol string Y Symbol
orderId int64 Y Matching engine's order id (max: 16 digits)
errCode int32 Y Error code
errMessage string Y Error message

Order update.

{
  "msg" : "OrderUpdate",
  "ts" : 1618930734696777,
  "createTs" : 1618930734356111,
  "seqn" : 277,
  "symbol" : "BTCUSDT",
  "clientOrderId" : 7777777,
  "orderId" : 6189307346867771,
  "execId" : 6189307346967771,
  "price" : "17333.14",
  "type" : "limit",
  "status" : "partially_filled",
  "side" : "buy",
  "tif" : "gtc",
  "maker" : false,
  "totalQty" : "2.05",
  "remainingQty" : "1.027"
}

{
  "msg": "OrderUpdate",
  "ts": 1699024189925782,
  "createTs": 1699024189925782,
  "symbol": "BTC/ETH",
  "clientOrderId": 1699024189922929553,
  "type": "market",
  "status": "partially_filled",
  "side": "sell",
  "tif": "ioc",
  "quoteTotalQty": "0.1",
  "quoteCumTradedQty": "0.0123",
  "remainingQty": "0.0",
  "seqn": 41,
  "orders": [
    {
      "msg": "OrderUpdate",
      "ts": 1699024189925782,
      "createTs": 1699024189925782,
      "symbol": "BTCUSDC",
      "clientOrderId": 1699024189922929553,
      "orderId": 6990241899257825,
      "execId": 6990241899257825,
      "type": "market",
      "status": "filled",
      "side": "sell",
      "tif": "ioc",
      "maker": false,
      "quoteTotalQty": "20.09697",
      "quoteCumTradedQty": "20.09697",
      "remainingQty": "0.0"
    },
    {
      "msg": "OrderUpdate",
      "ts": 1699024189925782,
      "createTs": 1699024189925782,
      "symbol": "ETHUSDC",
      "clientOrderId": 1699024189922929553,
      "orderId": 6990241899257826,
      "execId": 6990241899257826,
      "type": "market",
      "status": "filled",
      "side": "buy",
      "tif": "ioc",
      "maker": false,
      "totalQty": "0.0123",
      "remainingQty": "0.0"
    }
  ]
}

Name Type Mandatory Description
msg string Y Message type: “OrderUpdate”
ts timestamp [usec] Y Transaction timestamp (microseconds)
createTs timestamp [usec] Y Order creation timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
symbol string Y Symbol
clientOrderId int64 Y Client's order id
origClientOrderId int64 N Original client's order id
orderId int64 Y Matching engine's order id (max: 16 digits)
execId int64 Y Unique execution/transaction id (max: 16 digits)
type order type Y Order type
status order status Y Order status
side side Y Order side
tif time in force Y Time in force
maker boolean Y True for maker, false for taker
price price N Order price
totalQty quantity Y Order quantity
quoteTotalQty quantity N Quote order quantity (market orders only)
remainingQty quantity N Order remaining quantity, may be missing for orders with quoteTotalQty
orders array of “OrderUpdate” N Array of intenral orders, that were executed for this order. Presented only for synthetic orders

Trade message.

{
  "msg" : "OrderTrade",
  "ts" : 1618930734676777,
  "seqn" : 277,
  "symbol" : "BTCUSDT",
  "execId" : 6189307346767771,
  "tradeId" : 6189307346767771,
  "tradePrice" : "17333.14",
  "execQty" : "2.05163",
  "cumTradedQty" : "3.15082",
  "quoteExecQty" : "35561.19001",
  "quoteCumTradedQty" : "54613.60417",
  "execNotional" : "17333.14",
  "matchedBookLevel" : 0
  "clientOrderId" : 7777777,
  "orderId" : 6189307340145680,
  "type" : "limit",
  "status" : "partially_filled",
  "side" : "buy",
  "tif" : "gtc",
  "maker" : true,
  "commissions":[{"asset":"HMFEE","amount":"0.05"}, {"asset":"BTC","amount":"0.0009"}],
  "feeTier" : 9
}

Either partial or full trade.

Name Type Mandatory Description
msg string Y Message type: “OrderTrade”
ts timestamp [usec] Y Transaction timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
symbol string Y Symbol
execId int64 Y Unique execution/transaction id (max: 16 digits)
tradeId int64 Y Unique trade id (max: 16 digits)
tradePrice price Y Trade price
execQty quantity Y Executed quantity
cumTradedQty quantity Y Cumulated order's traded quantity
quoteExecQty quantity Y Quote executed quantity
quoteCumTradedQty quantity Y Quote cumulated order's traded quantity
execNotional price Y Executed notional value
matchedBookLevel int32 Y Matched order book level
clientOrderId int64 Y Client's order id
orderId int64 Y Matching engine's order id (max: 16 digits)
type order type Y Order type
status order status Y Order status
side side Y Order side
tif time in force Y Time in force
maker boolean Y True for maker, false for taker
commissions price Y List of commissions taken (asset and amount).
feeTier int32 Y Current fee tier

Asset balance.

{
  "msg" : "AssetBalance",
  "ts" : 1618930734676777,
  "seqn" : 277,
  "account" : "ACCOUNT_7",
  "asset" : "BTC",
  "available" : "21.14",
  "availableNotional" : "634200",
  "locked" : "2.05",
  "lockedNotional" : "61500",
  "total" : "23.19",
  "totalNotional" : "695700",
}

This message follows every trade message.

Name Type Mandatory Description
msg string Y Message type: “AssetBalance”
ts timestamp [usec] Y Transaction timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
account string Y Account name
asset string Y Asset name
total price Y Total assets. Sum of locked and available
locked price Y Locked assets due to placed orders
available price Y Available for assets for placing orders
totalNotional price N Total assets in USD
availableNotional price N Available assets in USD
lockedNotional price N Locked assets in USD

Asset deposit request.

{
  "msg" : "AssetDeposit",
  "ts" : 1618930734676777,
  "seqn" : 177,
  "clientId" : 777,
  "account" : "ACCOUNT_7",
  "asset" : "BTC",
  "amount" : "10"
}
Name Type Mandatory Description
msg string Y Message type: “AssetDeposit”
ts timestamp [usec] Y Client's timestamp (microseconds)
seqn int64 Y Client's sequence number (max: 16 digits)
clientId int64 Y Client id to deposit on behalf of
account string Y Account name to deposit to
asset string Y Asset name
amount price Y Amount to deposit
description string N Asset deposit description

Asset deposit confirmation.

{
  "msg" : "AssetDepositConfirm",
  "ts" : 1618930734676777,
  "seqn" : 277,
  "clientId" : 777,
  "account" : "ACCOUNT_7",
  "asset" : "BTC",
  "amount" : "10"
}
Name Type Mandatory Description
msg string Y Message type: “AssetDepositConfirm”
ts timestamp [usec] Y Transaction timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
clientId int64 Y Client id to deposit on behalf of
account string Y Account name to deposit to
asset string Y Asset name
amount price Y Deposited amount
description string N Description used in AssetDeposit

Asset deposit reject.

{
  "msg" : "AssetDepositReject",
  "ts" : 1618930734676777,
  "seqn" : 277,
  "clientId" : 777,
  "account" : "ACCOUNT_7",
  "asset" : "BTC",
  "amount" : "10",
  "errCode" : 55,
  "errMessage" : "Message rate limit exceeded"
}
Name Type Mandatory Description
msg string Y Message type: “AssetDepositReject”
ts timestamp [usec] Y Processing timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
clientId int64 Y Client id to deposit on behalf of
account string Y Account name to deposit to
asset string Y Asset name
amount price Y Amount to deposit
errCode int32 Y Error code
errMessage string Y Error message
description string N Description used in AssetDeposit

Asset withdraw request.

{
  "msg" : "AssetWithdraw",
  "ts" : 1618930734676777,
  "seqn" : 177,
  "clientId" : 777,
  "account" : "ACCOUNT_7",
  "asset" : "BTC",
  "amount" : "10"
}
Name Type Mandatory Description
msg string Y Message type: “AssetWithdraw”
ts timestamp [usec] Y Client's timestamp (microseconds)
seqn int64 Y Client's sequence number (max: 16 digits)
clientId int64 Y Client id to withdraw on behalf of
account string Y Account name to withdraw from
asset string Y Asset name
amount price Y Amount to withdraw
description string N Asset withdraw description

Asset withdraw confirmation.

{
  "msg" : "AssetWithdrawConfirm",
  "ts" : 1618930734676777,
  "seqn" : 277,
  "clientId" : 777,
  "account" : "ACCOUNT_7",
  "asset" : "BTC",
  "amount" : "10"
}
Name Type Mandatory Description
msg string Y Message type: “AssetWithdrawConfirm”
ts timestamp [usec] Y Transaction timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
clientId int64 Y Client id to withdraw on behalf of
account string Y Account name to withdraw from
asset string Y Asset name
amount price Y Withdrawn amount
description string N Description used in AssetWithdraw

Asset withdraw reject.

{
  "msg" : "AssetWithdrawReject",
  "ts" : 1618930734676777,
  "seqn" : 277,
  "clientId" : 777,
  "account" : "ACCOUNT_7",
  "asset" : "BTC",
  "amount" : "10",
  "errCode" : 160,
  "errMessage" : "Insufficient funds"
}
Name Type Mandatory Description
msg string Y Message type: “AssetWithdrawReject”
ts timestamp [usec] Y Processing timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
clientId int64 Y Client id to withdraw on behalf of
account string Y Account name to withdraw from
asset string Y Asset name
amount price Y Amount to withdraw
errCode int32 Y Error code
errMessage string Y Error message
description string N Description used in AssetWithdraw

Open orders query.

{
  "msg" : "OrderQuery",
  "ts" : 1618930735676777,
  "seqn" : 177,
  "symbol" : "BTCUSDT",
  "clientOrderId" : 7777777
}

{
  "msg" : "OrderQuery",
  "ts" : 1618930735676777,
  "seqn" : 177,
  "symbol" : "BTCUSDT"
}

{
  "msg" : "OrderQuery",
  "ts" : 1618930735676777,
  "seqn" : 177,
  "limit" : 700
}

If a clientOrderId or/and orderId is provided, a single open order query is performed. If none of them is provided and a symbol is provided, a query for all instrument's orders is performed. If neither clientOrderId/orderId nor symbol is provided, a query of all open orders is performed.

Name Type Mandatory Description
msg string Y Message type: “OrderQuery”
ts timestamp [usec] Y Client's timestamp (microseconds)
seqn int64 Y Client's sequence number (max: 16 digits)
symbol string N Symbol
clientOrderId int64 N Client's order id
orderId int64 N Matching engine's order id (max: 16 digits)
limit int32 N Max number of replies. Max=1000, default=500.

Open orders query reply.

{
  "msg" : "OrderQueryReply",
  "ts" : 1618930735686777,
  "seqn" : 277,
  "symbol" : "BTCUSDT",
  "orders" : []
}

{
  "msg" : "OrderQueryReply",
  "ts" : 1618930735686777,
  "seqn" : 277,
  "symbol" : "BTCUSDT",
  "clientOrderId" : 7777777,
  "errCode" : 157,
  "errMessage" : "Order not found"
}
Name Type Mandatory Description
msg string Y Message type: “OrderQueryReply”
ts timestamp [usec] Y Processing timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
symbol string N Symbol
clientOrderId int64 N Client's order id
orderId int64 N Matching engine's order id (max: 16 digits)
limit int32 N Max number of replies. Max=1000, default=500
orders array of “OrderUpdate” N Array of “OrderUpdate” messages (with “msg” and “seqn” fields stripped)
errCode int32 N Error code
errMessage string N Error message

Trades query.

{
  "msg" : "TradeQuery",
  "ts" : 1618930735676777,
  "seqn" : 177,
  "startTs" : 1618930710000000,
  "endTs" : 1618930735000000,
  "limit" : 100
}

Performs query of the historical trades based on the [start time, end time] interval or/and starting with a specific trade id (trade ids are monotonically increasing).

Name Type Mandatory Description
msg string Y Message type: “TradeQuery”
ts timestamp [usec] Y Client's timestamp (microseconds)
seqn int64 Y Client's sequence number (max: 16 digits)
symbol string N Symbol
startTs timestamp [usec] N Start of interval timestamp (microseconds)
endTs timestamp [usec] N End of interval timestamp (microseconds); current time, if not provided
startTradeId int64 N Trade id of the first requested trade (max: 16 digits)
limit int32 N Max number of replies. Max=1000, default=500.

Trades query reply.

{
  "msg" : "TradeQueryReply",
  "ts" : 1618930735686777,
  "seqn" : 277,
  "symbol" : "BTCUSDT",
  "startTs" : 1618930710000000,
  "endTs" : 1618930735000000,
  "limit" : 100,
  "trades" : []
}

{
  "msg" : "TradeQueryReply",
  "ts" : 1618930735686777,
  "seqn" : 277,
  "symbol" : "BTCUSDT",
  "startTs" : 1618930710000000,
  "endTs" : 1618930735000000,
  "limit" : 100,
  "errCode" : 55,
  "errMessage" : "Message rate limit exceeded"
}

Name Type Mandatory Description
msg string Y Message type: “TradeQueryReply”
ts timestamp [usec] Y Processing timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
symbol string N Symbol
startTs timestamp [usec] N Start of interval timestamp (microseconds)
endTs timestamp [usec] N End of interval timestamp (microseconds); current time, if not provided
startTradeId int64 N Trade id of the first requested trade (max: 16 digits)
limit int32 N Max number of replies. Max=1000, default=500.
trades array of “Trade” N Array of “Trade” messages (with “msg” and “seqn” fields stripped)
errCode int32 N Error code
errMessage string N Error message

Asset balance query.

{
  "msg" : "AssetBalanceQuery",
  "ts" : 1618930734676777,
  "seqn" : 177,
  "account" : "ACCOUNT_7",
  "asset" : "BTC"
}

{
  "msg" : "AssetBalanceQuery",
  "ts" : 1618930734676777,
  "seqn" : 177,
  "clientId": 777,
  "account" : "ACCOUNT_7"
}

If asset name is not provided, a query of all account's assets is performed.

Name Type Mandatory Description
msg string Y Message type: “AssetBalanceQuery”
ts timestamp [usec] Y Client's timestamp (microseconds)
seqn int64 Y Client's sequence number (max: 16 digits)
clientId int64 N Client id to query on behalf of
account string Y Account name
asset string N Asset name

Asset balance query reply.

{
  "msg" : "AssetBalanceQueryReply",
  "ts" : 1618930734676777,
  "seqn" : 277,
  "account" : "ACCOUNT_7",
  "balances" : [
    {
      "ts" : 1618930734676777,
      "account" : "ACCOUNT_7",
      "asset" : "BTC",
        "available" : "21.14",
        "availableNotional" : "634200",
        "locked" : "2.05",
        "lockedNotional" : "61500",
        "total" : "23.19",
        "totalNotional" : "695700",
    }
  ]
}

{
  "msg" : "AssetBalanceQueryReply",
  "ts" : 1618930734676777,
  "seqn" : 277,
  "account" : "ACCOUNT_7",
  "errCode" : 55,
  "errMessage" : "Message rate limit exceeded"
}
Name Type Mandatory Description
msg string Y Message type: “AssetBalanceQueryReply”
ts timestamp [usec] Y Processing timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
clientId int64 N Client id to query on behalf of
account string Y Account name
asset string N Asset name
balances array of “AssetBalance” N Array of “AssetBalance” messages (with “msg” and “seqn” fields stripped)
errCode int32 N Error code
errMessage string N Error message

Logoff.

{
  "msg" : "Logoff",
  "ts" : 1618930734676777,
  "seqn" : 177,
  "clientId" : 777,
  "account" : "default",
  "forceCancelAllOrders" : true
}
Name Type Mandatory Description
msg string Y Message type: “Logoff”
ts timestamp [usec] Y Client's timestamp (microseconds)
seqn int64 Y Client's sequence number (max: 16 digits)
clientId int64 Y Client id to logoff
account string N Account name
forceCancelAllOrders boolean N Force cancel all user's orders. Has no effect if user is not connected.

Logoff reply.

{
  "msg" : "LogoffReply",
  "ts" : 1618930734676777,
  "seqn" : 277,
  "clientId" : 777,
  "account" : "default",
  "result" : "success"
}

{
  "msg" : "LogoffReply",
  "ts" : 1618930734676777,
  "seqn" : 277,
  "clientId" : 777,
  "account" : "default",
  "result" : "error"
  "errCode" : 73,
  "errMessage" : "Invalid user"
}
Name Type Mandatory Description
msg string Y Message type: “LogoffReply”
ts timestamp [usec] Y Processing timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
clientId int64 Y Client id
account string Y Account name
result string Y Result: “success”, “error”
errCode int32 N Error code
errMessage string N Error message

Error message.

Examples:

{
  "msg" : "Error",
  "ts" : 1618930734676777,
  "seqn" : 277,
  "errCode": 46,
  "errMessage": "Missing mandatory field: symbol",
  "refMsg" : "NewOrder",
  "refSeqn" : 177
}
Name Type Mandatory Description
msg string Y Message type: “Error”
ts timestamp [usec] Y Message generation timestamp (microseconds)
seqn int64 Y Exchange sequence number (max: 16 digits)
errCode int32 N Error code
errMessage string N Error message
refMsg string N Referenced message type
refSeqn int64 N Referenced client's sequence number (max: 16 digits)

Types.

Order attributes (as string).