volatility-modeling
БесплатноЗапускает вложенные скриптыНе проверенVolatility estimation, forecasting, and regime classification using GARCH, EWMA, realized volatility, and volatility cones
от agiprolabs★ 611 звёзд на GitHubОб этом скилле
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 Case | How Volatility Is Used |
|---|---|
| Position sizing | Scale position inversely with vol so each trade risks a consistent dollar amount |
| Stop placement | ATR-based stops widen in high-vol regimes, tighten in low-vol |
| Strategy selection | Mean-reversion works in low vol; momentum works in high vol |
| Risk budgeting | Vol-target portfolios maintain constant portfolio-level risk |
| Regime detection | Vol regime shifts signal changing market dynamics |
| Option pricing | Implied 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
- Get 1+ years of daily data.
- For each lookback window (5, 10, 20, 60, 120 days):
- Compute rolling realized volatility.
- Extract percentiles: 5th, 25th, 50th, 75th, 95th.
- Plot percentiles vs window length — the "cone" shape.
- 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:
| Characteristic | Detail |
|---|---|
| Level | 50–150% annualized is typical; TradFi equities are 15–25% |
| Clustering | Strong — high-vol days cluster together |
| Weekday patterns | Weekend vol ofte |
Установить volatility-modeling в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл volatility-modeling?
Volatility estimation, forecasting, and regime classification using GARCH, EWMA, realized volatility, and volatility cones
Как установить скилл volatility-modeling?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл volatility-modeling запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic