Agent skill

Options Strategy Backtesting

by HKUDS in HKUDS/Vibe-Trading

Backtests multi-leg option strategies by synthesizing Black-Scholes prices from the underlying, simulating PnL, Greeks exposure and expiration for crypto and equity options.

MITAuto-check passedBusiness, Finance & HR

Install Options Strategy Backtesting

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

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

GitHub CLI
$ gh skill install HKUDS/Vibe-Trading options-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/options-strategy .claude/skills/options-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
options-strategy
GitHub stars
35k
Token cost
~2k tokens
SKILL.md length
695 words
Files
1
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

Backtests multi-leg option strategies by synthesizing Black-Scholes prices from the underlying, simulating PnL, Greeks exposure and expiration for crypto and equity options.

  • Backtesting an iron condor, butterfly or calendar spread
  • SKILL.md covers Purpose, Supported Strategy Types, OptionsSignalEngine Interface and config.json Format, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Pricing options with Black-Scholes from an underlying price series

What it does

Starting from the underlying price, the engine synthesizes theoretical option prices with the Black-Scholes model and then simulates profit and loss, Greek exposure and expiration exercise for multi-leg portfolios. It is meant for backtesting and for pricing and sensitivity research on cryptocurrency and equity options.

A table lists the supported structures together with the market view each one suits: covered call, protective put, straddle, strangle, iron condor, butterfly and calendar spread. The named use cases fall into three groups, hedging with covered calls or protective puts, volatility trading with straddles or strangles, and spread strategies, plus option pricing and Greek sensitivity research. The config sets engine to options, a risk-free rate defaulting to 0.05 and volatility from 30-day rolling history, and signals fill on the next bar's close by default.

When your agent uses it

  • Backtesting an iron condor, butterfly or calendar spread
  • Pricing options with Black-Scholes from an underlying price series
  • Studying the Greek sensitivity of a multi-leg position
  • Testing a covered call or protective put overlay

Example prompts

  • “Backtest an iron condor on this price series using Black-Scholes prices.”
  • “Compare a straddle and a strangle for an expected large move.”
  • “Show the Greeks exposure of a butterfly spread over time.”
  • “Simulate a covered call on my holding and report PnL at expiration.”

What it can do on your machine

Read from SKILL.md and the folder at commit b1f6ce7. 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 and json).

    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

Options Strategy Backtesting loads about 2k tokens when it runs. Until then it costs about 42 tokens; SKILL.md has 695 words of instructions outside code blocks.

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

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 b1f6ce7, republished under its MIT licence (© HKUDS). 695 words, ~1,991 tokens.

Download SKILL.mdSave it as .claude/skills/options-strategy/SKILL.md (or your agent's skills folder).
name
options-strategy
description
Options strategy framework supporting Black-Scholes pricing, Greeks analysis, and multi-leg backtesting. Suitable for cryptocurrency and equity options.
category
asset-class

Purpose

Backtesting of option portfolio strategies. Starting from the underlying price, the engine synthesizes theoretical option prices with the Black-Scholes model, then simulates PnL, Greeks exposure, and expiration exercise for multi-leg option portfolios.

Applicable scenarios:

  • Hedging strategies (covered call, protective put)
  • Volatility trading (straddle, strangle)
  • Spread strategies (iron condor, butterfly, calendar spread)
  • Option pricing analysis and Greeks sensitivity research

Supported Strategy Types

StrategyStructureApplicable Market View
Covered CallHold underlying + short callMildly bullish, collect premium
Protective PutHold underlying + long putBullish but wants downside protection
StraddleBuy same-strike call + putExpect large movement, direction uncertain
StrangleBuy different-strike call + putExpect large movement, lower cost
Iron CondorSell put spread + sell call spreadRange-bound market, collect premium
ButterflyBuy low call + sell 2 middle calls + buy high callExpect narrow-range movement
Calendar SpreadSell near-month + buy far-month at same strikeExploit differences in time decay

OptionsSignalEngine Interface

Write the strategy in code/signal_engine.py, with class name SignalEngine, implementing the generate method:

python
class SignalEngine:
    """Option strategy signal engine."""

    def generate(self, data_map: dict) -> list:
        """Generate option trading instructions.

        Args:
            data_map: code -> DataFrame (columns: open, high, low, close, volume)

        Returns:
            List of trading instructions. Each instruction has the format:
            {
                "date": "2024-01-15",        # Trading date
                "action": "open" / "close",  # Open or close position
                "underlying": "BTC-USDT",    # Underlying code
                "legs": [                    # List of option legs
                    {
                        "type": "call" / "put",  # Option type
                        "strike": 50000,          # Strike price
                        "expiry": "2024-02-15",   # Expiration date
                        "qty": 1                  # Quantity (positive = long, negative = short)
                    }
                ]
            }
        """
Multi-Leg Combination Example

Iron Condor opening signal:

python
{
    "date": "2024-01-15",
    "action": "open",
    "underlying": "000300.SH",
    "legs": [
        {"type": "put",  "strike": 3800, "expiry": "2024-02-15", "qty": -1},  # Sell put
        {"type": "put",  "strike": 3700, "expiry": "2024-02-15", "qty":  1},  # Buy protective put
        {"type": "call", "strike": 4200, "expiry": "2024-02-15", "qty": -1},  # Sell call
        {"type": "call", "strike": 4300, "expiry": "2024-02-15", "qty":  1},  # Buy protective call
    ]
}

config.json Format

json
{
    "codes": ["000300.SH"],
    "start_date": "2020-01-01",
    "end_date": "2024-12-31",
    "source": "tushare",
    "engine": "options",
    "initial_cash": 1000000,
    "commission": 0.001,
    "options_config": {
        "risk_free_rate": 0.05,
        "iv_source": "historical",
        "contract_multiplier": 1.0,
        "same_day_fill": false,
        "default_iv": 0.3
    }
}

Key fields:

  • engine must be set to "options" so the runner selects the option backtest engine
  • options_config.risk_free_rate: risk-free rate, default 0.05
  • options_config.iv_source: volatility source, currently supports "historical" (30-day rolling historical volatility computed from underlying closes)
  • options_config.contract_multiplier: contract multiplier, default 1.0
  • options_config.same_day_fill: false (default) fills a signal dated T on the next bar's close; true restores the legacy same-date fill (signal and fill share T's close and IV)
  • options_config.default_iv: volatility used for bars without a full rolling window (warm-up and NaN gaps), default 0.3; must be finite and positive

BS Model Principles

Black-Scholes formula (European options):

Call = S * N(d1) - K * e^(-rT) * N(d2)
Put  = K * e^(-rT) * N(-d2) - S * N(-d1)

d1 = [ln(S/K) + (r + sigma^2/2) * T] / (sigma * sqrt(T))
d2 = d1 - sigma * sqrt(T)

Where S = underlying price, K = strike, T = time to expiry in years, r = risk-free rate, sigma = volatility, and N() = cumulative distribution function of the standard normal.

This engine starts from the underlying daily price series, substitutes historical volatility for implied volatility, and computes theoretical option prices through the BS formula. This is a synthetic-data mode, meaning no real option market data is required.

Greeks Meaning and Usage

GreekMeaningUsage
DeltaChange in option price for a 1-unit move in the underlyingDirectional exposure management, hedge-ratio calculation
GammaChange in Delta for a 1-unit move in the underlyingMeasures hedge stability; high Gamma = frequent rebalancing required
ThetaTime decay of option value per day (usually negative)Time-value management, source of return for short-option strategies
VegaChange in option price for a 1% volatility moveCore metric for volatility trading, measures volatility exposure

The backtest engine computes portfolio-level Greeks aggregates on each trading day and outputs them to greeks.csv.

Show full SKILL.md (270 more words)Show less

Common Pitfalls

Volatility Smile

The BS model assumes constant volatility, but in real markets implied volatility differs across strikes and expiries (volatility smile / skew). This engine approximates with historical volatility, so pricing may be biased for deep OTM / deep ITM options. Strategy design should avoid over-reliance on pricing precision at extreme strikes.

Time Decay (Theta Decay)

Theta decay is not linear — the closer the option is to expiry, the faster the decay. The last 30 days decay much faster than the prior 30 days. Short-vol strategies benefit from this, but Gamma risk also rises sharply near expiry.

Early Exercise

This engine supports European options only (exercise only at expiry), not American options. In scenarios with meaningful early-exercise value (for example, deep ITM puts or calls on high-dividend underlyings), pricing will be biased.

Liquidity and Slippage

In synthetic-data mode there are no bid-ask spreads or liquidity constraints. In real trading, deep OTM options have poor liquidity and wide spreads, so backtest results will be overly optimistic.

Contract Multiplier

Option contract multipliers differ across markets (for example, China A-share ETF options often use a 10,000 multiplier, while crypto is typically 1). Make sure options_config.contract_multiplier is set correctly.

Artifact Description

After backtesting, the following files are generated in the artifacts/ directory:

FileContents
equity.csvDaily equity, cash, market value of holdings
metrics.csvReturn, Sharpe ratio, maximum drawdown, and similar metrics
trades.csvTrade-by-trade records (open / close / exercise / expire)
greeks.csvDaily portfolio Greeks aggregates (delta/gamma/theta/vega)
ohlcv_{code}.csvRaw underlying candlestick data

Pricing Tool

The Agent can call the options_pricing tool for one-off pricing:

Call the options_pricing tool with:
  spot: 50000
  strike: 52000
  expiry_days: 30
  volatility: 0.6
  option_type: "call"

