Update an existing order, can be used to update margin, exchange, and derivative orders.
To update an order, construct a payload using the "ou" (order update) abbreviation and include the desired order details. Please look to the sidebar for examples.
When you update the 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, such as the response fields.
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.
// Adjust the remaining amount to 0.1 and set price to 500
[
0,
'ou',
null,
{
id: 1149698545,
amount: '0.1',
price: '500'
}
]
// Increase the remaining amount by 0.1
[
0,
'ou',
null,
{
id: 1149698545,
delta: '0.1',
price: '6500'
}
]
// Change both price parameters of a stop limit order and set it to hidden
[
0,
'ou',
null,
{
id: 1149698545,
delta: '0.1',
price: '2500',
price_aux_limit: '2600',
flags: 64
}
]
// Move the order to group `123`
[
0,
'ou',
null,
{
id: 1149698545,
gid: 123
}
]
// set trailing price delta to 45
[
0,
'ou',
null,
{
id: 1149698545,
price_trailing: '45'
}
]
// set order expiration date
[
0,
'ou',
null,
{
id: 1149698545,
tif: '2020-06-30'
}
]// When the order update is submitted you will receive an 'n' (notification) event as confirmation. If successful, you will also receive an 'ou' (order update) event. Both events are sent on CHANNEL_ID = 0.
[
0, // CHANNEL_ID
"n", // EVENT
[
1575289447641, // MTS
"ou-req", // TYPE
null, // MESSAGE_ID
null, // _PLACEHOLDER
[
1185815100, // ID
null, // GID
1575289350475, // CID
"tETHUSD", // SYMBOL
1575289351944, // MTS_CREATE
1575289351948, // MTS_UPDATE
-3, // AMOUNT
-3, // AMOUNT_ORIG
"LIMIT", // ORDER_TYPE
null, // 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
"Submitting update to limit sell order for 3 ETH." // TEXT
]
]
[
0, // CHANNEL_ID
"ou", // EVENT
[
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
]
]
Request fields
| Name | Type | Description |
|---|---|---|
| id | Int | Order ID |
| cid | Int | Client Order ID |
| cid_date | String | Client Order ID Date |
| gid | Int | Group Order ID |
| price | Decimal string | Price |
| amount | Decimal string | Amount |
| lev | Int | Set the leverage for a derivative order, supported by derivative symbol orders only. The value should be between 1 and 100 inclusive. Mandatory for derivative order updates. |
| delta | Decimal string | Change of amount |
| price_aux_limit | Decimal string | Auxiliary limit price |
| price_trailing | Decimal string | Trailing price delta |
| flags | Int | See <https://docs.bitfinex.com/v2/docs/flag-values>. |
| tif | Datetime string | Time-In-Force: datetime for automatic order cancellation (e.g. 2020-01-15 10:45:23). Note: TIF can be updated but not removed. |
| meta | Object | Object to pass order meta data. Options: 'make_visible' (to toggle visible on hit for hidden orders), 'protect_selfmatch' (to cancel submitted order if it would match with one of your own orders). Example: meta: {aff_code: "AFF_CODE_HERE", make_visible: 1} |
Multiple FlagsThe summation of flags may result in multiple flags. For example 4160 (64 + 4096) means hidden post only.
meta:{protect_selfmatch: 1}The 'protect_selfmatch' flag can be used to avoid matching orders with standing orders on the same account. This flag is passed in the meta object in the order body when submitting or updating your orders.
Note that this flag is only intended to assist users in avoiding unintentional wash trading. As per our trading rulebook, wash trading is forbidden on the platform.
Update order notification data
| Index | Field | Type | Description |
|---|---|---|---|
| [0] | CHANNEL_ID | Int | ID of the channel. (0 for account info messages) |
| [1] | EVENT | String | Type of event ('n' for notification) |
| [2] | NOTIFICATION_ARRAY | Array | Notification array |
Notification array data
| Index | Field | Type | Description |
|---|---|---|---|
| [0] | MTS | Int | Millisecond Time Stamp of the update |
| [1] | TYPE | String | Purpose of notification ('ou-req') |
| [2] | MESSAGE_ID | Int | Unique ID of the message |
| [3] | _PLACEHOLDER | ||
| [4] | ORDER_ARRAY | Array | Order data |
| [5] | CODE | Null or integer | Work in progress |
| [6] | STATUS | String | Status of the notification; it may vary over time (SUCCESS, ERROR, FAILURE, ...) |
| [7] | TEXT | String | Text of the notification |
"ou" event data
| Index | Field | Type | Description |
|---|---|---|---|
| [0] | CHANNEL_ID | Int | ID of the channel. (0 for account info messages) |
| [1] | TYPE | String | Type of event ('ou' for order update) |
| [2] | ORDER_ARRAY | Array | Order data |
Order Array data
| Index | Field | Type | Description |
|---|---|---|---|
| [0] | ID | Int | Order ID |
| [1] | GID | Int | Group ID |
| [2] | CID | Int | Client Order ID |
| [3] | SYMBOL | String | Pair (tBTCUSD, …) |
| [4] | MTS_CREATE | Int | Millisecond timestamp of creation |
| [5] | MTS_UPDATE | Int | Millisecond timestamp of update |
| [6] | AMOUNT | Float | Positive means buy, negative means sell. |
| [7] | AMOUNT_ORIG | Float | Original amount |
| [8] | ORDER_TYPE | String | The 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_PREV | String | Previous order type |
| [10] | MTS_TIF | Int | Millisecond timestamp of Time-In-Force: automatic order cancellation |
[ . . . ] | |||
| [12] | FLAGS | Int | See https://docs.bitfinex.com/v2/docs/flag-values |
| [13] | 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) |
[ . . . ] | |||
| [16] | PRICE | Float | Price |
| [17] | PRICE_AVG | Float | Average price |
| [18] | PRICE_TRAILING | Float | The trailing price |
| [19] | PRICE_AUX_LIMIT | Float | Auxiliary Limit price (for STOP LIMIT) |
[ . . . ] | |||
| [23] | NOTIFY | Int | 0 if false, 1 if true |
| [24] | HIDDEN | Int | 1 if Hidden, 0 if not hidden |
| [25] | PLACED_ID | Int | If another order caused this order to be placed (OCO) this will be that other order's ID |
[ . . . ] | |||
| [28] | ROUTING | String | Indicates origin of action: BFX, ETHFX, API>BFX, API>ETHFX |
[ . . . ] | |||
| [31] | META | Json string | Additional meta information about the order (e.g., $F7 = IS_POST_ONLY (0 if false, 1 if true), $F33 = Leverage (int)) |
