arbitragelab.time_series_approach.ou_optimal_threshold

The module implements the base class for OU Optimal Threshold Model.

Module Contents

Classes

OUModelOptimalThreshold

This class contains base functions for modules that calculate optimal O-U model trading thresholds

class OUModelOptimalThreshold

This class contains base functions for modules that calculate optimal O-U model trading thresholds through time-series approaches.

construct_ou_model_from_given_parameters(theta: float, mu: float, sigma: float)

Initializes the O-U process from given parameters.

Parameters:
  • theta – (float) The long-term mean of the O-U process.

  • mu – (float) The speed at which the values will regroup around the long-term mean.

  • sigma – (float) The amplitude of randomness of the O-U process.

fit_ou_model_to_data(data: numpy.array | pandas.DataFrame, data_frequency: str)

Fits the O-U process to log values of the given data.

Parameters:
  • data – (np.array/pd.DataFrame) It could be a single time series or a time series of two assets prices. The dimensions should be either n x 1 or n x 2.

  • data_frequency – (str) Data frequency [“D” - daily, “M” - monthly, “Y” - yearly].