jpskill.com
🛠️ 開発・MCP コミュニティ

volatility-modeling

GARCHやEWMAなどの手法を用いて、金融市場の変動率(ボラティリティ)を予測したり、変動のパターンを分類したりすることで、リスク管理や投資戦略に役立てる分析を支援するSkill。

📜 元の英語説明(参考)

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

🇯🇵 日本人クリエイター向け解説

一言でいうと

GARCHやEWMAなどの手法を用いて、金融市場の変動率(ボラティリティ)を予測したり、変動のパターンを分類したりすることで、リスク管理や投資戦略に役立てる分析を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o volatility-modeling.zip https://jpskill.com/download/10451.zip && unzip -o volatility-modeling.zip && rm volatility-modeling.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/10451.zip -OutFile "$d\volatility-modeling.zip"; Expand-Archive "$d\volatility-modeling.zip" -DestinationPath $d -Force; ri "$d\volatility-modeling.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して volatility-modeling.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → volatility-modeling フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

ボラティリティモデリング

ボラティリティ(価格変動の大きさ)は、おそらくトレーディングにおいて最も重要な量です。ポジションサイズ、ストップロス設定、オプション価格設定、およびレジーム検出を左右します。このスキルでは、暗号市場におけるボラティリティの推定、予測、および実践的な応用について説明します。

ボラティリティが重要な理由

ユースケース ボラティリティの使われ方
ポジションサイズ 各トレードのリスク金額を一定にするため、ボラティリティに反比例してポジションを調整する
ストップロス設定 高ボラティリティの状況ではATRベースのストップロスを広げ、低ボラティリティの状況では狭める
戦略選択 低ボラティリティではミーンリバージョンが有効で、高ボラティリティではモメンタムが有効
リスク予算 ボラティリティターゲットポートフォリオは、ポートフォリオレベルのリスクを一定に保つ
レジーム検出 ボラティリティレジームのシフトは、市場のダイナミクスの変化を示す
オプション価格設定 インプライドボラティリティと実現ボラティリティのギャップが、取引機会を生み出す

ボラティリティの種類

ヒストリカル(実現)ボラティリティ

過去の観測されたリターンから計算されます。最も一般的で直接測定可能な形式です。統計的な効率が異なる複数の推定量が存在します。

インプライドボラティリティ

Black-Scholesモデルなどのモデルを介して、オプション価格から導き出されます。流動的なオプション市場が少ない暗号DeFiでは限定的ですが、BTC/ETHのDeribitで利用可能です。

予測ボラティリティ

EWMAやGARCHなどのモデルから予測される将来のボラティリティです。将来を見据えたポジションサイズとリスク予算に使用されます。


推定方法

1. Close-to-Close(対数リターンの標準偏差)

最も単純な推定量です。対数リターンの標準偏差を計算し、年率換算します。

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
  • 長所: 単純で、広く理解されています。
  • 短所: 終値のみを使用し、日中の値幅を無視します。

2. Parkinson(高値-安値レンジ)

日中の高値-安値レンジを使用します。これは、close-to-closeよりも統計的に約5倍効率的です。

hl_ratio = np.log(highs / lows)
vol_parkinson = np.sqrt(np.mean(hl_ratio**2) / (4 * np.log(2))) * np.sqrt(365)
  • 長所: より効率的で、日中の動きを捉えます。
  • 短所: 離散サンプリングによる下方バイアスがあります。close-to-closeのジャンプを無視します。

3. Garman-Klass(OHLC)

最も効率的な1日のOHLC推定量です。

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)
  • 長所: OHLC推定量の中で最高の効率です。
  • 短所: ドリフトがないと仮定します。オープニングギャップに敏感です。

4. Yang-Zhang

オーバーナイト(終値から始値)と始値から終値の成分を組み合わせます。ギャップを適切に処理します。24時間365日取引される暗号にはあまり関係ありませんが、散発的な取引が行われるトークンには役立ちます。

5. EWMA(指数加重移動平均)

RiskMetricsのアプローチです。λを超える推定するパラメータはありません。

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(日次データの場合、RiskMetrics)。
  • λ = 0.97(週次データの場合)。
  • λが高いほど、新しい情報に対する反応が滑らかで遅くなります。

