prepare_grid_combinations#
API documentation for tradeexecutor.backtest.grid_search.prepare_grid_combinations Python function.
- prepare_grid_combinations(parameters, result_path, clear_cached_results=False, marker_file='README-GRID-SEARCH.md', create_indicators=None, strategy_universe=None, execution_context=<ExecutionContext backtesting, unspecified engine version>)[source]#
Get iterable search matrix of all parameter combinations.
Make sure we preverse the original order of the grid search parameters.
Set up the folder to store the results
- Parameters:
parameters (Union[Dict[str, List[Any]], type]) –
A grid of parameters we will search.
Can be a dict or a class of which all members will be enumerated.
result_path (Path) – A folder where resulting state files will be stored.
clear_cached_results –
Clear any existing result files from the saved result cache.
You need to do this if you change the strategy logic outside the given combination parameters, as the framework will otherwise serve you the old cached results.
marker_file – Safety to prevent novice users to nuke their hard disk with this command.
create_indicators (tradeexecutor.strategy.pandas_trader.indicator.CreateIndicatorsProtocolV1 | tradeexecutor.strategy.pandas_trader.indicator.CreateIndicatorsProtocolV2 | None) – Pass create_indicators function if you want your grid seacrh to use fast cached indicators.
strategy_universe (tradeexecutor.strategy.trading_strategy_universe.TradingStrategyUniverse | None) – Needed with create_indicators
execution_context (ExecutionContext) – Tell if we are running unit testing or real backtesting.
- Returns:
List of all combinations we need to search through
- Return type: