Core concepts¶
Eight words carry most of algo-trading. Learn these and the rest of the codebase reads easily.
| Term | In one sentence |
|---|---|
| Update | One thing that happened on a venue — a book level changed, a trade printed. |
| Packet | A group of updates that share a timestamp, processed as one unit. |
| Feed | The current book state, kept up to date by applying updates. |
| Signal | A computed number derived from feeds or other signals — for example a midpoint or a fair value. |
| Actor | Something that turns the current signals and book into desired orders. |
| Intent | A desired order action from an actor: submit this, cancel that. |
| Order manager | The venue-agnostic record of what orders actually exist. |
| Execution venue | The trait a real exchange or a simulator implements to accept orders. |
The journey of one packet¶
flowchart TD
U["Updates arrive<br/>book levels, trades"]
P["Grouped into a packet<br/>shared timestamp"]
F["Feed state updated"]
S["Subscribed signals recompute<br/>in dependency order"]
A["Actors read signals + book<br/>and return intents"]
O["Order manager turns intents<br/>into concrete requests"]
V["Execution venue<br/>real adapter or simulator"]
E["Order events return<br/>accepted, filled, canceled"]
PT["Post-trade records written"]
U --> P --> F --> S --> A --> O --> V
V --> E --> A
E --> PT
classDef key fill:#2e7d32,stroke:#1b5e20,color:#fff
class S,A key
The two green stages are where nearly all strategy work happens. Everything around them is plumbing that stays the same across venues.
Packets, not messages¶
A MarketDataPacket is a non-empty list of updates that share a timestamp.
Processing is packet-at-a-time rather than message-at-a-time so that everything
that happened at one instant is visible before any decision is made — a strategy
never reacts to half of a simultaneous change.
Update payloads cover book snapshots, level updates, order-level updates, trade orders, public trades, account trades, and order lifecycle events.
Signals have a value and a validity¶
Every signal owns two outputs:
value— usually a number.is_valid— whether anything downstream is allowed to use that value.
This matters more than it looks. A signal that has not warmed up, or whose
inputs went stale, reports is_valid = false rather than a misleading number,
and actors that need it simply do not quote. Checking validity is not optional
politeness; it is the mechanism that stops a cold strategy from trading on
garbage.
Signals declare their dependencies(), and the runtime topologically sorts
them: if B depends on A, A always recomputes first.
Actors decide, they do not execute¶
An actor receives an ActorContext — the current fair value, the book, its own
position, tick size, and its resting orders — and returns OrderIntent values.
It never talks to a venue. That separation is what lets the same actor run
against a live adapter and against the simulator unchanged.
Intents are declarative and small:
| Intent | Meaning |
|---|---|
SubmitLimit |
Place a limit order, optionally post-only |
ModifyLimit |
Amend an existing limit order |
Cancel |
Cancel this actor's order on one side |
CancelOrder |
Cancel one specific client order ID |
SubmitIoc |
Cross the spread with an immediate-or-cancel order |
CancelAllForActor |
Clear everything this actor holds on an instrument |
Strategy mode is the safety dial¶
Independently of intents, a strategy runs in one of five modes:
| Mode | Effect |
|---|---|
Normal |
Quote normally |
ReducePosition |
Only quote in the direction that reduces inventory |
NormalPaused |
Hold position, stop adding |
ReducePositionPaused |
Reducing, and paused |
Stopped |
No quoting |
Risk gates, drawdown limits, and lifecycle commands express themselves by moving this dial, which is why a strategy can be wound down without changing its logic.
Execution is a trait, not a venue¶
ExecutionVenue is deliberately tiny — submit, modify, cancel, poll,
plus an optional health check. Anything implementing it can execute a strategy:
| Implementation | Used for |
|---|---|
| Live venue adapters (in Dyson) | Real trading |
| Simulator | Backtests, with modeled latency and queue position |
Note that poll is a pull, not a callback. The runtime asks the venue for
events on its own schedule, which keeps event ordering under the runtime's
control rather than the network's.
Related¶
- Signals and actors — how to write either one
- Crate map — where each of these lives
- State management — what survives a restart