Skip to main content

run_twin_spread_nb

run_twin_spread_nb(
    model_output: numpy.ndarray,
    long_entries: float,
    long_exits: float,
    short_entries: float,
    short_exits: float,
    clean: bool = True,
) ‑> systematica.signals.base.Signals
Compute trading signals based on a spread strategy. The function generates long and short entry/exit signals based on two opposite indicators. It checks the conditions where one asset is up and the other is down at the same time for initiating positions. Parameters:
NameTypeDefaultDescription
model_outputndarray--A 2d array representing model predictions for two assets.
long_entriesfloat--Threshold values for initiating long positions.
long_exitsfloat--Threshold values for exiting long positions.
short_entriesfloat--Threshold values for initiating short positions.
short_exitsfloat--Threshold values for exiting short positions.
cleanbooltoTrue Clean signals. Defaults to True.
Returns:
TypeDescription
SignalsA Signals object containing boolean arrays for long entries, long exits, short entries, and short exits.