Monte Carlo Simulation for European Call Option
Zheng-Liang Lu
Department of Computer Science and Information Engineering National Taiwan University
January 9, 2020
Introduction
• We invent new financial instruments to hedge the risk of holding assets, which are volatile from time to time.
• The central question of financial engineering
1is, “What is the fair price of one instrument?”
• The key idea is very simple: no free lunch.
2• We first inscribe the price behavior by stochastic processes.
• In particular, we assume that the return rate of one stock is a Brownian motion
3.
1See https://en.wikipedia.org/wiki/Financial_engineering and https://en.wikipedia.org/wiki/Rocket_science_in_finance.
2See https://en.wikipedia.org/wiki/Arbitrage.
3See https://en.wikipedia.org/wiki/Brownian_motion.
Zheng-Liang Lu 1
Brownian Motion
• The stock price S
tfollows dS
tS
t= µdt + σdW
t, (1)
where µ is the annual return rate, σ is the annualized volatility, and W
tis a Wiener process.
4• By the Itˆ o calculus, the solution of Equation (1) is S
t+1= S
te
(µ−12σ2)∆t+σ√
∆tZt
, where ∆t is the time interval and Z
t∼ N(0, 1).
4See https://en.wikipedia.org/wiki/Wiener_process.
Zheng-Liang Lu 2
1 clear; clc; close all;
2
3 s0 = 100; mu = 0.05; v = 0.2;
4 T = 1; n = 252; dt = T / n;
5
6 A = (mu - 0.5 * v ˆ 2) * dt;
7 B = v * sqrt(dt);
8
9 figure; grid on; hold on;
10 for i = 1 : 50 % 50 price paths
11 ds = exp(A + B * randn(1, n));
12 S = s0 * cumprod([1 , ds]);
13 plot([0 : n] + today, S);
14 end
15 xlabel("Date"); ylabel("Closed price");
16 datetick("x", 29); axis tight;
• Use cumprod to calculate the cumulative product.
• Use datetick and assign dates to the x axis.
Zheng-Liang Lu 3
2020-01-01 2020-04-01 2020-07-01 Date
80 100 120 140 160 180
Closed price
Zheng-Liang Lu 4
European Call Option
6• A European option is an option that can only be exercised at the strike price X at maturity time T .
• If the asset follows Equation (1) with the spot price S
0, then the call price c is
c = e
−rTE
Q[ (S
T− X )
+],
where r is the risk-free interest rate and E(·) is the expected value of the payoff function (S
T− X )
+under the risk-neutral probability measure Q.
55Also see https://en.wikipedia.org/wiki/Black_Scholes_model#
Black_Scholes_formula.
6Black and Scholes (1972) and Merton (1973). Merton and Scholes received the 1997 Nobel Memorial Prize in Economic Sciences for their work.
Zheng-Liang Lu 5
1 clear; clc; close all;
2
3 s0 = 100; mu = 0.05;
4 v = 0.2; T = 1; n = 1e5;
5 A = (mu - 0.5 * v ˆ 2) * T;
6 B = v * sqrt(T);
7 ST = s0 * exp(A + B * randn(1, n));
8
9 histogram(ST, 20, "binmethod", "integer", ...
10 "Normalization", "probability");
11 xlabel("Price");
12 ylabel("Probability density");
13 hold on; grid on;
14
15 X = 100; % strike price
16 line([X, X], [0, 0.025], "color", "red");
17 legend({"Stock price at time T", "Strike price"});
Zheng-Liang Lu 6
40 60 80 100 120 140 160 180 200 220 240 Price
0 0.005 0.01 0.015 0.02 0.025
Probability density
Stock price at time T Strike price
Zheng-Liang Lu 7
1 ...
2
3 % MC simulation
4 c = 0;
5 for i = 1 : n
6 ST = s0 * exp(A + B * randn(1));
7 if ST > X
8 c = c + ST - X;
9 end
10 end
11 c = exp(-mu * T) * c / n
12
13 % built-in function: see Financial Toolbox
14 blsprice(s0, X, mu, T, v)
• The simulation produces the call price about 10.4579 while the Black-Scholes formula gives us the call price 10.4506.
Zheng-Liang Lu 8
Vectorized Version
1 clear; clc;
2
3 s0 = 100; X = 100; mu = 0.05;
4 v = 0.2; T = 1; n = 1e6;
5 A = (mu - 0.5 * v ˆ 2) * T;
6 B = v * sqrt(T);
7 ST = s0 * exp(A + B * randn(1, n));
8
9 % MC simulation by vectorization
10 c = exp(-mu * T) * sum(ST(ST > X) - X) / n
Zheng-Liang Lu 9