Architecture
How QuantJourney Backtester is organized across data, strategy hooks, execution, portfolio state and reporting.
QuantJourney Backtester is organized as a layered research system. Strategy code expresses intent; the engine owns data alignment, timing, accounting, execution assumptions, validation and report artifacts.
Technology
End-to-End Backtest Engine Stack
From strategy hooks to auditable portfolio evidence.How To Read The Engine
Backtest Engine Module Map
Use this map when you want to know which directory owns which behavior. The top of each card is the responsibility; the file list underneath is where to start reading.
Public strategy surface
What a strategy author touches first.
backtester/core.py Backtester lifecycle, run_strategy(), mode dispatch and strategy hook orchestration. backtester/__init__.py Public exports for Backtester, order types, risk models and rebalance primitives. strategies/ Runnable examples for weight mode, order mode, rebalance policies and validation workflows. Data and feature layer
How raw prices become aligned feature frames.
backtester/universe.py Universe helpers and instrument set definitions. backtester/portfolio/instr_data.py InstrumentData container for OHLCV, adjusted close, indicators and strategy features. backtester/portfolio/instr_calc.py Instrument-level calculations used before signals, weights or orders read data. backtester/portfolio/config.py Portfolio and data-processing configuration surface. Weight-mode portfolio engine
Target weights become realized portfolio state.
backtester/portfolio/rebalance.py RebalancePolicy and RebalanceEngine for calendar, drift, signal and risk-triggered rebalances. backtester/portfolio/portf_data.py PortfolioData state: returns, NAV, weights, positions, turnover and artifacts. backtester/portfolio/portf_calc.py Portfolio-level performance and accounting calculations. backtester/portfolio/weight_cost.py Turnover and transaction-cost handling for weight-mode portfolios. backtester/portfolio/schemas.py Typed portfolio result schemas and validation contracts. Order-mode execution engine
Discrete orders become fills, cash and position mutations.
backtester/execution/order_types.py Order, OrderType, side, time-in-force, bracket and OCO data structures. backtester/execution/fill_engine.py Pending order book, trigger checks, fill pricing, child orders and sibling cancellation. backtester/execution/slippage.py Fixed bps, market impact and execution price adjustment models. backtester/execution/commission.py Per-fill commission schemes and minimum ticket costs. backtester/execution/contract_spec.py Contract metadata for futures and multi-asset PnL handling. Risk overlays
Weight transforms before portfolio accounting.
backtester/risk/base.py RiskModel interface and composition contract. backtester/risk/position_limit.py Per-instrument exposure caps and clipping. backtester/risk/vol_target.py Volatility targeting overlay. backtester/risk/inverse_vol.py Inverse-volatility allocation. backtester/risk/risk_parity.py Risk parity style allocation logic. Analytics and reports
The run becomes evidence: metrics, plots, PDFs and archives.
backtester/engines/performance.py Main performance report engine and rich result assembly. backtester/engines/plot_orchestrator.py Coordinates report plots from portfolio, strategy trace and analytics modules. backtester/engines/pdf_creation.py PDF creation pipeline. backtester/engines/factsheet_pdf.py Factsheet-style PDF output. backtester/engines/archive.py Run archive, reproducibility metadata and persisted artifacts. backtester/engines/blotter.py Order/fill/trade audit output. backtester/metrics/configs/portfolio_perf.py Portfolio performance metric definitions and report configuration. Validation and optimization
Out-of-sample checks around an already-defined engine run.
backtester/walkforward/engine.py WalkForwardEngine orchestration. backtester/walkforward/config.py Fold, purge and validation settings. backtester/walkforward/folds/ Rolling, expanding, anchored, CPCV and purge fold builders. backtester/walkforward/optimization/ Grid and Optuna optimization helpers. backtester/walkforward/statistics/ Aggregation, DSR, rolling rank stability and overfit diagnostics. SDK, cloud and utilities
Hosted runner integration and supporting infrastructure.
backtester/sdk/client.py Client for hosted Backtester API workflows. backtester/mixins/sdk_client.py Strategy mixin for SDK behavior. backtester/mixins/reporting.py Reporting helper mixin used by strategy objects. backtester/im_client.py Infrastructure messaging client. backtester/utils/reproducibility.py Run metadata and reproducibility helpers. backtester/utils/logger.py Package logging utilities.