Ports and adapters, with the strategy as a pure function
QuantForge separates the engine from the outside world with four traits: MarketDataSource, TradingVenue, CandleStore, and RunJournalStore. Binance Spot and SQLite are adapters behind them. Strategies sit behind a determinism contract: a pure function of the bar sequence, no clock, no randomness, no I/O, and decisions only on closed candles.
Because strategies are deterministic, a backtest and a live run over the same bars make the same decisions. A restart replays recent bars to warm indicators up, and backtests fill at the next bar's open. The StrategyContext is plain owned data with no borrows into the engine, so the boundary can later cross an FFI line into Python.












