GridCombination#
API documentation for tradeexecutor.backtest.grid_search.GridCombination Python class in Trading Strategy framework.
- class GridCombination[source]#
Bases:
object
One combination line in grid search.
- __init__(index, result_path, parameters, indicators=None)#
- Parameters:
index (int) –
result_path (Path) –
parameters (Tuple[GridParameter]) –
indicators (Optional[set[tradeexecutor.strategy.pandas_trader.indicator.IndicatorKey]]) –
- Return type:
None
Methods
__init__
(index, result_path, parameters[, ...])as_dict
()Get as kwargs mapping.
Open parameters dict.
get_all_indicators
(combinations)Get all defined indicators that need to be calculated, across all grid search combinatios.
Get the path where the resulting state file is stored.
Human readable label for this combination
Get the path where the resulting state file is stored.
to_strategy_parameters
()validate
()Check arguments can be serialised as fs path.
Attributes
How many of nth grid combinations this is
In which folder we store the result files of all grid search runs
Alphabetically sorted list of parameters
Indicators for this combination.
Get all parameters that are searchable.
- result_path: Path#
In which folder we store the result files of all grid search runs
Each individual combination will have its subfolder based on its parameter.
- parameters: Tuple[GridParameter]#
Alphabetically sorted list of parameters
Each parameter can have 0…n values.] If parameter is not “single”, i.e. single value, then it is searchable.
- indicators: set[tradeexecutor.strategy.pandas_trader.indicator.IndicatorKey] | None#
Indicators for this combination.
create_indicators() is called with the
parameters
and it yields the result of indicators we need to calculate for this grid combination. Only avaiable if trading_strategy_engine_version > 0.5.One key entry for each trading pair if pair specific indicators are used
- property searchable_parameters: List[GridParameter]#
Get all parameters that are searchable.
Searchable parameters have two or more values.
- get_relative_result_path()[source]#
Get the path where the resulting state file is stored.
Try to avoid messing with 256 character limit on filenames, thus break down as folders.
- Return type:
- destructure()[source]#
Open parameters dict.
This will return the arguments in the same order you pass them to
prepare_grid_combinations()
.
- static get_all_indicators(combinations)[source]#
Get all defined indicators that need to be calculated, across all grid search combinatios.
Duplications are merged.
- Parameters:
combinations (Iterable[GridCombination]) –
- Return type:
set[tradeexecutor.strategy.pandas_trader.indicator.IndicatorKey]
- __init__(index, result_path, parameters, indicators=None)#
- Parameters:
index (int) –
result_path (Path) –
parameters (Tuple[GridParameter]) –
indicators (Optional[set[tradeexecutor.strategy.pandas_trader.indicator.IndicatorKey]]) –
- Return type:
None