Killed Diffusion
Killed Diffusion
St
Ku
S0
Kl
Contents
1 Killed diffusion, simulation schemes, what are we talking about? 2
1.1 Getting started – why? . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Deriving the path-dependent options cost under Black-Scholes . . . 3
3 Simulations 9
3.1 Programming choices . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Payoffs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3 Killed diffusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3.4 Convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1
References 13
Appendices 14
In this study, we implement two numerical schemes for stochastic differential equa-
tions where the diffusion stops if it escapes from a defined domain. Theoretical
results are given and sketches of the proofs are highlighted. We apply these re-
sults to a quantitative finance problem: the pricing of path-dependent option, in
particular we play with an up-and-out call and a double no-touch call. The code
is made public and accessible in a GitHub repository.
With τ := inf{t > 0 : Xt ∈ / D}, this leads to the computation of E [1T <τ f (XT )] .
The direct application in finance is with barrier and digital options that pay re-
spectively the underlying asset, one unit of a specified currency, conditional on the
barrier levels not having been broken.
Barrier options are either up, down, and in, out: an up-and-out barrier option
with barrier B leads to the boundary condition V (B, t) = 0 ∀t ≤ T. With D =
(−∞, B], the risk-neutral evaluation of the up-and-out call gives a price at time t:
h RT i
Cup−out = EQ e− t rs ds (ST − K)+ 1T <τ |Ft
Similarly, we can define an up-and-in call option using D = [B, +∞), usually with
S0 ≥ B. Note that if K ≥ B, the option simply becomes a vanilla call option of
strike K and maturity T .
For simplicity, we write E(.) as the expectation taken under risk-neutral measure
Q.
2
Overall, being able to study such payoffs opens the realm of barrier options
as well as no-touch and one-touch options that are some path-dependent binary
options – the payoff is either $1M or $0 based on a condition (e.g. the EURUSD
price remained under 1.087 up until maturity of the option) being filled: these are
high leverage speculative instruments that can lead to significant gains for those
who master their use.
The paper implements two discretisation schemes to price such payoffs using Monte
Carlo methods: a continuous Euler scheme and a discrete Euler scheme. We will
be implementing those algorithms and running a set of experiments to evaluate
the claims of the paper: do we actually observe a o(N −1 ) convergence for the
continuous scheme while only a o(N −1/2 ) for the discrete scheme? How do the
simulation prices compare to the theoretical closed-form formulas under Black-
Scholes dynamics?
For all barrier options, an arbitrage argument gives the following parity formula
between the prices of barrier options and vanilla call and put options:
where the price of the European call, resp. put option with strike price K are
obtained from the Black-Scholes formula. Consequently, in what follows we will
only compute the prices of the up-and-out barrier call.
M0T = max Su
0≤u≤T
Proposition 1.0.1. When K ≤ B, the price of the up-and-out barrier call option
with maturity T , strike price K and (upper) barrier level B is given by:
3
h i
e−(T −t)r E (ST − K)+ 1{M T <B } | Ft =
0
St
1{M0t <B} Bl (St , K, r, T − t, σ) − St 1{M0t <B} Φ δ+ T −t
B
2r/σ2 2
B B B
−B 1{M0t <B} Φ δ+ T −t
− Φ δ+ T −t
St KS St
t
St
+ e−(T −t)r K 1{M t <B } Φ δ− T −t
0 B
1−2r/σ2 2
St B B
+e −(T −t)r
K 1{M0t <B} Φ δ− T −t T −t
− Φ δ− .
B KSt St
where
σ2
τ 1
δ± (s) = √ log s + r ± τ , s>0
σ τ 2
Note that the price of the up-and-out barrier call option vanishes when B ≤ K.
Note also that as B → ∞, the price of the up-and-out barrier call option converges
to the price of the European call option:
h i
−(T −t)r
E (ST − K) 1{M T <B } | Ft = e−(T −t)r E (ST − K)+ | Ft
+
lim e
B→∞ 0
T −t St T −t St
= St Φ δ+ − KΦ δ−
K K
Proof. See A
Proposition 1.0.2. Price of a double no-touch option with lower and upper bar-
riers Smin , Smax :
α ∞
(1 − (−1)m e−αH ) 1 2 n2 π 2
S β(T −t)
X nπ S
V (S, t) = 2π e n 2 H 2 + n2 π 2
exp − σ 2
t sin ln ,
Smin n=1
α 2 H H S min
Proof. See B
4
2 Monte Carlo methods
Our objective is to estimate E [1T <τ f (XT )], as seen before. Let us introduce a
more general diffusion than the Black-Scholes model, the Itô diffusion, as used in
the article of Emmanuel Gobet:
Let (Xt )t≥0 be the Itô diffusion taking its values in Rd defined by
Z t Z t
Xt = x + B (Xs ) ds + σ (Xs ) dWs
0 0
′
where (Wt )t≥0 is a Brownian motion in Rd . Let τ := inf {t > 0 : Xt ∈
/ D} be its
d
first exit time from the open set D ⊂ R .
In the case of our barrier option, we can take D = (−∞, b), where b is the barrier
level. We can also take D = (a, +∞), or D = (a, b), where a and b are the lower
and upper barriers, respectively, in the case of a double no-touch barrier option.
Using the theory of Monte Carlo numerical methods for the Stochastic Differential
Equation (SDE) with a first exit time, we can estimate the price of a barrier option.
We can use the Euler scheme, which is a simple and efficient method to simulate
the diffusion process.
The question remains: shall we use a discrete or continuous Euler scheme? The
continuous Euler scheme is more accurate, but it is more difficult to simulate the
first exit time from the open set D. Indeed between two time steps the diffusion
can still unfortunately exit the domain.
2.1 Methods
1. Discrete Euler scheme
X̃0 = x
X̃ti+1 = X̃ti + B X̃ti T /N + σ X̃ti Wti+1 − Wti
5
The simulation involves simulation
N independent Gaussian variables for the
increments Wti+1 − Wti 0≤i≤N −1 .
Introducing a more complex scheme, our goal is to refine the discrete Euler
scheme by considering a modified stopping time τ̃c , which is the first exit
time from the open set D for the continuous Euler scheme.
X̃t shall be defined as:
ti ≤t≤ti+1
X̃t = X̃ti + B X̃ti (t − ti ) + σ X̃ti (Wt − Wti ) , for ti ≤ t < ti+1 , 1
Between two time steps, the diffusion can still exit the domain. From a
simulation standpoint, Gobet suggests
drawing N additional independent
Bernoulli variables to simulate if X̃t has left D between two dis-
0≤t≤T
cretization times or not. Each parameter involved for the simulation of the
Bernoulli variables is related to the quantity
P ∀t ∈ [ti , ti+1 ] X̃t ∈ D|X̃ti = z1 , X̃ti+1 = z2 := p (z1 , z2 , T /N )
+∞
k(b − a) (k(b − a) + z2 − z1 )
p (z1 , z2 , ∆) =1b>z1 >a 1b>z2 >a 1 −
X
exp −2
k=−∞
σ 2 (z1 ) ∆
(k(b − a) + z1 − b) (k(b − a) + z2 − b)
− exp −2 .
σ 2 (z1 ) ∆
2
see [RY13], p. 105, for instance
6
2.2 Theoretical results
Let us introduce the following (weak) convergence errors for the two respective
schemes:
h i
Ec (f, T, x, N ) := Ex 1T <τ̃c f X̃T − Ex [1T <τ f (XT )]
h i
Ed (f, T, x, N ) := Ex 1T <τ̃d f X̃T − Ex [1T <τ f (XT )]
(C) : Px ∃t ∈ [0, T ] Xt ∈
/ D; ∀t ∈ [0, T ] Xt ∈ D̄ = 0
Ec (f, T, x, N ) = CN −1 + o N −1
7
• for the discrete Euler scheme:
Ed (f, T, x, N ) = O N −1/2
2.2.3 Theorems
We make some reasonable assumptions on the regularity of the coefficients of the
diffusion process, the smoothness of the survival domain, and the payoff function.
These allow us to bound the error functions, at the rate N −1 for the continuous
scheme and the rate N −1/2 for the discrete scheme.
For instance:
h i h i
Ec (f, T, x, N ) =Ex 1T <τ̃c f X̃T − Ex v (T − T /N ) ∧ τ̃c , X̃(T −T /N )∧τ̃c
h i h i
+ Ex v (T − T /N ) ∧ τ̃c , X̃(T −T /N )∧τ̃c − Ex v 0, X̃0
:=C1 (N ) + C2 (N )
and C1 will yield a contribution of the order O(N −3/2 ) while C2 will be broken
down between two other error terms, one having a dominating contribution of the
order O(N −1 ) – this involves applying Itô’s formula and the Bernstein inequality
for martingales.
8
3 Simulations
3.1 Programming choices
To implement the different schemes and run the Monte Carlo pricers, we mainly
need to do a lot of additions and multiplications, and a way to generate realisations
from a standard normal distribution, thus a random number generator. For those
reasons, we decided to implement the code in C++, to scale the number of simu-
lations without triggering impatience issues... and to expose the main functions in
Python so they can be used in a notebook for instance, and produce visualisations
quickly and easily.
Figure 1: The killed diffusion module and available functions exposed in Python
For the simulations, we will consider the following set of parameters in a constant
drift and volatility Black-Scholes framework:
• S0 = 100
• K = 100
• r = 5%
• T =1
• σ = 0.22
• lower barrier L = 80
Throughout the analysis of the results, we call ”MC” the discrete naive scheme
while we use the name ”MC - Gobet” for the continuous scheme.
9
3.2 Payoffs
Vanilla option price - Classic european call with strike K = 100
MC
50 BS
40
30
20
10
0
60 80 100 120 140
The Monte Carlo price from a discrete scheme matches very closely the theoretical
price for this vanilla call.
Now, let’s visualize the difference between classic Monte Carlo estimators using the
discrete Euler scheme and the refinement introduced by Emmanuel Gobet using
the law of some Brownian bridge to model the evolution between two increments.
Barrier option price - Call up-and-out with strike K = 100, barrier B = 120
1.2
MC
1.0 MC - Gobet
BS
0.8
0.6
0.4
0.2
0.0
60 80 100 120 140
The Gobet continuous scheme appears more accurate than a ”naive” Monte
Carlo pricer: indeed, the option is path-dependent and the discrete scheme leaves
out some possibilities to get the diffusion killed, overestimating the survival prob-
ability of the diffusion leads to an inflated price.
We observe that the price is lower than for a vanilla call option: of course
if the barrier is hit the option expires worthless. This product is interesting as it
gives a different exposure than the vanilla call: there is limited upside so a trader
might also express a more detailed view on volatility when buying this cheaper
option.
Still, we observe that despite a high number of simulations and a reasonable dis-
cretization stepsize, the Monte Carlo price lacks regularity (the MC price gravi-
tates around the theoretical price): if we were to be the seller of such an option, we
would build a confidence interval around a given price by running the pricer several
times (one instance of the Gobet method takes a little less than half a second on
our personal machines) and price this uncertainty in the spread we would charge
10
to the potential buyer – and we certainly would not choose a geometric brownian
motion dynamic for the underlying asset.
Double no-touch option price with barriers L = 80, B = 120
0.30 MC
MC - Gobet
0.25 BS
0.20
0.15
0.10
0.05
0.00
60 80 100 120 140
Here we can make the same remarks as above: the continuous scheme appears to
match better the theoretical price, while the discrete scheme does not account for
potential death of the diffusion in-between two time-steps.
Here, we see that the ATM double no-touch option would roughly pay 4-to-1, pro-
vided that the underlying asset remains between $80 and $120 during the whole
year, knowing the asset has an annualized volatility of 22%.
As we can see, the probability of hitting the barrier between two consecutive time
steps rapidly grows, as the diffusion comes closer to the barrier. This contribution
to the killing likelihood of the diffusion is what drives the price a bit down compared
to the discrete scheme. We plot only up to the point of stopping time, i.e. exactly
where we kill the diffusion when the barrier is hit.
11
3.4 Convergence
Error between the MC price and the theoretical price
101
100
Error (log scale)
10 1
10 2
Monte Carlo d(f, T, x, N)
10 3 Fit (N ), -0.519
Monte Carlo - Gobet c(f, T, x, N)
10 4 Fit (N ), -0.876
100 101 102 103
(N) Number of time steps (log scale)
To achieve this view, we sampled the two different errors by running our Monte
Carlo methods using logarithmic scaling with base 1.5. This allowed to obtain
estimates with varying values of N ranging from 1 to roughly 2000 discretization
time steps.
Note that we retrieve the convergence results of section 2. for both discrete and
continuous Euler schemes. Using a linear regression on a log scale we found em-
pirical rates of convergence that roughly match the one from the paper for the
respective errors:
In the case of our up-and-out barrier call option, f is defined as x 7→ (x − K)+ , for
the double no-touch option it simply is x 7→ 1, or any amount that the counterparty
agrees to pay upon meeting the staying in-between the barriers during the lifetime
of the option condition.
12
References
[Gob00] Emmanuel Gobet. “Weak approximation of killed diffusion using Euler
schemes”. In: Stochastic processes and their applications 87.2 (2000),
pp. 167–197.
[EMT02] Stefan Ebenfeld, Matthias R Mayr, and Jurgen Topper. “An analysis
of onion options and double-no-touch digitals”. In: Wilmott (2002),
pp. 68–77.
[RY13] Daniel Revuz and Marc Yor. Continuous martingales and Brownian
motion. Vol. 293. Springer Science & Business Media, 2013.
13
Appendices
A Call up-and-out price derivation
3
Proof.
Let’s take a deep breath and expand the barrier replication cost:
h i
e−(T −t)r E (ST − K)+ 1{M T <B } | Ft
0
h i
= e−(T −t)r E (ST − K)+ 1{M t <B } 1{M T <B } | Ft
0 t
−(T −t)r
1{M0t <B} E (ST − K) 1 {Maxt≤r≤T Sr < B} | Ft
+
=e
Since, 1{M t <B } is Ft -measurable, we can take it out of the expectation. We then
0
have:
" + #
ST
= e−(T −t)r 1{M t <B } E x −K 1nx Maxt≤r≤T Sr >Bo
0 St St
x=St
In the case of the Black-Scholes model, we have an explicit expression for the
2
diffusion: SSrt = e(r−σ /2)(r−t)+σ(Wr −Wt )
" + #
ST −t
= e−(T −t)r 1{M t <B } E x −K 1nx Max0≤r≤T −t Sr <Bo .
0 S0 S0
+ n o
=e −(T −t)r
1{M0t <B} E xe σW
fT −t
−K 1 x Max0≤r≤T −t e
σW
fr
<B .
x=St
ft = Wt + µt and µ := − 2r−σ2 .
where W 2σ
We have:
3
This proof is inspired by what is highlighted in https://personal.ntu.edu.sg/nprivault/
MA5182/barrier-options.pdf
14
h i h n o n oi
E (ST − K)+ 1{M T <B } = E S0 eσWT − K 1 S0 e σWT >K } 1 S0 eσX0 < B
f f bT
0
Z ∞Z ∞
= (S0 eσy − K) 1{S0 eσy >K} 1{S0 eσx <B} dP X b T ≤ x, W
0
fT ≤ y
Z−∞
∞ Z−∞
∞
= (S0 eσy − K) 1{σy>log(K/S0 )} 1{σx<log(B/S0 )} φXbT ,W
fT (x, y)dxdy
−∞ −∞
Z ∞Z ∞
= (S0 eσy − K) 1{σy>log(K/S0 )} 1{σx<log(B/S0 )} 1{y∨0<x}
−∞ −∞
× φXbT ,W
fT (x, y)dxdy
r Z σ−1 log(B/S ) Z σ−1 log(B/S )
1 2 0 0
where φM0T ,ST is the joint probability density function of M0T , ST , which satisfies
Z x Z y
M0T
P ≤ x and ST ≤ y = φM0T ,ST (u, v)dudv, x, y ≥ 0.
0 0
Z b Z b
2x(y−x)/T
(2x − y)e dx = (2x − y)e2x(y−x)/T dx
a a
T 2x(y−x)/T x=b
=− e x=a
2
T 2a(y−a)/T
− e2b(y−b)/T
= e
2
T 2(y∨0)(y−y∨0)/T
− e2b(y−b)/T
= e
2
T
1 − e2b(y−b)/T
=
2
15
h i
E (ST − K)+ 1{M T <B } =
0
2 b
e−µ T /2
Z
2
(S0 eσy − K) eµy−y /(2T ) 1 − e2b(y−b)/T dy =
√
2πT c
Z b
−µ2 T /2 1 2
e(σ+µ)y−y /(2T ) 1 − e2b(y−b)/T dy
S0 e √
2πT c
Z b
−µ2 T /2 1 2
eµy−y /(2T ) 1 − e2b(y−b)/T dy =
− Ke √
2πT c
Z b
−µ2 T /2 1 2
S0 e √ e(σ+µ)y−y /(2T ) dy
2πT c
Z b
−µ2 T /2−2b2 /T 1 2
− S0 e √ e(σ+µ+2b/T )y−y /(2T ) dy
2πT c
Z b
2 1 2
− Ke−µ T /2 √ eµy−y /(2T ) dy
2πT c
Z b
−µ2 T /2−2b2 /T 1 2
+ Ke √ e(µ+2b/T )y−y /(2T ) dy.
2πT c
h i
e−rT E (ST − K)+ 1{M T <B } =
0
−(r+µ2 /2)T +(σ+µ)2 T /2 −c + (σ + µ)T −b + (σ + µ)T
S0 e Φ √ −Φ √
T T
−S0 e−(r+µ /2)T −2b /T +(σ+µ+2b/T ) T /2
2 2 2
−c + (σ + µ + 2b/T )T −b + (σ + µ + 2b/T )T
× Φ √ −Φ √
T T
−c + µT −b + µT
− Ke−rT Φ √ −Φ √
T T
−(r+µ2 /2)T −2b2 /T +(µ+2b/T )2 T /2
+ Ke
−c + (µ + 2b/T )T −b + (µ + 2b/T )T
× Φ √ −Φ √
T T
T S0 T S0
= S0 Φ δ+ − Φ δ+
K B
2
−(r+µ2 /2)T −2b2 /T +(σ+µ+2b/T )2 T /2 T B T B
− S0 e Φ δ+ − Φ δ+
KS0 S0
S0 S0
− Ke−rT Φ δ− T
− Φ δ− T
K B
2
−(r+µ2 /2)T −2b2 T +(µ+2b/T )2 T /2 B B
+ Ke Φ δ− − Φ δ− ,
KS0 S0
T
0 ≤ x ≤ B, where δ± (s) is defined above.
16
2
µ2 b2 T
r σ
2b 2r B
−T r + −2 + σ+µ+ = 2b + = 1 + 2 log ,
2 T 2 T σ 2 σ S0
and
2
µ2 b2 T
2b 2r B
−T r + −2 + µ+ = −rT + 2µb = −rT + −1 + 2 log
2 T 2 T σ S0
this yields:
S0 S0
−rT
E (ST − K) 1
∗ +
M0T T T
e <B = S0 Φ δ+ − Φ δ+
K B
S0 S0
− e−rT K Φ δ− T
− Φ δ−T
K B
2r/σ2 2
B T B T B
−B Φ δ+ − Φ δ+
S0 KS0 S0
1−2r/σ2 2
−rT S0 T B T B
+e K Φ δ− − Φ δ−
B KS0 S0
T S0 T S0
= S0 Φ δ+ − Φ δ+
K B
1+2r/σ2 2
B T B T B
− S0 Φ δ+ − Φ δ+
S0 KS0 S0
S0 S0
− e−rT K Φ δ− T
− Φ δ−T
K B
1−2r/σ2 2
−rT S0 T B T B
+e K Φ δ− − Φ δ−
B KS0 S0
In log-space with Xt = log (St /S0 ), with the transformation V (X, t) = eαX+β(T −t) U (X, t),
the convenient α = −r̃/σ 2 and β = −r̃/2σ 2 − r, r̃ = r − 12 σ 2 , we get the heat
equation:
∂U 1 ∂ 2U
+ σ2 = 0.
∂t 2 ∂X 2
17
The conditions stemming from the double no-touch option payoff now are: U (0, t) =
U (H, t) = 0, with H = ln BL for 0 ≤ t ≤ T , and terminal condition U (X, T ) =
e−αX .
Plugging this into the heat equation solved by U gives a first order differential
2 2
n π
equation verified by the coefficients An , thus An (t) = an exp σ 2 t
2H 2
To find an expression for the little an ’s, we use the identity:
RH nπ mπ 1
S S
0
sin ln Smin
sin ln Smin
= Hδn,m , with δn,m the Kronecker delta.
H H 2
We find out that for each m ∈ N∗ ,
2 2
1 2n π mπH
am exp σ 2
t = 2 2 (1 − (−1)m e−αH ).
2 2H α H + m2 π 2
Plugging everything back in, we get the theoretical price for a double no-touch
barrier under Black-Scholes dynamics:
α ∞
(1 − (−1)m e−αH ) 1 2 n2 π 2
S β(T −t)
X nπ S
V (S, t) = 2π e n exp − σ t sin ln ,
Smin n=1
α 2 H 2 + n2 π 2 2 H2 H Smin
Here, we are happy as this is (almost, except to notations choices) what is given
in [EMT02].
18