27
Delft University of Technology Review of the Carr-Madan Method George K. Inkoom (4004817) August 16, 2014

Computational Finance Practicum

Embed Size (px)

DESCRIPTION

Project about reproducing results regarding the Carr-Madan method in the paper written by Oosterlee.

Citation preview

Page 1: Computational Finance Practicum

Delft University of Technology

Review of the Carr-Madan Method

George K. Inkoom (4004817)

August 16, 2014

Page 2: Computational Finance Practicum
Page 3: Computational Finance Practicum

Contents

1 Review of the Carr-Madan method 41.1 Option Valuation with Carr-Madan method . . . . . . . . . . . . . . . . . 4

2 Carr-Madan’s result presented in Table 1 9

3 Carr-Madan result presented in Table 2 10

4 Carr-Madan result presented in Table 6 12

5 Carr-Madan result for H1-HW model 14

3

Page 4: Computational Finance Practicum

Introduction

In this paper, we discuss the Carr-Madan method, which is an option pricing methodfor European options based on Fast-Fourier transform. In particular, we review thetheoretical aspects of the Carr-Madan method and also reproduce the Carr-Madan re-sults obtained by the numerical experiment performed in [Fang and Oosterlee, 2008]and [Grzelak and Oosterlee, 2009].

The paper is organized as follow: In Section 1, we review the theoretical aspects ofCarr-Madan method, reproduce the Carr-Madan results presented in Table 1, 2 and 6of [Fang and Oosterlee, 2008] in section 2, 3 and 4 respectively. In section 5, we performa numerical experiment using the Carr-Madan method to price European option underthe H1-HW model.

Note that most of this report refers to [Fang and Oosterlee, 2008], [Carr and Madan,1999], [Kienitz and Wetterau, 2012], [Ng, 2005] and [Grzelak and Oosterlee, 2009].

1 Review of the Carr-Madan method

In this section, we discuss the Fourier-inversion technique proposed by Carr & Madan in1999 called the Carr-Madan method. The Carr-Madan method rely on a transformationto the Fourier domain and on the availability of the (discounted) characteristic functionof the logarithm of the stock price. In fact, in many situations, the characteristic functionfor a wide class of stock models are analytically obtainable even if the risk-neutral densitythemselves are not always available explicitly.

The Carr-Madan method ensures that the Fourier transform of the European optionprices exist by the inclusion of an exponential damping factor. Furthermore, singularitiesare removed by the damping factor and also European option prices are computed byFFT algorithm.

1.1 Option Valuation with Carr-Madan method

Consider the problem of valuing a European call of maturity T under different assump-tions of the underlying asset’s model.

Let ST denote the stock price at maturity T of an underlying asset of an Europeancall option with strike price K. Further, define k ≡ log(K) as the log of the strike priceK, sT ≡ log(ST ) as the log asset price at time T and fT (s) as the risk neutral densityof the log asset price, sT , under the Q-measure. Then, the characteristic function of therisk neutral density of the log asset price is given as:

4

Page 5: Computational Finance Practicum

φT (u) =

∫ ∞−∞

eiusfT (s) ds (1)

The initial European call price, C(K,T ), related to the risk neutral density, fT (s),is then given by:

C(K,T ) = e−rTEQ[maxST −K, 0]= e−rTEQ[maxesT − ek, 0]

= e−rT∫ ∞−∞

maxesT − ek, 0fT (sT ) dsT

= e−rT∫ ∞k

(esT − ek)fT (sT ) dsT

(2)

Note that the initial European call price, C(ek, T ), is not in L1 for a given maturityT , since

limK→0

C(K,T ) = limk→−∞

C(ek, T ) = S0 (3)

and thus does not tend to zero for k → −∞.

However, to assure integrability, we introduce a damping parameter, α ∈ R. Wethen consider the following modified call price:

c(k, T ) ≡ eαkC(ek, T ), for α > 0. (4)

Note that the choice for α > 0 is to ensure the existence of the Fourier transform ofc(k, T ) which we will discuss later.

For α > 0, we expect c(k, T ) ∈ L1, the space of integrable functions and so thereforewe have that the Fourier transform of c(k, T ) is well-defined and given as:

ψT,call(v) ≡ c(k, T ) =

∫ ∞−∞

eivkc(k, T ) dk (5)

Inverting gives

c(k, T ) =1

∫ ∞−∞

eivkψT,call(v) dv (6)

Then the initial European call price value is equivalent to

C(K,T ) = e−α log(K)c(k, T ) =e−α log(K)

∫ ∞−∞

eiv log(K)ψT,call(v) dv

=e−α log(K)

π<(∫ ∞

0eiv log(K)ψT,call(v) dv

) (7)

5

Page 6: Computational Finance Practicum

The expression for ψT,call(v) which is the Fourier transform of c(k, T ) can be writtenas follow:

ψT,call(v) =

∫ ∞−∞

eivkc(k, T ) dk =

∫ ∞−∞

eivkeαkC(ek, T ) dk

=

∫ ∞−∞

e(iv+α)k(e−rT

∫ ∞k

(esT − ek)fT (sT ) dsT

)dk

= e−rT∫ ∞−∞

fT (sT )(∫ sT

−∞e(iv+α)k(esT − ek) dk

)dsT

= e−rT∫ ∞−∞

fT (sT )(esT∫ sT

−∞e(iv+α)k dk −

∫ sT

−∞e(iv+α+1)k dk

)dsT

= e−rT∫ ∞−∞

