Application Center - Maplesoft

App Preview:

Black-Scholes Model

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Image 

Black-Scholes Model 

? Maplesoft, a division of Waterloo Maple Inc., 2008 

Model Overview 

Analytic Solution 

Monte Carlo Simulation 

Differential Equations 

Plot_2d 

In this application, we compute the option price using three different methods. The first method is to derive the analytical solution to the option price based on the classical Black-Scholes model. Next, we compute the option price through Monte Carlo simulation based on the Black-Scholes model for stock price estimation.  Finally, we use the Black-Scholes differential equation model to estimate the option price. 

Overview of the Model 

We consider the classical Black-Scholes model with single risky asset that follows a geometric Brownian motion 

 

 

 

where (W[t], `>=`(t, 0)) is a standard Brownian motion, `>=`(sigma, 0) is the constant volatility, `>=`(r, 0) is the constant risk-free rate and `>=`(S[0], 0) is the initial asset price. Under these conditions, for any the stock price S[t] is given by the following formula. 

 

S[t] = `*`(S[0], `*`(`^`(e, `+`(`*`(`+`(r, `-`(`*`(`/`(1, 2), `*`(`^`(sigma, 2))))), `*`(t)), `σW`[t])))) 

We consider a security with time to maturity T and the payoff function.   

`:=`(P, proc (S, K) options operator, arrow; piecewise(`<`(K, S), 1, `<=`(S, K), 0) end proc); -1 

 

Payoff of the form P(S) = piecewise(`>`(S, K), 1, `<=`(S, K), 0) corresponds to a digital call options with strike price, K. 

We will consider several methods for computing the price of this security. 

Parameters 

Embedded component 

Embedded component 

Embedded component 

Embedded component 

Embedded component 

Analytic Solution  

 

`:=`(_EnvStatisticsRandomVariableName, Phi); -1 

`:=`(U, Statistics:-RandomVariable(LogNormal(`*`(`+`(r, `-`(`*`(`/`(1, 2), `*`(`^`(sigma, 2))))), `*`(T)), `*`(sigma, `*`(sqrt(T)))))); -1 

S[T] can be represented in the form 

`:=`(S[T], `*`(S[0], `*`(U))) 

`*`(S[0], `*`(_R)) (2.1)
 

where Phi is a lognormal random variable with parameters T(`+`(r, `-`(`*`(`/`(1, 2), `*`(`^`(sigma, 2)))))) and `*`(sigma, `*`(sqrt(T))). 

 

The price of this option can be computed as the discounted expected payoff of the option 

 

`*`(exp(`+`(`-`(`*`(r, `*`(T))))), `*`(`𝔼`(P(S[T])))) 

 

`:=`(P_analytic, P(S[T], K)) 

piecewise(`<`(K, `*`(S[0], `*`(_R))), 1, `<=`(`*`(S[0], `*`(_R)), K), 0) (2.2)
 

`:=`(V_analytic, `assuming`([`*`(exp(`+`(`-`(`*`(r, `*`(T))))), `*`(Statistics:-ExpectedValue(P_analytic)))], [`>`(r, 0), `>`(sigma, 0), `>`(S[0], 0), `>`(K, 0), `>`(T, 0)])); -1 

V_analytic 

