
A nimble backtesting and statistics library for options strategies.
Optopsy is a Python backtesting engine that lets you go from "How do 45-DTE iron condors on SPX perform with a 50% profit target and 2x stop loss vs holding to expiration?" to detailed performance statistics in seconds, not spreadsheets.
Full Documentation | API Reference | Examples
🤖 Looking for AI/LLM integration?
optopsy-mcp provides a high-performance MCP server for strategy screening and backtesting. Powered by a complete Rust rewrite of the Optopsy engine, it is specifically built for seamless interaction with Large Language Models.
Features
- 38 Built-in Strategies - From simple calls/puts to iron condors, butterflies, condors, ratio spreads, collars, calendars, and diagonals
- Per-Leg Delta Targeting - Select strikes by delta with
target, min, max per leg
- Trade Simulator - Chronological simulation with capital tracking, position limits, and equity curves via
simulate()
- Portfolio Simulation - Weighted multi-strategy portfolio backtesting via
simulate_portfolio()
- Early Exits - Stop-loss, take-profit, and max-hold-days rules for automatic position management
- Commissions - Model broker fees with per-contract, base fee, and min fee structures
- Risk Metrics - Sharpe, Sortino, VaR, CVaR, Calmar, Omega, tail ratio, and more via
compute_risk_metrics()
- 80+ Entry Signals - Filter entries with TA indicators (RSI, MACD, Bollinger Bands, EMA, ATR, IV Rank) via pandas-ta-classic