23
Middle East Technical University Institute of Applied Mathematics TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM TO THE HESTON MODEL (2009) Nazlı ÇELİK Advisor: Dr. C. Coşkun KÜÇÜKÖZMEN

TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

Middle East Technical University

Institute of Applied Mathematics

TERM PROJECT

AN APPLICATION OF FAST FOURIER

TRANSFORM OPTION PRICING

ALGORITHM TO THE HESTON MODEL

(2009)

Nazlı ÇELİK

Advisor: Dr. C. Coşkun KÜÇÜKÖZMEN

Page 2: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

1

Suppose that we use the standard deviation of possible

future returns on a stock ... as a measure of its volatility. Is it

reasonable to take that volatility as constant over time? I think

not.

Fischer Black Business and Economics Statistics Selection, American Statistical Association, 177-181 (1976)

Page 3: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

2

Table of Contents

1.Introduction……………………………………………………………………. - 3 -

2.A Brief Overview of Heston Model………………………………………… - 3 -

2.1 Heston Model……………….………………………………………….3

2.2 Parameters anf Characteristic Function…………………………4

3.Approach to the Asset Returns………………..…………………………… - 7 -

3.1 Partial Differential Equations Approach………………………….7

3.2 Risk Neutral Approach…….…………………………………………8

4.Pricing of an Option…………………….…………………………………... - 8 -

4.1 Overview of Fourier Transform…………………………...………..8

4.2 Using Fast Fourier Transform for

In-The-Money&At-The-Money Option Prices…………………….…10

4.3 Using Fast Fourier Transform for

Out-of-The-Money Option Prices……………………………………..13

5.Application and Findings ….…………………………………..…………… - 14-

5.1 Parameters Estimation………………………………………………14

5.2 Result.……………………………………………………………..…..16

6.Conclusion…..……………………………..………………………………… - 17 -

Appendices 1 and 2…………..……..………………………………….… - 18-

References……………………….………………………………...…….… -22-

Page 4: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

3

1.INTRODUCTION

Modelling volatility is one of the main objectives of quantitative finance.

Stochastic approaches are widely used in quantitative finance.Therefore adequate

stochastic volatility models are crucial for option pricing.

Black & Scholes (BS, 1973) Model has been the first succesful attempt to

explain the dynamics of option prices. Strong assumptions in BS Model makes it

impossible to apply in practice since financial asset returns are not normally

distributed. They have fatter tails than the normal distribution proposes and extreme

observations are much more frequent in high-frequency financial data. Therefore

stohastic volatility is needed for option pricing. In this project Heston model will be

tested as an alternative to BS models as a stochastic volatility model.

The project is organised as follows: Chapter 1 gives a brief explanation of

Heston Model and why it should be examined. In Chapter 2 dicussion of Fast Fourier

Transformation Method is made to apply Heston and lastly Chapter 3 addresses the

application of Heston Model by Fast Fourier Transformation into the option pricing.

2. A Brief Overview of Heston Model

2.1 Heston Model

In finance, Heston model, named after Steven Heston, is a mathematical

model describing the evolution of the volatility of an underlying asset. It is a

stochastic volatility model that assumes the volatility of the asset is not constant, nor

even deterministic, but follows a random process.

Heston Model is one of the most widely used stochastic volatility (SV) models

today. A practical approach on option pricing by stochastic volatility by using MatLab

is presented in the project. After constructing the model, the focus will be on

calibration of the model.

Page 5: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

4

2.2 Parameters and Characteristic Function

According to Black and Scholes(1973) formula stock prices follow the

process shown below;

Where is a Weiner Process.

In Heston Method we add a second Weiner Process for the volatility

modelling, which means volatility is not considered as constant. The second equation

is;

With the assumption of;

where denote price and volatility processes respectively and

are correlated Brownian motion processes (with correlation parameter ρ).

is long run mean and is the rate of reversion. Volatility of volatility is denoted by σ.

