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:
Return type:

None

Methods

__init__(index, result_path, parameters[, ...])

as_dict()

Get as kwargs mapping.

destructure()

Open parameters dict.

get_all_indicators(combinations)

Get all defined indicators that need to be calculated, across all grid search combinatios.

get_all_parameters_label()

Get label which includes single value parameters as well.

get_full_result_path()

Get the path where the resulting state file is stored.

get_label()

Human-readable label for this combination.

get_parameter(name)

Get a parameter value.

get_relative_result_path()

Get the path where the resulting state file is stored.

to_strategy_parameters()

validate()

Check arguments can be serialised as fs path.

Attributes

index

How many of nth grid combinations this is

result_path

In which folder we store the result files of all grid search runs

parameters

Alphabetically sorted list of parameters

indicators

Indicators for this combination.

searchable_parameters

Get all parameters that are searchable.

index: int#

How many of nth grid combinations this is

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:

Path

get_full_result_path()[source]#

Get the path where the resulting state file is stored.

Return type:

Path

validate()[source]#

Check arguments can be serialised as fs path.

as_dict()[source]#

Get as kwargs mapping.

Return type:

dict

get_label()[source]#

Human-readable label for this combination.

See also get_all_parameters_label().

Return type:

str

get_all_parameters_label()[source]#

Get label which includes single value parameters as well.

See also get_label().

Return type:

str

destructure()[source]#

Open parameters dict.

This will return the arguments in the same order you pass them to prepare_grid_combinations().

Return type:

List[Any]

get_parameter(name)[source]#

Get a parameter value.

Parameters:

name (str) – Parameter name

Raises:

ValueError – If parameter is missing.

Return type:

object

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:
Return type:

None