MCPInstall

volatility-modeling

Volatility estimation, forecasting, and regime classification using GARCH, EWMA, realized volatility, and volatility cones

Installs
499
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/agiprolabs/claude-trading-skills --skill volatility-modeling
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads volatility-modeling automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Volatility Modeling

Volatility — the magnitude of price fluctuations — is arguably the single most important quantity in trading. It drives position sizing, stop placement, option pricing, and regime detection. This skill covers estimation, forecasting, and practical application of volatility in crypto markets.

Why Volatility Matters

Use CaseHow Volatility Is Used
Position sizingScale position inversely with vol so each trade risks a consistent dollar amount
Stop placementATR-based stops widen in high-vol regimes, tighten in low-vol
Strategy selectionMean-reversion works in low vol; momentum works in high vol
Risk budgetingVol-target portfolios maintain constant portfolio-level risk
Regime detectionVol regime shifts signal changing market dynamics
Option pricingImplied vs realized vol gap creates trading opportunities

Types of Volatility

Historical (Realized) Volatility

Computed from observed past returns. The most common and directly measurable form. Multiple estimators exist with different statistical efficiency.

Implied Volatility

Derived from option prices via Black-Scholes or similar models. Limited in crypto DeFi where liquid options markets are sparse, but available on Deribit for BTC/ETH.

Forecast Volatility

Predicted future volatility from models like EWMA or GARCH. Used for forward-looking position sizing and risk budgets.


Estimation Methods

1. Close-to-Close (Standard Deviation of Log Returns)

The simplest estimator. Compute the standard deviation of log returns and annualize.

import numpy as np

log_returns = np.log(closes[1:] / closes[:-1])
vol_daily = np.std(log_returns, ddof=1)
vol_annual = vol_daily * np.sqrt(365)  # crypto trades 365 days
  • Pros: Simple, widely understood.
  • Cons: Uses only close prices — ignores intraday range.

2. Parkinson (High-Low Range)

Uses the daily high-low range, which is ~5x more statistically efficient than close-to-close.

hl_ratio = np.log(highs / lows)
vol_parkinson = np.sqrt(np.mean(hl_ratio**2) / (4 * np.log(2))) * np.sqrt(365)
  • Pros: More efficient, captures intraday moves.
  • Cons: Downward bias with discrete sampling; ignores close-to-close jumps.

3. Garman-Klass (OHLC)

The most efficient single-day OHLC estimator.

hl = np.log(highs / lows)
co = np.log(closes / opens)
gk = np.mean(0.5 * hl**2 - (2 * np.log(2) - 1) * co**2)
vol_gk = np.sqrt(gk) * np.sqrt(365)
  • Pros: Best efficiency among OHLC estimators.
  • Cons: Assumes no drift; sensitive to opening gaps.

4. Yang-Zhang

Combines overnight (close-to-open) and open-to-close components. Handles gaps properly. Less relevant for 24/7 crypto but useful for tokens with sporadic trading.

5. EWMA (Exponentially Weighted Moving Average)

RiskMetrics approach — no parameters to estimate beyond λ.

lam = 0.94  # RiskMetrics default for daily
ewma_var = np.zeros(len(returns))
ewma_var[0] = returns[0] ** 2
for t in range(1, len(returns)):
    ewma_var[t] = lam * ewma_var[t - 1] + (1 - lam) * returns[t - 1] ** 2
vol_ewma = np.sqrt(ewma_var) * np.sqrt(365)
  • λ = 0.94 for daily data (RiskMetrics).
  • λ = 0.97 for weekly data.
  • Higher λ → smoother, slower reaction to new information.

6. GARCH(1,1)

The workhorse autoregressive volatility model. Captures volatility clustering.

σ²_t = ω + α · r²_{t-1} + β · σ²_{t-1}
  • ω: long-run variance weight.
  • α: reaction to recent shock (typically 0.05–0.15 for crypto).
  • β: persistence (typically 0.80–0.90 for crypto).
  • α + β < 1: stationarity constraint.
  • Long-run variance: ω / (1 − α − β).

Estimated via maximum likelihood. See references/estimators.md for details.


Volatility Cones

Volatility cones show the percentile distribution of realized volatility at different lookback windows, revealing whether current vol is historically high or low.

Construction

  1. Get 1+ years of daily data.
  2. For each lookback window (5, 10, 20, 60, 120 days):
    • Compute rolling realized volatility.
    • Extract percentiles: 5th, 25th, 50th, 75th, 95th.
  3. Plot percentiles vs window length — the "cone" shape.
  4. Overlay current realized vol at each window.

