perform_optimisation#

API documentation for tradeexecutor.backtest.optimiser.perform_optimisation Python function.

perform_optimisation(iterations, search_func, decide_trades, create_indicators, strategy_universe, parameters, max_workers=<function get_safe_max_workers_count>, trading_strategy_engine_version='0.5', data_retention=GridSearchDataRetention.metrics_only, execution_context=<ExecutionContext backtesting, unspecified engine version>, indicator_storage=None, result_path=None, min_batch_size=4, real_space_rounding=Decimal('0.01'), timeout=600, log_level=None, result_filter=<tradeexecutor.backtest.optimiser.MinTradeCountFilter object>, bad_result_value=0)[source]#

Search different strategy parameters using an optimiser.

  • Use scikit-optimize to find the optimal strategy parameters.

  • The results of previous runs are cached on a disk using the same cache as grid search, though the cache is not as effective as each optimise run walks randomly around.

  • Unlike in grid search, indicators are calculated in the child worker processes, because we do not know what indicator values we are going to search upfront. There might a race condition between different child workers to calculate and save indicator data series, but it should not matter as cache writes are atomic.

  • This will likely consume gigabytes of disk space

Parameters:
Returns:

Grid search results for different combinations.

Return type:

OptimiserResult