Orders

Receive a snapshot and updates for any order events on your account.

Subscribe to the account information channel to keep track of your orders. The account information channel provides a snapshot and updates on the orders in your account. The snapshot is delivered upon subscribing and any changes to your orders will be provided as updates 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.

Order events are sent with CHAN_ID = 0 and can be identified by looking at the TYPE stream field. Order events will use one of the following abbreviations: 'os' (order snapshot), 'on' (order new), 'ou' (order update), and 'oc' (order cancel).


[
  0, //CHAN_ID
  "os", //MSG_TYPE
  [
    [
      34930659963, //ID
      null, //GID
      1574955083558, //CID
      "tETHUSD", //SYMBOL
      1574955083558, //MTS_CREATE
      1574955083573, //MTS_UPDATE
      0.201104, //AMOUNT
      0.201104, //AMOUNT_ORIG
      "EXCHANGE LIMIT", //ORDER_TYPE
      null, //TYPE_PREV
      null, //MTS_TIF
      null, //PLACEHOLDER
      0, //FLAGS
      "ACTIVE", //STATUS
      null, //PLACEHOLDER
      null, //PLACEHOLDER
      120, //PRICE
      0, //PRICE_AVG
      0, //PRICE_TRAILING
      0, //PRICE_AUX_LIMIT
      null, //PLACEHOLDER
      null, //PLACEHOLDER
      null, //PLACEHOLDER
      0, //NOTIFY
      0, //HIDDEN
      null, //PLACED_ID
      null, //PLACEHOLDER
      null, //PLACEHOLDER
      "BFX", //ROUTING
      null, //PLACEHOLDER
      null, //PLACEHOLDER
      {meta_object} //META
    ], //ORDER_ARRAY
    ...
  ] //ORDER_SNAPSHOT
]
[
  0, //CHAN_ID
  "oc", //MSG_TYPE
  [
    34930659963, //ID
    null, //GID
    1574955083558, //CID
    "tETHUSD", //SYMBOL
    1574955083558, //MTS_CREATE
    1574955354487, //MTS_UPDATE
    0.201104, //AMOUNT
    0.201104, //AMOUNT_ORIG
    "EXCHANGE LIMIT", //ORDER_TYPE
    null, //TYPE_PREV
    null, //MTS_TIF
    null, //PLACEHOLDER
    0, //FLAGS
    "CANCELED", //ORDER_STATUS
    null, //PLACEHOLDER
    null, //PLACEHOLDER
    120, //PRICE
    0, //PRICE_AVG
    0, //PRICE_TRAILING
    0, //PRICE_AUX_LIMIT
    null, //PLACEHOLDER
    null, //PLACEHOLDER
    null, //PLACEHOLDER
    0, //NOTIFY
    0, //HIDDEN
    null, //PLACED_ID
    null, //PLACEHOLDER
    null, //PLACEHOLDER
    "BFX", //ROUTING
    null, //PLACEHOLDER
    null, //PLACEHOLDER
    {meta_object} //META
  ] //ORDER_ARRAY
]

Order snapshot data

IndexFieldTypeDescription
[0]CHANNEL_IDIntIdentification number assigned to the channel for the duration of this connection.
[1]MSG_TYPEString'os' (order snapshot)
[2]ORDER_SNAPSHOTArrayArray with an array of active orders (Indices [0...n] will be orders)
[2][0...n]ORDER_ARRAYArrayOrder array

Order update data

IndexFieldTypeDescription
[0]CHANNEL_IDIntIdentification number assigned to the channel for the duration of this connection.
[1]MSG_TYPEString'on' (order new), 'ou' (order update), 'oc' (order cancel (canceled or fully executed)).
[2]ORDER_ARRAYTradeOrder array

Order arrays

Index Field Type Description
[0]IDIntOrder ID
[1]GIDIntGroup ID
[2]CIDIntClient Order ID
[3]SYMBOLStringPair (tBTCUSD, …)
[4]MTS_CREATEIntMillisecond timestamp of creation
[5]MTS_UPDATEIntMillisecond timestamp of update
[6]AMOUNTFloatPositive means buy, negative means sell.
[7]AMOUNT_ORIGFloatOriginal amount
[8]ORDER_TYPEStringThe type of the order: LIMIT, MARKET, STOP, STOP LIMIT, TRAILING STOP, EXCHANGE MARKET, EXCHANGE LIMIT, EXCHANGE STOP, EXCHANGE STOP LIMIT, EXCHANGE TRAILING STOP, FOK, EXCHANGE FOK, IOC, EXCHANGE IOC.
[9]TYPE_PREVStringPrevious order type
[10]MTS_TIFIntMillisecond timestamp of Time-In-Force: automatic order cancellation
[ . . . ]
[12]FLAGSIntSee https://docs.bitfinex.com/v2/docs/flag-values
[13]ORDER_STATUSStringOrder Status: ACTIVE, EXECUTED @ PRICE(AMOUNT) e.g. "EXECUTED @ 107.6(-0.2)", PARTIALLY FILLED @ PRICE(AMOUNT), INSUFFICIENT MARGIN was: PARTIALLY FILLED @ PRICE(AMOUNT), CANCELED, CANCELED was: PARTIALLY FILLED @ PRICE(AMOUNT), RSN_DUST (amount is less than 0.00000001), RSN_PAUSE (trading is paused due to rebase events on AMPL or funding settlement on derivatives)
[ . . . ]
[16]PRICEFloatPrice
[17]PRICE_AVGFloatAverage price
[18]PRICE_TRAILINGFloatThe trailing price
[19]PRICE_AUX_LIMITFloatAuxiliary Limit price (for STOP LIMIT)
[ . . . ]
[23]NOTIFYInt0 if false, 1 if true
[24]HIDDENInt1 if Hidden, 0 if not hidden
[25]PLACED_IDIntIf another order caused this order to be placed (OCO) this will be that other order's ID
[ . . . ]
[28]ROUTINGStringIndicates origin of action: BFX
[ . . . ]
[31]METAJson stringAdditional meta information about the order (e.g., $F7 = IS_POST_ONLY (0 if false, 1 if true), $F33 = Leverage (int), aff_code: "aff_code_here")

📘

Multiple Flags

The summation of flags may result in multiple flags. For example 4160 (64 + 4096) means hidden post only.