modular_trader.framework.signal_generation#

Submodules#

Classes#

BaseSignalGeneration

Abstract base class for signal generation.

ConstantSignalGeneration

Constant signal generator.

NullSignalGeneration

Signal generation strategy that doesn't generate any signals.

Package Contents#

class modular_trader.framework.signal_generation.BaseSignalGeneration#

Bases: abc.ABC

Inheritance diagram of modular_trader.framework.signal_generation.BaseSignalGeneration

Abstract base class for signal generation.

Attributes:
context: Context

The framework context.

universe: AssetUniverse

The asset universe to generate signals for.

Methods:
run(context: Context, universe: AssetUniverse) -> Iterable[Signal]:

Must be implemented by subclasses. Called by __call__() to generate signals.

__call__(context: modular_trader.context.Context, universe: modular_trader.universe.AssetUniverse)#

Generate signals.

Args:
context: Context

The framework context.

universe: AssetUniverse

The asset universe to generate signals for.

Returns:
Iterable[Signal]:

An iterable of signals.

Parameters:
abstract run(context: modular_trader.context.Context, universe: modular_trader.universe.AssetUniverse) Iterable[modular_trader.signal.Signal]#

Must be implemented by subclasses.

Called by __call__() to generate signals.

Parameters:
Return type:

Iterable[modular_trader.signal.Signal]

class modular_trader.framework.signal_generation.ConstantSignalGeneration#

Bases: modular_trader.framework.signal_generation.base.BaseSignalGeneration

Inheritance diagram of modular_trader.framework.signal_generation.ConstantSignalGeneration

Constant signal generator.

Generates a signal for each symbol in the universe with a constant direction.

run(context: modular_trader.context.Context, universe: modular_trader.universe.AssetUniverse) Iterable[modular_trader.signal.Signal]#

Returns an iterable of constant signals.

Args:

context: Context universe: AssetUniverse

Returns:

An iterable of signals.

Parameters:
Return type:

Iterable[modular_trader.signal.Signal]

direction: modular_trader.signal.SignalDirection = None#
class modular_trader.framework.signal_generation.NullSignalGeneration#

Bases: modular_trader.framework.signal_generation.base.BaseSignalGeneration

Inheritance diagram of modular_trader.framework.signal_generation.NullSignalGeneration

Signal generation strategy that doesn’t generate any signals.

This signal generation strategy is useful for testing or debugging purposes.

run(context: modular_trader.context.Context, universe: modular_trader.universe.AssetUniverse) Iterable[None]#

Returns an empty iterable of signals.

Parameters:
Return type:

Iterable[None]