The Magic Formula for Trading Options Risk Free

The Magic Formula for Trading Options Risk Free

Understanding the Breeden-Litzenberger Formula

Introduction to Risk Neutral Probability Density Functions

  • The video introduces the Breeden-Litzenberger formula, which is used to derive risk-neutral probability density functions from option prices. This method is particularly useful for complex dynamics and high-dimensional scenarios.

Advantages of the Breeden-Litzenberger Formula

  • The formula allows for the computation of complicated derivatives at different strikes for a specific time to maturity, simplifying the process of obtaining risk-neutral probability distributions.

Smoothing and Cumulative Density Function Creation

  • After obtaining a discrete probability density function (pdf), linear regression will be applied to smooth this function, leading to the creation of a cumulative density function that facilitates easy pricing of complex derivatives.

Definition and Pricing Mechanism

  • The Feynman-Kac analysis helps define risk-neutral probabilities necessary for option pricing. A European call option's price can be expressed in terms of its strike price and time to maturity using these probabilities.

Deriving Option Prices Using Integrals

  • The call option price is derived through an integral involving the risk-neutral pdf, where it represents discounted expectations based on potential payoffs above a certain strike price.

Exploring General Densities Beyond Log-Normal

Transitioning from Log-Normal Distributions

  • While constant volatility leads to log-normal densities yielding Black-Scholes formulas, more general densities can be considered under no-arbitrage conditions using the Breeden-Litzenberger framework.

Derivative Calculations for PDF Extraction

  • Taking derivatives with respect to strike prices allows extraction of both first and second derivatives from integrals, ultimately leading to identification of the risk-neutral pdf.

Practical Application in Python

Setting Up Python Environment

  • The video discusses setting up a Python environment with libraries such as NumPy, SciPy, Pandas, and Matplotlib for implementing calculations related to risk-neutral distributions.

Stochastic Volatility Model Overview

  • A European call option with stochastic volatility modeled under Heston's framework is introduced. Key parameters include drift and diffusion terms relevant for underlying processes.

Parameter Initialization in Heston Model

Defining Key Parameters

  • Initial parameters are set: stock price at 100, strike at 150, one-year time frame (tau), and an annual risk-free rate of 6%.

Mean Reversion Rate Considerations

  • Parameters like kappa (mean reversion rate), theta (long-term variance), initial volatility values are defined while ensuring conditions are met to avoid negative volatility issues within Heston’s model framework.

Understanding Option Pricing and the Heston Model

Finite Difference Approximation for Derivatives

  • The discussion begins with the application of a discount factor multiplied by the probability density function (pdf) to approximate option pricing.
  • Call prices are calculated for various strikes, ensuring an even difference between them, which is essential for risk-neutral distribution calculations at specific maturities.

Analytical Solutions in the Heston Model

  • An analytical solution exists for calculating option prices under the Heston model, relying on its characteristic equation. A previous video provides detailed steps on this calculation.
  • Complex integrals from 0 to infinity of the characteristic function must be computed using rectangular integration methods.

Numerical Integration Challenges

  • The choice of step size in numerical integration significantly affects precision, especially for out-of-the-money options due to Python's round-off errors.
  • The speaker notes that C-based libraries like QuantLib are more effective than Python for numerical integration tasks.

Implementation of Rectangular Integration

  • After calculating option prices using rectangular integration across a range of strikes (60 to 180), second-order finite difference approximations are employed to derive risk-neutral distributions.
  • The process involves creating a data frame with strike prices and applying shift functions in Pandas to compute necessary values.

Visualization and Comparison with QuantLib

  • A plot illustrates Heston stochastic volatility-calculated option prices alongside curvature representing density functions; issues arise when curvature dips below zero due to round-off errors.

Understanding Probability Density Functions and Numerical Integration

Overview of Probability Density Function (PDF) and Mean Squared Error (MSE)

  • The discussion begins with the importance of a probability density function, highlighting that the density should not drop below zero, which is ideal for its application.
  • The mean squared error (MSE) between option prices from rectangular integration and the QuantLib library is noted to be very small at 0.07 across various strikes, indicating minimal differences in pricing.
  • Larger discrepancies occur for out-of-the-money options due to complex integration over small increments, leading to rounding errors in Python's binary float point number approximations.