It returns the theoretical price and Greeks, which is suitable for interactive analysis.

© 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/options-strategy of HKUDS/Vibe-Trading.

Open the folder on GitHubat commit b1f6ce7

Compare with similar skills

Options Strategy Backtesting 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.

Options Strategy Backtesting compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Options Strategy Backtesting this skillHKUDS/Vibe-Trading35k—~2kAutomated safety check: PassMIT
Relative ValuationYijia-Xiao/FinanceHarness196—~446Automated safety check: PassApache-2.0
Forecastingericrisco/rsc-harness180—~2.8kAutomated safety check: PassMIT
Multi-Symbol Market Scannertradesdontlie/tradingview-mcp6.8k2 repos~447Automated safety check: PassCustom licence
Pine Script Development Looptradesdontlie/tradingview-mcp6.8k2 repos~617Automated safety check: PassCustom licence
Creating Financial ModelsChen-zexi/open-ptc-agent7293 repos~1.3kAutomated safety check: PassMIT

Similar skills

  • Relative Valuation

    Yijia-Xiao/FinanceHarness

    Value an equity against its peers — peer-median trading multiples applied to the company's metrics for an implied range, cross-read against its own valuation ratios.

    196 GitHub stars~446 tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • Forecasting

    ericrisco/rsc-harness

    A skill your agent uses when projecting history forward — sales, demand, units, revenue, signups, traffic — into a defensible number with an error band: method by data shape, rolling-origin…

    180 GitHub stars~2.8k tokensUpdated today
    Data & AnalyticsAuto-check passed
  • Multi-Symbol Market Scanner

    tradesdontlie/tradingview-mcp

    Scans a list of trading symbols in TradingView for setups, patterns or strategy results and reports them as a ranked comparison table.

    6.8k GitHub starsUsed in 2 repos~447 tokens
    Business, Finance & HRAuto-check passed
  • Pine Script Development Loop

    tradesdontlie/tradingview-mcp

    Runs a write, compile, fix and verify loop for TradingView Pine Script indicators and strategies, pushing code into the Pine Editor and checking it on the chart.

    6.8k GitHub starsUsed in 2 repos~617 tokens
    Business, Finance & HRAuto-check passed
  • Creating Financial Models

    Chen-zexi/open-ptc-agent

    This skill provides an advanced financial modeling suite with DCF analysis, sensitivity testing, Monte Carlo simulations, and scenario planning for investment decisions

    729 GitHub starsUsed in 3 repos~1.3k tokens
    Business, Finance & HRAuto-check passed
  • CCXT Crypto Exchange Library

    2025Emma/vibe-coding-cn

    Reference help for the CCXT library covering crypto exchange APIs, market data, trading and order management across 150+ exchanges in JavaScript, Python and PHP.

    23k GitHub starsUsed in 1 repo~4.4k 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 Options Strategy Backtesting

What does Options Strategy Backtesting do?

Backtests multi-leg option strategies by synthesizing Black-Scholes prices from the underlying, simulating PnL, Greeks exposure and expiration for crypto and equity options. Starting from the underlying price, the engine synthesizes theoretical option prices with the Black-Scholes model and then simulates profit and loss, Greek exposure and expiration exercise for multi-leg portfolios. It is meant for backtesting and for pricing and sensitivity research on cryptocurrency and equity options.

When should I use Options Strategy Backtesting?

Options Strategy Backtesting fits situations like: backtesting an iron condor, butterfly or calendar spread; pricing options with Black-Scholes from an underlying price series; studying the Greek sensitivity of a multi-leg position; testing a covered call or protective put overlay.

How do I install Options Strategy Backtesting in Claude Code?

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

How do I install Options Strategy Backtesting in Codex?

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

Can I use Options Strategy Backtesting 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 options-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/options-strategy, .gemini/skills/options-strategy, .github/skills/options-strategy and .opencode/skills/options-strategy in your project.

What does Options Strategy Backtesting need to run?

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

Does Options Strategy Backtesting 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 Options Strategy Backtesting 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 Options Strategy Backtesting use?

Options Strategy Backtesting 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 Options Strategy Backtesting use?

About 2k tokens (SKILL.md is roughly 8k 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 Options Strategy Backtesting?

Skills that share tags, products or a category with Options Strategy Backtesting: Relative Valuation (Yijia-Xiao/FinanceHarness, 196 stars), Forecasting (ericrisco/rsc-harness, 180 stars), Multi-Symbol Market Scanner (tradesdontlie/tradingview-mcp, 6.8k stars) and Pine Script Development Loop (tradesdontlie/tradingview-mcp, 6.8k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Options Strategy Backtesting?

HKUDS (a GitHub organization) maintains it in HKUDS/Vibe-Trading, which has 35,097 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on October 9, 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.