KalmanAccounts coming soon

Kalman stat-arb

A pair of cointegrated assets drifts apart and back. The classic trade is long the cheap leg, short the rich one. On Solana spot we cannot short, so this strategy trades the same signal by rotating capital: hold the cheap leg outright, return to a 50/50 split when the spread normalizes.

The signal

We estimate the hedge relationship online rather than fitting it once. A Kalman filter treats the hedge ratio and intercept as a random walk on log prices and updates them every bar. Its standardized innovation — the surprise in the latest observation, divided by the square root of its predicted variance — is the z-score we trade.

state:  w = [beta, alpha]  — random walk
obs:    log(y) = beta · log(x) + alpha + eps
signal: z = e / sqrt(F)   — standardized innovation

After R. E. Kalman, "A New Approach to Linear Filtering and Prediction Problems", J. Basic Eng. 82(1), 1960. Pair qualification uses Engle & Granger (1987) cointegration and an Ornstein–Uhlenbeck half-life.

Rules

ParameterDefaultMeaning
|z| > 2.0rotateFrom balanced, go fully into the cheap leg. Sells queue before buys, so the sale funds the purchase.
|z| < 0.5normalizeSpread has normalized — return to a balanced 50/50 holding.
|z| > 4.0freezeRelationship treated as broken: flatten to balanced, freeze a full warm-up before trading again.
warmup300 barsNo trades until the filter's covariance has settled.

Parameters

ParameterDefaultMeaning
entry_z2.0Rotation threshold. Lower trades more, pays more cost.
exit_z0.5Normalization band for returning to balanced.
stop_z4.0Relationship-broken guard, triggers freeze.
delta1e-4Process noise. Higher adapts faster, tracks noise.

What would make us turn it off

Cointegration p-value on the trailing window rising above 0.05 for a sustained period; half-life extending beyond the holding horizon; or repeated stop-z freezes, which indicate the pair is no longer mean-reverting rather than merely stretched. Any of the three kills the pair publicly on the pair explorer, with the reason recorded.

Known failure modes

Rotation costs two fills per signal, so a chopping z-score bleeds fees. A slow structural drift in the LST peg looks like a tradable spread until it doesn't. Strategy-internal position beliefs are reconciled from actual fills, never trusted directly.