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.
[
CHANNEL_ID
EVENT
[
MTS, //omitted for 'oc' event
TYPE, //omitted for 'oc' event
MESSAGE_ID, //omitted for 'oc' event
null, //omitted for 'oc' event
[
ID,
GID,
CID,
SYMBOL,
MTS_CREATE,
MTS_UPDATE,
AMOUNT,
AMOUNT_ORIG,
ORDER_TYPE,
TYPE_PREV,
MTS_TIF,
_PLACEHOLDER,
FLAGS,
STATUS,
_PLACEHOLDER,
_PLACEHOLDER,
PRICE,
PRICE_AVG,
PRICE_TRAILING,
PRICE_AUX_LIMIT,
_PLACEHOLDER,
_PLACEHOLDER,
_PLACEHOLDER,
NOTIFY,
HIDDEN,
PLACED_ID,
_PLACEHOLDER,
_PLACEHOLDER,
ROUTING,
_PLACEHOLDER,
_PLACEHOLDER,
META
]
CODE, //omitted for 'oc' event
STATUS, //omitted for 'oc' event
TEXT //omitted for 'oc' event
]
]
[0,"n",[1575291219660,"oc-req",null,null,[1185815100,null,1575289350475,"tETHUSD",1575289351944,1575289447644,-3,-3,"LIMIT","LIMIT",null,null,0,"ACTIVE",null,null,240,0,0,0,null,null,null,0,0,null,null,null,"API>BFX",null,null,null],null,"SUCCESS","Submitted for cancellation; waiting for confirmation (ID: 1185815100)."]]
[0,"oc",[1185815100,null,1575289350475,"tETHUSD",1575289351944,1575291219663,-3,-3,"LIMIT","LIMIT",null,null,0,"CANCELED",null,null,240,0,0,0,null,null,null,0,0,null,null,null,"API>BFX",null,null,null]]
Request Fields
Name | Type | Description |
---|---|---|
id | int64 | Internal Order ID |
cid | int45 | Client Order ID |
cid_date | string | Client Order ID Date |
Response Fields
Term | Type | Description |
---|---|---|
CHANNEL_ID | int | ID of the channel. (0 for account info messages) |
EVENT | string | Type of event ('n' for notification) |
MTS | int | Millisecond Time Stamp of the update |
TYPE | string | Purpose of notification ('on-req', 'oc-req', 'uca', 'fon-req', 'foc-req') |
MESSAGE_ID | int | unique ID of the message |
ID | int | Order ID |
GID | int | Group ID |
CID | int | Client Order ID |
SYMBOL | string | Pair (tBTCUSD, …) |
MTS_CREATE | int | Millisecond timestamp of creation |
MTS_UPDATE | int | Millisecond timestamp of update |
AMOUNT | float | Positive means buy, negative means sell. |
AMOUNT_ORIG | float | Original amount |
TYPE | string | The type of the order: LIMIT, EXCHANGE LIMIT, MARKET, EXCHANGE MARKET, STOP, EXCHANGE STOP, STOP LIMIT, EXCHANGE STOP LIMIT, TRAILING STOP, EXCHANGE TRAILING STOP, FOK, EXCHANGE FOK, IOC, EXCHANGE IOC. |
TYPE_PREV | string | Previous order type |
MTS_TIF | int | Millisecond timestamp of Time-In-Force: automatic order cancellation |
ORDER_STATUS | string | Order 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) |
PRICE | float | Price |
PRICE_AVG | float | Average price |
PRICE_TRAILING | float | The trailing price |
PRICE_AUX_LIMIT | float | Auxiliary Limit price (for STOP LIMIT) |
HIDDEN | int | 0 if false, 1 if true |
PLACED_ID | int | If another order caused this order to be placed (OCO) this will be that other order's ID |
ROUTING | string | indicates origin of action: BFX, ETHFX, API>BFX, API>ETHFX |
FLAGS | int | See https://docs.bitfinex.com/v2/docs/flag-values. |
META | json string | Additional meta information about the order ( $F7 = IS_POST_ONLY (0 if false, 1 if true), $F33 = Leverage (int)) |
CODE | null or integer | Work in progress |
STATUS | string | Status of the notification; it may vary over time (SUCCESS, ERROR, FAILURE, ...) |
TEXT | string | Text of the notification |