Skip to main content

Atomic Amends

· 3 min read

Fast, single-transaction amend endpoints are now available enabling clients to modify order parameters in-place, keeping queue priority within the book.

Atomic amends are lightweight and are faster than creating a new order within the matching engine.

Revisiting Legacy Edit Transactions

The legacy editOrder endpoints are implemented using a cancel-new transaction model in the engine. This offers an effective and clean model for adjusting many of the core order attributes but also has some disadvantages.

The cancel-new model has multiple phases, i.e. a cancel phase, a creation phase for a new order and a copy phase for order attributes. Latency is introduced as each phase need validation, persistence and new identifiers.

Caveats are introduced because the cancel-phase loses some order state, i.e. fill information for any executions are attached to the previous order and cannot be copied to the new one.

To summarize, from a client perspective:

  • Latency is introduced due to multiple phases of processing and persistence.
  • The client needs to chain order identifiers to track changes to an order.
  • Orders always lose priority in the price queue.
  • The loss of fill information on the order makes the transaction difficult to use when trading around the market price.

Introducing Atomic Amend Transactions

The new atomic amend order model is a single phase transaction, the order parameters are modified in-place within the book.

New Behaviours

A single order will be maintained across the lifetime of amend transactions. Therefore, orders will:

  • Keep the same order identifiers assigned by Kraken and/or client.
  • Keep the executions on the order from any previous fills.
  • Keep queue priority in the order book where possible.

Some other beneficial behaviours have been added:

  • Amending down order quantity to below the filled quantity is accepted and the order will be amended to match the filled quantity.
  • Trigger order types can be amended in either the triggered or untriggered state.

For the full detail on keeping queue priority and amending iceberg orders, see the atomic amend guide.

Performance

From a performance perspective, there are some significant gains:

  • Atomic amends are faster than legacy edit transactions within the engine due to a reduction in phases.
  • Atomic amends are faster than creating a new order given they adjust existing order in the book.
  • Given the efficiency increase, higher rate limits are available on atomic amends. See spot transaction limits.
  • Due to the better handling of race conditions, systematic clients are no longer required to initiate their own cancel-new transactions therefore reducing risk, number of transactions, io and latency.

FIX Protocol

Kraken FIX API has added the Replace Request (35=G) transaction message based the atomic amend model. This enables clients to amend the orders using FIX and benefit from the improved performance / rate limits.

Example

Scenario: simple price amend with client order identifier.

{
"method": "amend_order",
"params": {
"cl_ord_id": "btc-240720-87302",
"limit_price": 690794,
"token": "ikrPacc6HFPRn4vwES2hEzERRe71SVF4tmSbmpmHLGQ"
}
}

API Support

The atomic amend transactions are supported in the following APIs:

The amend history for an order can be retrieved using the REST /OrderAmends endpoint.