It is clear that, in Heston Model we can imply more than one distributions by

changing the value of ρ.

We define the ρ as the correlation between returns and volatility, and hence

can deduce that ρ affects the heavy tails of the distribution. Obviously when ρ>0, this

means that as asset price increases volatility increases which also increase the

heaviness of the right tail and squeeze the other one. In contrast when ρ<0 there we

observed an inverse proportion between prices and volatility where we observe the

heavy tail in the left part of the distribution. As a result we can easily imply that ρ

affects the skewness of the distribution.

Page 6: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

5

5 6 7 8 9 10 11 12 13

0.0001

0.00050.001

0.0050.01

0.050.1

0.25

0.5

0.75

0.90.95

0.990.995

0.9990.9995

0.9999

Data

Pro

babili

tyProbability plot for Normal distribution

Figure 1 ρ= -0.9

We can see in Figure 1 that when ρ is smaller than zero asset returns is left skewed.

6 7 8 9 10 11 12 13 14

0.0001

0.00050.001

0.0050.01

0.050.1

0.25

0.5

0.75

0.90.95

0.990.995

0.9990.9995

0.9999

Data

Pro

babili

ty

Probability plot for Normal distribution

Figure 2 ρ= 0

In Figure 2 skewness is close to zero.

Page 7: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

6

7 8 9 10 11 12 13 14 15

0.0001

0.00050.001

0.0050.01

0.050.1

0.25

0.5

0.75

0.90.95

0.990.995

0.9990.9995

0.9999

Data

Pro

babili

tyProbability plot for Normal distribution

Figure 3 ρ= 0.9

Lastly in Figure 3 right skewness can be observed clearly.

We know that the skewness characteristics affects the shape of volatility

surfaces. Therefore another superiority of Heston model is including ρ in calculations.

Since FFT technique is based on characteristic functions, characteristic

function of Heston Model should be derived.

By definition, the characteristic function is given by;

The probability of the final log-stock price being greater than the strike

price is given by;

