run_backtest_for_module#

API documentation for tradeexecutor.backtest.backtest_module.run_backtest_for_module Python function.

run_backtest_for_module(strategy_file, cache_path=None, trading_strategy_api_key=None, execution_context=<ExecutionContext backtesting, unspecified engine version>, max_workers=None, verbose=True)[source]#

Run a backtest described in the strategy module.

  • Designed for notebooks and console

  • Load all data and run a backtest

  • Will display multiple tqdm porgress bars and may print output

Parameters:
  • strategy_file (Path) – Path to the strategy module

  • cache_path (pathlib.Path | None) – Path to the indicator cache

  • trading_strategy_api_key (str) – If not given, attempt load from a setting file or environment

  • verbose – Print CLI console output

  • max_workers (int) –

Returns:

(state, universe, diagnostics data tuple)

Return type:

BacktestResult