The black_scholes function implements the Black-Scholes-Merton model, which is
widely used to price European call and put options on non-dividend paying
stocks. This model provides not only the option price but also key risk
sensitivities ("Greeks"), including Delta, Gamma, Vega, Theta, and Rho.
The formula for the option pricing and the calculation of the Greeks depend on
several factors including the current stock price (S), the strike price (K),
time to expiration (T), the risk-free interest rate (r), and volatility
(sigma). The function returns a dictionary of the calculated option
price and Greeks, rounded to two decimal places.
Key Assumptions of the Black-Scholes Model
Efficient Markets: the model assumes that markets are
efficient, meaning that there are no arbitrage opportunities. Prices move in
a continuous and random manner, reflecting all available information.
Lognormal Distribution of Stock Prices: The Black-Scholes
model assumes that the underlying asset price follows a lognormal
distribution. This implies that stock prices can’t fall below zero and have
a skewed distribution, with more potential for upward movement than downward
movement.
Constant Risk-Free Rate: The risk-free interest rate (r) is
assumed to be constant throughout the life of the option. This means that
there are no significant changes in monetary policy or other factors
affecting risk-free returns over the option's duration
Constant Volatility: The volatility (sigma) of the
underlying asset is assumed to be constant during the life of the option.
Volatility represents the asset's price fluctuation, and in the real world,
this assumption is often considered one of the major limitations of the
Black-Scholes model
European Option Style: The model assumes the option is
European-style, meaning it can only be exercised at the expiration date.
This differs from American-style options, which can be exercised at any
point before or at expiration.
No Dividends: The model assumes the underlying asset does
not pay dividends during the life of the option. This is a key limitation,
as many real-world assets, such as stocks, do pay dividends.
Function Parameters
S: Current price of the underlying asset.
K: Strike price of the option.
T: Time to expiration in years.
r: Risk-free interest rate
σ: Volatility of the underlying asset (annualized standard
deviation of the asset’s returns).
Option type: The type of option, either 'call' or 'put'
Explanation of Key Calculations
d1 and d2: These values are intermediate variables used in
the calculation of both the option price and the Greeks. They represent the
standard deviations (adjusted by time) from the current price to the strike
price under the lognormal assumption