P( =

with = ln and = T- t. Let the log-strike y be defined y = ln .

Page 8: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

7

Then, the probability density function must be given by;

Then;

=

=

= exp {

3. APPROACH TO THE ASSET RETURNS

3.1 Partial Differential Equations Approach

Black and Scholes(1973) model has only one random process while Heston

method proposes two random processes. This means that we need a second hedge

condition in pricing. In Black and Scholes model we hedge by the stock, this time we

have to hedge volatility also in order to construct a riskless portfolio. So we add a

second portfolio which is V(S,ν,t) , so hedge –Δ number of stocks and hedge –Δ₁

number of another asset where –Δ₁ depends on the volatility of the asset.

After this brief explanation of the difference between BS and Heston portfolio

hedging, the pricing procedure will be discussed. Since the derivation of the Partial

Derivative Equation is not the main objective of this study. For more detail, please

refer to Heston(1993) and Black and Scholes(1973) .

Page 9: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

8

The PDE is shown below ;

Under Heston model we should satisfy this equation by a value of option U(St,Vt,t,T).

Λ(S,V,t) stand for the market price of the volatility risk.

3.2 Risk Neutral Approach

Definition of Risk neutral valuation is the pricing of a contingent claim in an

equivalent martingale measure (EMM). The price is evaluated as the expected

discounted payoff of the contingent claim, under the EMM Q, say. So,

where H(T) is the payoff of the option at time T and r is the risk free rate of interest

over [t; T] (we are assuming, of course, that interest rates are deterministic and pre-

visible, and that the numeraire is the money market instrument).

4. PRICING OF AN OPTION

4.1 Overview of Fourier Transform

In this section, a numerical approach for pricing options which utilizes the

characteristic function of the underlying instrument's price process is described. The

approach has been introduced by Carr and Madan (1999) and is based on the FFT.

The use of the FFT is motivated by two reasons. On the one hand, the algorithm

offers a speed advantage. This effect is even boosted by the possibility of the pricing

algorithm to calculate prices for a whole range of strikes. On the other hand, the

characteristic function of the log price is known and has a simple form for many

models considered in literature while the density is often not known in the closed

Page 10: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

9

form. The approach assumes that the characteristic function of the log-price is given

analytically. The basic idea of the method is to develop an analytic expression for the

Fourier transform of the option price and to get the price by Fourier inversion.

The FFT is an efficient algorithm for computing the sum;

w(k) = (1)

where N is typically a power of two.

In calculations of call option value, Fast Fourier Transform Method is used

because of its advantages when compared to closed form solution. Using FFT with

with risk neutral approach provides simplicity in calculations.

For example let’s say an European call option of maturity T, written on an asset spot

price ST. We know that the characteristic function of sT = ln(ST) is defined by:

(u) = E [exp(iu )] (2)

Characteristic functions are used in the pure diffusion context with stochastic

volatility (Heston 1993), and with stochastic interest rates. Finally, they have been

used for jumps coupled with stochastic volatility and for jumps coupled with

stochastic interest rates and volatility. The methods are generally much faster than

finite difference solutions to partial differential equations, which led Heston to refer to

them as closed form solutions.

Our first definition is that the Fourier Transform

are integrable functionof an f(x);

(3)

(4)

F(x) refers to the risk neutral density function of the log returns and refers

to the characteristic function of f(x).

Page 11: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

10

The advantage is that altough a random variable does not satisfy the

absolutely continuous property (which means it has a density function), its

characteristic function exists.

4.2 Using Fast Fourier Transform for In-The-Money and

At-The-Money Option Prices

Let denote the price of a European call option with maturity T and strike K =

exp(k);

(5)

Where stands for the risk neutral density function of X as we defined before.

Carr and Madan(1999) modified this pricing function, since is not square

integrable. Modified version is;

where (6)

After this modification we put into the Fourier Transform Function;

(7)

(8)

After finding these equations we substitute the equation (8) into the equation (6) and

we construct the new ;

= ` (9)

= = = (10)

Page 12: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

11

Lastly by substituting the equation (5) and (6) into the equation (7) we get the new

Fast Fourier Transform Function;

(11)

Call values are determined by substituting (11) into (10) and performing the

required integration. We note that the integration (10) is a direct Fourier transform

and lends itself to an application of the FFT.

There exists a FFT function in MatLab in oreder to apply this method. For

detailed information you can see Carr & Madan (1999).

It is shown that is the characteristic function of . In Hong (2004) in order to

simplify the computations the components of is given as;

(12)

A = i + ( (13)

B = (14)

C = [2 log ( (15)

where;

= ( ²+ ) (16)

(17)

-ρσ (18)

Page 13: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

12

Now the details for formulating the integration is presented (10) as an

application of the summation (1). By the Trapezoid Rule1 lets set set

then the approximation for is;

(19)

where the upper limir for the integral is a=N .

Since we are interested in at-the-money call values , k is close to 0.

For N values of k we can construct a space of size λ, value of k are;

= -b + λ (u-1) for u=1,2,3….N (20)

From the equation (20) we can deduce that the interval for the log strike level is

[ -b , b] where;

b= N λ (21)

by substituting (20) into (19) and casting ;

for u=1,2,3….N (22)

In order to apply FFT we define;

ηλ = (23)

We need to obtain an accurate integration with larger values of η and, for this

purpose, we apply Simpson's rule2 weightings into our summation. With Simpson's

rule weightings and the restriction (23), we may write our call price as;

1 The Trapezoid Rule Works by approximating the region under the graph of by a trapezium and calculating its area. It

follows that: .

2 In numerical analysis, Simpson's rule is a method for numerical integration, the numerical approximation of definite integrals.

Specifically, it is the following approximation. It follows that: .

Page 14: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

13

(24)

Where is Kronecker that is 1 for =0 otherwise 0.

The summation has the adequate form to apply FFT. The crucial thing is to determine

the appropriate values for Carr&Madan (1999) show that;

= η(j-1)

η =

c = 600

N = 4096

b =

From the definition of the characteristic function, this requires that:

E ( ) < ∞

In the application data is divided into two parts based on the strike price of the

option. In calculations α is taken as 1.25. It is known that as α increases option price

will decrease but will stabilize in the long run.

Another point is that Carr and Madan (1999) put out a different FFT for out-

of–money options since out-of-money options do no have an intrinsic value as in-the-

money options.

4.3 Using Fast Fourier Transform for Out-of-the-Money Option Prices

In previous section call values are calculated by an exponential function to

obtain square integrable function whose Fourier transform is an analytic function of

the characteristic function of the log price. Unfortunately, for very short maturities, the

call value approaches to its non-analytic intrinsic value causing the integrand in the

Fourier inversion high oscillate (vary above and below a mean value), and therefore

difficult to numerically integrate.

Page 15: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

14

The formula for out-of-the-money option price is presented here without

derivation from Carr and Madan(1999)

(25)

where;

(26)

= (27)

5.APPLICATION AND FINDINGS

5.1 Parameters Estimation

USD/TRY currency is used as a proxy asset for option pricing in this project.

08.01.2008 is set as the settlement date. Historical data is provided in Appendix 1.

Other inputs of the pricing function are as follows;

k (rate of reversion) 3

μ (spot asset mean) 1,2433838

θ (long run variance) 0,0356327

σ (volatility of volatility) 0,0003453

V0 (initial variance) 0,0546287

ρ (correlation between returns and volatility) 0,0224825

S0(initial Asset price) 1,1686

r (risk free rate) 15,50%

Strike prices and maturities are generated in MatLab by using the the linspace

function.

Page 16: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

15

Figure 5.1 Volatility Surface in Bloomberg

Figure 5.1 depicts the volatility surface of the USD/TRY option for the relative date in

Bloomberg. Market prices are used to construct this volatility surface. As can be

seen in the Figure 5.1, implied volatility increases as the maturity increase and the

strike price of the call option decreases (in the money).

Page 17: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

16

5.2 Results

As stated earlier USD/TRY option as a proxy asset will be priced by using the

FFT method. Now let’s examine the result of the pricing process.

00.2

0.40.6

0.81

0.8

1

1.2

1.4

1.60

2

4

6

8

10

Maturity(years)

Volatility Surface

Strike

Implie

d V

ola

tilit

y

Figure 5.2

The demonstration above Figure 5.2 builds the volatility surface based on the

parameters of the model and enhances an intuitive understanding of the Heston

model.

It can be seen in figure 5.2 that the volatility perception is changed. Volatility

smile shape has been changed yet volatility for in-the-money and at-the-money

options is still high and also for at-the-money options volatility is still low.

A good way to judge how well the FFT application to Heston model fits the

empirical implied volatility surface is to compare the two volatility surfaces

graphically. We see from Figure 5.2 that the smile generated by the FFT application

to Heston model is far too flat relative to the empirical implied volatility surface. For

longer expirations, however, the fit seems satisfactory.

Page 18: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

17

Finally, taking σ (volatility of volatility) into account in the model causes the

curvature of the implied volatility skew (related to the kurtosis of the risk-neutral

density) to increase.

6.CONCLUSION

Having considered the shortcomings of Black and Scholes Model, stochastic

volatility models are needed for sure. Heston, one of the most popular stochastic

volatility option pricing models, is motivated by the widespread evidence that volatility

is stochastic and that the distribution of risky asset returns has tail(s) heavier than

that of a normal distribution.

In this project Heston Model is built up with Fast Fourier Transform in order to

overcome computational problems.

Application of Fast Fourier Transformation algorithm to FFT application to

Heston model provided recovery of probability density function, application of

equivalent martingale approach and simplicity in calculations.

From the two volatility smiles presented in this project, it can be observed that

the FFT application to Heston model fits pretty good for longer expirations but really

not close for short expirations. In order to cope with the steep skew for short

expirations, jump diffusion should be integrated to the option pricing model. Moreover

calibration process should be applied in order to test the model parameters and to

obtain more accurate results.

Page 19: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

18

APPENDIX

A.1 Data

Date USD Currency Date USD Currency Date USD Currency

16.01.2008 1,1812 02.11.2007 1,1792 20.08.2007 1,3640

15.01.2008 1,1555 01.11.2007 1,1786 17.08.2007 1,3475

14.01.2008 1,1510 31.10.2007 1,1617 16.08.2007 1,4033

11.01.2008 1,1520 30.10.2007 1,1879 15.08.2007 1,3593

10.01.2008 1,1501 26.10.2007 1,1865 14.08.2007 1,3255

09.01.2008 1,1590 25.10.2007 1,1896 13.08.2007 1,2860

08.01.2008 1,1686 24.10.2007 1,2088 10.08.2007 1,2913

07.01.2008 1,1685 23.10.2007 1,2064 09.08.2007 1,3025

04.01.2008 1,1730 22.10.2007 1,2265 08.08.2007 1,2517

03.01.2008 1,1685 19.10.2007 1,2132 07.08.2007 1,2680

02.01.2008 1,1675 18.10.2007 1,1948 06.08.2007 1,2685

31.12.2007 1,1655 17.10.2007 1,2075 03.08.2007 1,2750

28.12.2007 1,1687 16.10.2007 1,2175 02.08.2007 1,2745

27.12.2007 1,1725 15.10.2007 1,2169 01.08.2007 1,2865

26.12.2007 1,1785 10.10.2007 1,1828 31.07.2007 1,2823

25.12.2007 1,1785 09.10.2007 1,1789 30.07.2007 1,2907

24.12.2007 1,1810 08.10.2007 1,1842 27.07.2007 1,2989

19.12.2007 1,1915 05.10.2007 1,1768 26.07.2007 1,2971

18.12.2007 1,1875 04.10.2007 1,1962 25.07.2007 1,2484

17.12.2007 1,1905 03.10.2007 1,2041 24.07.2007 1,2530

14.12.2007 1,1860 02.10.2007 1,2069 23.07.2007 1,2453

13.12.2007 1,1710 01.10.2007 1,1976 20.07.2007 1,2675

12.12.2007 1,1705 28.09.2007 1,2036 19.07.2007 1,2624

11.12.2007 1,1815 27.09.2007 1,2124 18.07.2007 1,2730

10.12.2007 1,1634 26.09.2007 1,2173 17.07.2007 1,2708

07.12.2007 1,1720 25.09.2007 1,2265 16.07.2007 1,2688

06.12.2007 1,1750 24.09.2007 1,2260 13.07.2007 1,2673

05.12.2007 1,1747 21.09.2007 1,2245 12.07.2007 1,2690

04.12.2007 1,1835 20.09.2007 1,2395 11.07.2007 1,2845

03.12.2007 1,1815 19.09.2007 1,2320 10.07.2007 1,2892

30.11.2007 1,1830 18.09.2007 1,2360 09.07.2007 1,2810

29.11.2007 1,1988 17.09.2007 1,2682 06.07.2007 1,2873

28.11.2007 1,2171 14.09.2007 1,2589 05.07.2007 1,2959

27.11.2007 1,2189 13.09.2007 1,2617 04.07.2007 1,2894

26.11.2007 1,1795 12.09.2007 1,2709 03.07.2007 1,2922

23.11.2007 1,2127 11.09.2007 1,2773 02.07.2007 1,2927

22.11.2007 1,2350 10.09.2007 1,2967 29.06.2007 1,3120

21.11.2007 1,1861 07.09.2007 1,3062 28.06.2007 1,3135

20.11.2007 1,1845 06.09.2007 1,2937 27.06.2007 1,3230

19.11.2007 1,1966 05.09.2007 1,3037 26.06.2007 1,3180

16.11.2007 1,1855 04.09.2007 1,2929 25.06.2007 1,3150

15.11.2007 1,1905 03.09.2007 1,2975 22.06.2007 1,3110

14.11.2007 1,1758 31.08.2007 1,3038 21.06.2007 1,3078

13.11.2007 1,1867 29.08.2007 1,3101 20.06.2007 1,3005

12.11.2007 1,2165 28.08.2007 1,3373 19.06.2007 1,3004

09.11.2007 1,1985 27.08.2007 1,3181 18.06.2007 1,3005

08.11.2007 1,1802 24.08.2007 1,3135 15.06.2007 1,3070

07.11.2007 1,1854 23.08.2007 1,3250 14.06.2007 1,3225

06.11.2007 1,1698 22.08.2007 1,3255 13.06.2007 1,3330

05.11.2007 1,1870 21.08.2007 1,3588 12.06.2007 1,3345

Page 20: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

19

A.2 MatLaB Codes For Option Pricing By FFT

The following function calculates at-the-money and in-the-money options

function CallValue = HestonFft(k,theta,sigma,rho,r ,v0,s0,strike,T)

%k = rate of reversion

%theta = long run variance

%sigma = Volatility of

volatility

%v0 = initial Variance

%rho = correlation

%T = maturity

%r = interest rate

%s0 = initial asset price

x0 = log(s0);

alpha = 1.25;

N= 4096;

c = 600;

eta = c/N;

b =pi/eta;

u = [0:N-1]*eta;

lamda = 2*b/N;

position = (log(strike) + b)/lamda + 1; %position of call

v = u - (alpha+1)*i;

zeta = -.5*(v.^2 +i*v);

gamma = k - rho*sigma*v*i;

PHI = sqrt(gamma.^2 - 2*sigma^2*zeta);

A = i*v*(x0 + r*T);

B = v0*((2*zeta.*(1-exp(-PHI.*T)))./(2*PHI - ...

(PHI-gamma).*(1-exp(-PHI*T))));

C = -k*theta/sigma^2*(2*log((2*PHI - ...

(PHI-gamma).*(1-exp(-PHI*T)))./ ...

(2*PHI)) + (PHI-gamma)*T);

charFunc = exp(A + B + C);

ModifiedCharFunc = charFunc*exp(-r*T)./(alpha^2 ...

+ alpha - u.^2 + i*(2*alpha +1)*u);

Page 21: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

20

SimpsonW = 1/3*(3 + (-i).^[1:N] - [1, zeros(1,N-1)]);

FftFunc = exp(i*b*u).*ModifiedCharFunc*eta.*SimpsonW;

payoff = real(fft(FftFunc));

CallValueM = exp(-log(strike)*alpha)*payoff/pi;

format short;

CallValue = CallValueM(round(position));

xxxxxxxxxxxxxxxxxxxxxxx

For out-of-the-money Options

.

function CallValue = Hestonfft_out_of_money(k,theta,sigma,rho,r,v0,s0,strike,T)

%k = rate of reversion

%theta = long run variance

%sigma = Volatility of

volatility

%v0 = initial Variance

%rho = correlation

%T = Time till maturity

%r = interest rate

%s0 = initial asset price

x0 = log(s0);

alpha = 1.25;

N= 4096;

c = 600;

eta = c/N;

b =pi/eta;

u = [0:N-1]*eta;

lamda = 2*b/N;

position = (log(strike) + b)/lamda + 1; %position of call

w1 = u-i*alpha;

w2 = u+i*alpha;

v1 = u-i*alpha -i;

v2 = u+i*alpha -i;

Page 22: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

21

zeta1 = -.5*(v1.^2 +i*v1);

gamma1 = k - rho*sigma*v1*i;

PHI1 = sqrt(gamma1.^2 - 2*sigma^2*zeta1);

A1 = i*v1*(x0 + r*T);

B1 = v0*((2*zeta1.*(1-exp(-PHI1.*T)))./(2*PHI1 - ...

(PHI1-gamma1).*(1-exp(-PHI1*T))));

C1 = -k*theta/sigma^2*(2*log((2*PHI1 - ...

(PHI1-gamma1).*(1-exp(-PHI1*T)))./(2*PHI1)) ...

+ (PHI1-gamma1)*T);

charFunc1 = exp(A1 + B1 + C1);

ModifiedCharFunc1 = exp(-r*T)*(1./(1+i*w1) - ...

exp(r*T)./(i*w1) - charFunc1./(w1.^2 - i*w1));

zeta2 = -.5*(v2.^2 +i*v2);

gamma2 = k - rho*sigma*v2*i;

PHI2 = sqrt(gamma2.^2 - 2*sigma^2*zeta2);

A2 = i*v2*(x0 + r*T);

B2 = v0*((2*zeta2.*(1-exp(-PHI2.*T)))./(2*PHI2 - ...

(PHI2-gamma2).*(1-exp(-PHI2*T))));

C2 = -k*theta/sigma^2*(2*log((2*PHI2 - ...

(PHI2-gamma2).*(1-exp(-PHI2*T)))./(2*PHI2)) ...

+ (PHI2-gamma2)*T);

charFunc2 = exp(A2 + B2 + C2);

ModifiedCharFunc2 = exp(-r*T)*(1./(1+i*w2) - ...

exp(r*T)./(i*w2) - charFunc2./(w2.^2 - i*w2));

ModifiedCharFuncCombo = (ModifiedCharFunc1 - ...

ModifiedCharFunc2)/2 ;

SimpsonW = 1/3*(3 + (-1).^[1:N] - [1, zeros(1,N-1)]);

FftFunc = exp(i*b*u).*ModifiedCharFuncCombo*eta.*...

SimpsonW;

payoff = real(fft(FftFunc));

CallValueM = payoff/pi/sinh(alpha*log(strike));

format short;

CallValue = CallValueM(round(position));

Page 23: TERM PROJECT AN APPLICATION OF FAST FOURIER TRANSFORM OPTION PRICING ALGORITHM …ruediger/pdf/anwendung_der... · 2010-04-29 · Middle East Technical University Institute of Applied

22

References

Black, F. & Scholes, M. (1973), ‘Valuation of options and corporate liabilities’, Journal

of Political Economy 81, 637–654.

Carr, P. & Madan, D. B. (1999), ‘Option evaluation the using fast fourier transform’, Journal of Computational Finance 2(4), 61–73.

Gatheral, J. (2004), ‘Lecture 1: Stochastic volatility and local volatility’, Case Studies

in Financial Modelling Notes, Courant Institute of Mathematical Sciences.

Heston, S. L. (1993), ‘A closed-form solution for options with stochastic volatility with applications to bonds and currency options’, The Review of Financial Studies 6(2), 327–343.

Hong, G., (2004), Forward Smile and Derivative Pricing, Equity Quantitative Strategists Working Paper, UBS.

Scott, Louis (1997), ‘Pricing Stock Options in a Jump-Diffusion Model with Stochastic

Volatility and Interest Rates: Application of Fourier Inversion Methods’, Mathematical

Finance, Volume 7, Number 4, October 1997 , pp. 413-426(14).

Kou, S. (2002) ‘A jump diffusion model for option pricing’. Management Science, v.48

pp.1086-1101

Moodley N. (2005) ‘The Heston Model: A Practical Approach’ Ph.D. proposal. University of The Witwatersrand

Merton, R. (1973) ‘Theory of rational option pricing’, Bell Journal of Economics and

Management Science vol 4: 141-183.

Mikhailov, S. & Ngel, U. (2003), ‘Hestons stochastic volatility model implementation,

calibration and some extensions’. Wilmott Magazine

Internet Sources

www.investopedia.com

www.Bloomberg.com

www.wikipedia.com