Cancel Order

Cancels the specified order

To cancel an order, construct a payload using the "oc" (order cancel) abbreviation. The order details need to include either the Internal Order ID or the Client Order ID and Client Order ID Date (YYYY-MM-DD format). Please look to the sidebar for examples.

When you cancel an order, you will receive a message of the appropriated type on the "account info" channel. Example responses are included in the sidebar. Please look to the Orders and Notifications pages for further information.

Order inputs require you to run the authentication code along with additional code for the input. The authentication code can be found on our Authenticated Channels and the additional code for inputs can be found on the Websocket Inputs page.

// Cancel order by internal order Id
[
  0,
  "oc",
  null,
  {
    "id": ID
  }
]

// Cancel order using client order Id and order creation date
[
  0,
  "oc",
  null,
  {
    "cid": CID,
    "cid_date": CID_DATE
  }
]
// When the cancellation request is submitted you will receive an 'n' (notification) event as confirmation. If the cancellation is successful, you will also receive an 'oc' (order cancelled) event. Both events are sent through CHANNEL_ID = 0.

[
  0, // CHANNEL_ID
  "n", // EVENT
  [
    1575291219660, // MTS
    "oc-req", // TYPE
    null, // MESSAGE_ID
    null, // _PLACEHOLDER
    [
      1185815100, // ID
      null, // GID
      1575289350475, // CID
      "tETHUSD", // SYMBOL
      1575289351944, // MTS_CREATE
      1575289447644, // MTS_UPDATE
      -3, // AMOUNT
      -3, // AMOUNT_ORIG
      "LIMIT", // ORDER_TYPE
      "LIMIT", // TYPE_PREV
      null, // MTS_TIF
      null, // _PLACEHOLDER
      0, // FLAGS
      "ACTIVE", // STATUS
      null, // _PLACEHOLDER
      null, // _PLACEHOLDER
      240, // 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
      "API>BFX", // ROUTING
      null, // _PLACEHOLDER
      null, // _PLACEHOLDER
      null // META
    ],
    null, // CODE
    "SUCCESS", // STATUS
    "Submitted for cancellation; waiting for confirmation (ID: 1185815100)." // TEXT
  ]
]

[
  0, // CHANNEL_ID
  "oc", // EVENT
  [
    1185815100, // ID
    null, // GID
    1575289350475, // CID
    "tETHUSD", // SYMBOL
    1575289351944, // MTS_CREATE
    1575291219663, // MTS_UPDATE
    -3, // AMOUNT
    -3, // AMOUNT_ORIG
    "LIMIT", // ORDER_TYPE
    "LIMIT", // TYPE_PREV
    null, // MTS_TIF
    null, // _PLACEHOLDER
    0, // FLAGS
    "CANCELED", // STATUS
    null, // _PLACEHOLDER
    null, // _PLACEHOLDER
    240, // 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
    "API>BFX", // ROUTING
    null, // _PLACEHOLDER
    null, // _PLACEHOLDER
    null // META
  ]
]

Request fields

NameTypeDescription
idIntInternal Order ID
cidIntClient Order ID
cid_dateStringClient Order ID Date

Cancel order notification data

IndexFieldTypeDescription
[0]CHANNEL_IDIntID of the channel. (0 for account info messages)
[1]EVENTStringType of event ('n' for notification)
[2]NOTIFICATION_ARRAYArrayNotification array

Notification array data

IndexFieldTypeDescription
[0]MTSIntMillisecond Time Stamp of the update
[1]TYPEStringPurpose of notification ('oc-req')
[2]MESSAGE_IDIntUnique ID of the message
[3]_PLACEHOLDER
[4]ORDER_ARRAYArrayOrder data
[5]CODENull or integerWork in progress
[6]STATUSStringStatus of the notification; it may vary over time (SUCCESS, ERROR, FAILURE, ...)
[7]TEXTStringText of the notification

"oc" event data

IndexFieldTypeDescription
[0]CHANNEL_IDIntID of the channel. (0 for account info messages)
[1]TYPEStringType of event ('oc' for order cancelled)
[2]ORDER_ARRAYArrayOrder data

Order Array data

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, FOK, IOC For exchange orders: EXCHANGE MARKET, EXCHANGE LIMIT, EXCHANGE STOP, EXCHANGE STOP LIMIT, EXCHANGE TRAILING STOP, EXCHANGE FOK, 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, ETHFX, API>BFX, API>ETHFX
[ . . . ]
[31]METAJson stringAdditional meta information about the order (e.g., $F7 = IS_POST_ONLY (0 if false, 1 if true), $F33 = Leverage (int))