Agent skill

Hedging Strategy Design

by HKUDS in HKUDS/Vibe-Trading

Designs hedging plans for existing positions with futures, ETFs and options, covering beta hedges, protective puts, collars, tail risk and cross-asset hedges, with hedge ratios and cost estimates.

MITAuto-check passedBusiness, Finance & HR

Install Hedging Strategy Design

skills CLI
$ npx skills add HKUDS/Vibe-Trading --skill hedging-strategy -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install HKUDS/Vibe-Trading hedging-strategy --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agent/src/skills/hedging-strategy .claude/skills/hedging-strategy && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
hedging-strategy
GitHub stars
35k
Token cost
~2.7k tokens
SKILL.md length
800 words
Files
1
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

Designs hedging plans for existing positions with futures, ETFs and options, covering beta hedges, protective puts, collars, tail risk and cross-asset hedges, with hedge ratios and cost estimates.

  • Works in 6 steps: Beta Hedging (Futures / ETFs) → Option Hedging Strategies → Tail-Risk Hedging → …
  • Hedging the market exposure of a stock portfolio with index futures or an ETF
  • SKILL.md covers Overview, Core Concepts, Analysis Framework and Output Format, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

The agent builds systematic hedges for positions you already hold, using linear hedges with futures or ETFs and nonlinear hedges with options, and returns hedge ratios, cost estimates and an execution plan. The guiding principle is that hedging does not remove risk but swaps unknown losses for known costs. Beta hedging covers the hedge ratio formula, the China index futures IF, IC and IM and a CSI 300 ETF as instruments, and how futures basis adds return or cost.

Option strategies include the protective put, with its premium cost and full protection below the strike, illustrated with a 50ETF option example, and the collar, which buys an out-of-the-money put and sells an out-of-the-money call to bring cost near zero in exchange for capped upside. A parameter table sets put and call strikes for aggressive, balanced and conservative styles. Tail-risk and cross-asset hedging are in scope as well.

When your agent uses it

  • Hedging the market exposure of a stock portfolio with index futures or an ETF
  • Choosing between a protective put and a collar
  • Calculating a hedge ratio and the cost of carrying the hedge
  • Planning protection against tail risk

Example prompts

  • “Calculate the beta hedge ratio for my A-share portfolio using IF futures.”
  • “Compare the cost of a protective put with a zero-cost collar on my 50ETF holding.”
  • “Which strikes should a balanced collar use?”
  • “Draft an execution plan for hedging a portfolio with index futures.”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Beta Hedging (Futures / ETFs)
  2. Option Hedging Strategies
  3. Tail-Risk Hedging
  4. Cross-Asset Hedging
  5. Hedge-Ratio Calculation Methods
  6. Hedging Cost Evaluation

What it can do on your machine

Read from SKILL.md and the folder at commit e532650. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Hedging Strategy Design loads about 2.7k tokens when it runs. Until then it costs about 41 tokens; SKILL.md has 800 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~41
When it runs · the whole SKILL.md, loaded when a task matches
~2.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from HKUDS/Vibe-Trading at commit e532650, republished under its MIT licence (© HKUDS). 800 words, ~2,706 tokens.

Download SKILL.mdSave it as .claude/skills/hedging-strategy/SKILL.md (or your agent's skills folder).
name
hedging-strategy
description
Hedging strategy design (beta hedge / option protection / tail risk / cross-asset hedging), including hedge-ratio calculation and cost evaluation.
category
asset-class

Hedging Strategy Design

Overview

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.

Core Concepts

1. Beta Hedging (Futures / ETFs)

Principle: hedge portfolio systematic risk (beta) with index futures or ETFs while preserving single-stock alpha.

Hedge ratio calculation:

python
# 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:

InstrumentCodeContract MultiplierMarginSuitable Scale
IF (CSI 300 futures)IF2403300 RMB / point~12%> 5 million RMB
IC (CSI 500 futures)IC2403200 RMB / point~14%> 3 million RMB
IM (CSI 1000 futures)IM2403200 RMB / point~15%> 3 million RMB
CSI 300 ETF (510300)510300.SH—UnleveredAny 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.

2. Option Hedging Strategies
Protective Put
Hold the underlying + buy a put option
  • Cost: option premium (typically 1-3% of underlying value per month)
  • Protection range: fully protected below the strike price
  • Applicable scenario: worried about a large drawdown but do not want to sell the position

China A-share example (50ETF options):

python
# 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
Collar
Hold the underlying + buy an OTM put + sell an OTM call
  • Cost: close to zero-cost (the call premium offsets the put premium)
  • Trade-off: gives up upside above the call strike
  • Applicable scenario: willing to cap upside in exchange for free downside protection

Parameter selection guide:

ParameterAggressiveBalancedConservative
Put strikeATM-5%ATM-8%ATM-10%
Call strikeATM+8%ATM+5%ATM+3%
Net costSlightly positiveNear zeroSlightly negative (income)
Maximum downside loss-5%-8%-10%
Maximum upside gain+8%+5%+3%
Put Spread (Bear Put Spread Hedge)
Buy a higher-strike put + sell a lower-strike put
  • Cost: 30-50% cheaper than buying a naked put
  • Protection range: only between the two strikes; no protection below the lower strike
  • Applicable scenario: hedging against moderate drawdowns while being cost-sensitive
3. Tail-Risk Hedging

Far OTM put strategy:

python
# 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):

python
# 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
4. Cross-Asset Hedging

Stock-bond hedge:

Stock/Bond MixExpected VolatilityApplicable 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):

  • During rising inflation: commodities rise while equities come under pressure → commodities hedge inflation risk
  • During falling inflation: equities rise while commodities come under pressure → equities drive returns
  • Gold ETF (518880.SH): low correlation with China A-shares and effective for tail-risk hedging