fT (sT )(esT[ 1

iv + αe(iv+α)k

]sT−∞−[ 1

iv + α+ 1e(iv+α+1)k

]sT−∞

)dsT

(8)

Since for α > 0, we have that

limk→−∞

|e(iv+α)k| = limk→−∞

|e(iv+α+1)k| = limk→−∞

e(α+1)k = 0 (9)

Equation (8) becomes

ψT,call(v) = e−rT∫ ∞−∞

fT (sT )[e(iv+α)sTiv + α

− e(iv+α+1)sT

iv + α+ 1

]dsT

=e−rTφT (v − (α+ 1)i)

α2 + α− v2 + i(2α+ 1)v

(10)

So finally the initial European call price value is:

C(k, T ) =e−αk

π<(∫ ∞

0eivkψT,call(v) dv

)(11)

where

ψT,call(v) =e−rTφT (v − (α+ 1)i)

α2 + α− v2 + i(2α+ 1)v. (12)

In particular, a sufficient condition for the modified call value to be in L1 is providedby ψT,call(0) being finite. However, form equation (4), we observe that ψT,call(0) is finiteprovided that φT (−(α+ 1)i) is finite. From the definition of the characteristic function,this requires that:

E[Sα+1T ] <∞.

We show the proof below as Lemma.

Lemma: Let α > 0. Then the Fourier transform of c(k, T ) exists (i.e. c(k, T ) ∈ L1),if E[Sα+1

T ] <∞.

6

Page 7: Computational Finance Practicum

Proof. First note that E[Sα+1T ] <∞ implies

ψT,call(0) <∞, (13)

since

|ψT,call(0)| = e−rT |φT (−(α+ 1)i)|α2 + α

=e−rTE[Sα+1

T ]

α2 + α(14)

where the last equality of equation (14) follows from

|φT (−(α+ 1)i)| = |E[e−(α+1)i log(ST )]| = |E[e(α+1)i log(ST )]| = E[Sα+1T ] (15)

However, we also have the equality:

ψT,call(0) =

∫ ∞−∞

c(k, T ) dk. (16)

which follows from equation (5). Combining equation (16) with equation (13) com-pletes the proof.

We numerically evaluate the initial European call price value, C(K,T), by approxi-mating the integral in terms of a sum by applying the trapezoidal integration rule. Now,define g(v) ≡ eivkψT,call(v), the trapezoidal rule over domain [0, D] then yields

∫ D

0g(v) dv ≈ η

2

[g(v1) + 2

N−1∑n=2

g(vn) + g(vN )]

= η[ N∑n=1

g(vn)− 1

2(g(v1) + g(vN ))

] (17)

where D is the effective upper limit for the integration which is defined as:

D = Nη.

Letvn = (n− 1)η; and ku = −b+ (u− 1)λ.

where n = 1, 2, . . . , N is the grid in the v-domain and u = 1, 2, . . . , N to be the gridin the k-domain.

Also, we choose the constant b as b = Nλ2 , such that the grid is laid around at-

the-money strikes since we are mainly interested in at-the-money option values; whichcorrespond to k ≡ log(K) near 0. Substituting the expression for vn and ku in equation(17) (recall that g(v) ≡ eivkψT,call(v)) yields

7

Page 8: Computational Finance Practicum

∫ D

0g(v) dv ≈ η

[ N∑n=1

e−i[−b+(u−1)λ][(n−1)η]ψT,call(vn)− 1

2(g(v1) + g(vN ))

]= η

[ N∑n=1

eib(n−1)η−i(n−1)λη(u−1)ψT,call(vn)− 1

2(g(v1) + g(vN ))

]= η

[ N∑n=1

e−iλη(n−1)(u−1)eib(n−1)ηψT,call(vn)− 1

2(g(v1) + g(vN ))

]= η

[ N∑n=1

e−i2πN

(n−1)(u−1)eibvnψT,call(vn)− 1

2(g(v1) + g(vN ))

]= η

[ N∑n=1

ω(n−1)(u−1)N [eibvnψT,call(vn)]− 1

2(g(v1) + g(vN ))

]

(18)

where the last two equalities of equation (18) hold, since we respectively set

λη =2π

N; and ωN = e−i

2πN .

Note that equation (18) is written in the form of Fast-Fourier transform (FFT). So,therefore FFT can be utilized to evaluate the sum given in equation (18), provided thatg(v1) = g(vN ) exists. Also, note that the FFT is an efficient algorithm for computingthe sum of the form:

w(k) =N∑j=1

e−i2πN

(j−1)(l−1)xj , for l = 1, 2, . . . , N (19)

where N representing the number of grid points is typically a power of 2. Thisalgorithm only requires O(N log2(N)) arithmetic operations.

So, the approximation of C(k,T) for the Carr-Madan inversion is:

C(ku, T ) ≈ e−αku

π<η[ N∑n=1

ω(n−1)(u−1)N [eibvnψT,call(vn)]− 1

2(g(v1) + g(vN ))

](20)

where we have imposed the Nyquist relation to the grid size in the v- and k-domains,

λη =2π

N.

Note that to increase the accuracy of the approximation, one can apply the Simpson’sintegration rule instead of the trapezoidal integration rule. In similar manner as above,

8

Page 9: Computational Finance Practicum

one can easily show that in the case of Simpson’s integration rule we have

C(ku, T ) ≈ e−αku

π< N∑n=1

