Eckmann Lyapunov Exponent
The Eckmann Lyapunov Exponent, from the method of Eckmann, Kamphorst, Ruelle and Ciliberto (1986), estimates the whole spectrum of exponents rather than only the largest: it approximates the dynamics around every point with a linear map and measures how the product of these maps along the path stretches space in every direction.
The formula for the Eckmann Lyapunov Exponent starts from the spacing m of the returns within a vector, set by the embedding dimension E and the number of exponents d:
\[m = \frac{E - 1}{d - 1}\]Every vector \(X_{i}\) holds the d log returns \(x_{i}\), \(x_{i + m}\), … spaced m periods apart. A linear map \(T_{i}\) that takes \(X_{i}\) to \(X_{i + m}\) is fitted by least squares on the nearest neighbours of \(X_{i}\) by the Chebyshev distance (the largest difference of any coordinate). The maps are multiplied along the path with a QR decomposition into an orthogonal matrix \(Q_{i}\) and an upper triangular matrix \(R_{i}\), starting from the Q of the step before:
\[T_{i} \cdot Q_{i-m} = Q_{i} \cdot R_{i}\]The diagonal of \(R_{i}\) holds the stretching in each direction, so the k-th exponent \(\lambda_{k}\) is the average log of the k-th diagonal element \(R_{i , kk}\) along the path, per period:
\[\lambda_{k} = \frac{\operatorname{mean}\left(\ln\left(\left\lvert R_{i,\text{kk}}\right\rvert\right)\right)}{m}\]The exponents run from the largest to the smallest: a positive first exponent points to chaos, as for the Rosenstein Lyapunov Exponent, and the number of positive exponents to the number of directions in which the dynamics stretch.
The Lyapunov exponent measures how fast two nearly identical states of a dynamic system move apart: the average rate, per period, at which a small difference grows (a positive exponent) or dies out (a negative one). It is the defining measure of chaos, a sensitive dependence on the starting point that makes even a deterministic process unpredictable beyond a few periods. A price series shows only one variable of whatever system drives it, so the methods first rebuild the dynamics from a delay embedding: vectors of returns spaced a fixed number of periods apart, which by Takens’ theorem trace out a path with the same exponents as the underlying system.
A positive largest exponent points to chaos, a value around 0 or below to a regular process. For noise, such as daily returns, the estimate is not 0 but depends on the embedding, so the exponent is mostly of use to compare assets or periods with each other rather than as a test for chaos.
Also known as: Lyapunov spectrum, Lyapunov exponents, Eckmann-Ruelle method.
In the Finance Toolkit this is get_lyapunov_exponent with method="eckmann", the same function as Lyapunov Exponent.
Example · EURUSD, GCUSD, BTCUSD · 2021 to 2025
Install the Finance Toolkit with pip install financetoolkit -U, then call get_lyapunov_exponent:
from financetoolkit import Toolkit
toolkit = Toolkit(
["EURUSD", "GCUSD", "BTCUSD"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.risk.get_lyapunov_exponent(method="eckmann")
| Parameter | Type | Description | Example |
|---|---|---|---|
method | str | The algorithm. Options are: “rosenstein” (Rosenstein Lyapunov Exponent, the largest exponent), “eckmann” (Eckmann Lyapunov Exponent, the spectrum). Defaults to “rosenstein”. | "rosenstein" |
period | str | None | The data frequency. Options are: “daily”, “weekly”, “monthly”, “quarterly”, “yearly”. Defaults to None, which uses “daily”. | "weekly" |
embedding | int | The embedding dimension; for “eckmann”, embedding - 1 must be a multiple of matrix_dimension - 1. Defaults to 10. | 10 |
delay | int | The number of periods between the returns of a vector of the Rosenstein method. Defaults to 1. | 1 |
min_separation | int | None | The smallest number of periods between a vector and its neighbour. Defaults to None, which uses the mean period of the returns (one over the power-weighted mean frequency of the periodogram, rounded up) for “rosenstein” and 0 for “eckmann”. | None, which uses the mean period of the returns (one over the power-weighted mean frequency of the periodogram, rounded up) for "rosenstein" and 0 for "eckmann" |
trajectory_length | int | The number of periods the pairs of the Rosenstein method are followed. Defaults to 20. | 20 |
matrix_dimension | int | The number of exponents of the Eckmann method. Defaults to 4. | 4 |
min_neighbors | int | None | The number of neighbours of every vector of the Eckmann method. Defaults to None, which uses min(2 * matrix_dimension, matrix_dimension + 4). | None, which uses min(2 * matrix_dimension, matrix_dimension + 4) |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |
show_columns | str | list[str] | None | The columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column. | None, which keeps every column |
Which returns:
| Item | Exponent 1 | Exponent 2 | Exponent 3 | Exponent 4 |
|---|---|---|---|---|
| EURUSD | 0.0585 | -0.0038 | -0.0762 | -0.2357 |
| GCUSD | 0.0624 | -0.0055 | -0.0691 | -0.2138 |
| BTCUSD | 0.0692 | 0.0043 | -0.0762 | -0.2148 |
| Benchmark | 0.0537 | -0.0126 | -0.0740 | -0.2180 |
4 rows
References
- Paper Eckmann, J.-P., Kamphorst, S.O., Ruelle, D. & Ciliberto, S. (1986). “Liapunov exponents from time series.” Physical Review A, 34(6), 4971-4979.
- Paper Takens, F. (1981). “Detecting Strange Attractors in Turbulence.” Lecture Notes in Mathematics, 898, 366-381.
- Library Referenced against nolds’ lyap_e (Eckmann Lyapunov Exponent)