Trades

Receive updates for any trade events on your account.

Subscribe to the account information channel to keep track of your trades. The account information channel will provide a feed of your trades for as long as the channel remains open. Any authenticated connection is automatically subscribed to the account information channel.

Example code to open an authenticated connection can be found on our Authenticated Channels Page.

Trade events are sent with CHAN_ID = 0 and can be identified by looking at the TYPE stream field. Trade events will use one of the following abbreviations: 'te' (trade executed) and 'tu' (trade execution update). The 'te' message is sent when a trade is executed while the 'tu' message is sent shortly after containing the trade id (ID) and additional updated fields.


[
  0, //CHAN_ID
  "te", //MSG_TYPE
  [
    402088407, //ID
    "tETHUST", //SYMBOL
    1574963975602, //MTS_CREATE
    34938060782, //ORDER_ID
    -0.2, //EXEC_AMOUNT
    153.57, //EXEC_PRICE
    "MARKET", //ORDER_TYPE
    0, //ORDER_PRICE
    -1, //MAKER
    null, //FEE ('tu' only)
    null, //FEE_CURRENCY ('tu' only)
    0 //CID
  ] //TRADE_ARRAY
]
  
[
  0, //CHAN_ID
  "tu", //MSG_TYPE
  [
    402088407, //ID
    "tETHUST", //SYMBOL
    1574963975602, //MTS_CREATE
    34938060782, //ORDER_ID
    -0.2, //EXEC_AMOUNT
    153.57, //EXEC_PRICE
    "MARKET", //ORDER_TYPE
    0, //ORDER_PRICE
    -1, //MAKER
    -0.061668, //FEE
    "USD", //FEE_CURRENCY
    1714466193700 //CID
  ] //TRADE_ARRAY
]

Trade update data

IndexFieldTypeDescription
[0]CHANNEL_IDIntIdentification number assigned to the channel for the duration of this connection.
[1]MSG_TYPEString'te' (trade executed), 'tu' (trade execution update)
[2]TRADE_ARRAYArrayTrade array

Trade arrays

Index Field Type Description
[0]IDIntegerTrade database id
[1]SYMBOLStringSymbol (tBTCUSD, …)
[2]MTS_CREATEIntegerExecution timestamp
[3]ORDER_IDIntegerOrder id
[4]EXEC_AMOUNTFloatPositive means buy, negative means sell
[5]EXEC_PRICEFloatExecution price
[6]ORDER_TYPEStringOrder type
[7]ORDER_PRICEFloatOrder price
[8]MAKERInt1 if true, -1 if false
[9]FEEFloatFee ('tu' only, returns null for 'te' events)
[10]FEE_CURRENCYStringFee currency ('tu' only, returns null for 'te' events)
[11]CIDIntegerClient Order ID