5. Hedge-Ratio Calculation Methods

Comparison of three methods:

python
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
6. Hedging Cost Evaluation

Cost components:

Cost ItemFutures HedgeOptions HedgeCross-Asset Hedge
Direct costMargin usage + feesPremiumAllocation to lower-yield assets
Opportunity costBasis cost (discount / premium)Time decay (Theta)Earn less in a bull market
Hidden costRoll costVolatility premiumRebalancing transaction costs
Annualized estimate2-5% (including basis)3-8% (depends on IV)1-3% (opportunity cost)

Cost-benefit decision framework:

python
# 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
Show full SKILL.md (302 more words)Show less

Analysis Framework

Five-Step Hedging Design Process
  1. Identify the risk: what kind of risk does the portfolio face? Systematic (beta) or idiosyncratic (single-name events)?
  2. Choose the instrument: linear (futures / ETF) or nonlinear (options)? This depends on the risk shape and budget
  3. Calculate the ratio: determine the number of hedge contracts or option lots
  4. Evaluate the cost: what is the annualized cost, and is it acceptable?
  5. Monitor and adjust: hedge ratios require dynamic adjustment (beta changes, options expire)
Risk Scenario → Hedge Instrument Mapping
Risk ScenarioRecommended InstrumentCost Level
Systematic broad-market selloffShort IF / IC futuresLow (margin)
Moderate drawdown (5-10%)Collar / Put SpreadLow (zero-cost collar)
Black swan (>20% crash)Far OTM putMedium (continuous spending)
Rising ratesShort government bond futures (TF / T)Low
Currency depreciationFX forwards / optionsMedium
Inflation upside surpriseAllocate to commodities / goldLow (opportunity cost)

Output Format

## 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]

Notes

  • China A-share index futures have trading restrictions (intraday opening limits, margin requirements), so actual usable size may be limited
  • Option liquidity is concentrated in near-month and near-the-money contracts; deep OTM options have wide bid-ask spreads
  • Beta is unstable: beta tends to be lower in bull markets and higher in bear markets (meaning the hedge is least sufficient when it is needed most)
  • Collar strategies cap upside, so large rallies in the underlying can materially drag portfolio performance
  • Tail hedging (far OTM puts) loses money most of the time and requires discipline to execute continuously; do not abandon it halfway because it "feels wasteful"
  • Correlations in cross-asset hedges can change violently during crises (trending toward 1), failing exactly when they are needed most
  • Hedge plans should be re-evaluated regularly (at least monthly) for beta and cost
  • This framework is for research backtesting only, does not constitute investment advice, and does not involve live trading execution

© HKUDS, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in agent/src/skills/hedging-strategy of HKUDS/Vibe-Trading.

Open the folder on GitHubat commit e532650

Compare with similar skills

Hedging Strategy Design next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Hedging Strategy Design compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Hedging Strategy Design this skillHKUDS/Vibe-Trading35k—~2.7kAutomated safety check: PassMIT
Stock Deep Analysis Workflowwbh604/UZI-Skill7.1k—~9.1kAutomated safety check: NotesMIT
Three-Statement Model Builderginlix-ai/LangAlpha1.8k—~5.4kAutomated safety check: PassApache-2.0
Money Financeiamzifei/show-me-the-money1k—~2.2kAutomated safety check: PassCustom licence
Financial Model Checkerginlix-ai/LangAlpha1.8k—~4.2kAutomated safety check: PassApache-2.0
DCF Model Builderginlix-ai/LangAlpha1.8k—~7.7kAutomated safety check: PassApache-2.0

Similar skills

  • Runs a staged deep analysis of a single stock on China A-share, Hong Kong and US markets, ending in an HTML report with valuation models and investor-panel scores.

    7.1k GitHub stars~9.1k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check: notes
  • Builds or repairs an integrated income statement, balance sheet and cash flow model in Excel with live formulas, supporting schedules, scenarios and a Checks sheet.

    1.8k GitHub stars~5.4k tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Money Finance

    iamzifei/show-me-the-money

    Financial tracking, revenue analytics, expense management, and pricing optimization.

    1k GitHub stars~2.2k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • Financial Model Checker

    ginlix-ai/LangAlpha

    Audits an existing Excel financial model without editing it, checking structure, formulas, integrity identities and source tie-out, and ends in a prioritized issue log.

    1.8k GitHub stars~4.2k tokensUpdated today
    Business, Finance & HRAuto-check passed
  • DCF Model Builder

    ginlix-ai/LangAlpha

    Builds a live Excel DCF valuation workbook with free cash flow projections, WACC, terminal value, three scenarios, sensitivity grids and a reverse DCF.

    1.8k GitHub stars~7.7k tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Financial statements, business segments, dividends, valuation multiples (PE/PB/PS), industry comparison, operating data, corporate actions, company and executive profiles, cross-stock comparison…

    270 GitHub starsUsed in 1 repo~1.8k tokens
    Business, Finance & HRAuto-check passed

More from HKUDS/Vibe-Trading

All 89 skills in this repo
  • Eastmoney Market Data

    HKUDS/Vibe-Trading

    Index of Eastmoney's free, no-token market data interfaces for China A-shares and Hong Kong stocks: fund flows, dragon-tiger lists, margin trading, reports and news.

    35k GitHub stars~1k tokensUpdated today
    Auto-check passed
  • OKX Market Data

    HKUDS/Vibe-Trading

    Retrieves public OKX cryptocurrency market data such as spot prices, candlesticks, funding rates and open interest through the OKX V5 REST API, with no authentication.

    35k GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • SEC EDGAR Filings Fetcher

    HKUDS/Vibe-Trading

    Fetches U.S. SEC EDGAR data: resolves tickers to CIK numbers, lists recent 10-K, 10-Q and 8-K filings with document URLs, and pulls XBRL financial series.

    35k GitHub stars~1.4k tokensUpdated today
    Auto-check passed
  • A-Share ST Risk Screener

    HKUDS/Vibe-Trading

    Predicts whether a mainland China A-share company risks an ST or *ST warning after its next annual report, using financial thresholds and Sina penalty records.

    35k GitHub stars~4.9k tokensUpdated today
    Auto-check passed
  • Breaks a structural trend such as AI infrastructure into its physical supply chain and ranks lesser-known listed companies sitting on each bottleneck.

    35k GitHub stars~2.7k tokensUpdated today
    Auto-check passed
  • Plans and drafts an eight-part, roughly 120k-word investigative series on one company, built around a strict fact-check pass rather than fast drafting.

    35k GitHub stars~2.4k tokensUpdated today
    Auto-check passed

Questions about Hedging Strategy Design

What does Hedging Strategy Design do?

Designs hedging plans for existing positions with futures, ETFs and options, covering beta hedges, protective puts, collars, tail risk and cross-asset hedges, with hedge ratios and cost estimates. The agent builds systematic hedges for positions you already hold, using linear hedges with futures or ETFs and nonlinear hedges with options, and returns hedge ratios, cost estimates and an execution plan. The guiding principle is that hedging does not remove risk but swaps unknown losses for known costs.

When should I use Hedging Strategy Design?

Hedging Strategy Design fits situations like: hedging the market exposure of a stock portfolio with index futures or an ETF; choosing between a protective put and a collar; calculating a hedge ratio and the cost of carrying the hedge; planning protection against tail risk.

How do I install Hedging Strategy Design in Claude Code?

Run `npx skills add HKUDS/Vibe-Trading --skill hedging-strategy -a claude-code`. Or copy the skill folder (agent/src/skills/hedging-strategy in HKUDS/Vibe-Trading) into .claude/skills/hedging-strategy in your project. Claude Code loads it when a task matches its description.

How do I install Hedging Strategy Design in Codex?

Run `npx skills add HKUDS/Vibe-Trading --skill hedging-strategy -a codex`. Or copy the skill folder (agent/src/skills/hedging-strategy in HKUDS/Vibe-Trading) into .agents/skills/hedging-strategy in your project. Codex loads it when a task matches its description.

Can I use Hedging Strategy Design in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add HKUDS/Vibe-Trading --skill hedging-strategy -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/hedging-strategy, .gemini/skills/hedging-strategy, .github/skills/hedging-strategy and .opencode/skills/hedging-strategy in your project.

What does Hedging Strategy Design need to run?

SKILL.md names no scripts, command-line tools or credentials: Hedging Strategy Design is instructions for the agent only.

Does Hedging Strategy Design access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Hedging Strategy Design safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Hedging Strategy Design use?

Hedging Strategy Design is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Hedging Strategy Design use?

About 2.7k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Hedging Strategy Design?

Skills that share tags, products or a category with Hedging Strategy Design: Stock Deep Analysis Workflow (wbh604/UZI-Skill, 7.1k stars), Three-Statement Model Builder (ginlix-ai/LangAlpha, 1.8k stars), Money Finance (iamzifei/show-me-the-money, 1k stars) and Financial Model Checker (ginlix-ai/LangAlpha, 1.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Hedging Strategy Design?

HKUDS (a GitHub organization) maintains it in HKUDS/Vibe-Trading, which has 35,043 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on October 8, 2026.

Source: HKUDS/Vibe-Trading on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.