Docs / Concepts / Running systems
RealThe live engine seam
One engine, generic over a venue, run step by step.
Generic over a venue
The engine is Engine<V: Venue>. A backtest engine is the same engine with the simulated venue. A live adapter implements the same trait.
pub trait Venue {
fn send(&mut self, cmd: VenueCommand, now: UnixNanos);
fn process(&mut self, now: UnixNanos) -> Vec<OrderEvent>;
fn on_quote(&mut self, q: &QuoteTick) -> Vec<OrderEvent>;
fn inflight_count(&self) -> usize;
fn adopt(&mut self, orders: &[Order]) -> Result<(), String>; // default: Ok
}Incremental run
reconcile(report): import the venue's open orders and positions, before startstart(t): begin at time tstep(&data): one market data itemidle(now): time passes with no data; venue arrivals and timers are handledfinish(): end the run and return the result
Same path
run over a slice of data is exactly these calls, and it gives the same digests as before the change. A live session drives the same calls with real time.
Bad input
A step older than the last idle time is refused as out-of-order data before it is counted.