1. Backtesting Trading Strategies

In qteasy, backtests are triggered via qt.run(op, mode=1, ...), simulating strategy runs on historical data to produce equity curves, trade logs, and performance metrics for evaluation and optimization.

1.1. Overview

  • Entry point: qt.run(operator, mode=1, ...) where mode=1 selects backtest mode.

  • Backtest outputs: equity curve (NAV, cumulative return), per-trade log, performance metrics (Sharpe, drawdown, win rate, etc.).

1.2. Backtest workflow overview

  1. Configure: asset pool (asset_pool), date range (invest_start, invest_end), initial/staged cash (invest_cash_amounts, etc.).

  2. Prepare data: ensure required history is available in DataSource.

  3. Run Operator step by step: call strategies at each run_timing to generate signals.

  4. Simulate fills: apply signals with costs, lot sizes, and related rules to update positions.

  5. Output: result object (e.g. Backtester), optional trade_log, visual charts, etc.

1.3. Chapters in this section

  • 2. How to run a backtest — entry point, configuration, full parameter list, minimal example.

  • 3. Backtest result structure — return value, field reference, equity curve and metrics.

  • 4. Trade process log — enabling trade_log, contents, viewing and saving.

  • 5. Evaluating backtest results — metric list, visualization, export and analysis.

For more on strategies and blenders, see references (e.g. references/3-back-test-strategy.md, 4-build-in-strategy-blender.md).