Quant options system
Architecture
One repository, Optra: an options trading engine that runs the same strategies in a backtest and live on Interactive Brokers, one server with one API in front of it for the page and for agents, and one numerics library under both. It is cut in two at gRPC: above, the control plane asks; below, the core owns the trading state and reaches the world through adapters.
- control plane: asks and shows
- core: owns the trading state
- adapters: the outside world
- quant: the numerics
Scroll sideways for the whole diagram. Click a box (or tab to it and press Enter) to see what it does and what it touches.
How it holds together
The control plane only asks
It holds no trading state and never opens the engine’s database: every question and every change goes through gRPC.
One writer
One event thread owns strategies, holdings and orders. Fills and commands reach it in order and are never dropped; quotes keep only the newest; logs and socket writes run off it.
One engine, two assemblies
A strategy is written once, and so is the engine: backtest and live differ in the ports only (event loop, clock, venue, storage, and live’s market data).
Each fill booked once
Execution merges each order update and drops a fill it has seen; an order’s end waits for its fills, so the holding does not depend on the order IB reports in. Positions update the holding, then the strategy hears of it. Every order and fill is saved; a restart replays them, and a strategy starts only once its positions agree with the broker’s.
One set of numerics, one set of data
The implied vol and Greeks the engine trades on and the research tools’ pricing are the same code, quant: the engine links it, the server reaches it through a C ABI. The screener reads the engine’s backtest and recorded days, a pick is backtested as a rule over every day, and the live holdings can be stressed.
The day runs itself
The scheduler restarts the engine before the open, asks the server for a check every five minutes and for the day’s report after the close; the report replays the recorded day in a backtest and lines the paper fills up against it.