modular_trader.signal#
Classes#
A signal. |
|
A collection of signals. |
|
The direction of a signal. |
Module Contents#
- class modular_trader.signal.Signal#
A signal.
A signal is an object that contains information about a trading signal. The signal is defined by the following attributes: - symbol: The symbol of the asset. - direction: The direction of the signal.
- direction: SignalDirection#
- symbol: str#
- class modular_trader.signal.SignalCollection#
A collection of signals.
This class represents a collection of trading signals. It contains the following attributes: - signals: A list of Signal objects.
- __iter__() Generator[Signal, None, None] #
Iterate over the signals.
- Return type:
Generator[Signal, None, None]
- __len__() int #
Return the number of signals.
- Return type:
int
- add(signals: Signal | Iterable[Signal]) None #
Add a signal or signals to the collection.
- Args:
signals: A signal or an iterable of signals.
- clear() None #
Clear the collection of signals.
- Return type:
None
- class modular_trader.signal.SignalDirection(*args, **kwds)#
Bases:
enum.Enum
The direction of a signal.
This enum defines the possible directions of a signal. The direction can be one of the following values: - UP: The signal is indicating a long position. - DOWN: The signal is indicating a short position. - FLAT: The signal is indicating no position.
- DOWN = -1#
- FLAT = 0#
- UP = 1#