After you are authenticated and subscribed to the private/authenticated channels, you are ready to place and cancel orders.

New Order

To submit an order, construct a payload using the "on" (order new) abbreviation and include the desired order details.

// Model
[
  0,
  "on",
  null,
  {
    "gid": GID,
    "cid": CID,
    "type": TYPE,
    "symbol": SYMBOL,
    "amount": AMOUNT,
    "price": PRICE,
    "meta": {} // optional param
    ...
  }
]

// Example
[
  0,
  "on",
  null,
  {
    "gid": 1,
    "cid": 12345,
    "type": "EXCHANGE LIMIT",
    "symbol": "tEOSUST",
    "amount": "1.0",
    "price": "2"
  }
]

// Example with signed transaction
[
  0,
  "on",
  null,
  {
    "cid": 1607622425293,
    "type": "EXCHANGE LIMIT",
    "symbol": "tEOSUST",
    "price": "3",
    "amount": "-2",
    "flags": 0,
    "meta": [
      "2020-12-17T17:47:05.000",
      4525,
      3656691465,
      0,
      0,
      0,
      [],
      [
        [
          "eosfinextest",
          "place",
          [["eosfinex1113", "active"]],
          "A00C9BC21FB60500CD7AC34D7601000000A3E111000000000855534454000000003E14F4FFFFFFFF08454F53000000000000000000000000"
        ]
      ],
      [],
      [
        "SIG_K1_JyXhJ3aK4xyLV3rrA2TTqXPDtak4H2bSxZwLpQyeF7AD9AeAg1Lob4TNimBLKeZdPKvoDeMJw1A7KWYkRVf5fQnDf3n9kF"
      ],
      []
    ]
  }
]
// When the order is submitted you will receive an 'n' (notification) event as confirmation. If the order request is successful, you will also receive  an 'on' (order new) event. Both events are sent through CHANNEL_ID = 0.

[
CHANNEL_ID
EVENT
 [
 MTS, //omitted for 'on' event
 TYPE, //omitted for 'on' event
 MESSAGE_ID, //omitted for 'on' event
 null, //omitted for 'on' event
  [
  ID,
  GID,
  CID,
  SYMBOL,
  MTS_CREATE, 
  MTS_UPDATE, 
  AMOUNT, 
  AMOUNT_ORIG, 
  TYPE,
  TYPE_PREV,
  MTS_TIF,
  _PLACEHOLDER,
  FLAGS,
  ORDER_STATUS,
  _PLACEHOLDER,
  _PLACEHOLDER,
  PRICE,
  PRICE_AVG,
  PRICE_TRAILING,
  PRICE_AUX_LIMIT,
  _PLACEHOLDER,
  _PLACEHOLDER,
  _PLACEHOLDER,
  HIDDEN, 
  PLACED_ID,
  _PLACEHOLDER,
  _PLACEHOLDER,
  _PLACEHOLDER,
  ROUTING,
  _PLACEHOLDER,
  _PLACEHOLDER,
  META
  ]
 CODE, //omitted for 'on' event
 STATUS, //omitted for 'on' event
 TEXT //omitted for 'on' event
 ]
]

[0,"n",[1575287438.515,"on-req",null,null,[1185815098,null,1575287436979,"tETHUSD",1575287438515,1575287438515,-2.5,-2.5,"LIMIT",null,null,null,0,"ACTIVE",null,null,230,0,0,0,null,null,null,0,null,null,null,null,"API>BFX",null,null,null],null,"SUCCESS","Submitting limit sell order for -2.5 ETH."]]

[0,"on",[1185815098,null,1575287436979,"tETHUSD",1575287438515,1575287438519,-2.5,-2.5,"LIMIT",null,null,null,0,"ACTIVE",null,null,230,0,0,0,null,null,null,0,0,null,null,null,"API>BFX",null,null,null]]

Request Fields

NameTypeDescription
gidint32(optional) Group id for the order
cidint45Should be unique in the day (UTC) (not enforced)
typestringThe type of the order: EXCHANGE MARKET, EXCHANGE LIMIT, EXCHANGE FOK, EXCHANGE IOC.
symbolstringsymbol (tBTCUSD, tEOSUST, ...)
amountdecimal stringPositive for buy, Negative for sell
pricedecimal stringPrice (Not required for market orders)
flagsint16See https://docs.bitfinex.com/v2/docs/flag-values.
tifdatetime stringTime-In-Force: datetime for automatic order cancellation (ie. 2020-01-01 10:45:23) )
metaarray(optional) The meta object allows required to have signed EOS transaction if secret key was not provided on login time. if it was provided then we will be able to generate signed transaction automatically.

📘

meta

if the secret key was provided at the auth stage, then there is no need to set this field. We strongly recommend that you do not use the secret_key, but instead use the array notation of the EOS signed transaction in the meta field.
example:

[
  0,
  "on",
  null,
  {
    "cid": 1607622425293,
    "type": "EXCHANGE LIMIT",
    "symbol": "tEOSUST",
    "price": "3",
    "amount": "-2",
    "flags": 0,
    "meta": [
      "2020-12-17T17:47:05.000",
      4525,
      3656691465,
      0,
      0,
      0,
      [],
      [
        [
          "eosfinextest",
          "place",
          [["eosfinex1113", "active"]],
          "A00C9BC21FB60500CD7AC34D7601000000A3E111000000000855534454000000003E14F4FFFFFFFF08454F53000000000000000000000000"
        ]
      ],
      [],
      [
        "SIG_K1_JyXhJ3aK4xyLV3rrA2TTqXPDtak4H2bSxZwLpQyeF7AD9AeAg1Lob4TNimBLKeZdPKvoDeMJw1A7KWYkRVf5fQnDf3n9kF"
      ],
      []
    ]
  }
]

📘

Multiple Flags

You may sum flag values to pass multiple flags. For example, passing 4160 (64 + 4096) means hidden and post only.
The default value is 0 and indicates that no flags will be used.

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: EXCHANGE MARKET, EXCHANGE LIMIT, EXCHANGE FOK, 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 / paused due to AMPL rebase event)
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
CODEnull or integerWork in progress
STATUSstringStatus of the notification; it may vary over time (SUCCESS, ERROR, FAILURE, ...)
TEXTstringText of the notification

Cancel Order

To cancel an order, construct a payload using the "oc" (order cancel) abbreviation. The order details need to include Internal Order ID. 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.

// Cancel order by internal order Id
[
  0,
  "oc",
  null,
  {
    "id": ID
  }
]
// 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, 
  TYPE,
  TYPE_PREV,
  MTS_TIF,
  _PLACEHOLDER,
  FLAGS,
  ORDER_STATUS,
  _PLACEHOLDER,
  _PLACEHOLDER,
  PRICE,
  PRICE_AVG,
  PRICE_TRAILING,
  PRICE_AUX_LIMIT,
  _PLACEHOLDER,
  _PLACEHOLDER,
  _PLACEHOLDER,
  HIDDEN, 
  PLACED_ID,
  _PLACEHOLDER,
  _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

NameTypeDescription
idint64Internal Order ID

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: EXCHANGE MARKET, EXCHANGE LIMIT, EXCHANGE FOK, 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 / paused due to AMPL rebase event)
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) )
CODEnull or integerWork in progress
STATUSstringStatus of the notification; it may vary over time (SUCCESS, ERROR, FAILURE, ...)
TEXTstringText of the notification