6. GARCH(1,1)

主力となる自己回帰ボラティリティモデルです。ボラティリティのクラスタリングを捉えます。

σ²_t = ω + α · r²_{t-1} + β · σ²_{t-1}
  • ω: 長期分散の重み。
  • α: 最近のショックへの反応(通常、暗号では0.05〜0.15)。
  • β: 永続性(通常、暗号では0.80〜0.90)。
  • α + β < 1: 定常性制約。
  • 長期分散: ω / (1 − α − β)。

最尤法で推定されます。詳細については、references/estimators.mdを参照してください。


ボラティリティコーン

ボラティリティコーンは、異なるルックバックウィンドウでの実現ボラティリティのパーセンタイル分布を示し、現在のボラティリティが歴史的に高いか低いかを明らかにします。

構築

  1. 1年以上の日次データを取得します。
  2. 各ルックバックウィンドウ(5、10、20、60、120日)について:
    • ローリング実現ボラティリティを計算します。
    • パーセンタイル(5th、25th、50th、75th、95th)を抽出します。
  3. パーセンタイル対ウィンドウ長をプロットします。これが「コーン」の形状です。
  4. 各ウィンドウでの現在の実現ボラティリティを重ねます。

解釈

  • 現在のボラティリティ > 75パーセンタイル: 歴史的に高い。ミーンリバージョンを期待します。
  • 現在のボラティリティ < 25パーセンタイル: 歴史的に圧縮されている。拡大を期待します。
  • 長いウィンドウでコーンが狭まる: ボラティリティはより長い期間でミーンリバートします。

完全な方法論と具体的な例については、references/volatility_cones.mdを参照してください。


暗号ボラティリティの特性

暗号ボラティリティは、従来の資産とは重要な点で異なります。

特性 詳細
レベル 年率換算で50〜150%が一般的です。TradFi株式は15〜25%です。
クラスタリング 強い。高ボラティリティの日がまとまって発生します。
曜日パターン 週末のボラティリティは低いことが多いですが、週末のギャップは大きくなる可能性があります。
出来高との相関 ボラティリティと出来高は正の相関があります。
レジーム依存性 強気市場のボラティリティ ≠ 弱気市場のボラティリティ。範囲が異なります。
ミーンリバージョン ボラティリティは価格よりも確実にミーンリバートします。
テールリスク ファットテール。正規分布が予測するよりも極端な動きが多くなります。

ボラティリティによるレジーム分類

レジーム 年率換算ボラティリティ範囲 特性
低ボラティリティ < 40% レンジバウンド、ミーンリバージョンが有効
通常ボラティリティ 40–80% トレンドが発生する可能性あり、バランスの取れた戦略
高ボラティリティ 80–120% 強いトレンドまたは急激な反転
クライシスボラティリティ > 120% 清算の連鎖、ポジションサイズを縮小

ボラティリティ予測

EWMA予測

シンプルで効果的です。現在のEWMA分散推定値が、1ステップの予測です。マルチステップ予測はフラットです(1ステップと同じ)。

GARCH予測

GARCHは、分散予測のタームストラクチャーを生成します。


σ²_{t+h} = V_L + (α + β)^h · (σ²_
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

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

  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:

Characteristic Detail
Level 50–150% annualized is typical; TradFi equities are 15–25%
Clustering Strong — high-vol days cluster together
Weekday patterns Weekend vol often lower but weekend gaps can be large
Volume correlation Vol and volume are positively correlated
Regime dependence Bull market vol ≠ bear market vol; ranges are different
Mean reversion Vol mean-reverts more reliably than price
Tail risk Fat tails — more extreme moves than normal distribution predicts

Regime Classification by Volatility

Regime Annualized Vol Range Characteristics
Low vol < 40% Range-bound, mean reversion works
Normal vol 40–80% Trending possible, balanced strategies
High vol 80–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

File Description
references/estimators.md Full derivations and details for all volatility estimators
references/volatility_cones.md Cone construction methodology and interpretation guide

Scripts

File Description
scripts/estimate_volatility.py Multi-estimator volatility computation with cone analysis
scripts/vol_forecast.py EWMA 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