Overview
TheStrategyState model represents a complete options strategy configuration sent to the API for analysis, heatmap generation, or AI insights. It includes the underlying asset price, volatility parameters, time horizon, and all option legs that make up the strategy.
This is the primary request model used across multiple endpoints including:
/api/heatmap- Generate profit/loss heatmaps/api/ai/greeks- Calculate portfolio Greeks/api/ai/insights- Get AI-powered strategy analysis
Model Structure
Current or simulated price of the underlying asset. Must be greater than 0.Example:
150.50 for a stock trading at $150.50Volatility shock to simulate, expressed as a decimal (e.g., 0.05 for +5% volatility increase).This allows you to stress-test your strategy under different volatility scenarios:
0.0- Use base volatility0.05- Simulate +5% volatility increase-0.03- Simulate -3% volatility decrease
Number of days forward to simulate for heatmap generation. Must be between 1 and 365.Common values:
7- One week outlook30- One month outlook (default)90- Quarterly outlook
Array of option positions that make up the strategy. Must contain at least one leg.Each leg represents a call, put, or stock position. See OptionLeg for detailed structure.
Symbol of the underlying asset (e.g., “AAPL”, “SPY”, “TSLA”).Used for fetching real-time market data and enhancing AI analysis with market context.
Pre-fetched market data including yfinance price history and sentiment analysis.This is typically populated internally by the backend when fetching market data. You can optionally provide this to avoid redundant API calls.
Example JSON
Simple Strategy (Iron Condor)
With Volatility Stress Test
Usage in API Endpoints
Calculate Portfolio Greeks
Generate Heatmap
Field Validation
✅ Must be greater than 0❌ Negative or zero values will be rejected
✅ Can be positive (increase vol) or negative (decrease vol)✅ Typical range: -0.5 to 0.5 (-50% to +50%)
✅ Must be between 1 and 365 (inclusive)❌ Values outside this range will be rejected
✅ Must contain at least 1 leg❌ Empty array will be rejected