Update Order

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

NameTypeDescription
idIntOrder ID
cidIntClient Order ID
cid_dateStringClient Order ID Date
gidIntGroup Order ID
priceDecimal stringPrice
amountDecimal stringAmount
levIntSet 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.
deltaDecimal stringChange of amount
price_aux_limitDecimal stringAuxiliary limit price
price_trailingDecimal stringTrailing price delta
flagsIntSee <https://docs.bitfinex.com/v2/docs/flag-values>.
tifDatetime stringTime-In-Force: datetime for automatic order cancellation (e.g. 2020-01-15 10:45:23). Note: TIF can be updated but not removed.
metaObjectObject 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 Flags

The 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

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 ('ou-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

"ou" event data

IndexFieldTypeDescription
[0]CHANNEL_IDIntID of the channel. (0 for account info messages)
[1]TYPEStringType of event ('ou' for order update)
[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))