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.

[
CHANNEL_ID
EVENT
 [
 MTS, //omitted for 'ou' event
 TYPE, //omitted for 'ou' event
 MESSAGE_ID, //omitted for 'ou' event
 null, //omitted for 'ou' 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 'ou' event
 STATUS, //omitted for 'ou' event
 TEXT //omitted for 'ou' event
 ]
]


[0,"n",[1575289447641,"ou-req",null,null,[1185815100,null,1575289350475,"tETHUSD",1575289351944,1575289351948,-3,-3,"LIMIT",null,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","Submitting update to limit sell order for 3 ETH."]]

[0,"ou",[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]]

Request Fields

NameTypeDescription
idint64Order ID
cidint45Client Order ID
cid_datestringClient Order ID Date
gidint32Group 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. The field is optional, if omitted the default leverage value of 10 will be used.
deltadecimal stringChange of amount
price_aux_limitdecimal stringAuxiliary limit price
price_trailingdecimal stringTrailing price delta
flagsint16See 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).
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.

Response Fields

TermTypeDescription
CHANNEL_IDintID of the channel. (0 for account info messages)
EVENTstringType of event ('n' for notification)
MTSintMillisecond Time Stamp of the update
TYPEstringPurpose of notification ('on-req', 'oc-req', 'uca', 'fon-req', 'foc-req')
MESSAGE_IDintunique ID of the message
IDintOrder ID
GIDintGroup ID
CIDintClient Order ID
SYMBOLstringPair (tBTCUSD, …)
MTS_CREATEintMillisecond timestamp of creation
MTS_UPDATEintMillisecond timestamp of update
AMOUNTfloatPositive means buy, negative means sell.
AMOUNT_ORIGfloatOriginal amount
TYPEstringThe 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_PREVstringPrevious order type
MTS_TIFintMillisecond timestamp of Time-In-Force: automatic order cancellation
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)
PRICEfloatPrice
PRICE_AVGfloatAverage price
PRICE_TRAILINGfloatThe trailing price
PRICE_AUX_LIMITfloatAuxiliary Limit price (for STOP LIMIT)
HIDDENint0 if false, 1 if true
PLACED_IDintIf another order caused this order to be placed (OCO) this will be that other order's ID
ROUTINGstringindicates origin of action: BFX, ETHFX, API>BFX, API>ETHFX
FLAGSintSee https://docs.bitfinex.com/v2/docs/flag-values.
METAjson stringAdditional meta information about the order ( $F7 = IS_POST_ONLY (0 if false, 1 if true), $F33 = Leverage (int))
CODEnull or integerWork in progress
STATUSstringStatus of the notification; it may vary over time (SUCCESS, ERROR, FAILURE, ...)
TEXTstringText of the notification