Partial Derivative
Calculate the partial derivative of an option based on the Black Scholes Model. The Black Scholes Model is a mathematical model used to estimate the price of European-style options. The partial derivative is the rate of change of the option price with respect to the strike price.
Note that this uses a single, flat assumed volatility (the same value at every strike price) rather than the market’s actual implied volatility smile. This means it is NOT the Breeden-Litzenberger risk-neutral density – with a flat volatility input the second derivative can only ever recover a lognormal density, regardless of what the real market smile looks like, which defeats the entire purpose of that theorem. For the actual market-implied (smile-consistent) risk-neutral density, see get_risk_neutral_density, which uses this same second-derivative relationship but applied to a volatility surface calibrated to real market option prices instead of a flat assumption.
The formula is as follows:
\[\text{Partial Derivative} (\text{PD}) = e ^{- r \cdot t} \cdot (1 / K) \cdot (1 / \sqrt{2 \cdot \pi \cdot \sigma ^{2} \cdot t}) \cdot e ^{- (1 / (2 \cdot \sigma ^{2} \cdot t)) \cdot (\ln(K / S) - ((r - q) - (0.5 \cdot \sigma ^{2})) \cdot t) ^{2}}\]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 and t is the time to expiration. This expression is algebraically identical to e^(-r * t) * N’(d2) / (K * σ * sqrt(t)), i.e. to the Dual Gamma, since both are the second derivative of the option price with respect to the strike price.
Also known as: numerical derivative, option sensitivity.
Partial Derivative in Python
get_partial_derivative is part of the Options module of the open-source Finance Toolkit. Install it with:
pip install financetoolkit -U
Then call get_partial_derivative as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["AAPL", "ASML"], api_key="FINANCIAL_MODELING_PREP_KEY")
toolkit.options.get_partial_derivative().loc["AAPL"]
Which returns:
| Strike Price | 2026-07-24 | 2026-07-25 | 2026-07-26 | 2026-07-27 | 2026-07-28 | 2026-07-29 | 2026-07-30 | 2026-07-31 |
|---|---|---|---|---|---|---|---|---|
| 335 | 0.0084 | 0.0085 | 0.0085 | 0.0086 | 0.0087 | 0.0087 | 0.0088 | 0.0088 |
| 340 | 0.0061 | 0.0062 | 0.0064 | 0.0065 | 0.0066 | 0.0067 | 0.0068 | 0.0069 |
| 345 | 0.0042 | 0.0044 | 0.0046 | 0.0047 | 0.0048 | 0.005 | 0.0051 | 0.0052 |
| 350 | 0.0028 | 0.003 | 0.0031 | 0.0033 | 0.0034 | 0.0036 | 0.0037 | 0.0038 |
| 355 | 0.0018 | 0.0019 | 0.0021 | 0.0022 | 0.0023 | 0.0025 | 0.0026 | 0.0027 |
| 360 | 0.0011 | 0.0012 | 0.0013 | 0.0014 | 0.0015 | 0.0016 | 0.0018 | 0.0019 |
| 365 | 0.0006 | 0.0007 | 0.0008 | 0.0009 | 0.001 | 0.0011 | 0.0012 | 0.0012 |
| 370 | 0.0004 | 0.0004 | 0.0005 | 0.0005 | 0.0006 | 0.0007 | 0.0007 | 0.0008 |
| 375 | 0.0002 | 0.0002 | 0.0003 | 0.0003 | 0.0004 | 0.0004 | 0.0005 | 0.0005 |
| 380 | 0.0001 | 0.0001 | 0.0002 | 0.0002 | 0.0002 | 0.0002 | 0.0003 | 0.0003 |
Parameters
get_partial_derivative accepts the following parameters:
- start_date (str | None, optional): The start date which determines the stock price. Defaults to None which means it will use the most recent date.
- strike_price_range (float): The percentage range to use for the strike prices. Defaults to 0.25 which equals 25% and thus results in strike prices from 75 to 125 if the current stock price is 100.
- strike_step_size (int): The step size to use for the strike prices. Defaults to 5 which means that the strike prices will be 75, 80, 85, 90, 95, 100, 105, 110, 115 and 120 if the current stock price is 100.
- expiration_time_range (int): The number of days to use for the time to expiration. Defaults to 30 which equals 30 days.
- 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 current dividend yield.
- 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.