volatility
This volatility strategy generates trading signals by ranking historical volatility percentiles to trade mean reversion across assets. Use it when you want to enter positions during low-volatility periods expecting expansion and exit or short during high-volatility periods expecting contraction, with customizable thresholds and annualization factors for different asset classes including cryptocurrencies.
git clone --depth 1 https://github.com/HKUDS/Vibe-Trading /tmp/volatility && cp -r /tmp/volatility/agent/src/skills/volatility ~/.claude/skills/volatilitySKILL.md
# 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 | 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 `annualize` should be set to 365 ## Dependencies ```bash pip install pandas numpy ``` ## Signal Convention - `1` = long (low-volatility regime), `-1` = short (high-volatility regime), `0` = stand aside
Professional finance research toolkit — backtesting (7 engines + benchmark comparison panel), factor analysis, Alpha Zoo (452 pre-built alphas across qlib158/alpha101/gtja191/academic), options pricing, 77 finance skills, 29 multi-agent swarm teams, Trade Journal analyzer, and Shadow Account (extract → backtest → render) across 7 data sources (tushare, yfinance, okx, akshare, mootdx, ccxt, futu).
ADR/H-share/A-share cross-listing premium analysis — track pricing gaps between US-listed ADRs, HK-listed H-shares, and A-shares for arbitrage signals, dual-listing valuation, and delisting risk assessment.
AKShare financial data aggregator (18k+ stars). Free, no API key. Covers A-shares, US, HK, futures, macro, forex. Primary fallback for tushare and yfinance.
Browse and bench the bundled alpha zoos — prebuilt cross-sectional factor libraries (Kakushadze 101, GTJA 191, Qlib 158, Fama-French / Carhart). Use when the user asks "which alphas exist", wants metadata on a named alpha, or wants to run IC/IR on a whole zoo over a universe.
A 股 ST/*ST 风险预测框架 — 基于最新中报/三季报或业绩预告/快报,预测下一财年是否会因营收、利润、净资产、分红不达标而被风险警示,并将新浪监管处罚记录作为独立证据面纳入风险等级。仅适用于 A 股,不预测财务造假。
Asset allocation theory and optimizer usage — MPT / Black-Litterman / risk budgeting / all-weather strategy, including guides for 4 optimizers and rebalancing rules.
Diagnose failed or underperforming backtests, locate the root cause, and fix the issue
Behavioral finance applications: theories of overreaction and underreaction, behavioral explanations for momentum and reversal, investor sentiment cycles, cognitive-bias checklists, and debiasing quantitative strategies.