Skip to main content

Matching engine

Self-trade prevention

Self-trading is not allowed on Tonic. Traders can specify one of the following self-trade prevention options when placing an order:

  • Decrement and cancel - This is the default behavior. The larger order is decremented by the remaining size of the smaller order, and the smaller order is canceled. Orders of the same size will both be canceled. The canceled amount is not processed as a fill.
  • Cancel oldest - Cancel the maker order. The taker order continues executing.
  • Cancel newest - Cancel the taker order. The maker order remains on the book.
  • Cancel both - Cancel both orders.


New orders match against the prices of resting orders, ie, the taker gets the best price.

There is no pending state for orders. The matching engine is run once each time a new order is placed, and matches execute immediately. For limit orders, unfilled quantity is placed on the book. For market orders, unused funding is refunded.