Implied Volatility
Calculate the Implied Volatility (IV) based on the Black Scholes Model and the actual option prices for any of the available expiration dates.
Implied Volatility (IV) is a measure of how much the market expects the price of the underlying asset to fluctuate in the future. It is a key component of options pricing and can also be used to calculate the theoretical value of an option.
By default the most recent risk free rate, dividend yield and stock price is used, you can alter this by changing the start date. The volatility is calculated based on the daily returns of the stock price and the selected period (this can be altered by defining this accordingly when defining the Toolkit class, start_date and end_date).
The formulas are as follows:
\[d_{1} = (\ln(S / K) + (r - q + (\sigma ^{2}) / 2) \cdot t) / (\sigma \cdot \sqrt{t})\] \[d_{2} = d_{1} - \sigma \cdot \sqrt{t}\] \[\text{Call Option Price} = S \cdot e ^{- q \cdot t} \cdot N(d_{1}) - K \cdot e ^{- r \cdot t} \cdot N(d_{2})\] \[\text{Put Option Price} = K \cdot e ^{- r \cdot t} \cdot N(- d_{2}) - S \cdot e ^{- q \cdot t} \cdot N(- d_{1})\]Where S is the stock price, K is the strike price, r is the risk free rate, q is the dividend yield, σ is the volatility, t is the time to expiration, N(d1) is the cumulative normal distribution of d1 and N(d2) is the the cumulative normal distribution of d2.
In which the Implied Volatility is then calculated as follows:
\[\text{Implied Volatility} = \operatorname{MINIMIZE}(\text{Black Scholes Theoretical Price} - \text{Actual Option Price})\]To determine the Implied Volatility, the Black Scholes Model is used to calculate the theoretical option price in which sigma (σ) is the only unknown variable. The actual option price is then used to determine the implied volatility by minimizing the difference between the theoretical and actual option price.
Also known as: IV, option-implied volatility.
No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Implied Volatility for you. Just ask in plain English.
Calculate the Implied Volatility in Python
The Implied Volatility is available in the Options module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_implied_volatility as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["MSFT", "AAPL"], api_key="FINANCIAL_MODELING_PREP_KEY")
implied_volatility = toolkit.options.get_implied_volatility()
implied_volatility.loc['AAPL']
Which returns:
| 2024-02-09 | |
|---|---|
| 162.5 | 0.2828 |
| 165 | 1.0238 |
| 167.5 | 0.7867 |
| 170 | 0.6984 |
| 172.5 | 0.6796 |
| 175 | 0.4611 |
| 177.5 | 0.4423 |
| 180 | 0.4154 |
| 182.5 | 0.3541 |
| 185 | 0.3506 |
| 187.5 | 0.3331 |
| 190 | 0.3329 |
| 192.5 | 0.3411 |
| 195 | 0.361 |
| 197.5 | 0.3833 |
| 200 | 0.4033 |
| 202.5 | 0.4477 |
| 205 | 0.4452 |
| 207.5 | 0.518 |
Parameters
get_implied_volatility accepts the following parameters:
- expiration_date (str | None, optional): The expiration date to use for the calculation. Defaults to None which means it will use the most recent expiration date.
- put_option (bool, optional): Whether to calculate the put option price. Defaults to False which means it will calculate the call option price.
- risk_free_rate (float, optional): The risk free rate to use for the calculation. Defaults to None which means it will use the current risk free rate.
- dividend_yield (float, optional): The dividend yield to use for the calculation. Defaults to None which means it will use the dividend yield as obtained through annual historical data.
- show_expiration_dates (bool, optional): Whether to show the expiration dates. Defaults to False.
- show_input_info (bool, optional): Whether to show the input information. Defaults to False.
- rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
- standardize (bool, optional): Whether to standardize (Z-Score) the result across the time to expiration columns for each ticker and strike price. Defaults to False.
Related Option Pricing
The Options module page introduces the module, and the sidebar lists all of its functions.