Canvas & Ratio
Choose your destination platform format
Layout Template
Choose a content structure for your slides
Preset Themes
Typography & Sizing
Brand Kit Customization
AGENCYConfigure brand assets for headers & footers
Outro Slide CTA
Customize your closing call-to-action slide
Background Pattern
Build Your Carousel
Drag and drop any post card below onto a slide, or use the quick buttons to insert content/images instantly!

Calculating the theta for American options is hard. It’s the "time decay" of an option's value. And it’s critical for traders to understand. The good news? We have QuantLib to do it for us. Here’s how:

Options theta represents the sensitivity of the option's price to the passage of time. Theta is a critical concept for options traders to understand. If you're long theta erodes value. If you're short, theta makes you money. Let's go:

We’ll start with importing NumPy for some math, OpenBB for data, and QuantLib to calculate theta.


Using OpenBB, grab the options chains to find at-the-money (ATM) strikes, expirations, and historical price data.


We use pandas to find the strike price that’s closest to the last traded price. Then we find the last closing price and the annualized volatility. Finally, we hard code the dividend yield, risk-free rate, and set the evaluation date to today.


Now we'll create the QuantLib handles to set the underlying price, yield term structure for the risk free rate and dividend, and the volatility term structure.


We can now build the Black-Scholes-Merton process which models the dynamics of the underlying asset. Using the Black-Scholes-Merton process, we can build our option pricer.


While this example values a plain vanilla option using constant volatility, QuantLib supports many features to better reflect reality. Try using a BlackVarianceCurve if you want to specify the at-the-money volatility with respect to time.