Docs / Concepts / Running systems
Real

The 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

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.