Interpretation

  • Current vol > 75th percentile: historically elevated — expect mean reversion.
  • Current vol < 25th percentile: historically compressed — expect expansion.
  • Cone narrowing at longer windows: vol mean-reverts over longer horizons.

See references/volatility_cones.md for full methodology and worked examples.


Crypto Volatility Characteristics

Crypto vol differs from traditional assets in important ways:

CharacteristicDetail
Level50–150% annualized is typical; TradFi equities are 15–25%
ClusteringStrong — high-vol days cluster together
Weekday patternsWeekend vol often lower but weekend gaps can be large
Volume correlationVol and volume are positively correlated
Regime dependenceBull market vol ≠ bear market vol; ranges are different
Mean reversionVol mean-reverts more reliably than price
Tail riskFat tails — more extreme moves than normal distribution predicts

Regime Classification by Volatility

RegimeAnnualized Vol RangeCharacteristics
Low vol< 40%Range-bound, mean reversion works
Normal vol40–80%Trending possible, balanced strategies
High vol80–120%Strong trends or sharp reversals
Crisis vol> 120%Liquidation cascades, reduced position size

Volatility Forecasting

EWMA Forecast

Simple and effective. The current EWMA variance estimate is the 1-step forecast. Multi-step forecasts are flat (same as 1-step).

GARCH Forecast

GARCH produces a term structure of variance forecasts:

σ²_{t+h} = V_L + (α + β)^h · (σ²_t − V_L)

Where V_L = ω / (1 − α − β) is the long-run variance.

  • Short-horizon forecasts reflect current conditions.
  • Long-horizon forecasts converge to long-run variance.
  • The speed of convergence depends on α + β (persistence).

See scripts/vol_forecast.py for a working implementation.


Practical Applications

Position Sizing with Volatility

# Vol-target position sizing
target_vol = 0.02  # 2% daily portfolio vol target
current_vol = 0.05  # 5% daily asset vol (annualized ~95%)
weight = target_vol / current_vol  # = 0.40 → 40% allocation

See the position-sizing skill for complete integration.

ATR-Based Stop Placement

atr_14 = talib.ATR(highs, lows, closes, timeperiod=14)
stop_distance = 2.0 * atr_14[-1]  # 2x ATR stop
stop_price = entry_price - stop_distance  # for longs

Vol-Regime Strategy Selection

vol_percentile = current_vol_percentile(token, window=30)
if vol_percentile < 25:
    strategy = "mean_reversion"
elif vol_percentile > 75:
    strategy = "momentum_breakout"
else:
    strategy = "balanced"

Files

References

FileDescription
references/estimators.mdFull derivations and details for all volatility estimators
references/volatility_cones.mdCone construction methodology and interpretation guide

Scripts

FileDescription
scripts/estimate_volatility.pyMulti-estimator volatility computation with cone analysis
scripts/vol_forecast.pyEWMA and GARCH forecasting with term structure output

Related Skills

  • regime-detection — Classify market regimes using volatility as a key input.
  • position-sizing — Scale positions inversely with volatility.
  • risk-management — Portfolio-level vol targeting and risk budgets.
  • pandas-ta — ATR and Bollinger Bands are volatility-based indicators.
  • custom-indicators — Build crypto-specific volatility indicators.

Dependencies

uv pip install pandas numpy scipy

Optional for live data:

uv pip install httpx

FAQ

What does the volatility-modeling skill do?

Volatility estimation, forecasting, and regime classification using GARCH, EWMA, realized volatility, and volatility cones

How do I install volatility-modeling?

Run npx skills add https://github.com/agiprolabs/claude-trading-skills --skill volatility-modeling in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/volatility-modeling/ (personal) or .claude/skills/volatility-modeling/ (project).

Which AI agents can use volatility-modeling?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is volatility-modeling safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains volatility-modeling?

It is published by agiprolabs in agiprolabs/claude-trading-skills. It has 499 recorded installs.

More from agiprolabs/claude-trading-skills

View all →

walk-forward-validation

agiprolabs/claude-trading-skills

Walk-forward validation framework for trading strategies and ML models with time-series-aware splits, overfit detection, and regime-aware validation

Business & Finance714 installs

risk-management

agiprolabs/claude-trading-skills

Portfolio-level risk controls, drawdown management, exposure limits, and circuit breakers for crypto trading

Business & Finance637 installs

pandas-ta

agiprolabs/claude-trading-skills

Technical analysis with 130+ indicators using pandas-ta for crypto market data

Data & Databases593 installs

position-sizing

agiprolabs/claude-trading-skills

