Hedging strategy design (beta hedge / option protection / tail risk / cross-asset hedging), including hedge-ratio calculation and cost evaluation.
复制下面这句话,粘贴给 Claude Code、Codex、Cursor 等 AI 编程工具,它会读取安装说明并在你确认后完成安装。
请阅读 https://ai.atlankj.com/install/asset/gh-hedging-strategy-813297382f05 ,按照其中的说明把「hedging-strategy」安装到你(当前 AI 工具)中。执行前先告诉我将运行的命令和写入的位置,等我确认。
查看 AI 将读取的安装说明正在读取 GitHub 原文…
内容来自 GitHub 原始文件,由原作者维护。在 GitHub 查看
Design systematic hedging plans for existing positions, covering linear hedges (futures / ETFs) and nonlinear hedges (options). Output hedge ratios, cost estimates, and execution plans. Core principle: hedging does not eliminate risk; it exchanges unknown losses for known costs.
Principle: hedge portfolio systematic risk (beta) with index futures or ETFs while preserving single-stock alpha.
Hedge ratio calculation:
# Minimum-variance hedge ratio
hedge_ratio = beta_portfolio * (portfolio_value / futures_value)
# Example: hold a 10 million RMB China A-share portfolio, beta = 1.2
# CSI 300 futures (IF) contract value = index level × 300
# IF level = 4000, contract value = 4000 × 300 = 1.2 million
# Required number of short contracts = 1.2 × (1000 / 120) = 10
# Beta estimation method
import numpy as np
# OLS regression: portfolio_returns = alpha + beta * index_returns + epsilon
beta = np.cov(portfolio_returns, index_returns)[0][1] / np.var(index_returns)
China A-share beta hedging instruments:
| Instrument | Code | Contract Multiplier | Margin | Suitable Scale |
|---|---|---|---|---|
| IF (CSI 300 futures) | IF2403 | 300 RMB / point | ~12% | > 5 million RMB |
| IC (CSI 500 futures) | IC2403 | 200 RMB / point | ~14% | > 3 million RMB |
| IM (CSI 1000 futures) | IM2403 | 200 RMB / point | ~15% | > 3 million RMB |
| CSI 300 ETF (510300) | 510300.SH | — | Unlevered | Any size |
Note: stock-index futures have basis (spot-futures spread). Shorting futures when they trade at a discount brings extra return (basis convergence), while premium pricing adds extra cost.
Hold the underlying + buy a put option
China A-share example (50ETF options):
# Hold 1 million shares of 50ETF (about 2.7 million RMB)
# Buy 100 contracts of 50ETF put 2700 (strike 2.700)
# Premium ≈ 0.05 RMB/share × 10000 shares/contract × 100 contracts = 50,000 RMB
# Cost ratio = 50,000 / 2,700,000 ≈ 1.85%
# Protection effect: losses are capped once ETF falls below 2.700
Hold the underlying + buy an OTM put + sell an OTM call
Parameter selection guide:
| Parameter | Aggressive | Balanced | Conservative |
|---|---|---|---|
| Put strike | ATM-5% | ATM-8% | ATM-10% |
| Call strike | ATM+8% | ATM+5% | ATM+3% |
| Net cost | Slightly positive | Near zero | Slightly negative (income) |
| Maximum downside loss | -5% | -8% | -10% |
| Maximum upside gain | +8% | +5% | +3% |
Buy a higher-strike put + sell a lower-strike put
Far OTM put strategy:
# Buy deep OTM puts (delta ≈ -0.05 ~ -0.10)
# Characteristics: expires worthless most of the time, but pays off massively during black swans
# Parameters
otm_put_strike = current_price * 0.85 # 15% OTM
cost_per_month = portfolio_value * 0.003 # about 0.3% / month
expected_payoff_in_crash = portfolio_value * 0.10 # ~10% payoff in a severe selloff
# Cost management: ongoing spend of about 3.6% / year, profitable only in tail events
# Taleb-style hedge: lose small amounts often, make large gains occasionally
VIX call strategy (US equities / options market):
# Buy OTM VIX calls (strike = current VIX + 10)
# If VIX jumps from 15 to 40, call value explodes
# Naturally negatively correlated with an equity portfolio
# China A-share substitutes:
# China has no VIX futures, so alternatives are:
# 1. Buy OTM 50ETF puts (similar tail protection)
# 2. Go long volatility: buy a straddle
# 3. Allocate to gold ETF (518880.SH) as a safe-haven asset
Stock-bond hedge:
| Stock/Bond Mix | Expected Volatility | Applicable Scenario |
|---|---|---|
| 80/20 | ~15% | Bull market environment, small bond buffer |
| 60/40 | ~10% | Classic allocation, suitable for most environments |
| 40/60 | ~7% | Bear market environment, bond-led |
| Risk Parity | ~8% | Volatility-balanced allocation |
Note: stock-bond correlation is not stable. In 2022, US stocks and bonds both fell (rising rates), and the traditional 60/40 mix failed. In China, negative stock-bond correlation has been relatively more stable.
Stock-commodity hedge (equities + commodities):
518880.SH): low correlation with China A-shares and effective for tail-risk hedgingComparison of three methods:
import numpy as np
from scipy import stats
# Method 1: OLS regression (simplest)
slope, intercept, r, p, se = stats.linregress(hedge_returns, portfolio_returns)
hedge_ratio_ols = slope
# Method 2: Minimum variance
covariance = np.cov(portfolio_returns, hedge_returns)[0][1]
variance_hedge = np.var(hedge_returns)
hedge_ratio_mv = covariance / variance_hedge
# Method 3: EWMA (exponentially weighted, more sensitive)
lambda_param = 0.94 # RiskMetrics default
ewma_cov = pd.Series(portfolio_returns * hedge_returns).ewm(alpha=1-lambda_param).mean()
ewma_var = pd.Series(hedge_returns**2).ewm(alpha=1-lambda_param).mean()
hedge_ratio_ewma = ewma_cov / ewma_var
# Selection guidance:
# Static hedge (monthly rebalance) -> OLS
# Dynamic hedge (weekly rebalance) -> EWMA
# Theoretical analysis -> minimum variance
Cost components:
| Cost Item | Futures Hedge | Options Hedge | Cross-Asset Hedge |
|---|---|---|---|
| Direct cost | Margin usage + fees | Premium | Allocation to lower-yield assets |
| Opportunity cost | Basis cost (discount / premium) | Time decay (Theta) | Earn less in a bull market |
| Hidden cost | Roll cost | Volatility premium | Rebalancing transaction costs |
| Annualized estimate | 2-5% (including basis) | 3-8% (depends on IV) | 1-3% (opportunity cost) |
Cost-benefit decision framework:
# Is the hedge worth it?
hedge_cost_annual = 0.04 # 4% annualized
expected_loss_without_hedge = 0.15 # 15% expected max loss without hedge
prob_of_loss = 0.25 # 25% probability
expected_loss = expected_loss_without_hedge * prob_of_loss # = 3.75%
# If hedge_cost > expected_loss -> hedge is relatively expensive
# If hedge_cost < expected_loss -> hedge is cost-effective
# Here 4% > 3.75%, so the hedge is marginally expensive, but it may still be worth it because of tail risk
| Risk Scenario | Recommended Instrument | Cost Level |
|---|---|---|
| Systematic broad-market selloff | Short IF / IC futures | Low (margin) |
| Moderate drawdown (5-10%) | Collar / Put Spread | Low (zero-cost collar) |
| Black swan (>20% crash) | Far OTM put | Medium (continuous spending) |
| Rising rates | Short government bond futures (TF / T) | Low |
| Currency depreciation | FX forwards / options | Medium |
| Inflation upside surprise | Allocate to commodities / gold | Low (opportunity cost) |
## Hedging Plan — [Portfolio Name]
### Portfolio Overview
- Portfolio size: [X ten-thousand RMB]
- Portfolio beta: [X.XX] (vs [benchmark index])
- Main risk: [systematic / sector concentration / tail]
### Hedging Plan
- Instrument: [short IF futures / Collar / Put Spread / ...]
- Hedge ratio: [X.XX]
- Number of contracts / option lots: [N]
- Hedge coverage: [X%] (full / partial hedge)
### Cost Evaluation
- Direct cost: [X ten-thousand RMB / year]
- Annualized cost ratio: [X%]
- Margin / premium usage: [X ten-thousand RMB]
### Scenario Analysis
| Market Move | PnL Without Hedge | PnL With Hedge | Hedge Effect |
|---------|-----------|-----------|---------|
| Down 10% | -X | -X | Reduce loss by X |
| Down 20% | -X | -X | Reduce loss by X |
| Up 10% | +X | +X | Give up X of upside |
### Execution Notes
- Entry timing: [specific time / condition]
- Rebalance frequency: [monthly / quarterly / event-driven]
- Exit condition: [risk resolution criterion]