Black_Scholes#
Functions
|
Calculates a temporal series of stock prices using the Black Scholes log normal model and the generated Brownian motion |
- simulate_Black_Scholes(S0, mu, sigma, T, dt) DataFrame [source]#
Calculates a temporal series of stock prices using the Black Scholes log normal model and the generated Brownian motion
stock_price_simulation = simulate_Black_Scholes(S0, mu, sigma, T, dt)
- Parameters:
S0 – integer, specifying the initial value of the underlying asset
mu – float, specifying the drift rate of the underlying asset
sigma – float, standard deviation of the underlying asset’s return
T – integer, specifying the maximum modeling time. ex. if T = 2 then modelling time will run from 0 to 2
dt – float, specifying the length of each subinterval. ex. dt=10, then there will be 10 intervals of length 0.1 between two integers of modeling time
- Returns:
stock_price_simulation = N x 2 pandas DataFrame where index is modeling time and values are a realisation of the uderlying’s price
Example
Model the price of a stock whitch is worth today 100. The market has a future annualized risk free rate of 5% and an annualized volatility of 30%. The user is interested in a price projection for the next 10 years in increments of 6 months (0.5 years):
>>> simulate_Black_Scholes(100, 0.05, 0.3, 10, 0.5) Time Stock Price 0.0 100.000000 0.5 131.721286 1.0 124.924654 1.5 209.302935 2.0 222.085955 2.5 208.085678 3.0 165.550253 3.5 239.512165 4.0 176.886669 4.5 148.687363 5.0 181.235262 5.5 164.280753 6.0 172.861576 6.5 170.698562 7.0 141.613940 7.5 121.070316 8.0 116.508183 8.5 104.524616 9.0 146.124924 9.5 202.368581 10.0 262.282989
For more information see https://en.wikipedia.org/wiki/Black%E2%80%93Scholes_model