TurQuant

Home / Research

An order's journey to the exchange

Between the moment an algorithm decides to buy and the moment the order reaches the matching engine, there is a path that usually stays out of sight. Every stop on that path determines both latency and risk. In this article we follow an order step by step, from the strategy to the exchange and back.

1. The decision: the strategy engine

The journey begins when the strategy engine reacts to a change in market data. What it produces is not yet an order but an intention: which instrument, which side, what price and how much. Before that intention can become an order, two questions must be answered: is this order fit to send, and can it be encoded in line with the rules?

2. Pre-trade risk controls

Before an order goes to the exchange, it should pass a set of checks inside the sending system. These checks are not the last line of defence but the first, because a faulty order that has reached the exchange usually cannot be taken back. International regulation defines a minimum set of these controls explicitly. The European Union's technical standard for algorithmic trading (RTS 6), for instance, requires price collars, maximum order values, maximum order volumes and maximum message limits at order entry.

  • Price collar: An order whose price is too far from a reference price is rejected. This control catches most "fat finger" errors.
  • Maximum order size and value: Limits on a single order, in lots and in currency.
  • Position and loss limits: Whether the position and daily loss that would result if the order filled would breach their limits.
  • Message rate: The number of orders, amendments and cancels sent per unit of time. A runaway loop usually shows up here first.

These controls also have a structural rule: no information means no permission. If the risk engine does not know an instrument's reference price or the current position, it should stop the order rather than let it through. A protection that silently "skips the check" is more dangerous than none at all, because everyone believes it is there.

3. The protocol: OUCH or FIX

An order that passes the checks is encoded in a form the exchange understands. At Borsa Istanbul there are two main routes:

OUCHFIX
FormatBinary messages with a fixed layout per message typeTag=value text messages
TransportSoupBinTCPFIXT 1.1 session layer
StrengthVery low encoding and decoding cost; for high-frequency trading and market makingIndustry standard; broad order-type support and easy integration with institutional systems
Instrument identifierNumeric order book identifierSecurityID (also the order book identifier)

The choice usually follows the strategy's needs. For a market maker updating many quotes per second, OUCH's fixed-layout binary messages are a clear advantage. For an institutional flow that trades less often but uses a range of order types, FIX is more flexible. Many systems use both: they send orders over OUCH and follow fills and order states through an independent FIX Drop Copy session.

4. Network and colocation

The encoded message leaves the network card and travels to the exchange gateway. Colocation means the server sits in the exchange data centre, physically as close to the matching engine as possible. At that point most of the latency no longer comes from the speed of light but from software: the operating system's network stack, switches between threads, memory allocation and locks. That is why the real work in a low-latency system is keeping the critical path of the code lean.

Thinking of latency as a single number is misleading. A better view is to build a latency budget: the sum of the time allowed for receiving data, updating the book, deciding, checking risk, encoding and sending the order. Unless each step is measured on its own, there is no way to know which one needs work. Percentiles matter, not averages: tail latency (p99) tends to grow in the busiest, fastest-moving moments of the market, exactly when latency is most expensive.

5. The exchange side: gateway, risk and matching

Once the order reaches the exchange, it also passes several stops. The gateway checks the session and the message rate; sessions exceeding the number of messages allowed per unit of time are throttled or have their messages rejected. Borsa Istanbul's pre-trade risk management application (PTRM) lets members set limits for their clients and accounts. The order then enters the matching engine, where under price-time priority it either matches against resting orders on the other side or rests in the book.

6. The way back: responses

Half of the journey is the return trip. The exchange sends messages reporting that the order was accepted, executed, cancelled or rejected. Two principles matter here:

  • Every response has a meaning and a timing. A rejected cancel request may mean the order had already been filled. If the system records that as "cancelled", its own view of the position drifts away from reality.
  • An independent source of truth is needed. In addition to responses on the order channel, records from a separate channel such as Drop Copy should be compared regularly with the state the system keeps for itself.

7. When everything goes wrong

A good order path should behave predictably when it breaks, too. There are two basic tools for this:

  • Cancel on disconnect: At Borsa Istanbul this service is enabled at the member's request. Loss of connection is confirmed through heartbeat checks, and if the user does not reconnect within the set time, the session's pending orders and the unfilled parts of partly filled orders are cancelled. This prevents a market maker that has lost its connection from leaving orphaned quotes in the book.
  • Kill switch: A mechanism that, with a single command, stops new orders and cancels open ones. What matters is not only sending the cancels but verifying that each one actually completed, and retrying those that did not.

Conclusion

An order's journey to the exchange is not only a speed problem; it is also a problem of correctness and responsibility. A fast system that does not know its own state can cost far more than a slow but accurate one. That is why, when building low-latency infrastructure, measurement, risk control and reconciliation deserve as much care as speed.

References

  • European Commission (2016). Commission Delegated Regulation (EU) 2017/589 (RTS 6) on organisational requirements of investment firms engaged in algorithmic trading. Official Journal of the European Union, L 87.
  • Borsa Istanbul. BISTECH OUCH Protocol Specification.
  • Borsa Istanbul. Genium INET FIX Protocol Specification and FIX Drop Copy Protocol Specification.
  • Nasdaq. SoupBinTCP Protocol Specification.
  • FIX Trading Community. FIX 5.0 Service Pack 2 and FIXT 1.1 specifications.

This article is for general information only and is not investment advice.

← Insights