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)[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 (Optional[Path]) – Path to the indicator cache

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

  • max_workers (Optional[int]) –

Returns:

(state, universe, diagnostics data tuple)

Return type:

tuple[tradeexecutor.state.state.State, tradeexecutor.strategy.trading_strategy_universe.TradingStrategyUniverse, dict]