optopsy  by michaelchu

Nimble options backtesting library with AI chat interface

Created 8 years ago
1,260 stars

Top 31.0% on SourcePulse

GitHubView on GitHub
Project Summary

A fast, flexible backtesting library for options strategies, Optopsy targets quantitative traders and researchers. It simplifies complex analysis by providing 28 built-in strategies, technical indicators for entry/exit signals, and advanced filtering by Greeks. A novel AI chat UI enables natural language interaction for data fetching, backtesting, and interpreting results, making sophisticated options analysis more accessible.

How It Works

The library processes options data from CSV or DataFrames, simulating trades for strategies like iron condors, butterflies, and vertical spreads. It integrates pandas-ta for technical analysis-based entry/exit signals and allows filtering by delta. Optopsy models realistic slippage and groups results by DTE and OTM% for granular analysis. The AI chat UI leverages EODHD for data retrieval and OpenAI-compatible LLMs (via LiteLLM) for conversational control and analysis.

Quick Start & Requirements

  • Install: pip install optopsy[ui] (includes AI UI) or pip install optopsy (core library).
  • Prerequisites: Python 3.12–3.13, Pandas 2.0+, NumPy 1.26+. Requires API keys for EODHD and an LLM provider (e.g., OpenAI, Anthropic) for the AI UI, configured via a .env file.
  • Launch AI UI: optopsy-chat.
  • Docs: Full Documentation, API Reference, Examples are available.

Highlighted Details

  • Supports 28 built-in options strategies, including complex multi-leg spreads.
  • Integrates pandas-ta for technical indicators (RSI, MACD, Bollinger Bands, EMA, ATR) and custom signal functions.
  • AI Chat UI allows natural language querying for data, backtests, and strategy comparisons.
  • Advanced features: Greeks filtering (delta), customizable slippage (mid, spread, liquidity), and result grouping by DTE/OTM%.
  • Flexible data input: accepts CSV or Pandas DataFrames, with optional support for Greeks and volume.

Maintenance & Community

Contributions are welcomed via issues and pull requests. No specific community channels (e.g., Discord, Slack) or core maintainer details are provided in the README.

Licensing & Compatibility

Licensed under the GNU General Public License v3.0 (GPL-3.0). This copyleft license may impose restrictions on use within proprietary or closed-source commercial applications.

Limitations & Caveats

The AI Chat UI is in Beta. Usage of the AI UI requires external API keys, potentially incurring costs. The GPL-3.0 license necessitates careful consideration for commercial integration.

Health Check
Last Commit

22 hours ago

Responsiveness

Inactive

Pull Requests (30d)
107
Issues (30d)
0
Star History
27 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.