Mean reversion analytics for price series.
Provides Ornstein-Uhlenbeck half-life estimation, which approximates how many periods it takes for deviations from trend to decay by half.
API Functions
| Function | Arity | Description | Param Kinds |
|---|---|---|---|
half_life | 1 | Estimate Ornstein-Uhlenbeck half-life from a price series. | prices: value |
Summary
Functions
Estimate Ornstein-Uhlenbeck half-life from a price series.
Functions
Estimate Ornstein-Uhlenbeck half-life from a price series.
Parameters
prices- List of prices in chronological order (oldest first) (value)
Returns
{:ok, half_life_in_periods}, {:error, :no_mean_reversion}, or nil for insufficient data (result_tuple)
Example
{:ok, 6.9}Errors
:no_mean_reversion
# descripex:contract
%{
params: %{
prices: %{
description: "List of prices in chronological order (oldest first)",
kind: :value
}
},
errors: [:no_mean_reversion],
returns: %{
type: :result_tuple,
description: "{:ok, half_life_in_periods}, {:error, :no_mean_reversion}, or nil for insufficient data"
},
returns_example: {:ok, 6.9}
}