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 (set[tradeexecutor.strategy.pandas_trader.indicator.IndicatorKey] | None) –
- 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 label which includes single value parameters as well.
Get the state file that is compresed
Get the path where the resulting state file is stored.
Human-readable label for this combination.
Get the filename for joblib pickled results are stored.
get_parameter
(name)Get a parameter value.
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:
- get_metrics_pickle_path()[source]#
Get the filename for joblib pickled results are stored.
This file is serialised with joblib and compressed with gzip
- Return type:
- get_label()[source]#
Human-readable label for this combination.
See also
get_all_parameters_label()
.- Return type:
- get_all_parameters_label()[source]#
Get label which includes single value parameters as well.
See also
get_label()
.- Return type:
- destructure()[source]#
Open parameters dict.
This will return the arguments in the same order you pass them to
prepare_grid_combinations()
.
- get_parameter(name)[source]#
Get a parameter value.
- Parameters:
name (str) – Parameter name
- Raises:
ValueError – If parameter is missing.
- Return type:
- 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 (set[tradeexecutor.strategy.pandas_trader.indicator.IndicatorKey] | None) –
- Return type:
None