volatility
What it does
This skill tests a strategy that bets volatility tends to return to its normal level. It is for traders who study how calm and stormy markets alternate.
When to use it
- ✓When you think a quiet, low-volatility period may be followed by a bigger move.
- ✓When a stock's volatility is at an unusually high level and you want to test an exit rule.
- ✓When you want to compare volatility regimes in crypto or stock price data.
Skill link
https://github.com/HKUDS/Vibe-Trading/blob/main/agent/src/skills/volatility/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Test a volatility strategy on this stock that buys when volatility is in the bottom 20 percent of its history.”
5 new skills a week. 1 minute to read.
How it works
It calculates historical volatility over a rolling window and ranks it against the recent past. It goes long when volatility is low, exits or shorts when it is high, and holds the current position in between.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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
- Compute HV: annualized standard deviation of returns over the past
hv_windowdays - Percentile ranking: percentile position of HV within the past
lookbackdays (0-100) - 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
- Percentile <
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
| Parameter | Default | Description |
|---|---|---|
| hv_window | 20 | Historical volatility calculation window |
| lookback | 120 | Lookback period for percentile ranking |
| low_pct | 20.0 | Low-volatility threshold (percentile) |
| high_pct | 80.0 | High-volatility threshold (percentile) |
| annualize | 252 | Annualization 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
annualizeshould be set to 365
Dependencies
pip install pandas numpy
Signal Convention
1= long (low-volatility regime),-1= short (high-volatility regime),0= stand aside
FAQ
What is historical volatility?
It is the annualized standard deviation of recent returns, which measures how much the price has been moving.
Why use 365 for crypto?
Crypto trades every day, so the skill uses 365 instead of 252 for annualizing volatility.
Does the strategy always work?
No. Volatility tends to revert, but there are no guarantees, so test it first.
Details
Original description by the author
Volatility strategy. Trades mean reversion based on percentile ranking of historical volatility (HV). Suitable for any OHLCV data.
repo: HKUDS/Vibe-Trading
Popularity
- GitHub stars
- 37k
- Ranking position
- #7566
- License
- MIT
- Updated
- 11/1/2026
Comments
- …
More skills from this repository
vibe-trading
37kGives your agent a full finance research toolkit, covering backtests, factor analysis, options pricing and market data across many markets.
adr-hshare
37kShows your agent how to compare the price of a Chinese company listed in several markets, such as a US ADR and a Hong Kong share.
akshare
37kLets your agent pull free market data for Chinese and global stocks, futures, forex and economic indicators, with no API key needed.
alpha-zoo
37kLets your agent browse a library of ready-made stock factors and test how well a whole set of them predicts returns on a chosen market.
Similar skills
gitcrawl
394kLets your agent search a saved archive of GitHub issues and pull requests, group duplicates, and check their current status on GitHub.
slacrawl
394kLets your agent search and count messages in a local Slack archive, check how fresh that archive is, and refresh it when needed.
goplaces
394kHelps your agent search for places, get their details and reviews, and resolve place names using Google Places, with JSON output for scripts.