longbridge-volatility-strategy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineselongbridge-volatility-strategy
longbridge-volatility-strategy
Computes 20-day and 60-day historical volatility (HV) for a stock, ranks the current level as a percentile over the trailing year, identifies the vol regime (low / normal / high), and recommends a corresponding options strategy.
Response language: match the user's input language — Simplified Chinese / Traditional Chinese / English.
计算个股的20日和60日历史波动率(HV),将当前波动率水平在过去一年的区间内按百分位排名,识别波动率状态(低/正常/高),并给出对应的期权策略建议。
回复语言:匹配用户输入语言——简体中文 / 繁体中文 / 英语
When to use
使用场景
- User asks about vol regime, whether volatility is cheap or expensive, or which options strategy suits current conditions.
- Triggers: "波动率策略 TSLA", "NVDA 历史波动率分位", "volatility percentile AAPL", "低波动率买跨式", "high volatility sell straddle".
- 用户询问波动率状态、波动率当前是偏高还是偏低,或是当前市场环境适合哪种期权策略时。
- 触发词:"波动率策略 TSLA", "NVDA 历史波动率分位", "volatility percentile AAPL", "低波动率买跨式", "high volatility sell straddle"。
Workflow
工作流程
- Fetch 252 daily candles (≈ 1 year):
longbridge kline <SYMBOL> --period day --count 252 --format json - Compute daily log-returns:
r_t = ln(close_t / close_{t-1}) - HV20 = annualised std of last 20 returns × √252; HV60 = last 60 returns × √252
- HV percentile: rank current HV20 among all rolling-20 HV values in the 252-day window
- Regime:
- HV percentile < 25% → Low vol: long vol trade (buy straddle or strangle)
- HV percentile > 75% → High vol: short vol trade (sell straddle, iron condor)
- Otherwise → Neutral — no strong directional vol bet
- Output the table below and a 2–3 sentence strategic recommendation
All computation is done by the LLM in Python (inline, no scripts/ needed for simple numpy/pandas math). If the user's environment does not have numpy, approximate HV using the close-to-close Parkinson estimate.
- 获取252根日K线(≈1年):
longbridge kline <SYMBOL> --period day --count 252 --format json - 计算日对数收益率:
r_t = ln(close_t / close_{t-1}) - HV20 = 最近20个收益率的年化标准差 × √252;HV60 = 最近60个收益率的年化标准差 × √252
- HV百分位:将当前HV20在252天窗口内的所有滚动20日HV值中进行排名
- 波动率状态:
- HV百分位 < 25% → 低波动率:做多波动率交易(买入跨式期权buy straddle或宽跨式期权strangle)
- HV百分位 > 75% → 高波动率:做空波动率交易(卖出跨式期权sell straddle、铁鹰式期权iron condor)
- 其他情况 → 中性——不进行明确的波动率方向押注
- 输出下方表格及2-3句策略建议
所有计算由LLM通过Python完成(内嵌式计算,简单的numpy/pandas运算无需额外脚本)。若用户环境未安装numpy,可采用收盘价-收盘价Parkinson估计法近似计算HV。
CLI
命令行界面(CLI)
bash
undefinedbash
undefinedRun --help first to confirm flag names
先运行--help确认参数名称
longbridge kline --help
longbridge kline --help
Fetch 252 daily candles
获取252根日K线
longbridge kline <SYMBOL> --period day --count 252 --format json
The JSON array returns rows with fields `time`, `open`, `high`, `low`, `close`, `volume`.longbridge kline <SYMBOL> --period day --count 252 --format json
返回的JSON数组包含以下字段:`time`(时间)、`open`(开盘价)、`high`(最高价)、`low`(最低价)、`close`(收盘价)、`volume`(成交量)。Output
输出
| Metric | 简体 | 繁體 | English |
|---|---|---|---|
| HV20 | 20日历史波动率 | 20日歷史波動率 | 20-day HV |
| HV60 | 60日历史波动率 | 60日歷史波動率 | 60-day HV |
| HV Percentile | 波动率百分位 | 波動率百分位 | HV Percentile |
| Regime | 波动率状态 | 波動率狀態 | Vol Regime |
| Signal | 策略建议 | 策略建議 | Strategy Signal |
Present results as a compact table followed by a strategy recommendation. Cite data source as Longbridge Securities / 数据来源:长桥证券 / 數據來源:長橋證券.
| 指标 | 简体 | 繁體 | English |
|---|---|---|---|
| HV20 | 20日历史波动率 | 20日歷史波動率 | 20-day HV |
| HV60 | 60日历史波动率 | 60日歷史波動率 | 60-day HV |
| HV Percentile | 波动率百分位 | 波動率百分位 | HV Percentile |
| Regime | 波动率状态 | 波動率狀態 | Vol Regime |
| Signal | 策略建议 | 策略建議 | Strategy Signal |
以简洁表格形式展示结果,随后附上策略建议。数据来源标注为Longbridge Securities / 数据来源:长桥证券 / 數據來源:長橋證券。
Error handling
错误处理
| Situation | 简体回复 | 繁體回復 | English reply |
|---|---|---|---|
| 回退到 MCP 或提示安装 longbridge-terminal | 回退到 MCP 或提示安裝 longbridge-terminal | Fall back to MCP or ask user to install longbridge-terminal |
| 请运行 | 請執行 | Run |
| Insufficient data (< 60 candles) | 数据不足,无法计算60日波动率 | 數據不足,無法計算60日波動率 | Not enough data for HV60 |
| Other stderr | 直接显示原始错误 | 直接顯示原始錯誤 | Surface verbatim |
| 场景 | 简体回复 | 繁體回復 | English reply |
|---|---|---|---|
| 回退到 MCP 或提示安装 longbridge-terminal | 回退到 MCP 或提示安裝 longbridge-terminal | Fall back to MCP or ask user to install longbridge-terminal |
| 请运行 | 請執行 | Run |
| 数据不足(<60根K线) | 数据不足,无法计算60日波动率 | 數據不足,無法計算60日波動率 | Not enough data for HV60 |
| 其他标准错误输出 | 直接显示原始错误 | 直接顯示原始錯誤 | Surface verbatim |
MCP fallback
MCP降级方案
When CLI is unavailable, use with and .
longbridgemcp__longbridge__candlesticksperiod=Daycount=252当命令行工具不可用时,使用,参数设置为和。
longbridgemcp__longbridge__candlesticksperiod=Daycount=252Related skills
相关技能
- — raw OHLCV fetch
longbridge-kline - — options chain for executing the straddle/condor
longbridge-derivatives - — mean-reversion companion strategy
longbridge-pairs-trading - — multi-asset vol correlation
longbridge-correlation
- — 获取原始OHLCV数据
longbridge-kline - — 用于执行跨式/铁鹰期权策略的期权链
longbridge-derivatives - — 均值回归配套策略
longbridge-pairs-trading - — 多资产波动率相关性
longbridge-correlation
File layout
文件结构
longbridge-volatility-strategy/
└── SKILL.mdlongbridge-volatility-strategy/
└── SKILL.md