Overview
The Calculations endpoint is the core engine of OptionStrat AI. It generates 2D profit/loss heatmaps by simulating your options strategy across different underlying prices and time horizons using Black-Scholes modeling.Generate Heatmap
Request Body (StrategyState)
Current or simulated price of the underlying asset. Must be greater than 0.
Volatility shock to simulate (e.g., 0.05 for +5% IV increase, -0.10 for -10% IV decrease)
Number of days forward to simulate in the heatmap. Range: 1-365.
Stock ticker symbol (e.g., “AAPL”). Optional but recommended for context.
Array of option legs (positions). Minimum 1 leg required.
Optional pre-fetched market data and sentiment information
Response
Status of the calculation:
"success" or "error"Maximum potential profit across all simulated scenarios
Maximum potential loss across all simulated scenarios
2D grid containing P&L calculations for different price/time combinations. Each element contains:
- Price point
- Time point (days forward)
- P&L value at that coordinate
Example Response
Error Response
Strategy Examples
Bull Call Spread
Bull Call Spread
Iron Condor
Iron Condor
Covered Call
Covered Call
Implementation Details
Calculation Engine: The heatmap uses Black-Scholes-Merton model to price options at different:
- Price points: Creates a grid of underlying prices (typically ±20% from current price)
- Time points: Simulates P&L from today through
days_to_simulate - Volatility: Applies
volatility_shockto implied volatility
Use Cases
- Visual Strategy Analysis: Generate data for P&L heatmap visualizations
- Risk Assessment: Identify max profit and max loss scenarios
- What-If Analysis: Test different volatility scenarios with
volatility_shock - Time Decay Modeling: See how strategy P&L evolves over time
- Price Target Planning: Visualize profit zones across price ranges