mean-reversion
Mean-reversion identifies when prices, spreads, or other financial metrics deviate from their long-run average and predictably return. This skill provides statistical tests (ADF, Hurst exponent, variance ratio) to confirm mean reversion, half-life estimation to time entries and exits, z-score frameworks for signal generation, and Ornstein-Uhlenbeck process modeling for continuous-time analysis.
Mean-reversion uses ADF testing, Hurst exponent, and z-score signals to identify and trade price reversions to equilibrium.
AI-generated summary based on this skill's SKILL.md
Install
agiprolabs/claude-trading-skills/mean-reversion · repository language: Python
git clone https://github.com/agiprolabs/claude-trading-skills
cp -r claude-trading-skills/skills/mean-reversion ~/.claude/skills/mean-reversionFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How does mean-reversion detect mean reverting assets?
Mean-reversion uses statistical tests including the Augmented Dickey-Fuller (ADF) test for stationarity, Hurst exponent calculation to measure mean-reversion strength, and variance ratio tests to confirm price series predictably return to their long-run average. These tests identify assets suitable for mean-reversion trading strategies.
What are z-score mean reversion signals and how do I use them?
Mean-reversion generates buy/sell signals by measuring z-score deviations from the mean. When a price deviates significantly (high z-score), mean-reversion signals a potential reversal trade. The skill calculates z-score thresholds to define entry and exit points, helping traders capitalize on temporary price dislocations.
How does mean-reversion estimate half-life for position sizing?
Mean-reversion estimates mean-reversion speed and half-life—the time for a price to revert halfway to its mean. This metric informs position sizing and holding periods. Faster half-lives suit shorter-term trades; slower ones require longer holding periods and larger position adjustments.
Can mean-reversion find cointegrated pairs for spread trading?
Yes. Mean-reversion identifies cointegrated pairs whose spreads exhibit mean-reverting behavior, enabling pairs trading strategies. The skill tests spread stationarity and models the relationship, allowing traders to profit from temporary divergences between correlated assets.
What is the Ornstein-Uhlenbeck process in mean-reversion modeling?
Mean-reversion models mean-reverting dynamics using the Ornstein-Uhlenbeck process, a continuous-time framework capturing mean-reversion speed and volatility. This approach enables more sophisticated parameter estimation and risk modeling compared to discrete-time methods.
How can mean-reversion be used for ranging market strategy?
Mean-reversion excels in ranging markets where prices oscillate around a stable mean. The skill identifies these conditions via statistical tests, then generates signals when prices deviate from the range. This approach works well for stablecoin depegs, funding rate arbitrage, and other mean-reverting dynamics in crypto and traditional markets.
SKILL.md
rendered from the published skill — quoted content, verbatim
Mean Reversion
Mean reversion is the statistical tendency for prices, spreads, or other financial variables to return toward a long-run average after deviating from it. A mean-reverting series overshoots its mean, then corrects back -- creating predictable oscillations that can be traded.
When Mean Reversion Works
- Ranging markets: Sideways price action with clear support/resistance
- Pairs spreads: Spread between cointegrated assets reverts to equilibrium
- Oversold/overbought extremes: RSI, Bollinger Band, or z-score extremes in stationary series
- Funding rate arbitrage: Perpetual funding rates revert to baseline
- Stablecoin depegs: Classic mean-reversion opportunity (peg = known mean)
- Post-dump recovery: Brief mean-reversion windows after initial PumpFun dumps
When Mean Reversion Fails
- Strong trending markets (most crypto most of the time)
- Regime changes: what was stationary becomes non-stationary
- Structural breaks: token migration, protocol upgrade,
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 5 files
skills/mean-reversion/SKILL.md
skills/mean-reversion/references/statistical_tests.md
skills/mean-reversion/references/strategy_design.md
skills/mean-reversion/scripts/mean_reversion_test.py
skills/mean-reversion/scripts/pairs_scanner.py