$ show sirnfs/OptionSuite
OptionSuite is an options trading strategy backtesting framework implemented in Python. The system uses an event-driven architecture to simulate trading strategies by processing historical options data from CSV files. It provides modular components for option types, data handling, strategy definition, portfolio management, and risk management. The main entry point is backTester.py which orchestrates the backtesting session by initializing data handlers, portfolio managers, and strategy managers. The framework supports various options strategies including naked puts, put verticals, and strangles, with configurable risk management rules for position exits.
The LLM identified 4 files worth highlighting for reuse:
Defines a comprehensive Option base class with all relevant financial attributes (underlying price, strike, Greeks, etc.) and essential methods like calcOptionPriceDiff, getNumDaysLeft, and updateOption. Demonstrates strong encapsulation and abstraction suitable for reuse in any options trading system. Only depends on standard library modules, making it highly portable.
Implements a clean event handler pattern using abstract base classes and enums. Provides a generic event system that can be reused in any event-driven application. The separation of event types (TICK, SIGNAL) and the abstract EventHandler class shows solid understanding of decoupling principles. Minimal dependencies (only standard library) ensure high reusability.
Defines an abstract base class for option primitives (strategies built from options like naked puts, verticals, strangles). Includes essential methods for P&L calculation, Greeks aggregation, buying power computation, and value updates. Demonstrates good domain modeling of options trading concepts. Dependencies are limited to base option types and standard library, allowing extraction for use in other trading systems.
Provides an abstract base class for trading strategies with helpful utility methods for checking days-to-expiration constraints (hasMinimumDTE, hasMaximumDTE) and identifying monthly expirations (isMonthlyExp). Encapsulates common strategy parameters like underlying ticker, order quantity, and risk management settings. Shows good framework design with clear separation of concerns and minimal dependencies.