AgentSkillsCN

derivatives-analyzer

基于 OpenBB 的衍生品交易分析工具包,覆盖加密货币永续合约、加密货币期权以及美国股票期权。适用于以下分析场景:(1) 加密货币永续合约——通过 Deribit 分析资金费率、未平仓量与标记价格;(2) BTC/ETH/SOL 期权——希腊字母指标、隐含波动率曲面、期权链;(3) 美国股票期权——SPY/AAPL/NVDA 期权链、希腊字母指标可视化、异常交易行为检测;(4) 任意衍生品的希腊字母分析(Delta、Gamma、Theta、Vega);(5) 隐含波动率与期权定价;(6) 波动率交易策略——VRP、期限结构、偏斜、飞鹰策略、跨式期权 Delta 对冲、日历价差、微笑套利。触发词包括:“分析 BTC 永续合约”、“展示 ETH 期权”、“SPY 期权链”、“希腊字母分析”、“隐含波动率曲面”、“资金费率”、“期权希腊字母”、“跨式期权价格”、“波动率信号”、“VRP 分析”、“期限结构”、“偏斜分析”、“波动率交易”。

SKILL.md
--- frontmatter
name: derivatives-analyzer
description: |
  OpenBB-based derivatives trading analysis toolkit covering crypto perpetual contracts, crypto options, and US equity options. Use when analyzing: (1) Crypto perpetuals - funding rates, open interest, mark price via Deribit; (2) BTC/ETH/SOL options - Greeks, IV surface, option chains; (3) US stock options - SPY/AAPL/NVDA chains, Greeks visualization, unusual activity detection; (4) Any derivatives Greeks analysis (delta, gamma, theta, vega); (5) Implied volatility and options pricing; (6) Volatility trading strategies - VRP, term structure, skew, fly, straddle delta hedge, calendar spreads, smile carry. Triggers: "analyze BTC perpetual", "show ETH options", "SPY options chain", "Greeks analysis", "IV surface", "funding rate", "options Greeks", "straddle price", "vol signals", "VRP analysis", "term structure", "skew analysis", "volatility trading".

Derivatives Analyzer

OpenBB-powered derivatives analysis for crypto and equity markets.

Prerequisites

bash
pip install openbb openbb-deribit

Quick Start

python
from openbb import obb
obb.user.preferences.output_type = "dataframe"

Supported Assets

CategorySymbolsProvider
Crypto PerpetualsBTC, ETH, SOL, XRP, BNBDeribit
Crypto OptionsBTC, ETH, SOLDeribit
US Equity OptionsAny US stockCBOE, yfinance

Core Workflows

1. Crypto Perpetual Analysis

python
# Get perpetual stats
info = obb.derivatives.futures.info(provider='deribit', symbol='BTC')
# Returns: last_price, funding_rate, open_interest, volume, mark_price

# List all instruments
instruments = obb.derivatives.futures.instruments(provider='deribit')

Key metrics: current_funding, funding_8h, open_interest, mark_price, volume_usd

2. Crypto Options Analysis

python
chains = obb.derivatives.options.chains(symbol='BTC', provider='deribit')
# Filter params: option_type, moneyness, strike_gt/lt, oi_gt, volume_gt

For Greeks filtering pattern, see references/greeks-filtering.md.

3. US Equity Options Analysis

python
chains = obb.derivatives.options.chains(symbol='SPY', provider='cboe')
price = chains['underlying_price'].iloc[0]

# Filter valid Greeks (critical step)
valid = chains[(chains['dte'] >= 7) & (chains['dte'] <= 60) & (chains['delta'] != 0)]

For complete workflow, see references/equity-options.md.

Scripts

ScriptPurpose
scripts/perpetual_analysis.pyCrypto perpetual funding & OI analysis
scripts/options_greeks.pyOptions Greeks analysis & visualization
scripts/iv_surface.pyImplied volatility surface plotting
scripts/vol_signals.pyVolatility trading signals (TS, Skew, Fly, VRP)

References

Volatility Trading Framework

Core PnL Formula

code
Vol Trade PnL = Vega PnL + Gamma Carry + Residuals - Fees
Smile Carry = Volga Carry + Vanna Carry

Key Indicators

IndicatorFormulaSignal
Term StructureFar IV - Near IVContango = sell calendar
Fly(25D Call + Put IV)/2 - ATM IVHigh = more vol premium
Skew25D Put IV - Call IVRight turn = bullish
VRPIV - RVPositive = sell vol

For complete strategy guide, see volatility-trading-strategies.md.

Common Patterns

Filter ATM Options (±5%)

python
atm = chains[(chains['strike'] >= price * 0.95) & (chains['strike'] <= price * 1.05)]
calls = atm[atm['option_type'] == 'call']
puts = atm[atm['option_type'] == 'put']

Calculate Straddle Cost

python
straddle = options.results.straddle(days=expiry)
cost = straddle.loc["Cost"].values[0]
dte = straddle.loc["DTE"].values[0]
implied_move = ((1 + cost / price) ** (1 / dte) - 1) * 100

Error Handling

ErrorCauseSolution
No data foundInvalid symbolVerify symbol format (e.g., 'BTC' not 'BTC-USD')
Provider not availableMissing extensionRun pip install openbb-deribit
Empty DataFrameMarket closedCheck market hours; try different expiration
KeyError: 'delta'Greeks unavailableUse provider with Greeks (cboe > yfinance)

Rate Limits

ProviderLimitNotes
Deribit20 req/secNo API key for public data
CBOEGenerousNo explicit limit
yfinance~2000/hourMay throttle on heavy use

Advanced Analysis Framework

Three-Chart System (Greeks.live Methodology)

ChartPurposeKey Metric
ATM IV + HVVRP identificationIV - RV spread
Term StructureCalendar opportunitiesContango/Backwardation
25Δ SkewDirectional bias + tail riskRisk Reversal

25-Delta Indicators

python
# Risk Reversal: Directional bias
rr = call_25d_iv - put_25d_iv  # Positive = bullish

# Butterfly: Tail risk premium
fly = (call_25d_iv + put_25d_iv) / 2 - atm_iv  # High = more premium

Position Sizing Rules

RuleThreshold
Max single trade loss≤ 2% account
Total options allocation≤ 20% account
Single asset concentration≤ 50% options

IV Regime Adjustment

IV PercentileSize MultiplierRationale
< 25%1.5xOptions cheap
25-75%1.0xNormal
> 75%0.5xOptions expensive

For complete framework, see advanced-options-framework.md.