Half-life of Mean-Reversion

This module contains a function that allows calculating a half-life of the mean-reversion process under the assumption that data follows the Ornstein-Uhlenbeck process.

The Ornstein-Uhlenbeck process can be described using a formula:

\[dy(t) = ( \lambda y(t-1) + \mu ) dt + d \varepsilon\]

where \(d \varepsilon\) is some Gaussian noise.

Implementation

get_half_life_of_mean_reversion(data: Series) float

Get half-life of mean-reversion under the assumption that data follows the Ornstein-Uhlenbeck process.

Parameters:

data – (np.array) Data points.

Returns:

(float) Half-life of mean reversion.

Examples

# Importing the function
from arbitragelab.cointegration_approach.utils import get_half_life_of_mean_reversion

# Finding the half-life of mean-reversion
half_life = get_half_life_of_mean_reversion(spread)