Guide · Agent skill
How to use the Options Strategy Backtester agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The options-strategy skill lets an AI agent design and backtest multi-leg option strategies, such as covered calls, iron condors, straddles and calendar spreads, using historical price data for the underlying asset. It is part of the HKUDS Vibe-Trading project and is released under the MIT licence. This guide explains what the skill does, how to install it, how to phrase requests, what it needs to run, and where its results can mislead you.
Quick start
- 1Download and unzip. Download the skill ZIP from this page and unzip it into ~/.claude/skills/ or a project's .claude/skills/ folder.
- 2Install the backtest framework. Make sure Vibe-Trading's options engine and its modules are available, with Python, numpy and pandas installed.
- 3Set up data access. Configure your historical price source for the underlying, such as tushare with its API token.
- 4Create config.json. Set engine to "options" and fill in the options_config values such as risk_free_rate and iv_source.
- 5Ask for a strategy. Describe the strategy, underlying, date range and legs in plain language so the agent can write or reuse a SignalEngine.
- 6Review artifacts. Open metrics.csv, trades.csv and greeks.csv in artifacts/ and check the results against the limits in this guide.
What the skill makes the agent do
An agent skill is a folder of instructions and optional scripts that an AI agent loads when a task matches the skill's description. This one covers option portfolio backtesting. Because real option prices are often unavailable, the engine starts from the underlying asset's daily price series and estimates theoretical option prices with the Black-Scholes model, substituting historical volatility for implied volatility.
On top of those estimated prices, the engine simulates profit and loss, portfolio Greek exposure (delta, gamma, theta, vega) and what happens at expiration. The skill is designed as a research tool for testing ideas, not as a live trading system.
- Hedging strategies: covered call and protective put
- Volatility trading: straddle and strangle
- Spread strategies: iron condor, butterfly and calendar spread
- Option pricing analysis and Greeks sensitivity research
Install the options-strategy skill
Download the skill ZIP from this page and unzip it. For a personal setup, place the unzipped folder in ~/.claude/skills/. To limit it to one project, place it in that project's .claude/skills/ folder instead.
If you use the Claude apps, you can instead upload the ZIP under Settings → Capabilities → Skills.
- Personal install: ~/.claude/skills/
- Project install: .claude/skills/ inside your project
- Claude apps: Settings → Capabilities → Skills, then upload the ZIP
Set up the backtest framework and data
The skill does not run on its own. It drives the Vibe-Trading backtest framework and its options engine, so you need that framework available. You also need Python with numpy and pandas, plus Vibe-Trading's src.quantlib.options and backtest.engines.options_portfolio modules.
The historical underlying prices are sourced through the framework. The example config uses tushare as the source, which typically requires a tushare API token.
- Vibe-Trading backtest framework with the options engine
- Python with numpy and pandas
- Vibe-Trading modules src.quantlib.options and backtest.engines.options_portfolio
- Historical price data for the underlying (example config uses tushare, typically needing an API token)
Configure a backtest
A backtest is controlled by a config.json file. The key setting is engine, which must be "options" so the runner selects the option backtest engine. The options_config block holds the pricing assumptions.
Useful fields from the skill: risk_free_rate defaults to 0.05; iv_source currently supports "historical", meaning 30-day rolling historical volatility computed from underlying closes; contract_multiplier defaults to 1.0; same_day_fill defaults to false, which fills a signal dated T on the next bar's close; default_iv defaults to 0.3 and is used for bars without a full rolling window.
- engine must be "options"
- risk_free_rate: default 0.05
- iv_source: "historical" is the supported option
- contract_multiplier: set this correctly for your market
- same_day_fill: false is the default and avoids same-bar fills
- default_iv: default 0.3, must be finite and positive
{
"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
}
}Write or reuse a strategy engine
A strategy is a signal engine: a class named SignalEngine with a generate method. It receives a map of code to a DataFrame with open, high, low, close and volume columns, and returns a list of instructions. Each instruction gives a date, an action (open or close), the underlying code and a list of legs. Each leg has a type (call or put), a strike, an expiry date and a quantity, where positive is long and negative is short.
You do not have to write one from scratch. The file example_signal_engine.py includes ready-made engines for covered call, cash-secured put, iron condor, vol-gated short strangle and protective put.
- Each leg: type, strike, expiry, qty (negative = short)
- Ready-made engines: covered call, cash-secured put, iron condor, vol-gated short strangle, protective put
{
"date": "2024-01-15",
"action": "open",
"underlying": "000300.SH",
"legs": [
{"type": "put", "strike": 3800, "expiry": "2024-02-15", "qty": -1},
{"type": "put", "strike": 3700, "expiry": "2024-02-15", "qty": 1},
{"type": "call", "strike": 4200, "expiry": "2024-02-15", "qty": -1},
{"type": "call", "strike": 4300, "expiry": "2024-02-15", "qty": 1}
]
}Read the output files
After a backtest, files are written to the artifacts/ directory. equity.csv holds daily equity, cash and market value of holdings. metrics.csv holds return, Sharpe ratio, maximum drawdown and similar figures. trades.csv records each open, close, exercise and expire event. greeks.csv holds daily portfolio delta, gamma, theta and vega. ohlcv_{code}.csv holds the raw underlying candlestick data.
- equity.csv: daily equity, cash, holdings value
- metrics.csv: return, Sharpe, max drawdown and similar
- trades.csv: open, close, exercise and expire records
- greeks.csv: daily delta, gamma, theta, vega
- ohlcv_{code}.csv: raw underlying data
Know the limits before trusting results
The Black-Scholes model assumes constant volatility, but real markets show a volatility smile or skew, so pricing can be biased for deep out-of-the-money or deep in-the-money options. The engine models European exercise only, so American-style options or options with significant early-exercise value will be priced incorrectly.
Synthetic mode has no bid-ask spreads or liquidity limits. Real deep out-of-the-money options are often illiquid with wide spreads, so backtest results can be materially optimistic. Contract multipliers also differ by market, so check contract_multiplier before reading any profit figure.
- Constant-volatility assumption biases extreme strikes
- European exercise only
- No bid-ask spreads or liquidity in synthetic mode
- Contract multiplier must match your market
Safety notes: scripts and network access
This skill runs scripts (example_signal_engine.py) and uses the network, mainly to fetch historical price data through the configured source. Review the script before running it, and check which data source and credentials your config uses. The skill is for research and does not place real option orders.
The agent can also call an options_pricing tool for one-off pricing, given inputs such as spot, strike and expiry_days.
- Review example_signal_engine.py before running it
- Network is used to fetch price data; credentials such as a tushare token stay in your environment
- Not a live trading or order-placement tool
What people use it for
- Test whether a covered call on an index would have outperformed holding the index over a chosen period
- Compare iron condor and short strangle ideas on the same underlying and date range
- Check how a calendar spread's Theta and Vega exposure changed day by day using greeks.csv
- Estimate a rough straddle payoff around expected large moves before studying real option quotes
- Price a single option one-off with the options_pricing tool for a quick sanity check
Frequently asked questions
How do I install the options-strategy skill?
Download the ZIP from this page and unzip it into ~/.claude/skills/ for personal use, or into a project's .claude/skills/ folder. In the Claude apps, you can upload the ZIP under Settings → Capabilities → Skills.
Is the options-strategy skill free?
The skill is released under the MIT licence. Your data source may not be free: the example config uses tushare, which typically needs an API token.
What do I need to run it?
You need the Vibe-Trading backtest framework with its options engine, Python with numpy and pandas, Vibe-Trading's src.quantlib.options and backtest.engines.options_portfolio modules, and historical price data for the underlying.
Can it use real option prices?
The engine is built for synthetic-data mode. It estimates option prices from the underlying's historical prices using Black-Scholes and historical volatility, so no real option market data is required.
Can I use it for live trading?
No. The skill is a research tool. Its results ignore bid-ask spreads and liquidity, so they can be materially optimistic, and it does not place orders.
Why are my backtest results or prices off?
Check that engine is set to "options", that contract_multiplier matches your market, and that your strategy avoids deep out-of-the-money or deep in-the-money strikes where the constant-volatility assumption is biased.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use this skill if you are a quantitative analyst, student or developer who wants to test how multi-leg option ideas behaved on historical price data, and who understands the synthetic assumptions. Pick a different tool if you need live trading, American-style option pricing, or realistic fills based on real option quotes.
Download the skill