ω(n−1)(u−1)N [eibvnψT,call(vn)

η

3(3 + (−1)n − δn−1 ]

, (21)

where δn−1 is the Kronecker delta function that equals one whenever n = 1 and zerootherwise. The approximation given above for both numerical integration rule can becomputed efficiently using the FFT in Matlab.

Note that we have only discussed the pricing of European call options by the Carr-Madan method above. However, one can also obtain the prices of European put optionsby the Carr-Madan method by choosing a negative value for α. In particular, for theEuropean put option price, P (K,T ), we consider the modified put option:

p(k, T ) ≡ e−αkP (ek, T ), for α > 0. (22)

Then the Fourier transform for the modified put option is given as:

ψT,put(u) =e−rTψT,call(u− (−α+ 1)i)

α2 − α− u2 + i(−2α+ 1)u. (23)

2 Carr-Madan’s result presented in Table 1

In this section, we reproduce the results presented in Table 1 of [Fang and Oosterlee,2008] for the Carr-Madan method. In fact, we use the trapezoidal integration rulecombined with the FFT algorithm to solve the inverse Fourier integral. The inverseFourier integral is given as:

f(x) =1

∫ ∞−∞

e−iwxφ(w) dw =1

π<(∫ ∞

0e−iwxφ(w) dw

), (1)

We consider the following function, which is the probability density function of thestandard normal distribution, given by

f(x) =1√2πe−

12x2 , (2)

and determine the accuracy for the different values of N .

The characteristic function of the standard normal distribution is given as:

φ(w) = exp(iµw − 1

2σ2w2

). (3)

9

Page 10: Computational Finance Practicum

We recover the density function given above by approximating the integral given inequation (1) of this section in terms of a sum by applying the trapezoidal integration rulecombined with the FFT algorithm. Note that the effective upper limit for the integrationin this case is D = 20 and we measure the maximum error at x = −5,−4, . . . , 4, 5.We use a truncation rang of size [0, 20]

Table 2.1 presents the Carr-Madan results for recovering the density function givenabove. Note the all cpu times presented, in (milli)seconds, are determined after aver-aging the computing times obtained from 100 experiments. The computer used for theexperiments has Intel(R) Core(TM) i5 CPU, M 520 2.40GHz and the code is written inMatlab R2013b. See Appendix for the Matlab code used for this experiment.

N 4 8 16 32 64

Max. error 0.80222 7.23068 0.77663 3.55850e-05 8.72502e-06

cpu time (in seconds) 2.33676e-04 2.35292e-04 2.47339e-04 2.53788e-04 6.76044e-04

Table 2.1: Cpu time and maximum error when recovering f(x) from φ(w) by Carr-Madanmethod.

Looking at the values presented in Table 2.1, it seems strange that the value forN = 8 is so high. This may be due to the choice of the truncation range or some mistakein the code but I haven’t found any mistake yet in the Matlab code. However, we seethat the maximum error decreases for larger values of N , while the cpu time increasesfor larger values of N .

3 Carr-Madan result presented in Table 2

In this section we discuss the experiment performed in section 5.2 of [Fang and Oost-erlee, 2008]. In fact, we use the Carr-Madan’s method to price European call optionsunder the Geometric Brownian Motion (GBM) process for three different strike prices.Furthermore, the call option experiment is performed under the GBM process with ashort time to maturity and we check the convergence bahaviour at three different strikeprices, namely K = 80, 100 and 120.

We use the same parameters as given in [Fang and Oosterlee, 2008] for the experimentand also assume for this experiment that the damping factor, α, in the Carr-Madan’smethod to be α = 0.75 as in [Fang and Oosterlee, 2008]. Note that the results for thesestrikes are obtained in one single numerical experiment and also we use a truncation rangof size [0, 100]. Moreover, the reference values are obtained using the built-in function’blsprice’ in Matlab.

10

Page 11: Computational Finance Practicum

The characteristic function of the log-asset price for the GBM is given by:

φGBM (u) = exp(iu log(S0) + iu(r − 1

2σ2)τ − 1

2σ2u2τ

), (1)

where τ = T − t0 = T − 0 = T .

The parameters used for this test are:

S0 = 100, r = 0.1, q = 0, T = 0.1, σ = 0.25.

The reference value corresponding to the three different strike prices are given inTable 3.1.

Strike Price Reference Value

80 20.799226308673340

100 3.659968453325448

120 0.044577814073288

Table 3.1: The reference value corresponding to the three different strike prices.

Table 3.2 shows the Carr-Madan’s results for pricing European calls under GBMprocess. Note the all cpu times presented, in (milli)seconds, are determined after aver-aging the computing times obtained from 100 experiments. The computer used for theexperiments has Intel(R) Core(TM) i5 CPU, M 520 2.40GHz and the code is written inMatlab R2013b. See Appendix for the Matlab code used for this experiment.

N 16 32 64 128 256

max. abs. err. 2.45188e+07 1.76294e+06 1.61966e+03 16.23027 0.07946

cpu time (msec.) 0.287098 0.280165 0.292623 0.330376 0.892498

Table 3.2: Error convergence and cpu time using the Carr-Madan’s method for pricingEuropean calls under GBM for the three different strike prices, namely K =80, 100 and 120.

As we can see in Table 3.2, the values for the maximum error are matches the resultpresented in Table 1 of [Fang and Oosterlee, 2008]. In fact, we see that the maximumerror decreases for larger values of N , while the cpu time increases for larger values of N .Note that we cannot compare the cpu times presented here in this paper with the onesobtained in [Fang and Oosterlee, 2008], because different type of computers are used.

11

Page 12: Computational Finance Practicum

4 Carr-Madan result presented in Table 6

In this section we discuss the experiment performed in section 5.3 of [Fang and Oosterlee,2008]. In particular, we use the Carr-Madan’s method to price European call optionsunder the Heston model for 21 consecutive strike prices. Furthermore, the call optionexperiment is performed under the Heston model with maturity T = 1 and we check theconvergence bahaviour at 21 consecutive strike prices, namely K = 50, 55, 60, . . . , 150.

We use the same parameters as given in [Fang and Oosterlee, 2008] for the experimentand also assume for this experiment that the damping factor, α, in the Carr-Madan’smethod to be α = 0.75 as in [Fang and Oosterlee, 2008]. Note that the results for thesestrike prices are obtained in one single numerical experiment and also we use a truncationrang of size [0, 1200]. Moreover, the reference values are obtained by the Carr-Madanmethod using N = 217 points with truncated Fourier domain set to [0, 1200].

In the Heston model, the volatility, denoted by√ut, is modeled by a stochastic

differential equation,dxt = (u− 1

2ut) dt+√ut dW1t,

dut = λ(u− ut) dt+ η√ut dW2t,

(1)

where xt denotes the log-asset price variable and ut the variance of the asset priceprocess. Parameters λ ≥ 0, u ≥ 0 and η ≥ 0 are called the speed of mean reversion, the mean level of variance and the volatility of volatility, respectively. Furthermore,the Brownian motions, W1t and W2t, are assumed to be correlated with correlationcoefficient ρ.

The characteristic function of the log-asset price for the Heston model is given by:

φheston(w) = exp(iw[log(S0) + rτ ]) ∗ exp(u0η2

[ 1− e−Dτ

1−Ge−Dτ](λ− ρηiw −D)

)∗ exp

(λuη2

[τ(λ− ρηiw −D)− 2 log

(1−Ge−Dτ

1−G

)]) (2)

where τ = T − t0 = T − 0 = T ,

D =√

(λ− ρηiw)2 + (w2 + iw)η2, (3)

G =λ− ρηiw −Dλ− ρηiw +D.

(4)

The parameters used for this test are:

S0 = 100, r = 0, q = 0, T = 1, λ = 1.5768, η = 0.5751, u = 0.0398, u0 = 0.0175, ρ = −0.5711.

Note for the Heston parameters given above that the Feller condition, i.e., 2uλ > η2,is not satisfied.

12

Page 13: Computational Finance Practicum

The reference value corresponding to the 21 consecutive strike prices, namely K =50, 55, 60, . . . , 150 with maturity T = 1 are given in Table 4.1.

Strike Price Reference Value Strike Price Reference Value

50 50.070539139723508 105 3.359201922125749

55 45.124108541464899 110 1.787135060623922

60 40.208801172304959 115 0.921148309770783

65 35.338694824309748 120 0.482828092902555

70 30.533286991857107 125 0.262123561233131

75 25.819775170846526 130 0.147593635853726

80 21.236638756022217 135 0.085878404410413

85 16.839368487397689 140 0.051414849791787

90 12.709531760206342 145 0.031553214380537

95 8.967794306297670 150 0.019788382151668

100 5.785155450240623

Table 4.1: The reference value corresponding to the 21 consecutive strike prices, namelyK = 50, 55, 60, . . . , 150 with maturity T = 1. Note that the reference valueare obtained by the Carr-Madan method using N = 217 points with truncatedFourier domain set to [0, 1200]

Table 4.2 shows the Carr-Madan’s results for pricing European calls under Hestonmodel. Note the all cpu times presented, in (milli)seconds, are determined after aver-aging the computing times obtained from 100 experiments. The computer used for theexperiments has Intel(R) Core(TM) i5 CPU, M 520 2.40GHz and the code is written inMatlab R2013b. See Appendix for the Matlab code used for this experiment.

N 512 1024 2048 4096 8192

max. abs. err. 2.70962e+05 4.96950e+02 0.56432 0.01071 3.44565e-06

cpu time (msec.) 0.92095 1.62337 4.03544 4.32354 8.07884

Table 4.2: Error convergence and cpu time using the Carr-Madan’s method for pricingEuropean calls under Heston model for 21 consecutive strike prices, namelyK = 50, 55, 60, . . . , 150 with maturity T = 1.

As we can see in Table 4.2, the values for the maximum error are different from theresult presented in Table 1 of [Fang and Oosterlee, 2008]. This may be due to the waythe maximum error is computed. In this paper, the maximum error is computed bysubtracting the computed European call option value with Carr-Madan method for the21 consecutive strike prices from their corresponding reference values shown in Table4.1. Nonetheless, we see that the maximum error decreases for larger values of N , whilethe cpu time increases for larger values of N . Note that we cannot compare the cputimes presented here in this paper with the ones obtained in [Fang and Oosterlee, 2008],because different type of computers are used.

13

Page 14: Computational Finance Practicum

5 Carr-Madan result for H1-HW model

In this section we discuss the pricing of European options under the H1-HW usingthe Carr-Madan method and we will also try to compare the results obtained for theEuropean options under H1-HW model with the ones obtain for the European optionsunder Heston model. In particular, we use the Carr-Madan’s method to price Europeanoptions under the H1-HW model for 21 consecutive strike prices. Furthermore, theEuropean option experiment is performed under the H1-HW model with maturity T = 1and we check the convergence bahaviour at 21 consecutive strike prices, namely K =50, 55, 60, . . . , 150.

For a state vector Xt = [St, σt, rt]T and fixed probability space (Ω,F ,Q) with a

filtration F = Ft : t ≥ 0, which satisfies the usual conditions. Then the HestonHull-White model is given by:

dSt = rtSt dt+√σtSt dW

xt , S0 > 0;

dσt = κ(σ − σt) dt+ γ√σt dW

σt , σ0 > 0;

drt = λ(θt − rt) dt+ η dW rt , r0 > 0;

(1)

with dW x

t dWσt = ρx,σ dt;

dW xt dW

rt = ρx,r dt;

dW σt dW

rt = ρσ,r dt;

(2)

where κ > 0 determines the speed of adjustment of the volatility towards its theo-retical mean, σ > 0, λ > 0 determines the speed of mean reversion for the interest rateprocess, θt is the interest rate term-structure, η controls the volatility of the interest rateand σ > 0 and γ > 0 is the second-order volatility, i.e. the variance of the volatility.

Furthermore, the reformulated Heston Hull-White hybrid model (H1-HW) followsthe system of SDEs given by:

dSt = rtSt dt+√σtSt dW

xt + ΩtSt dW

rt + ∆

√σtSt dW

σt , S0 > 0;

dσt = κ(σ − σt) dt+ γ√σt dW

σt , σ0 > 0;

drt = λ(θt − rt) dt+ η dW rt , r0 > 0;

(3)

with dW x

t dWσt = ρx,σ dt;

dW xt dW

rt = 0;

dW σt dW

rt = 0;

(4)

where Ωt is a time-dependent function, ∆ a constant parameter and we still assumeindependence between instantaneous short rate, rt and the volatility process σt, i.e.ρr,σ = 0.

14

Page 15: Computational Finance Practicum

The coefficients for the H1-HW model are given by:Ωt ≈ ρx,rE(

√σt)

ρ2x,σ = ρ2x,σ + ρ2x,r;

∆ = ρx,σ − ρx,σ;(5)

where

E(√σt) ≈

(σ(1− e−κt) + σ0e

−κt − γ2

(1− e−κt)(σe−κt − σ + 2σ0)

(σe−κt − σ + σ0)

) 12

:= Λ(t) (6)

Moreover, the value E(√σt) can be approximated by a function of the following form:

E(√σt) ≈ a+ be−ct (7)

where the values a, b and c are estimated by:a =

√σ − γ2

8κ ,

b =√σ0 − a,

c = − log(b−1(Λ(1)− a)).

(8)

The characteristic function for the H1-HW model is given in Lemma 3.4 of thepaper, [Grzelak and Oosterlee, 2009].

We now use the Carr-Madan method to price European options under H1-HW modelfor 21 consecutive strike prices, namely K = 50, 55, 60, . . . , 150 with maturity T = 1.We assume for this experiment that the damping factor, α, in the Carr-Madan’s methodto be α = 0.75 as in [Fang and Oosterlee, 2008]. Note that the results for these strikeprices are obtained in one single numerical experiment and also we use a truncation rangof size [0, 1200]. Moreover, the reference values are obtained by the Carr-Madan methodusing N = 217 points with truncated Fourier domain set to [0, 1200].

The parameters used for this test are:

S0 = 100, r = 0, q = 0, T = 1, κ = 1.5768; σ = 0.0398; γ = 0.3;

λ = 0.05; r0 = θ = 0; η = 0.05; ρx,r = 0.6; ρx,σ = −0.7;σ0 = 0.0175;

Note for the H1-HW parameters given above that the Feller condition, i.e., 2σκ > γ2,is satisfied.

Table 5.1 shows the Carr-Madan’s results for pricing European calls under H1-HWmodel. Note the all cpu times presented, in (milli)seconds, are determined after aver-aging the computing times obtained from 100 experiments. The computer used for the

15

Page 16: Computational Finance Practicum

experiments has Intel(R) Core(TM) i5 CPU, M 520 2.40GHz and the code is written inMatlab R2013b. See Appendix for the Matlab code used for this experiment.

N 512 1024 2048 4096 8192

max. abs. err. 2.57660e+05 4.66523e+02 0.56432 0.01071 3.44565e-06

cpu time (msec.) 1.66956 2.57719 4.54578 6.08057 11.44484

Table 5.1: Error convergence and cpu time using the Carr-Madan’s method for pricingEuropean calls under H1-HW model for 21 consecutive strike prices, namelyK = 50, 55, 60, . . . , 150 with maturity T = 1.

As we can see in Table 5.1, the values for the maximum error are relatively the sameas the result presented in Table 4.2 of this paper. We compute the maximum error inthe same way as in section 4. Furthermore, we see that the maximum error decreasesfor larger values of N , while the cpu time increases for larger values of N . Moreover,we see that the cpu times for the H1-HW model are larger than the cpu times for theHeston model.

16

Page 17: Computational Finance Practicum

Appendix

Matlab Implementations.

% Function for applying FFT with trapezoidal rule

function [ku,density,integral,values] = FFT(phi,fft_nu,fft_N,x)

fft_lambda = (2*pi)/(fft_N*fft_nu); % spacing for log strike

fft_b = 0.5*fft_N*fft_lambda;

ku = -fft_b + fft_lambda*[0:1:fft_N-1]; % log strike levels ranging from -b to +b.

u = [0:1:fft_N-1]*fft_nu; % grid point of CHF-domain

% applying FFT with trapezoidal rule

fft_input = exp(1i*fft_b.*u).*phi;

fft_output = fft(fft_input);

gamma1 = exp(1i*ku*u(1))*phi(1);

gamma2 = exp(1i*ku*u(end))*phi(end);

value = -0.5*(gamma1 + gamma2);

density = (fft_nu*real(fft_output + value))/pi;

integral = fft_lambda*(sum(density)-0.5*(density(1)+density(end)));

values = interp1(ku,density,x,’spline’);

end

% function for the computation of the characteristic function

% of the standard normal distribution

function [phi] = phi_normal(mu,sigma,fft_N,fft_nu)

u = [0:1:fft_N-1]*fft_nu; % grid point of CHF-domain

phi = exp(1i*mu*u - 0.5*(sigma*u).^2);

end

% function for the computation of the characteristic function

% of the GBM process

function [phi] = phi_gbm(fft_nu,fft_N,S,r,sigma,tau)

17

Page 18: Computational Finance Practicum

lnS = log(S);

alpha = 0.75; % Damping factor

v1 = [0:1:fft_N-1]*fft_nu; % grid point of psi-domain

v2 = (v1 - 1i*(alpha + 1)); % shifted grid point of psi-domain

v = v2;

phi = exp(1i*v.*lnS + 1i*v.*(r - 0.5*sigma^2)*tau - 0.5*v.^2*sigma^2*tau);

end

% function for the computation of the characteristic function

% of the Heston model

function [phi] = phi_heston(fft_nu,fft_N,S,r,lambda,nu,u_bar,rho,tau,u0)

lnS = log(S);

alpha = 0.75; % Damping factor

v1 = [0:1:fft_N-1]*fft_nu; % grid point of psi-domain

v2 = (v1 - 1i*(alpha + 1)); % shifted grid point of psi-domain

v = v2;

D = sqrt((lambda - 1i*rho*nu.*v).^2 + (v.^2 + 1i*v).*nu^2);

G = (lambda - 1i*rho*nu.*v - D)./(lambda - 1i*rho*nu.*v + D);

phi1 = exp(1i*v.*(lnS + r*tau));

phi2 = exp((u0/nu^2).*((1 - exp(-D*tau))./(1 - G.*exp(-D*tau)))

.*(lambda - 1i*rho*nu.*v - D));

phi3 = exp((lambda*u_bar/nu^2)*(tau*(lambda - 1i*rho*nu.*v - D)

- 2*log((1 - G.*exp(-D*tau))./(1 - G))));

phi = phi1.*phi2.*phi3; % Discounted Characteristic Function

end

% function for the computation of the characteristic function

% of the H1-HW model

function [phi] = phi_h1hw(fft_nu,fft_N,kappa,gamma,theta,lambda,nu,sigma_bar

,rho_xr,rho_xs,tau,r0,sigma0,S)

x0 = log(S); % log transformation of stock

alpha = 0.75; % Damping factor

18

Page 19: Computational Finance Practicum

% Checking Feller condition.

if 2*kappa*sigma_bar > gamma^2

% Values for the approximation of Ohm := rho(x,r)*(a+b*exp(-c*t)).

a = sqrt(sigma_bar - (gamma^2/8*kappa));

b = sqrt(sigma0) - a;

Expected_volatility = sqrt(sigma_bar*(1-exp(-kappa*(1)))

+ sigma0*exp(-kappa*(1)) - (gamma^2/8*kappa)*(((1-exp(-kappa*(1)))

*(sigma_bar*exp(kappa*(1))-sigma_bar+2*sigma0)) /(sigma_bar*exp(kappa*(1))

-sigma_bar+sigma0)));

c = -log((1/b)*(Expected_volatility - a));

% Values from equation 2.14 in paper.

rho_xs_hat = rho_xs^2 + rho_xr^2;

delta = rho_xs - rho_xs_hat;

v1 = [0:1:fft_N-1]*fft_nu; % grid point of psi-domain

v2 = (v1 - 1i*(alpha + 1)); % shifted grid point of psi-domain

v = v2;

f1 = kappa - 1i*v*gamma*rho_xs_hat - 1i*v*gamma*delta;

f2 = -0.5*1i*v*(1 + delta^2 + 2*rho_xs_hat*delta) - 0.5*v.^2

*(1 + delta^2 + 2*rho_xs_hat*delta);

d = sqrt(f1.^2 - 2*gamma^2.*f2);

g = (f1 - d)./(f1 + d);

Bx = 1i*v;

Br = (1/lambda)*(1i*v - 1)*(1 - exp(-lambda*tau));

Bs = (1/gamma^2)*((1 - exp(-d*tau))./(1 - g.*exp(-d*tau))).*(f1 - d);

I0 = (1/lambda)*(1i*v - 1)*(tau + (1/lambda)*(exp(-lambda*tau) - 1));

I1 = (rho_xr^2/2*c)*(b^2*(1 - exp(-2*c*tau)) + 4*a*b*(1 - exp(-2*c*tau))

+ 2*a^2*c*tau);

I2 = (1/2*lambda^3)*(1i + v).^2*(3 + exp(-2*lambda*tau) - 4*exp(-lambda*tau)

- 2*lambda*tau);

I3 = (rho_xr*(1i*v - 1)./c*lambda^2*(c + lambda))*exp(-(c + lambda)*tau)

*(b*lambda*(c - exp(lambda*tau)*(c+lambda-lambda*exp(c*tau)))

+a*c*exp(c*tau)*(c+lambda)*(1+exp(lambda*tau)*(lambda*tau - 1)));

I4 = (1/gamma^2)*tau.*(f1 - d) - (2/gamma^2)*log((1 - g.*exp(-d*tau))./(1 - g));

A = lambda*theta.*I0 - (0.5*1i*v + 0.5*v.^2).*I1 + 0.5*nu^2.*I2

+ 1i*v*nu.*I3 + kappa*sigma_bar.*I4;

phi = exp(A + Bx*x0 + Bs*sigma0 + Br*r0);

disp(’Feller Condition is satisfied’)

19

Page 20: Computational Finance Practicum

else

disp(’Feller Condition is not satisfied. Try again with valid values’)

end

% The real matlab code used for reproducing the Carr-Madan results

format long

clc;

clear all;

close all;

clf;

% FFT method for standard normal distribution

mu = 0; sigma = 1;

x = [-5:1:5];

% vector of the maximum error

max_error_normal = zeros(5,1);

% Exact values of the standard normal distribution in the given points.

fx_normal_exact = (1/sqrt(2*pi))*exp(-0.5*x.^2);

% effective upper limit for integration which is uplim = fft_N*fft_nu.

% Note that the truncation range in this case is of size [0,20].

uplim = 1200;

% predefined parameters for fft

fft_N = [2.^[10:-1:2]]; % must be a power of two

fft_nu = uplim./fft_N; % spacing of psi integrand

for i = 1:5

% Average runtime measurement for the GBM model

runTime_normal = 0; % variable to store runtime

N_timemeasure_normal = 100; % average of 100 runs

for run = 1:N_timemeasure_normal

tic; % start stopwatch

20

Page 21: Computational Finance Practicum

% Discounted Characteristic Function of the normal distribution.

[phi_fft] = phi_normal(mu,sigma,fft_N(i),fft_nu(i));

% Applying FFT with trapezoidal rule.

[ku,density_fft,integral_fft,values_fft] = FFT(phi_fft,fft_nu(i),fft_N(i),x);

error_normal = abs(values_fft - fx_normal_exact);

max_error_normal(i) = max(error_normal);

runTime_normal = runTime_normal + toc; % increase runtime

end

integral_fft;

max_error_normal;

runTime_normal_s = runTime_normal/N_timemeasure_normal

runTime_normal_ms = 1000*runTime_normal_s;

end

max_error_normal

% Recovered density function for the standard normal distribution.

figure(1)

plot(ku,density_fft)

ylim([0 0.45])

xlim([-11 11])

% Carr-Madan method results for GBM model

S = 100; r = 0.1; q = 0; T = 0.1; sigma = 0.25;

tau = T; Strike = [80, 100, 120];

n = length(Strike);

% vector of the maximum error

max_error_gbm = zeros(5,1);

% effective upper limit for integration which is uplim = fft_N*fft_nu.

% Note that the truncation range in this case is of size [0,100].

uplim = 100;

% predefined parameters for fft

21

Page 22: Computational Finance Practicum

fft_N = [2.^[8:-1:4]]; % must be a power of two (2^12 = 4096)

fft_nu = uplim./fft_N; % spacing of psi integrand

% Exact Call option price with Black-Scholes model.

[Call_gbm,Put_gbm] = blsprice(S,Strike,r,tau,sigma,q);

for i = 1:5

% Average runtime measurement for the GBM model

runTime_gbm = 0; % variable to store runtime

N_timemeasure_gbm = 100; % average of 100 runs

for run = 1:N_timemeasure_gbm

tic; % start stopwatch

% Discounted Characteristic Function for the GBM model

[phi_gbm1] = phi_gbm(fft_nu(i),fft_N(i),S,r,sigma,tau);

% Call option price with Carr-Madan method for the GBM model

[call_price_fft_gbm] = CarrMadanFFT(phi_gbm1,fft_nu(i),fft_N(i),Strike,tau,r);

% Error Convergence under GBM model

error_gbm = abs(call_price_fft_gbm - Call_gbm);

max_error_gbm(i) = max(error_gbm);

runTime_gbm = runTime_gbm + toc; % increase runtime

end

max_error_gbm;

runTime_gbm_s = runTime_gbm/N_timemeasure_gbm;

runTime_gbm_ms = 1000*runTime_gbm_s

end

max_error_gbm

figure(2)

plot(Strike,Call_gbm,’r’,Strike,call_price_fft_gbm,’b*’)

xlabel(’Strike’)

ylabel(’Call option price’)

22

Page 23: Computational Finance Practicum

% Results of Carr-Madan for GBM model in table.

% Results_gmb = zeros(length(Strike),4);

Results_gmb = zeros(n,4);

Results_gmb(:,1) = Strike;

Results_gmb(:,2) = Call_gbm;

Results_gmb(:,3) = call_price_fft_gbm;

Results_gmb(:,4) = error_gbm;

Results_gmb;

% Carr-Madan method results for Heston model

S = 100; r = 0; q = 0; lambda = 1.5768; nu = 0.5751;

u_bar = 0.0398; u0 = 0.0175; rho = -0.5711; T = 1;

tau = T;

% Strike = 100;

Strike = [50:5:150];

n = length(Strike);

% vector of the maximum error

max_error_heston = zeros(5,1);

% effective upper limit for integration which is uplim = fft_N*fft_nu.

% Note that the truncation range in this case is of size [0,1200].

uplim = 1200;

% predefined parameters for fft

fft_N = [2.^[13:-1:9]]; % must be a power of two (2^12 = 4096)

fft_nu = uplim./fft_N; % spacing of psi integrand

% Reference Call option values with Carr-Madan method for the Heston model

N_ref = 2^17; % number of grid for the reference value

nu_ref = uplim/N_ref; % spacing of psi integrand for the reference value

% Discounted Characteristic Function for the Heston model

[phi_ref] = phi_heston(nu_ref,N_ref,S,r,lambda,nu,u_bar,rho,tau,u0);

% Call option price with Carr-Madan method for the Heston model

[call_price_fft_ref] = CarrMadanFFT(phi_ref,nu_ref,N_ref,Strike,tau,r);

for i = 1:5

% Average runtime measurement for the Heston model

23

Page 24: Computational Finance Practicum

runTime_heston = 0; % variable to store runtime

N_timemeasure_heston = 100; % average of 100 runs

for run = 1:N_timemeasure_heston

tic; % start stopwatch

% Discounted Characteristic Function for the Heston model

[phi_heston1] = phi_heston(fft_nu(i),fft_N(i),S,r,lambda,nu,u_bar,rho,tau,u0);

% Call option price with Carr-Madan method for the Heston model

[call_price_fft_heston] = CarrMadanFFT(phi_heston1,fft_nu(i),fft_N(i),Strike,tau,r);

% Error Convergence under Heston model

% error_heston = abs(call_price_fft_heston - 5.785155450240623);

error_heston = abs(call_price_fft_heston - call_price_fft_ref);

max_error_heston(i) = max(error_heston);

runTime_heston = runTime_heston + toc; % increase runtime

end

max_error_heston;

runTime_heston_s = runTime_heston/N_timemeasure_heston;

runTime_heston_ms = 1000*runTime_heston_s

end

max_error_heston

figure(3)

plot(Strike,call_price_fft_ref,’r’,Strike,call_price_fft_heston,’b*’)

xlabel(’Strike’)

ylabel(’Call option price’)

% Results of Carr-Madan for Heston model in table

% Results_heston = zeros(length(Strike),4);

Results_heston = zeros(n,4);

Results_heston(:,1) = Strike;

Results_heston(:,2) = call_price_fft_ref;

Results_heston(:,3) = call_price_fft_heston;

Results_heston(:,4) = error_heston;

24

Page 25: Computational Finance Practicum

Results_heston;

% Carr-Madan method results for H1-HW model

S = 100; r = 0; q = 0; T = 1; tau = T;

kappa = 1.5768; sigma_bar = 0.0398; gamma = 0.3;

lambda = 0.05; theta = 0; nu = 0.05;

% rho_xr = 0.1; rho_xs = -0.5711; % gives relatively good results

rho_xr = 0.6; rho_xs = -0.7; % gives a better results

r0 = theta; sigma0 = 0.0175;

Strike = [50:5:150];

n = length(Strike);

% effective upper limit for integration which is uplim = fft_N*fft_nu.

% Note that the truncation range in this case is of size [0,1200].

uplim = 1200;

% predefined parameters for fft

fft_N = 2^13; % must be a power of two (2^12 = 4096)

fft_nu = uplim/fft_N; % spacing of psi integrand

% Average runtime measurement for the H1-HW model

runTime_h1hw = 0; % variable to store runtime

N_timemeasure_h1hw = 100; % average of 100 runs

for run = 1:N_timemeasure_h1hw

tic; % start stopwatch

% Discounted Characteristic Function for the H1-HW model

[phi_h1hw1] = phi_h1hw(fft_nu,fft_N,kappa,gamma,theta,lambda,nu,sigma_bar,

rho_xr,rho_xs,tau,r0,sigma0,S);

% Call option price with Carr-Madan method for the H1-HW model

[call_price_fft_h1hw] = CarrMadanFFT(phi_h1hw1,fft_nu,fft_N,Strike,tau,r);

% Error Convergence under H1-HW model

error_h1hw = abs(call_price_fft_h1hw - call_price_fft_ref);

max_error_h1hw = max(error_h1hw);

runTime_h1hw = runTime_h1hw + toc; % increase runtime

25

Page 26: Computational Finance Practicum

end

max_error_h1hw

% calculate average runtime in seconds

runTime_h1hw_s = runTime_h1hw/N_timemeasure_h1hw;

% calculate average runtime in milliseconds

runTime_h1hw_ms = 1000*runTime_h1hw_s

figure(4)

plot(Strike,call_price_fft_ref,’r’,Strike,call_price_fft_h1hw,’b*’)

xlabel(’Strike’)

ylabel(’Call option price’)

26

Page 27: Computational Finance Practicum

References

[Carr and Madan, 1999] Carr, P. and Madan, D. B. (1999). Option Valuation Using theFast Fourier Transform. J. Comp. Finance, 2:61–73.

[Fang and Oosterlee, 2008] Fang, F. and Oosterlee, C. (2008). A Novel Pricing MethodFor European Options Based on Fourier-Cosine Series Expansions.

[Grzelak and Oosterlee, 2009] Grzelak, L. A. and Oosterlee, C. W. (2009). On TheHeston Model with Stochastic Interest Rates.

[Kienitz and Wetterau, 2012] Kienitz, J. and Wetterau, D. (2012). Financial Modelling:Theory, Implementation and Practice. Wiley Finance.

[Ng, 2005] Ng, M. (2005). Option Pricing via the FFT and its Application to Calibra-tion.

27