Calculate the Black Scholes Model, a mathematical model used to estimate the price of European-style options.

The Black Scholes Model is a mathematical model used to estimate the price of European-style options. It is widely used by traders and investors to determine the theoretical value of an option, and to assess the potential risks and rewards of a position.

Within Risk Management, defining the theoretical value of an option is important to assess the potential risk and rewards of an option position. A position that could be used to hedge a portfolio, for example, is a long put option. The theoretical value of this option can be used to determine the potential risk and rewards of this position.

The Black Scholes Model is based on several assumptions, including the following:

  • The option is European and can only be exercised at expiration.
  • The underlying stock follows a lognormal distribution.
  • The risk-free rate and volatility of the underlying stock are known and constant.
  • The returns on the underlying stock are normally distributed.

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.

Also known as: BSM, Black-Scholes-Merton, option pricing model.

No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Black Scholes Model for you. Just ask in plain English.

Calculate the Black Scholes Model in Python

The Black Scholes Model is available in the Options module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_black_scholes_model as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(["AMZN", "AAPL"], api_key="FINANCIAL_MODELING_PREP_KEY")

black_scholes = toolkit.options.get_black_scholes_model()

black_scholes.loc['AMZN']

Which returns:

Strike Price 2024-01-12 2024-01-13 2024-01-14 2024-01-15 2024-01-16 2024-01-17 2024-01-18 2024-01-19 2024-01-20 2024-01-21 2024-01-22 2024-01-23 2024-01-24 2024-01-25 2024-01-26 2024-01-27 2024-01-28 2024-01-29 2024-01-30 2024-01-31 2024-02-01 2024-02-02 2024-02-03 2024-02-04 2024-02-05 2024-02-06 2024-02-07 2024-02-08 2024-02-09
115 40.1925 40.2051 40.2176 40.2301 40.2427 40.2552 40.2677 40.2803 40.2928 40.3053 40.3179 40.3304 40.3429 40.3554 40.3679 40.3805 40.393 40.4055 40.4181 40.4306 40.4432 40.4558 40.4684 40.4811 40.4938 40.5065 40.5193 40.5322 40.5451
120 35.1931 35.2062 35.2192 35.2323 35.2454 35.2585 35.2716 35.2846 35.2977 35.3108 35.3239 35.3369 35.35 35.3631 35.3762 35.3894 35.4026 35.4158 35.4292 35.4426 35.4561 35.4697 35.4834 35.4973 35.5113 35.5255 35.5399 35.5544 35.5691
125 30.1936 30.2073 30.2209 30.2345 30.2481 30.2618 30.2754 30.289 30.3026 30.3163 30.33 30.3438 30.3576 30.3716 30.3858 30.4001 30.4147 30.4296 30.4447 30.4602 30.476 30.4921 30.5087 30.5256 30.5429 30.5606 30.5787 30.5972 30.6161
130 25.1942 25.2083 25.2225 25.2367 25.2509 25.265 25.2793 25.2936 25.3081 25.3229 25.3381 25.3537 25.3699 25.3866 25.4041 25.4223 25.4412 25.4609 25.4814 25.5026 25.5246 25.5474 25.571 25.5952 25.6202 25.6459 25.6723 25.6993 25.7269
135 20.1947 20.2094 20.2242 20.2389 20.2538 20.2691 20.2851 20.3022 20.3206 20.3405 20.3619 20.385 20.4098 20.4363 20.4643 20.4938 20.5248 20.5572 20.5908 20.6257 20.6617 20.6987 20.7367 20.7756 20.8153 20.8558 20.897 20.9388 20.9813
140 15.1953 15.2105 15.2261 15.2432 15.2631 15.2869 15.3149 15.3471 15.3834 15.4233 15.4664 15.5125 15.5611 15.6119 15.6645 15.7189 15.7747 15.8317 15.8898 15.9488 16.0085 16.0689 16.1299 16.1913 16.2531 16.3152 16.3776 16.4402 16.5029
145 10.1958 10.2147 10.2456 10.2916 10.3506 10.4194 10.4956 10.5769 10.662 10.7497 10.8392 10.9299 11.0213 11.113 11.2049 11.2967 11.3882 11.4794 11.5701 11.6603 11.75 11.839 11.9275 12.0153 12.1024 12.1889 12.2747 12.3598 12.4443
150 5.2213 5.3527 5.52 5.6952 5.8693 6.0395 6.2047 6.3647 6.5198 6.6702 6.8162 6.9581 7.0962 7.2308 7.3621 7.4903 7.6157 7.7384 7.8586 7.9765 8.0921 8.2056 8.3172 8.4268 8.5347 8.6409 8.7455 8.8485 8.9501
155 1.1757 1.6286 1.9783 2.2744 2.5363 2.7739 2.9931 3.1976 3.3902 3.5728 3.7469 3.9136 4.0737 4.2282 4.3775 4.5221 4.6626 4.7991 4.9322 5.062 5.1888 5.3128 5.4341 5.5531 5.6697 5.7842 5.8966 6.0071 6.1158
160 0.0437 0.2013 0.3903 0.5823 0.77 0.9513 1.1259 1.2942 1.4565 1.6133 1.7651 1.9124 2.0554 2.1946 2.3302 2.4624 2.5916 2.7179 2.8416 2.9627 3.0814 3.198 3.3124 3.4249 3.5355 3.6443 3.7514 3.8569 3.9608
165 0.0001 0.0081 0.0378 0.0889 0.1563 0.235 0.3213 0.413 0.5081 0.6055 0.7043 0.804 0.9039 1.0039 1.1036 1.2029 1.3017 1.3999 1.4974 1.5941 1.69 1.7852 1.8795 1.973 2.0657 2.1576 2.2487 2.339 2.4285
170 0 0.0001 0.0017 0.0079 0.0208 0.0412 0.0689 0.103 0.143 0.1879 0.237 0.2897 0.3454 0.4037 0.4641 0.5263 0.59 0.6549 0.721 0.7878 0.8555 0.9237 0.9923 1.0614 1.1307 1.2003 1.27 1.3398 1.4096

Parameters

get_black_scholes_model 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.
  • put_option (bool, optional): Whether to calculate the put option price. Defaults to False which means it will calculate the call option price.
  • 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 dividend yield as obtained through annual historical data.
  • 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.

The Options module page introduces the module, and the sidebar lists all of its functions.

Share