-
APPLICATIONS OF STOCHASTIC CALCULUS TO FINANCIAL
MODELING
BEN RAPPORT
Abstract. Following a brief discussion of measure theory and
probability, weintroduce stochastic processes, specifically
Brownian motion, as mathematicalmodels of randomness. Building upon
this foundation, we derive fundamentalresults of Itô Calculus and
use these results to solve Stochastic Di↵erentialEquations (SDEs).
Alongside no-arbitrage arguments, we employ these toolsto reproduce
the Black-Scholes-Merton (BSM) option pricing model and theMargrabe
Formula. We conclude by discussing Monte Carlo methods as ameans of
simulating stochastic processes.
Contents
1. Introduction 12. Review of Measure Theory and Probability 23.
Stochastic Processes 44. Itô Calculus 55. Stochastic Di↵erential
Equations 96. Applications to Financial Modeling 117. Stochastic
Simulation 16Acknowledgments 19References 19Appendix 20
1. Introduction
Most real world processes contain elements of randomness. In
specific contexts,the impact of this randomness can be disregarded
because of its small relativemagnitude. However, in other contexts,
this randomness is essential to describing aprocess’ evolution.
These random, or stochastic, processes are di�cult to model us-ing
traditional calculus techniques as most of these processes form
non-di↵erentiablepaths. In an e↵ort to translate traditional
calculus techniques and theory into thestochastic setting, Kiyosi
Itô developed Itô Calculus to provide these random pro-cesses
with a rigorous formalization. Itô Calculus retained many
properties fromtraditional calculus while adding key new
constructions, chief among them the ItôIntegral and Itô’s
Formula. These two results, which produce the stochastic
refor-mulations of integration and the chain rule respectively,
have major applicationsthroughout applied mathematics.
Date: AUGUST 29, 2020.
1
-
2 BEN RAPPORT
In modern finance stochastic processes are used to model price
movements ofsecurities in the stock market. One of the earliest
pricing models, the BSM model,produces a PDE which describes how
the value of an option changes over time inan arbitrage-free
market. For European options, the solution to this
di↵erentialequation can be written as a closed-form expression in
which the characteristics ofthe underlying asset can be explicitly
observed and interpreted. Many years later,William Margrabe built
upon this model and derived a more general version of thisPDE that
applies to a broader range of instruments and derivatives.
In this paper, we will begin with a brief review of measure
theory and some basicprobabilistic concepts. We will then give a
formalized introduction to stochasticprocesses and discuss some
pertinent properties of Brownian motion. Using thisknowledge as our
foundation, we will then begin our treatment of Itô Calculus
inwhich we will derive the Itô Formula and explore stochastic
di↵erential equations asa means to model financial instruments that
depend on random price movements.Finally, we will consider the
application of these models and review some numericalmethods for
simulating the stochastic behavior of more complex derivatives.
2. Review of Measure Theory and Probability
To begin this paper, we introduce several measure-theoretic and
probabilisticdefinitions and concepts for consideration – many of
which can be found in [1]. Wedenote ⌦ to be the outcome space, the
set of all possible outcomes, for a givenprocedure. For example,
the outcome space for a singular die roll is given by⌦ = {1, 2, 3,
4, 5, 6}.
Definitions 2.1. Let ⌦ be given. Then a �-algebra F on ⌦ is a
family of subsetsof ⌦ such that
(1) ; 2 F(2) F 2 F =) F C 2 F , where F C = ⌦ \ F is the
compliment of F in ⌦
(3) A1, A2, ... 2 F =) A :=1Si=1
Ai 2 F
The pair (⌦,F) is called a measurable space. For any U =Si
Fi ⇢ ⌦, we define
HU :=\
{H;H is a �-algebra of ⌦ such that U ⇢ H}
to be the �-algebra generated by U . As is shown in [1], HU is
also the smallest�-algebra which contains U . The Borel �-algebra B
is the �-algebra generated bythe collection of all open subsets of
Rn. A Borel set is an element B 2 B.
Definitions 2.2. We define a probability measure on (⌦,F) to be
the functionP : F ! [0, 1] with the following properties:
(1) P (;) = 1� P (⌦) = 0
(2) if A1, A2, ... 2 F and Ai \Aj = ; for all i 6= j, then P
(1Si=1
Ai) =1Pi=1
P (Ai)
A probability space is a triple (⌦,F , P ).
Definitions 2.3. Given a probability space (⌦,F , P ), a set F
is F-measurable ifF 2 F . A function f : ⌦ ! Rn is said to be
F-measurable if for all open setsU 2 Rn we have that
f�1(U) := {! 2 ⌦; f(!) 2 U} 2 F .
-
APPLICATIONS OF STOCHASTIC CALCULUS TO FINANCIAL MODELING 3
Definitions 2.4. A random variable on (⌦,F , P ) is an
F-measurable functionX : ⌦ ! Rn. The �-algebra generated by the
random variable X is given byHX = {X�1(B);B 2 B}. For any random
variable, X, we define its distributionto be µX(B) :=P (X�1(B)) = P
(X 2 B) where B is a Borel set.
Definitions 2.5. A collection of measurable sets {Fi} is
independent if
P (F1 \ F2 \ ... \ Fn) = P (F1) · P (F2) · · · P (Fn).
Suppose X1, X2, ... , Xn are random variables on (⌦,F , P ). The
collection of ran-dom variables {X1, X2, ... , Xn} is independent
if the collection of their generated�-algebras {HX1 ,HX2 , ...
,HXn} is independent.
Remark 2.6. Any two elements of an independent set are
independent. Thus, if{X1, X2, ... , Xn} is independent, then X1 and
X2 are independent.
Definitions 2.7. Let X be a random variable which assumes values
in Rn. IfZ
⌦
|X(!)|dP (!) < 1, then E[X] :=
Z
⌦
X(!)dP (!) =
Z
Rn
xdµX(x)
where E[X] is the expectation of X. If f : Rn ! R is
B-measurable andZ
⌦
|f(X(!))|dP (!) < 1, then E[f(X)] :=
Z
⌦
f(X(!))dP (!) =
Z
Rn
f(x)dµX(x) .
If H ⇢ F is a �-algebra, then the conditional expectation of X
given H, writtenas E[X|H], is a function from ⌦ to Rn satisfying
the following two properties:
(1) E[X|H] is H measurable(2)
R
H
E[X|H] dP =R
H
XdP , for all H 2 H
The variance of X is defined as V ar[X] := E[X2]� [E[X]]2 = E[(X
� E[X])2].
Proposition 2.8. For conciseness, we will now present several
properties of ex-pectation and variance. Their proofs can be found
in [2]. Suppose X is given asabove. Let a, b 2 R, H 2 F and Y : ⌦ !
Rn be another random variable such thatE[|Y |] < 1. We then
observe
(1) E[aX + bY |H] = aE[X|H] + bE[Y |H](2) E[E[X|H]] = E[X](3)
E[X|H] = X if X is H-measurable.(4) E[X|H] = E[X] if X and H are
independent.(5) V ar[aX + b] = a2V ar[X]
Definition 2.9. The cumulative distribution function (CDF) of a
random vari-able X is the function FX : Rn ! [0, 1] where FX(x) = P
(X x) = µX( x). Arandom variable is said to be continuous if its
CDF is continuous.
Definition 2.10. Let X be a continuous random variable X : ⌦ !
R. If thereexists a function f : R ! [0, 1] such that
FX(x) =
Zx
�1f(t)dt ,
then f(x) is the density function of X.
-
4 BEN RAPPORT
Definitions 2.11. A normally distributed random variable X : ⌦ !
R withE[X] = µ and Var[X] = �2 has cumulative distribution
function
(2.12) FX(b) =
bZ
�1
1
�p2⇡
· e�(x�µ)2
2�2 dx .
For such a random variable we write X ⇠ N(µ,�2). A random
variable Z is saidto have lognormal distribution if log(Z) ⇠
N(µ,�2). A random variable Y is saidto have standard normal
distribution if Y ⇠ N(0, 1). The standard normal CDFand density
function are given by
�(b) = FY (b) =
bZ
�1
1p2⇡
· e�x2
2 dx =
bZ
�1
f(x) dx .
3. Stochastic Processes
While it is possible to model randomness in higher dimensions,
in this paper wewill focus exclusively on 1-D models, in particular
1-D Brownian motion.
Definition 3.1. A stochastic process in (⌦,F , P ) over an
interval T is a param-eterized collection of random variables
{Xt(!)}t2T where X : T ⇥ ⌦ ! R.
Definition 3.2. A filtration on (⌦,F) is an increasing sequence
of �-algebrasK = {Ft}t�0 such that for all s 2 [0, t) we have that
Fs ⇢ Ft ⇢ F .
Remark 3.3. Let K = {Ft}t�0 be a filtration and f : T ⇥ ⌦ ! R be
a randomvariable on (⌦,F , P ). A process {ft(!)}t�0 is Ft-adapted
if ft(!) is Ft-measurablefor every t � 0. We define the natural
filtration of a process {Xt(!)}t�0 to be thecollection of
�-algebras {Ft} generated by {Xt(!)}t�0. It follows that a
stochasticprocess is adapted with respect to its natural
filtration.
Definition 3.4. A martingale in (⌦,F , P ) is an Ft-adapted
stochastic process{Mt}t�0 with the following properties:
(1) E[|Mt|] < 1 for all t � 0(2) E[Ms|Ft] = Mt for all s � t,
which implies E[Ms �Mt|Ft] = 0
Remark 3.5. Consider a game whose value at time t is modeled by
a martingale,Mt. Over any interval, the expected change in value,
or return, of the game is 0. Assuch, the second martingale property
is often refered to as the fair game property.
Definition 3.6. We define a Brownian motion about the origin
with drift µ andvariance �2 to be the stochastic process {Bt(!)}t�0
for which
(1) B0 = 0(2) For s < t, the random variable Y (t,!) = Bt(!)
� Bs(!) is normally dis-
tributed with E[Y ] = µ(t� s) and V ar[Y ] = �2(t� s)(3) If s
< t, then the random variable Y = Bt(!) � Bs(!) is independent
of
the natural filtration of {Bp(!)}s�p�0 (Independent
Increments)(4) P [B : T ⇥ ! ! Bt(!) is continous with respect to t]
= 1
A Brownian motion is standard if it has drift ⌘ 0 and variance ⌘
1. From this defi-nition, it can be shown that a standard Brownian
motion Bt is a Gaussian processand thus
(3.7) E[eiu(Bt�Bs)] = e�u2(t�s)
2 for u 2 R and i =p�1 .
-
APPLICATIONS OF STOCHASTIC CALCULUS TO FINANCIAL MODELING 5
Given its continuous nature, Brownian motion can be thought of
as a random path.
Remark 3.8. Any Brownian motion Wt about the origin with drift µ
and variance�2 may be described by Wt = µt + �Bt, where Bt is
standard Brownian motion.Given this fact, Bt will be used to
represent standard Brownian motion from thispoint onward.
Examples 3.9. Let (⌦,F , P ) be given. It follows from
Proposition 2.8 that
E[(Bt �Bs)2] = E[(Bt �Bs)
2� E[(Bt �Bs)]
2] = V ar[(Bt �Bs)] = t� s .
Often we will compute E[(Btj+1 �Btj )2] which, as shown above,
equals tj+1 � tj .
Moreover, for s � t > 0, we observe
E[Bs|Ft] = E[Bs �Bt|Ft] + E[Bt|Ft] = Bt.
Through manipulations of (2.12) it can be shown that E[|Bt|]
< 1 for all t, at whichpoint we may conclude that standard
Brownian motion is in fact a martingale. Astandard Brownian motion
may thus be thought of as a fair game whose varianceover an
interval T is exactly the length of that interval.
Proposition 3.10. E[(Bt�Bs)4] = 3(t�s)2. A proof can be found in
the Appendix.
4. Itô Calculus
Before we begin our treatement of Itô Calculus, we must first
establish a classof functions for which these concepts can be
applied.
Definition 4.1. A function f(t,!) : [0,1)⇥ ⌦ ! R is nice on [S,
T ) if
(1) (t,!) ! f(t,!) is B ⇥ ⌦-measurable (B := Borel � �
algebra)(2) f(t,!) is Ft-adapted
(3) E[RT
S(f(t,!))2 dt] < 1
(4) P [RT
S(f(t,!))2 dt < 1] = 1, for any probability measure P
The last condition is stricter than necesary, but saves space.
Additonally, a nicefunction is said to be elementary if it has the
form �(t,!) =
Pjej(!) ·1{tj ,tj+1}(t).
Similarly,RT
S�(t,!) dBt(!) :=
Pjej(!) ·�Bj . The notation �Bj is used exten-
sively in this section and assumes the existence of a partition
⇡ = {to, .., tn}. Forany stochastic process we denote �Xj := Xtj+1
�Xtj , and �tj := tj+1 � tj .
Definition 4.2. Suppose u(t,!), v(t,!) are nice on [0,1). We
define an Itô processto be the stochastic process {Xt}t�0 in (⌦,F
, P ) which satisfies
(4.3) X0 2 R, dXt = u(t,!)dt+ v(t,!)dBt for t � 0 .
Theorem 4.4 (The Itô Isometry for Elementary Functions). Let
�(t,!) be abounded elementary function. Then
(4.5) E[(
ZT
S
�(t,!) dBt(!))2] = E[(
ZT
S
�(t,!)2 dt)] .
-
6 BEN RAPPORT
Proof. Observe, if i 6= j, then E[ei · ej ·�Bj ·�Bi] = E[ei · ej
·�Bi] ·E[�Bj ] = 0because Brownian motion has independent
increments. Hence,
E[(
ZT
S
�(t,!) dBt(!))2] = E[(
X
j
ej(!) ·�Bj)(X
i
ei(!) ·�Bi)]
=X
i,j
E[ej · ei ·�Bj ·�Bi]
=X
j
E[e2j(!) · (�Bj)
2]
=X
j
E[e2j(!)] · (�tj)
= E[
ZT
S
�(t,!)2 dt] as needed. ⇤
We will now present the Itô Integral and give an outline of its
proof, noting thesimilarities in construction to the Lebesgue and
Riemann Integrals. The followingoutline derives from the proof
given in [1].
Theorem 4.6 (The Itô Integral). Let f be a nice function on [S,
T ). Then the ItôIntegral over that interval is
(4.7) I[f ](w) :=
ZT
S
f(t,!) dBt(!) = limn!1
ZT
S
�n(t,!) dBt(!)
where {�n} is a sequence of elementary functions for which
(4.8) E[
ZT
S
(f(t,!)� �n(t,!))2 dt] ! 0 as n ! 1 .
Proof. In the same way step functions are used to approximate
bounded functionsin the derivation of the Riemann Integral, the
Itô Integral uses elementary nicefunctions to approximate nice
functions. In doing so, we will generate a sequenceof elementary
functions which satisfy (4.8). The first step of the proof is to
approx-imate nice functions using a sequence of bounded nice
functions. Specifically, forany nice function f , we must produce a
sequence {hn} of bounded nice functionssuch that
E[
ZT
S
(f � hn(t,!))2 dt] ! 0 as n ! 1 .
Next, we replicate this process to show that any bounded nice
function can beapproximated by a sequence of bounded and continuous
nice functions. Finally, wewould show that any bounded and
continuous nice function can be approximatedby a sequence of
elementary nice functions. It then follows that this sequence
ofelementary nice functions {�n} yields the desired convergence in
expectation. Wethus define the Itô Integral of f on (S, T ) as
I[f ](w) :=
ZT
S
f(t,!) dBt(!) = limn!1
ZT
S
�n(t,!) dBt(!) ,
where the convergence of the rightmost expression follows from
the Itô Isometryand the convergence of Cauchy sequences. ⇤
-
APPLICATIONS OF STOCHASTIC CALCULUS TO FINANCIAL MODELING 7
A corollary to Theorem 4.4 found in [1] extends the Itô
Isometry from elementaryfunctions to all nice functions and will be
used in later theorems. Moreover, giventhis construction, it
follows that the Itô process given by (4.3) is also described
by
Xt = X0 +
Zt
0u(s,!)ds+
Zt
0v(s,!)dBs .
Lemma 4.9. Let f(s,!) be a nice function on [0, t) and define fj
= f(sj ,!). Then
as �sj ! 0, we observeP
jfj · (�Bj)2 !
Pjfj ·�sj =
Rt
0 fj ds .
Proof. Following from analysis presented in the Itô Isometry,
we find that if i 6= j,then ((�Bi)2 � �ti) and (fi)(fj)((�Bj)2 �
�tj) are independent, and thus theexpectation of their product is
0. Following from the construction of the Itô Integral,we
compute
E[(X
j
fj(�Bj)2�
X
j
fj�tj)2] = E[
X
j,i
fjfi((�Bj)2��tj)((�Bi)
2��ti)] .
Next, we expand the square, recall (3.10), use the independence
argument presentedabove, and observe
E[X
j
f2j· ((�Bj)
2��tj)
2] = E[X
j
f2j· ((�Bj)
4� 2(�Bj)
2(�tj) + (�tj)2)]
=X
j
E[f2j] · E[(�Bj)
4� 2(�Bj)
2(�tj) + (�tj)2]
=X
j
E[f2j] · (3(�tj)
2� 2(�tj)
2 + (�tj)2)
=X
j
E[f2j] · (2(�tj)
2) ! 0
as �tj ! 0 given that f is nice. ⇤
Setting f ⌘ 1, this proof illustrates a fundamental construction
of Itô Calculus:(dBt)2 = dt. Another important computation is
revealed in the final line; as �tj !0, the summation
Pj(�tj)2 ! 0. Similarly, as we will show in (4.15) and
(4.16),
as �tj ! 0, the summationP
j(�tj)(�Bj) ! 0. This is expressed in di↵erential
notation through the equations (dt)2 = 0 and (dt)(dBt) = 0.
Theorem 4.10 (Itô’s Formula). Let Xt be an Itô process.
Suppose g(t, x) 2C2([0,1) ⇥ R). Then Yt = g(t,Xt) is also an Itô
process which satisfies the fol-lowing Stochastic Di↵erential
Equation
(4.11) dYt = @tg(t,Xt)dt+ @xg(t,Xt)dXt +1
2@xxg(t,Xt)(dXt)
2 .
Proof. By Taylor’s Theorem, we may rewrite Yt = g(t,Xt) as
(4.12) g(t,Xt) = g(0, X0) +X
j
-
8 BEN RAPPORT
where Rj is the remainder term of each polynomial. We then
demonstrate thedesired result (4.11) by evaluating each summation
separately. As �tj ! 0, weobserve that
(4.13)X
j
-
APPLICATIONS OF STOCHASTIC CALCULUS TO FINANCIAL MODELING 9
Recalling that (dXs)2 = u2(ds)2 + 2uv(dBs)(ds) + v2(dBs)2 =
v2ds, we findZ
t
0d(g) =
Zt
0
@g
@sds+
Zt
0
@g
@xdXs +
1
2
Zt
0
@2g
@x2(dXs)
2 .
Therefore we concluded(Yt) = d(g(t,Xt))
=
✓@g(t,Xt)
@t+
v2(t,!)
2·@2g(t,Xt)
@x2
◆dt+
@g(t,Xt)
@xdXt
=@g(t,Xt)
@tdt+
@g(t,Xt)
@xdXt +
1
2
@2g(t,Xt)
@x2(dXt)
2 is an Itô process. ⇤
For our proof of the Margrabe Formula in the Applications to
Financial Modelingsection, we use the 2-dimensional interpretation
of the Itô Formula. The followingdefinition and theorem can be
found in [1].
Definition 4.17. Let µi,�i be nice functions (i 2 (1, 2)). We
define a 2-dimensionalItô process to be
dXt =
(dXt = µ1(t,!)dt+ �1(t,!)dBtdYt = µ2(t,!)dt+ �2(t,!)dWt
where Bt and Wt are both 1-dimensional standard Brownian
motions.
Theorem 4.18. Let dXt be a 2-dimensional Itô process as defined
above and letg(t,Xt) = g(t,Xt, Yt) be a C2 map g : [0,1]⇥R2 ! R.
Then Yt = g(t,Xt) is alsoan Itô process which satisfies
(4.19) dYt = @tg(t,Xt)dt+ @xg(t,Xt)dXt + @yg(t,Xt)dYt +
1
2[@xxg(t,Xt)(dXt)
2 + 2@xyg(t,Xt)(dXt)(dYt) + @yyg(t,Xt)(dYt)2] .
5. Stochastic Differential Equations
While we will not discuss di↵erential equations in depth, we
present some exam-ples of common SDEs in mathematical finance and
their solutions. We will focusprimarily on Itô processes.
Example 5.1. Let Xt be an Itô process satisfying
dXt = µtXtdt+ �tdBt where µt = µ(t,Xt), �t = �(t,Xt) 2
C2([0,1)⇥R)
To solve this SDE we multiply both sides of the equality by an
integrating factor:
e�µttdXt = e�µtt(µtXtdt+ �tdBt) .
Thus, letting g(t,Xt) = e�µttXt = Yt, we apply Itô’s Formula to
obtain
d(Yt) = �µte�µttXtdt+ e
�µttdXt + 0 · (dXt)2 .
Substituting dXt into d(Yt), we find
d(Yt) = �e�µttµtXtdt+ e
�µttµtXtdt+ e�µtt�tdBt .
Therefore d(e�µttXt) = e�µtt�tdBt, and thusRT
0 d(e�µttXt) =
RT
0 e�µtt�tdBt.
Solving this integral we find e�µTTXT �X0 =RT
0 e�µtt�tdBt and equivalently
XT = X0eµTT +
ZT
0e(µTT�µtt)�tdBt .
-
10 BEN RAPPORT
The above example is a variation of the famous
Ornstein-Uhlenbleck equation.Altering this equation slightly, we
get the di↵erential equation for Geometric Brown-ian motion (GBM).
Because GBM is a strictly positive stochastic processes (Xt >
0for all t assuming X0 > 0) and has lognormal distribution, it
is used extensively tomodel financial market behaviors. We show the
derivation of its solution below.
Example 5.2. Let Xt be a stochastic process satisfying the
following SDE:
dXt = Xt[µtdt+ �tdBt] µt = µ(t,Xt), �t = �(t,Xt) 2
C2([0,1)⇥R)
We solve this SDE via careful selection of g. Let g(t,Xt) =
ln(Xt) = Yt . Hence,
d(Yt) =1
XtdXt �
1
2(Xt)2(dXt)
2
= µtdt+ �tdBt �1
2[µtdt+ �tdBt]
2
= µtdt+ �tdBt �1
2[(µt)
2(dt)2 + 2µt�t(dt)(dBt) + �t2(dBt)
2]
= (µt �1
2�t
2)dt+ �tdBt .
Integrating both sides of this expression we observe
ln(XT /Xt) =
ZT
t
d(Ys)
=
ZT
t
(µs �1
2�s
2)ds+
ZT
t
�sdBs
Consequently, we derive XT = XteR Tt (µs�
12�s
2)ds+R Tt �sdBs . If µ and � are constants
in R, then we define the stochastic process {XT }T�t to be a
Geometric Brownianmotion with drift µ and variance �2. For such a
Brownian motion we claim
XT = Xte[(T�t)(µ� 12�
2)+�(BT�Bt)]
= Xte[(T�t)(µ� 12�
2)+�pT�t·Y ]
(5.3)
where Y ⇠ N(0, 1). As such, we compute the conditional
expectation
E[XT |Ft] = E[Xte[(T�t)(µ� 12�
2)+�pT�t·Y ]
|Ft]
= Xte(T�t)(µ� 12�
2)· E[e�
pT�t·Y
|Ft]
= Xte(T�t)(µ� 12�
2)· e
12�
2(T�t)
= Xteµ(T�t) .
(5.4)
Lastly, let Z = (T � t)(µ � 12�2) + �
pT � t · Y = log(XT
Xt). We then assert that
E[Z] = (µ� �2
2 )(T � t) and V ar[Z] = �2(T � t). It follows that
Z = log(XTXt
) ⇠ N((µ��2
2)(T � t),�
p
T � t) ;
hence, we claim that XT has lognormal distribution.
-
APPLICATIONS OF STOCHASTIC CALCULUS TO FINANCIAL MODELING 11
6. Applications to Financial Modeling
The stochastic modeling techniques developed in the previous
sections are readilyapplied to finance. A security x is an object
which has value V (x) = X and canbe bought and sold. An asset is a
security whose change in value can be describedusing SDEs. A
derivative of an asset is a security whose value is a function of
timeand the asset’s value. A market, M , is the set of all
securities. The risk-free rateis a security whose value Rt is a
function of time and the other securities in themarket X̄t.
Formally, the risk free rate is modeled by R0 = 1, dRt =
r(t,Xt)Rtdt
and equivalently RT = Rt · eR Tt r(s,Xs) ds for T > t �
0.
A portfolio is an allocation in a market given by ✓ = {ai},
where ai 2 R. In thisway, a portfolio can be thought of as a
quantity of each security in a market. Astrategy is an algorithm
which buys and sells securities in a market, thus generatinga
collection of portfolios {✓t}. The value of a portfolio at time t,
is the sum of thevalues of its securities and is denoted V (✓t) =
✓t·Xt =
PaitXi
twhereXt = (Rt, X̄t).
The return of a portfolio over an interval [t, T ] is given by V
(✓T )� V (✓t).A strategy inM is an arbitrage when P [V (✓T ) > V
(✓t)(1+
RTRt
)] = 1. Conversely,a market is arbitrage-free when no strategy
can be an arbitrage. In this way, we canthink of an arbitrage-free
market as a market in which the risk-free rate o↵ers thebest
guaranteed return. Finally, a portfolio is self-financing if dV
(✓t) =
PiaitdXi
t.
Definition 6.1. A trading space is a pair (M , ✓) for which
(1) The market M is arbitrage-free and includes the risk-free
rate.(2) Every portfolio ✓ is self-financing.(3) Securities in the
market can be bought and sold at any time (Continuity).(4) Asset
values in the market are modeled by GBM.
Remark. The value of an asset in a trading space can also be
thought of as its price.For such an asset Xt, we describe the
instantaneous change of its price as dXt.
One common example of a financial derivative is an option. Given
an asset xwith value Xt, an x-option grants its owner the ability
to buy 1 unit of x at aspecific point in time, or over a specific
time interval, for a fixed price K.1 Noticethat an option grants
its owner the right to buy the underlying asset, but does
notobligate its owner to buy the asset – the owner of the option
may choose NOT tobuy the asset. A European option is an option
wherein the owner of the option hasthe right to buy the underlying
asset only at a specific point in time T .2
Suppose we want to sell an option, but do not want to be exposed
to risk. Wemust derive a strategy such that at time T , the value
of our portfolio is guaranteedto be greater than or equal to the
value of the option which we sell. This strategyis derived via the
Black-Scholes-Merton equation and is shown below.
1 The derivative refered to as an option throughout this paper
is more specifically known asa call-option. Likewise, a put-option
grants its owner the ability to sell 1 unit of a security at
aspecific point in time, or over a specific time interval, for a
fixed price K.
2 Options are often used in the financial services industry as
insurance contracts. For example,suppose that one asset made up a
large percentage of our portfolio. This being the case, we
mightwant to purchase a put-option so that if the asset were to
dramatically decrease in value, we wouldstill retain a baseline
value of K.
-
12 BEN RAPPORT
Theorem 6.2 (Black-Scholes-Merton Equation). Let T = (M, ✓) be a
trading spacewith an asset y, whose price is given by {St}. Suppose
f(t, St) 2 T is the price of ay-option whose value at time T is
given by f(T, ST ) = F (ST ) = max(ST �K, O),for K 2 R fixed. Then
for x = x(t) = St
(6.3) @tf(t, x) = r(t, x)(f(t, x)� x@xf(t, x))�(�(t, x))2x2
2@xxf(t, x) .
Proof. The BSM strategy {✓t} first sells an option at time 0 for
a price f(0, S0).Simultaneously, the strategy creates a portfolio,
✓0, allocated between the risk-freerate and the asset y, such that
V (✓0) = f(0, S0) = a10R0 + a
20S0. For t 2 [0, T ], the
strategy generates {✓t} such that the value of the portfolio at
time T satisfies
(6.4) P [V (✓T ) � F (ST )] = 1 .
The above inequality asserts that at time T the BSM strategy
produces a portfolio✓T with value greater than or equal to the
value of the sold option almost surely.Due to the arbitrage-free
nature of a trading space, we refine (6.4) as follows.For the sake
of contradiction, suppose that there exists a strategy {✓⇤
t} given by
✓⇤t= (b1
t, b2
t, 0) such that P [V (✓T ) > F (ST )] = 1. Now consider the
strategy {✓0t}
given by ✓0t= (b1
t, b2
t,�1). We would then observe
P [V (✓0T) = V (✓T )� F (ST ) > f(0, S0)� V (✓0) = V (✓
00) = 0] = 1
implying that P [V (✓0T)� V (✓00) > V (✓
00)(1 +RT ) = 0] = 1 .
This result would indicate that {✓0t} is an arbitrage,
contradicting the arbitrage-free
nature of a trading space. Hence, we assert that for t 2 [0, T ]
the strategy mustgenerate {✓t} such that
(6.5) P [V (✓T ) = F (ST )] = 1 where ✓t = (a1t, a2
t, 0) for t 2 [0, T ] .
Next, we will use a similar arbitrage argument to extend this
result, in turn provingthat V (✓t) = f(t, St) for all t 2 (0, T ).
For the sake of contradiction, suppose thatV (✓t) > f(t, St) for
some fixed set of points t 2 E = {t0, t1, ...} ✓ [0, T ]. In
thiscase, the strategy defined by
✓0t=
((a1
t, a2
t,�1) if t t0
(�a1t+ [V (✓t0)� f(t0, St0)],�a
2t, 1) if t > t0
is an arbitrage as
P [V (✓0T) = F (ST )� V (✓T ) + � = � > 0 = V (✓0)� f(0, S0)
= V (✓
00) = 0] = 1
where � = [V (✓t0) � f(t0, St0)] > 0. Therefore, E must be
empty as there cannotexist any points t for which V (✓t) ⇧ f(t,
St). A similar argument, employing thestrategy defined by
✓0t=
((�a1
t,�a2
t, 1) if t t0
(a1t+ [f(t0, St0)� V (✓t0)], a
2t,�1) if t > t0
can be made to show V (✓t0) ⌅ f(t0, St0). Therefore, by
trichotomy, we find thatf(t, St) = V (✓t) for all t 2 [0, T ],
which yields the crucial equality
(6.6) dV (✓t) = d(f(t, St)) for all t 2 [0, T ) .
-
APPLICATIONS OF STOCHASTIC CALCULUS TO FINANCIAL MODELING 13
Let St be a GBM represented by dSt = St[µtdt+ �tdBt] where µt =
µ(t,Xt), �t =�(t,Xt) 2 C2([0,1) ⇥ R). As every portfolio in a
trading space is self-financing,we assert dV (✓t) = a1dRt + a2dSt.
By (6.6) we claim
d(V (✓t)) = d(f(t, St)) ,
and thus a1dRt + a2dSt = @tf(t, St)dt+ @xf(t, St)dSt +1
2@xxf(t, St)(dSt)
2 .
Noticing, (dSt)2 = [St(µtdt+ �tdBt)]2 = S2t �2tdt we proceed to
show
a1dRt + [a2 � @xf(t, St)] · St[µtdt+ �tdBt] = @tf(t, St)dt+1
2@xxf(t, St)S
2t�2tdt .
Recall, that we wanted the BSM strategy to be riskless, i.e.
have a guarenteedreturn. To do so, we must constantly update our
portfolio such that the randomterm in the above di↵erential
equation is always eliminated. Setting a2 = @xf(t, St),
and consequentially a1 =f(t,St)�@xf(t,St)
Rt, we compute
[f(t, St)� @xf(t, St)]r(t, St)dt = @tf(t, St)dt+1
2@xxf(t,Xt)S
2t�2dt
and @tf(t, St) = [f(t, St)� @xf(t, St)]r(t, St)��2tS2t
2@xxf(t,Xt)
which is the Black-Scholes-Merton Equation. ⇤
The PDE derived in this theorem yields the risk-free pricing of
a y-option withstrike price K and expiration T . We consider this
pricing schema to be risk-freebecause we can construct a portfolio
of the risk-free rate and the underlying stock,for which we can
entirely eliminate randomnness. Even though this schema is
risk-free, the y-option itself need not be risk-free – the y-option
will almost surely nothave a guaranteed value at time T . However,
the y-option does have an expectedvalue at time T . We can use this
expected value to derive the closed form risk-neutral solution to
the BSM model, wherein the expected return of the y-optionequals
the return of the risk-free rate.
Corollary 6.7. Suppose r(t, St) and �(t, St) are constant. Then
the risk-neutralprice of the y-option described above is
(6.8) f(t, St) = St�(d1)� e�r(T�t)K�(d2)
where K 2 R is from 6.2 and d1, d2 are given by
d1 =ln(St
K) + (r + �
2
2 )(T � t)
�pT � t
and d2 =ln(St
K) + (r � �
2
2 )(T � t)
�pT � t
.
Proof. We begin with a risk-neutral argument. If we desire the
price of our y-option to be risk-neutral, then the expected return
of the y-option should be equalto the expected return of an initial
portfolio of f(t,St)
Rtunits of the risk free rate.
Mathematically, we assert that
(6.9)f(t, St)
Rt·RT � f(t, St) = E[F (ST )� f(t, St)|Ft].
As r(t, St) is constant,RTRt
is Ft-measurable and thus we simplify (6.9) to be
(6.10) f(t, St)er(T�t) = E[F (ST )|Ft] .
-
14 BEN RAPPORT
Recalling (5.4), another risk-neutrality argument can be made to
show
(6.11) Z = e(T�t)(µ�12�
2)+�pT�t·Y = e(T�t)(r�
12�
2)+�pT�t·Y .
Using this result, we compute
E[F (ST )|Ft] =
Z 1
�1max(Ste
z�K, 0)f(z)dz
=
Zln( KSt
)
�1max(Ste
z�K, 0)f(z)dz +
Z 1
ln( KSt)max(Ste
z�K, 0)f(z)dz
=
Z 1
ln( KSt)Ste
z�Kf(z)dz
= St
Z 1
ln( KSt)ezf(z)dz �K
Z 1
ln( KSt)f(z)dz
= St
Z 1
ln( KSt)e(T�t)(µ�
12�
2)+�pT�t·ye�y
2
dy �K
Z 1
ln( KSt)e�z
2
dz
which following several lines of computation simplifies to
be
= Ster(T�t)�
ln(St
K) + (r + �
2
2 )(T � t)
�pT � t
!�K�
ln(St
K) + (r � �
2
2 )(T � t)
�pT � t
!.
Finally, we isolate f(t, St) to derive the closed form BSM
pricing equation
f(t, St) = St�(d1)� e�r(T�t)K�(d2). ⇤
Before continuing, it is worth discussing some assumptions and
limitations of theBlack-Scholes-Merton model, the majority of which
derive from the constructionof the trading space. Firstly, the BSM
model assumes that securities are boughtand sold continously. In
reality, there are specific intervals in which markets areopen and
securities can be exchanged – after normal market hours, securities
arestill bought and sold, but there is a signifcant decrease in the
volume of exchangedsecurities. This leads to a drastically di↵erent
market environment. Additionally,arbitrage strategies exist in
realistic markets, but are almost never present for morethan a
microsecond. This fact combined with our assumption of continous
tradingleads to a certain tension in our result: if we assume the
continuous exchangeof assets, then in a more realistic model there
could be instantaneous arbitragestrategies.3
Lastly, our assumption that assets follow GBM with constant
drift and varianceis an over-generalization of market behaviors. It
is very rare for an asset to haveconstant variance, and even rarer
for its drift to remain constant. However, BSMis simply a model,
and should not be viewed as an all encompassing formula. BSMis a
framework.
Now we will consider a derivative, whose payo↵ does not depend
on a singularasset, but instead on two assets. One such example is
a spread-option. An x/y-spread-option grants its owner the ability
to exchange 1 unit of an asset x for 1 unitof an asset y at a
specific point in time. Like an plain y-option, a
spread-optiongrants its owner the right to exchange the assets, but
does not obligate the owner
3 One could construct a heuristic measure-theoretic argument
that these moments of inconsis-tency are so minute that we may
treat them as a set of measure zero, but this lacks
formalization.
-
APPLICATIONS OF STOCHASTIC CALCULUS TO FINANCIAL MODELING 15
to do so. Unlike a y-option, a spread-option does not have a
strike price, its payo↵depends solely on the price of the two
underlying assets at time T . The formulageneralizing BSM to this
environment is known as the Margrabe Formula, and isshown below
Corollary 6.12 (The Margrabe Formula). Let T = (M, ✓) be a
trading space withtwo assets x, y, whose prices satisfy
dXt = Xt[µ1dt+ �1dWt] and dYt = Yt[µ2dt+ �2dBt] where µ1,�1,
µ2,�2 2 R
and Wt and Bt are independent standard Brownian motions. Suppose
thatf(t,Xt, Yt) 2 T is the price of a x/y-spread-option whose value
at time T is givenby f(T,XT , YT ) = F (XT , YT ) = max(XT � YT ,
O). Then the risk-neutral price ofthe x/y-spread-option described
above is
(6.13) f(t,Xt, Yt) = Xt�(q1)� Yt�(q2)
where q1 and q2 are given by
q1 =ln(S1
S2) + �
2
2 (T � t)
�pT � t
and q2 =ln(S1
S2)� �
2
2 (T � t)
�pT � t
, for � =q
�21 + �22 .
Proof. The proof of the Margrabe formula is a direct extension
of the BSM equation.Consider a self-financing portfolio
(6.14) V (✓t) = a1tRt + a
2tXt + a
3tYt such that V (✓T ) = F (XT , YT ) .
Using the same type of arbitrage arguments as those found in
BSM, we have that
V (✓t) = f(t,Xt, Yt) for all t 2 [0, T ]
which yields the crucial equality:
dV (✓t) = d(f(t,Xt, Yt)) .
Following the same procedure as in Theorem 6.2, this time using
the 2-d Itô For-mula, we find that
(6.15) a1tdRt + a
2tdXt + a
3tdYt = @tf(t,Xt)dt+ @xf(t,Xt)dXt + @yf(t,Xt)dYt
+1
2[@xxf(t,Xt)(dXt)
2 + 2@xyf(t,Xt)(dXt)(dYt) + @yyf(t,Xt)(dYt)2] .
Using analogous riskless arguments from Theorem 6.2, we set
a2 = @xf(t,Xt), a3 = @yf(t,Xt) and a1 =f(t,Xt)� @xf(t,Xt)�
@yf(t,Xt)
Rt.
Recalling that dRt = r(t,Xt)Rtdt, we assert
a1tdRt = r(t,Xt)(f(t,Xt)� @xf(t,Xt)� @yf(t,Xt))dt .
We then reduce (6.15) to be
(6.16) r(t,Xt)(f(t,Xt)� @xf(t,Xt)� @yf(t,Xt))dt
= @tf(t,Xt)dt+1
2[@xxf(t,Xt)(dXt)
2+2@xyf(t,Xt)(dXt)(dYt)+@yyf(t,Xt)(dYt)2] .
Next, we look to expand (dXt)2, (dXt)(dYt), and (dYt)2. We
observe that
(dXt)2 = [Xt(µ1dt+ �1dWt)]
2
= X2t(µ21(dt)
2 + 2µ1�1dtdWt + �21(dWt)
2)
= X2t�21dt.
-
16 BEN RAPPORT
Symmetrically, we also find that (dYt)2 = Y 2t �22dt. Recalling
that Wt and Bt are
independent, we compute
(dXt)(dYt) = [Xt(µ1dt+ �1dWt)][Yt(µ2dt+ �2dBt)]
= XtYt[µ1µ2(dt)2 + µ1�2dtdBt + µ2�1dWtdt+ �1�2(dWt)(dBt)]
= 0 .
Therefore, (6.16) simplifies to be
(6.17) r(t,Xt)(f(t,Xt)� @xf(t,Xt)� @yf(t,Xt))
= @tf(t,Xt) +1
2[@xxf(t,Xt)X
2t�21 + @yyf(t,Xt)Y
2t�22 ] .
We claim that V (✓T ) = F (XT , YT ) = max(XT � YT , 0) =
YTmax(XTYT
� 1, 0).Suppose that we standardized our market such that all
asset values are measuredin terms of Yt – the new numeraire.
4 By asserting Yt as the numeraire, the spread-option thus
becomes an x-option with K = 1 and r = 0. Hence, we apply the
BSMmodel to Zt =
XtYt
, noting Zt is a GBM with drift µ1 and variance �21 + �22 .
As
such, we obtain the equivalences
(6.18)f(t,Xt, Yt)
Yt= f(t, Zt) and
f(T,XT , YT )
YT= F (ZT ) = max(ZT � 1, 0) .
Applying the BSM schema to Zt, (6.17) reduces to
(6.19) 0 = @tf(t, Zt) +1
2Z2t@zzf(t, Zt)(�
21 + �
22) .
Next we use Corollary 6.7 and observe
f(t, Zt) = Zt�
0
@ ln(S1S2
) + �21+�
22
2 (T � t)p(�21 + �
22)(T � t)
1
A�1e�0·(T�t)�
0
@ ln(S1S2
)� �21+�
22
2 (T � t)p(�21 + �
22)(T � t)
1
A .
Isolating f(t,Xt, Yt), we conclude
⇤(6.20) f(t,Xt, Yt) = Xt�(q1)� Yt�(q2) .
7. Stochastic Simulation
While it is sometimes possible to model stochastic process with
closed formequations, more often than not, doing so is
computationally intensive and ine�cient.As a result, approximation
schema known as Monte Carlo methods have becomeimportant tools for
simulating Itô calculus in applied settings. In a Monte
Carlomethod, a sample value of an asset at time T is computed
recursively from an initialcondition via a step formula. The
expected value of a process is hence computedas the average of a
large number of sample values.
We will present two common Monte Carlo methods, the Euler method
and theMilstein method, and use them both to simulate models of
complex financial deriva-tives.
4 Often this procedure of standardizing a market with respect to
Yt is formalized via appli-cations of the Girsanov Theorem and the
Radon-Nikodym Theorem, which provide a foundationfor the change in
measure induced by a change in the numeraire. While a more
heuristic repre-sentation is shown here, formal proofs of both
theorems and their application can be found in [2]and [7].
-
APPLICATIONS OF STOCHASTIC CALCULUS TO FINANCIAL MODELING 17
Construction 7.1 (Euler Method). Let x be an asset whose price
Xt is modeledby (4.3) and let �t be the step size of the method.
Given X0 = x0 2 R+ we definethe step formula of the Euler Method of
Xt to be
X̂t+1 = X̂t + u(t, Ŝt)�t+ v(t, X̂t)�Bt where �Bt ⇠ N(0,�t)
.
In the Euler Method, we see that the step formula follows almost
directly fromthe asset value’s SDE. This is one of the most
fundamental Monte Carlo meth-ods because of its simplistic formula
and computation. As with any Monte Carlomethod, as the number of
sample values is increased, the approximation error de-creases.
Similarly, as we decrease the method’s step size, our approximation
errordecreases. The Milstein Method, presented below, is a
refinement of the Eulermethod and derives from the Itô
Formula.
Construction 7.2 (Milstein Method). Let x be an asset whose
price Xt is alsomodeled by (4.3). Given X0 = x0 2 R+ we define the
step formula of the MilsteinMethod of Xt to be
X̂t+1 = X̂t + u(t, X̂t)�t+ v(t, X̂t)�Bt +1
2v(t, X̂t)@xv(t, X̂t) · ((�Bt)
2��t)
where �Bt ⇠ N(0,�t) and �t is the step size of the method.
We now present a number of simulations using these Monte Carlo
methods. Foreach of the following examples our step size will be
equal to 1100 .
Example 7.3. Let x be an asset whose price Xt is modeled by
X0 = 200, dXt =1000X̂t
· cos( t2000 )dt+ log(X̂2t+ t)dBt for t 2 [0, 10) .
The step formula of the Milstein Method of Xt is given by
X̂t+1 = X̂t+10
X̂t· cos(
t
2000)+ log(X̂2
t+ t)�Bt+
log(X̂2t+ t) · 2X̂t
X̂2t+ t
· ((�Bt)2�
1
100)
where �Bt ⇠ N(0,1
100 ). A plot of 100 sample paths generated by the
MilsteinMethod is shown below.
From the sample paths generated in this schema, we approximate
the expectedvalue of this security at time T = 10 to be 189.66 with
a variance of 10.99.
-
18 BEN RAPPORT
However, 100 sample paths is a relatively small sample size,
which in turnproduces an inexact estimate.
The purpose of the above model is not to represent any specific
real life assetclass, but rather to show the computational e�ciency
of Monte Carlo methods inhandling complex stochastic structures.
Next, we take a basic GBM and evaluatehow close the Monte Carlo
method approximation comes to the theoretic valuederived in
(5.5).
Example 7.4. Let x be an asset whose price Xt is modeled by
X0 = 100, dXt = .03Xtdt+ 1.4XtdBt for t 2 [0, 10) .
A plot of 400 samples generated by the Milstein Method is shown
below.
From the sample paths generated in this schema, we approximate
the expectedvalue of this asset at time t = 10 to be 134.17 with a
variance of 1062.07. In (5.5),we derived the expected value of a
GBM with mean µ and � to be X0eTµ. Assuch, we compute E[Xt] =
134.99, which is incredibly close to our simulated valueof 134.17.
Next, we use Monte-Carlo methods to model a spread-option
derivativesimilar to the one discussed in our presentation of the
Margrabe formula.
Example 7.5. Let x and y be assets whose prices are modeled by
X0 = 300,dXt = .03Xtdt + .4XtdBt for t 2 [0, 5) and Y0 = 200, dYt =
.1Ytdt + .8YtdBtfor t 2 [0, 5), respectively. Lastly, let z be a
derivative whose value at time T , isgiven as F (ZT ) = max(XT �YT
, 0). Using Euler methods, we can approximate theexpected value of
ZT by simulating pairs of the assets Xt and Yt. A plot of
1000sample paths of Zt is shown below.
-
APPLICATIONS OF STOCHASTIC CALCULUS TO FINANCIAL MODELING 19
From the sample paths generated in this schema, we approximate
the expectedvalue of this derivative at time T = 10 to be 39.27
with a variance of 1917.65.While the initial value of this
derivative at time t is exactly 100, by time T wesee that its
expected value is significantly less than 100. Again, it is
importantto recall that a real life spread-option strategy using
this model would run sev-eral thousand simulations so that the
approximated price could converge to thetheoretical expected
value.
Acknowledgments
I would like to thank DeVon Ingram for his guidance throughout
the programand for helping me understand the intricacies of measure
theory. I would like tothank Sebastián Muñoz for first
introducing me to Itô calculus during our springDRP. I would like
to thank Greg Lawler for his insightful lecture series on
randomwalks and stochastic systems. I would like to thank Peter May
for making thisprogram not only possible, but exciting despite less
than ideal conditions. Lastly,thank you to Mom, Dad, E and M – I
love you guys.
References
[1] Øksendal, B. (1995). Stochastic Di↵erential Equations, An
Introduction with Applications.http://th.if.uj.edu.pl/
gudowska/dydaktyka/Oksendal.pdf
[2] Evans, L. (2013). An Introduction to Stochastic Di↵erential
Equations.[3] Lawler, G. F. (2014). Stochastic Calculus: An
Introduction with Applications.
http://www.math.uchicago.edu/ lawler/finbook.pdf[4] Bass, R.
(2013). Real Analysis graduate students.
http://bass.math.uconn.edu/rags010213.pdf[5] Hull, J. C. (1989).
Options, Futures, and Other Derivatives. Pearson.[6] Suresh, E.
(2019). Stochastic Calculus Applied to Arbitrage-Free Options
Pricing.
http://math.uchicago.edu/ may/REU2019/REUPapers/Suresh.pdf[7]
Margrabe, W. (1978). The Value of an Option to Exchange One Asset
for Another.
Journal of F inance. http://www.jstor.com/stable/2326358
-
20 BEN RAPPORT
Appendix
A. Proof for Proposition 3.10
Proof. Let Wt = Bt �Bs ⇠ N(0, t� s). Using the Taylor expansion
for ex we find
E[eiu(Bt�Bs)] = E[eiu(Wt)]
= E[1X
n=0
(iuWt)n
n!]
=1X
n=0
E[(iuWt)n
n!]
= E[1] + E[iuWt] + E[�u2W 2
t
2] + E[
�iu3W 3t
3!] + E[
u4W 4t
4!]
E[eiu(Bt�Bs)] = 1 + uE[iWt]�u2
2E[W 2
t]�
u3
3!E[iW 3
t] +
u4
4!E[W 4
t] + ...
Recall, by (3.6) we have E[eiu(Bt�Bs)] = e�u2(t�s)
2 . Expanding the right hand sideof the equality we find
e�u2(t�s)
2 = 1�u2(t� s)
2+
u4(t� s)2
2 · 4�
u6(t� s)3
3! · 8+
u8(t� s)4
4! · 16+ ...
Setting the even powered u terms equal we find
(�1)ku2kE[W 2k
t]
(2k)!= (�1)k
u2k · (t� s)k
k! · 2kfor k 2 N
Thus, E[W 2kt
] =(2k)!
2k · k!· (t� s)k for k 2 N
Therefore, E[(Bt �Bs)4] = E[W 4
t] = 3(t� s)2. ⇤
B. Coding for Section 7 can be found on the following pages.
-
Stochastic Simulation Code
August 28, 2020
[1]: import numpy as np
import math
import random
from matplotlib import pyplot as plt
from IPython.display import clear_output
PI = 3.1415926
e = 2.71828
[2]: def random_normal(sigma):
mu = 0
r = np.random.normal(mu, sigma)
return r
print(random_normal(.01))
-0.0009863635516575134
[56]: #EXAMPLE 1#the u, v and v_prime functions are input
manually...
def u_fcn(t,x,mu,sigma):
value = 1000*np.cos(t/2000)/x
return value
def v_fcn(t,x,mu,sigma):
value = np.log(x*x+t)
return value
def v_prime(t,x,mu,sigma):
value = 2*x/(x*x+t) #= v_prime = (d/dx)(v_fcn)return value
testing=[]
def average(lst):
return sum(lst)/len(lst)
1
-
def milstein_method(mu, sigma, start, step, end):
prices = [start]
step_count = int(end/step)
time = 0
for i in range(step_count):
current = prices[-1]
time+=step_count/100
#notice here we divide by 100 so that the time value remains
appropriately scaledrand = random_normal(step)
new = current + u_fcn(time,current,mu,sigma)*step +�
,!v_fcn(time,current,mu,sigma)*rand +\
.
,!5*v_fcn(time,current,mu,sigma)*v_prime(time,current,mu,sigma)*(rand**2-step)
prices.append(new)
testing.append(current)
plt.plot(prices)
plt.figure(figsize=(10,5),dpi=300)
plt.xlabel('Time (in centiseconds)')
plt.ylabel('Value of Security')
plt.title('Value of Exotic Security over time')
for i in range(100):
milstein_method(mu = .1, sigma = 10, start = 200, step = .01,
end = 10)
print('the simulated mean at t=10 is ' +
str(average(testing)))
print('the simulated variance at t=10 is ' +
str(np.var(testing)))
print('the simulated volatility at t=10 is ' +
str(np.std(testing)))
plt.savefig("REUfig1.png")
the simulated mean at t=10 is 189.65625938675225
the simulated variance at t=10 is 10.989436532745883
the simulated volatility at t=10 is 3.315031905238
2
-
[48]: #EXAMPLE 2
testing=[]
def euler_method(mu, sigma, start, step, end):
prices = [start]
step_count = int(end / step)
for i in range(step_count):
current = prices[-1]
rand = random_normal(step)
new = current + current*mu*step + current*sigma*rand
prices.append(new)
testing.append(current)
plt.plot(prices)
plt.figure(figsize=(10,5),dpi=300)
plt.xlabel('Time (in centiseconds)')
plt.ylabel('Value of Security')
plt.title('Value of Security over time')
for i in range(400):
euler_method(mu = .03, sigma = .7, start = 100, step = .01, end
= 10)
print('the simulated mean at t=10 is ' +
str(average(testing)))
print('the simulated variance at t=10 is ' +
str(np.var(testing)))
print('the simulated volatility at t=10 is ' +
str(np.std(testing)))
plt.savefig("REUfig2.png")
3
-
the simulated mean at t=10 is 134.1736349676156
the simulated variance at t=10 is 1062.0686338366047
the simulated volatility at t=10 is 32.58939449938591
[49]: 100*e**(10*.03)
[49]: 134.98585351801717
[51]: #EXAMPLE 3testing = []
def spreadoption_euler_method(mu1, sigma1, start1, mu2, sigma2,
start2, step,�
,!end):
prices1 = [start1]
prices2= [start2]
prices3 = [start1-start2]
step_count = int(end / step)
for i in range(step_count):
current1 = prices1[-1]
rand1 = random_normal(step)
new1 = current1 + current1*mu1*step + current1*sigma1*rand1
prices1.append(new1)
current2 = prices2[-1]
rand2 = random_normal(step)
new2 = current2 + current2*mu2*step + current2*sigma2*rand2
prices2.append(new2)
4
-
delta = new1 - new2
new3 = max(delta,0)
prices3.append(new3)
plt.plot(prices3)
testing.append(prices3[-1])
plt.figure(figsize=(10,5),dpi=300)
plt.xlabel('Time (in centiseconds)')
plt.ylabel('Value of Security')
plt.title('Value of Spread-Option over time')
for i in range(1000):
spreadoption_euler_method(mu1 = 0.03, sigma1 = 0.4, start1 =
300, mu2 = .1,�
,!sigma2 = 0.8, start2 = 200, step = .01, end = 5)
print('the simulated mean at t=5 is ' +
str(average(testing)))
print('the simulated variance at t=5 is ' +
str(np.var(testing)))
print('the simulated volatility at t=5 is ' +
str(np.std(testing)))
plt.savefig("REUfig3.png")
the simulated mean at t=5 is 39.2667816646157
the simulated variance at t=5 is 1917.9965577027765
the simulated volatility at t=5 is 43.79493758076128
5