`*`(exp(`+`(`-`(`*`(r, `*`(T))))), `*`(`+`(`*`(`/`(1, 2), `*`(erf(`+`(`/`(`*`(`/`(1, 4), `*`(`^`(2, `/`(1, 2)), `*`(`+`(`-`(`*`(2, `*`(ln(K)))), `*`(2, `*`(ln(S[0]))), `*`(2, `*`(r, `*`(T))), `-`(`*`(... (2.3)
 

Analytic Price 

Calculate Option Price 

Embedded component 

 

We can use the analytic result to study the various market sensitivities. For example, we can symbolically compute the delta of our option. 

`:=`(Delta, diff(V_analytic, S[0])) 

`+`(`/`(`*`(`/`(1, 2), `*`(exp(`+`(`-`(`*`(r, `*`(T))))), `*`(exp(`+`(`-`(`/`(`*`(`/`(1, 8), `*`(`^`(`+`(`-`(`*`(2, `*`(ln(K)))), `*`(2, `*`(ln(S[0]))), `*`(2, `*`(r, `*`(T))), `-`(`*`(`^`(sigma, 2), ... (2.4)
 

 

Here is a formula for the Gamma. 

`:=`(_GAMMA, factor(diff(Delta, S[0]))) 

`+`(`-`(`/`(`*`(`/`(1, 4), `*`(exp(`+`(`-`(`*`(r, `*`(T))))), `*`(exp(`+`(`-`(`/`(`*`(`/`(1, 8), `*`(`^`(`+`(`-`(`*`(2, `*`(ln(K)))), `*`(2, `*`(ln(S[0]))), `*`(2, `*`(r, `*`(T))), `-`(`*`(`^`(sigma, ... (2.5)
 

 

We can also use the symbolic formula to plot the option price as a function of the parameters.  

Embedded component 

Plot Option Price 

Monte Carlo Simulation 

Alternatively, we can estimate the expectation using Monte Carlo simulation to compute the option price. The discrete-time version of the model is 

 

S[`+`(t, h)] = `*`(S[t], `*`(Phi)) 

where h = `/`(1, `*`(N)), and Phi is drawn from the lognormal distribution with parameters `*`(`+`(r, `-`(`*`(`/`(1, 2), `*`(`^`(s, 2))))), `*`(h)) and `*`(sigma, `*`(sqrt(h))). We can use this expression to generate a sample path for the price of our risky asset. 

 

Simulating Stock Prices 

Generate Sample 

Embedded componentEmbedded component 

*please be patient, it may take a few seconds to generate a sample 

Number of Replications 

Embedded component 

Number of Updates 

Embedded component 

 

 

 

Note: We know the distribution of the final stock price. To compute the option price, we need only to simulate the final stock price, and not the whole stock path. 

 

We can verify the above analytic result using Monte Carlo simulation. 

 

Monte Carlo Simulation 

Number of Replications 

Option Price 

Embedded component 

Embedded component 

Standard Error 

Embedded component 

Compute Option Price 

 

Differential Equations 

 

Finally, we can use the Black-Scholes differential equations to compute the option price. 

 

`:=`(DE, `+`(diff(V(S, t), t), `*`(r, `*`(S, `*`(diff(V(S, t), S)))), `*`(`/`(1, 2), `*`(`^`(sigma, 2), `*`(`^`(S, 2), `*`(diff(V(S, t), S, S)))))) = `*`(r, `*`(V(S, t)))) 

`+`(diff(V(S, t), t), `*`(r, `*`(S, `*`(diff(V(S, t), S)))), `*`(`/`(1, 2), `*`(`^`(sigma, 2), `*`(`^`(S, 2), `*`(diff(diff(V(S, t), S), S)))))) = `*`(r, `*`(V(S, t))) (4.1)
 

The key boundary condition is: 

 

`:=`(BC1, V(S, T) = P(S, K)) 

V(S, T) = piecewise(`<`(K, S), 1, `<=`(S, K), 0) (4.2)
 

Another obvious condition: 

 

`:=`(BC2, V(0, t) = 0) 

V(0, t) = 0 (4.3)
 

Finally, if `≫`(S[t], K) for some `<`(t, T), then it holds with a high probability that `≫`(S[T], K). Our option will thus be exercised and produce cash flow `*`(P(`+`(S[T], `-`(K))), `*`(`≈P`(S[T]))) 

`:=`(BC3, V(`*`(2, 100), t) = 1) 

V(200, t) = 1 (4.4)
 

Numeric PDE Solver 

Space Step 

Time Step 

Embedded component 

Embedded component 

Compute Option Price 

Option Price 

Embedded component