CtrlK
BlogDocsLog inGet started
Tessl Logo

volatility

Volatility strategy. Trades mean reversion based on percentile ranking of historical volatility (HV). Suitable for any OHLCV data.

58

Quality

67%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Passed

No findings from the security scan

Fix and improve this skill with Tessl

tessl review fix ./agent/src/skills/volatility/SKILL.md
SKILL.md
Quality
Evals
Security

Volatility Strategy

Purpose

Uses percentile ranking of historical volatility (HV) to capture volatility mean reversion: build positions in low-volatility regimes while waiting for volatility expansion, and exit or short in high-volatility regimes to capture contraction.

Signal Logic

  1. Compute HV: annualized standard deviation of returns over the past hv_window days
  2. Percentile ranking: percentile position of HV within the past lookback days (0-100)
  3. Signal generation:
    • Percentile < low_pct → go long (volatility is low, waiting for expansion)
    • Percentile > high_pct → exit / go short (volatility is high, waiting for contraction)
    • Middle region → keep the current position

Key Implementation Details

  • HV = returns.rolling(hv_window).std() * sqrt(252) (annualized)
  • Percentile = hv.rolling(lookback).rank(pct=True) * 100
  • For cryptocurrencies, use 365 instead of 252 as the annualization factor

Parameters

ParameterDefaultDescription
hv_window20Historical volatility calculation window
lookback120Lookback period for percentile ranking
low_pct20.0Low-volatility threshold (percentile)
high_pct80.0High-volatility threshold (percentile)
annualize252Annualization factor (252 for China A-shares, 365 for crypto)

Common Pitfalls

  • Before the lookback window is filled, there is not enough data to compute percentiles, so the signal should be 0 (fillna)
  • Volatility is not direction. Going long in low-volatility regimes does not guarantee price appreciation; it only means volatility expansion is statistically more likely
  • Cryptocurrencies trade 7x24, so annualize should be set to 365

Dependencies

pip install pandas numpy

Signal Convention

  • 1 = long (low-volatility regime), -1 = short (high-volatility regime), 0 = stand aside
Repository
HKUDS/Vibe-Trading
Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.