Trade sizing methods including fixed fractional, volatility-adjusted, Kelly criterion, and liquidity-constrained sizing

Business & Finance581 installs

regime-detection

agiprolabs/claude-trading-skills

Market regime identification using volatility clustering, trend detection, and statistical methods for adaptive trading

Business & Finance578 installs

kelly-criterion

agiprolabs/claude-trading-skills

Kelly criterion optimal sizing with fractional variants, edge estimation, and practical application for crypto trading

Business & Finance534 installs

Popular business & finance skills

View category →

sales-enablement

coreyhaines31/marketingskills

When the user wants to create sales collateral, pitch decks, one-pagers, objection handling docs, or demo scripts. Also use when the user mentions 'sales deck,' 'pitch deck,' 'one-pager,' 'leave-behind,' 'objection handling,' 'deal-specific ROI analysis,' 'demo script,' 'talk track,' 'sales playbook,' 'proposal template,' 'buyer persona card,' 'battle card,' 'battlecard,' 'competitive one-pager,' 'win-loss analysis,' 'why are we losing deals,' 'loss reasons,' 'how do I respond to this objection,' 'prospect just said,' 'help my sales team,' 'sales materials,' or 'what should I give my sales reps,' 'cold call script,' or 'voicemail script.' Use this for any document or asset that helps a sales team close deals. For public competitor comparison pages, see competitors. For running buyer interviews or churn research, see customer-research. For marketing website copy, see copywriting. For cold outreach emails, see cold-email. For the offer being sold (bonuses, guarantees, pricing structure),

Business & Finance119.5K installs

revops

coreyhaines31/marketingskills

When the user wants help with revenue operations, lead lifecycle management, or marketing-to-sales handoff processes. Also use when the user mentions 'RevOps,' 'revenue operations,' 'lead scoring,' 'outbound pipeline stages,' 'lead routing,' 'MQL,' 'SQL,' 'pipeline stages,' 'deal desk,' 'CRM automation,' 'marketing-to-sales handoff,' 'data hygiene,' 'leads aren't getting to sales,' 'pipeline management,' 'lead qualification,' or 'when should marketing hand off to sales.' Use this for anything involving the systems and processes that connect marketing to revenue. For cold outreach emails, see cold-email. For email drip campaigns, see emails. For pricing decisions, see pricing.

Business & Finance114.1K installs

sales-funnel-blueprint

autonnel/autonnel-skills

Turn an offer into a concrete multi-step sales funnel spec - page-by-page structure, price ladder, copy outline and the metrics each step must hit. Use when asked to build a sales funnel, marketing funnel, landing page flow, lead magnet funnel, webinar funnel, tripwire or VSL funnel, when planning a product launch page flow, or when someone asks "what pages do I need" for selling something online.

Business & Finance104.5K installs

pricing

coreyhaines31/marketingskills

When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' 'should I offer a free plan,' 'pricing page teardown,' 'pricing page audit,' 'is my pricing page AI-readable,' or 'can AI read my pricing.' Use this whenever someone is figuring out what to charge, how to structure their plans, or wants to audit a pricing page (for humans and for the AI agents that shortlist tools). For in-app upgrade screens, see paywalls. For offer construction (bonuses, guarantees, value framing, naming) on services/courses/coaching/high-ticket B2B, see offers.

Business & Finance80K installs

cross-border-ecommerce

nexscope-ai/ecommerce-skills

Cross-border e-commerce expansion advisor. Scores target markets on 8 weighted dimensions (market size, ecommerce penetration, competition, regulatory complexity, logistics infrastructure, payment ecosystem, cultural distance, IP protection), compares 5 fulfillment models with cost and transit data, provides country-by-country tax/duty compliance guides (EU VAT/IOSS, UK VAT, US sales tax, CA GST, AU GST, JP consumption tax), maps local payment preferences by market, and builds a phased expansion roadmap. No API key required.

Business & Finance62.9K installs

pricing-strategy

coreyhaines31/marketingskills

When the user wants help with pricing decisions, packaging, or monetization strategy. Also use when the user mentions 'pricing,' 'pricing tiers,' 'freemium,' 'free trial,' 'packaging,' 'price increase,' 'value metric,' 'Van Westendorp,' 'willingness to pay,' 'monetization,' 'how much should I charge,' 'my pricing is wrong,' 'pricing page,' 'annual vs monthly,' 'per seat pricing,' or 'should I offer a free plan.' Use this whenever someone is figuring out what to charge or how to structure their plans. For in-app upgrade screens, see paywall-upgrade-cro.

Business & Finance61.2K installs