Challenges with Python's Numerical Integration

  • Python's limitations regarding numerical integration are discussed, particularly concerning round-off errors when dealing with small values.
  • A call for suggestions on improving Python’s numerical integration methods is made, emphasizing variable step sizes for different strikes.

Interpolation Techniques for PDF Calculation

  • The speaker plans to multiply option prices by a forward factor and use SciPy's interp1d function to interpolate between discrete curvature functions based on given strikes.
  • It is emphasized that interpolation can only be performed within the range of provided data points; thus calculations are limited between specified strike values.

Cumulative Distribution Function (CDF)

  • To derive the cumulative distribution function from the PDF, a cumulative sum of the linear PDF across all strikes is computed.
  • The resulting CDF represents risk-neutral distribution at a specific time to maturity, allowing users to input a strike price k to obtain probabilities.

Pricing Complex Derivatives Using Risk-Neutral PDFs

  • The risk-neutral density function can be utilized for pricing derivatives at a defined time to maturity using market prices or models like Heston’s model.
  • A generic pricing formula for calls and puts is introduced, detailing how numerical integration applies to these payoffs based on stock price S_t .
  • Integrands are defined for both call and put options; however, practical limits exist due to maximum calculable CDF values derived from interpolation techniques.

Understanding High-Dimensional Pricing Models

Efficiency in Pricing Calculations

  • The discussion highlights the complexity involved in calculating pricing for different strikes, especially when dealing with high dimensions and time steps.
  • It emphasizes that high complexity is required for accurate calculations, which can be model-dependent.
  • The use of risk-neutral density functions is presented as a highly efficient method for pricing options.
Video description

In 1978, Breeden and Litzenberger showed how under risk-neutral pricing, that the discounted Risk-Neutral Density (RND) function could be estimated directly from option prices. In this video we demonstrate how to use the Breeden-Litzenberger formula to derive the risk-neutral density function from European call options with stochastic volatilty under the Heston model. We price the call options using the semi-analytical solution for the Heston model using rectangular integration and compare this to the QuantLib implementation in Python. Here we compare the differences in prices and explain why there are differences - floating point errors. Once we have the option prices (or possibly market prices) we can implement the Breeden-Litzenberger formula easily using pandas dataframe shift functions. To utilise the estimated pdf within other calculations, we need to make use of scipy's interpolation function. The Risk-Neutral Density function can they be used to price other complex derivatives given a time to maturity. ★ ★ Code Available on GitHub ★ ★ GitHub: https://github.com/TheQuantPy Specific Tutorial Link: https://github.com/TheQuantPy/youtube-tutorials/blob/8e64e19629cee840928b51baf4660e5c777e87e7/2022/002%20Apr-Jun/2022-06-06%20The%20Magic%20Formula%20for%20Trading%20Options%20Risk%20Free.ipynb ★ ★ QuantPy GitHub ★ ★ Collection of resources used on QuantPy YouTube channel. https://github.com/thequantpy ★ ★ Discord Community ★ ★ Join a small niche community of like-minded quants on discord. https://discord.com/invite/aY2Af4CxHP ★ ★ Support our Patreon Community ★ ★ Get access to Jupyter Notebooks that can run in the browser without downloading python. https://www.patreon.com/quantpy ★ ★ ThetaData API ★ ★ ThetaData's API provides both realtime and historical options data for end-of-day, and intraday trades and quotes. Use coupon 'QPY1' to receive 20% off on your first month. https://www.thetadata.net/ ★ ★ Online Quant Tutorials ★ ★ WEBSITE: https://quantpy.com.au ★ ★ Contact Us ★ ★ EMAIL: pythonforquants@gmail.com Disclaimer: All ideas, opinions, recommendations and/or forecasts, expressed or implied in this content, are for informational and educational purposes only and should not be construed as financial product advice or an inducement or instruction to invest, trade, and/or speculate in the markets. Any action or refraining from action; investments, trades, and/or speculations made in light of the ideas, opinions, and/or forecasts, expressed or implied in this content, are committed at your own risk an consequence, financial or otherwise. As an affiliate of ThetaData, QuantPy Pty Ltd is compensated for any purchases made through the link provided in this description.