How proshotv2/gamma-vanna-options-exposure works
Main Components to Highlight
• External Data Provider: Indicate Tradier’s API as the external service supplying real-time options chain data, quotes, and expiration details.
• API Access and Credential Management: Represent the authentication mechanism (the function to retrieve the OAuth token and base URL), which configures access for both sandbox and production environments.
• Data Retrieval Module: Show the function(s) responsible for making the API calls (e.g., the get_quote function) and parsing responses.
• Calculation Module: Identify the mathematical processing layer where the application computes implied volatility (using the Black-Scholes or Black model), Gamma Exposure, and Vanna Exposure. Include components for:
• Calculating IV (using py_vollib_vectorized functions)
• Gamma Exposure calculation (gamma * OI * 100 * Spot Price^2)
• Vanna Exposure calculation (using vanna computed with inputs such as norm.pdf results and adjustments)
• Dash Web UI Module: Represent the frontend layer created with Dash. This component serves as the presentation layer where the computed exposures and possibly other data are rendered for the user.
Architectural Patterns and Design Principles
• Modularity by noting that functions such as get_tradier_credentials, get_quote, calculate_iv, and calculate_vanna provide a clear separation of concerns.
Relevant Technologies, Frameworks, and Libraries
• Python – The main programming language.
• Dash Library – For building the interactive web-based dashboard/interface.
• Requests Library – For making HTTP API calls to Tradier.
• Py_vollib_vectorized – For vectorized calculation of implied volatility.
• Standard libraries (math, norm from statistics/ scipy) – Used for mathematical and statistical operations.
• Tradier API – The external data source for market data.