Skip to Content
raikiri

Life of an order

What happens between a decision to trade and a fill, and how raikiri notices when it and the venue disagree.

Every order takes the same road, whether it comes from a strategy, the terminal or the client API. On paper the venue at the end is simulated. With raikiri Pro it is a real one.

The order is written to the journal before it goes to the gateway, so a restart always knows about it. The order id you get back means the order left strategyd. The venue's answer arrives later as an event.

Cancel and amend

Cancels have a lane of their own ahead of new orders, and no risk check or halt ever blocks them. An amend from a strategy changes the price only, and a venue without native amends refuses it. Through the client API an amend is a confirmed cancel followed by a new order, so it loses its place in the queue.

When no answer comes

A request that was sent and got no reply may still have reached the exchange. raikiri does not guess: the order stays open until the venue's own records settle it.

About every 30 seconds each gateway with keys asks the venue for positions, open orders, balances and fills, where the venue offers them.

  • An order the venue no longer has is closed and its strategy is told.
  • A position that differs twice in a row halts new orders to that gateway until a person resolves it. Cancels still go out.
  • A venue that cannot answer is recorded as unknown. A failed read is never taken for a flat position.

Each disagreement is listed at GET /v1/recon-breaks.

Sending the same order twice

An order with the same book, instrument, side, price and size as one sent within the last second is refused as a duplicate. A market maker that repeats itself on purpose turns this off in the risk file.

Edit this page on GitHub

On this page