Skip to main content

RollingSpreadModel

Rolling divergence spread model. The spread represents the relative performance of both instruments. Whenever the two instruments move apart, the spread increases and may reach a certain threshold where we take a long position in the underperformer and a short position in the overachiever. This threshold is set as percentage point. All of this is done in a rolling manner to reduce noise. Method generated by attrs for class RollingSpreadModel.

Ancestors

  • systematica.models.base.BaseStatArb
  • abc.ABC

Static methods

get_feature_expression

Returns the expression model for rolling spread strategy. Returns:

Instance variables

  • lower: float: Lower threshold. Defaults to -0.2.
  • minp: int: Mininim period. Defaults to None, which means no minimum period is applied.
  • upper: float: Upper threshold. Defaults to 0.2.
  • window: int: The size of the rolling window. Defaults to 365.

Methods

plot

Plot rolling spread scores with entry and exit signals. Parameters: Returns:

RollingZscoreModel

Rolling divergence spread model. The spread represents the relative performance of both instruments. Whenever the two instruments move apart, the spread increases and may reach a certain threshold where we take a long position in the underperformer and a short position in the overachiever. This threshold is set to a number of standard deviations from the mean. All of this is done in a rolling manner, as the linear relationship between the instruments is always changing. We will use the prediction error of the ordinary least squares (OLS), which is the difference between the true value and the predicted value. Method generated by attrs for class RollingZscoreModel.

Ancestors

  • systematica.models.base.BaseStatArb
  • abc.ABC

Static methods

get_feature_expression

Returns the expression model for rolling spread strategy. Returns:

Instance variables

  • lower_alpha: float: Lower tail probability used to compute percent point function (inverse of cdf) at q of the given RV. Defaults to 0.05.
  • minp: int: Mininim period. Defaults to None, which means no minimum period is applied.
  • upper_alpha: float: Upper tail probability used to compute percent point function (inverse of cdf) at q of the given RV. Defaults to 0.05.
  • use_returns: bool: Flag to explicitly use returns as input if True. Otherwise, use log prices Defaults to `False.
  • window: int: The size of the rolling window. Defaults to 365.

Methods

plot

Plot rolling spread z-scores with entry and exit signals. Parameters: Returns: