modular_trader.framework.asset_selection#

Submodules#

Classes#

BaseAssetSelection

Base class for asset selection.

ManualAssetSelection

Selects the assets based on a predefined list of symbols.

Package Contents#

class modular_trader.framework.asset_selection.BaseAssetSelection#

Bases: abc.ABC

Inheritance diagram of modular_trader.framework.asset_selection.BaseAssetSelection

Base class for asset selection.

This class defines the interface for all asset selection strategies.

__call__(context: modular_trader.context.Context)#

Selects the assets to be used in the backtest.

Called by the framework to select the assets to be used in the backtest.

Parameters:

context (modular_trader.context.Context)

abstract run(context: modular_trader.context.Context) Iterable[str]#

Selects the assets to be used in the backtest.

Must be implemented by subclasses.

Parameters:

context (modular_trader.context.Context)

Return type:

Iterable[str]

class modular_trader.framework.asset_selection.ManualAssetSelection#

Bases: modular_trader.framework.asset_selection.base.BaseAssetSelection

Inheritance diagram of modular_trader.framework.asset_selection.ManualAssetSelection

Selects the assets based on a predefined list of symbols.

This class is used when the assets to be traded are known in advance.

Attributes:

symbols (list[str]): A list of symbol strings.

run(context: modular_trader.context.Context) Iterable[str]#

Selects the assets based on a predefined list of symbols.

Args:

context (Context): The framework context.

Returns:

Iterable[str]: An iterable of symbol strings.

Parameters:

context (modular_trader.context.Context)

Return type:

Iterable[str]

symbols: list[str]#