Nov
27

## Pricing Parisian Options

A

Unfortunately, the authors don't release their codes for us to study, I tried to program according to that paper with theta scheme finite difference, where theta =0, 0.5, 1 refer to explicit, Crank-Nicolson, and implicit finite difference, respectively. Below is a runnable

Plots of the

Hot posts:

15 Incredibly Stupid Ways People Made Their Millions

Online stock practice

Ino.com: Don't Join Marketclub until You Read This MarketClub Reviews

World Changing Mathematical Discoveries

Value at Risk xls

Random posts:

Basics of Using Bloomberg

Recent developments of option pricing models

Download Multiple Stock Quotes From Yahoo Finance

Peter J Acklam inverse normal cumulative distribution

Yield Curve Modelling

**parisian option**pricer was shared at the post before at http://www.mathfinance.cn/parisian-option-pricer/, where the authors Haber, Schoenbucher, and Wilmott values**Parisian and Parasian options**via explicit finite difference method. (**Parisian option**is a barrier option but becomes activated only after stock prices have spent a certain continuous, pre-decided time, called a window, above or below the barrier.)Unfortunately, the authors don't release their codes for us to study, I tried to program according to that paper with theta scheme finite difference, where theta =0, 0.5, 1 refer to explicit, Crank-Nicolson, and implicit finite difference, respectively. Below is a runnable

**naive**Matlab code, please correct me if you find errors, cheers & have a nice weekend.% set parameter

N = 201; M = 200; s = 10; T = 1;

Tau = 0.1; %barrier window 20 days

sigma = 0.2; r = 0.05; K = 10;

Bar = 12; %barrier

bar = log(Bar);

% time-space grid

R = 3;

h = 2*R/(N+1);

k = T/M;

NoTau = floor(Tau/k);

x = linspace(-R,R,N+2)';

% compute finite difference matrix A

e = ones(N,1);

alphap = -sigma^2/2/h^2 +(sigma^2/2-r)/2/h;

alpham = -sigma^2/2/h^2 -(sigma^2/2-r)/2/h;

beta = sigma^2/h^2+r;

A = spdiags([alpham*e, beta*e, alphap*e], -1:1, N, N);

% compute matrices for the theta scheme

theta = 0.5;

B = speye(N,N) + theta*k*A;

C = speye(N,N) - (1-theta)*k*A;

% compute initial data

u = max(exp(x)-K,0);

u = repmat(u,1,NoTau+1);

inx = find(x>bar,1,'first');

u(:,1) = 0; %up and out when j=tau

f = zeros(N,1);

% start timestepping

for m = 1:M

lastu = u;

% compute right hand side

for j = 2:NoTau+1

f = C*[lastu(2:inx-2,NoTau+1);lastu(inx-1:end-1,j-1)]; %below using tau=0, above using tau=tau+1;

u(:,j) = zeros(N+2,1);

% solve the linear system

u(2:N+1,j) = B\f;

end

u(inx-1,2:NoTau) = u(inx-1,NoTau+1);%reset value at barrier point for parisian

lastu = u;

end

N = 201; M = 200; s = 10; T = 1;

Tau = 0.1; %barrier window 20 days

sigma = 0.2; r = 0.05; K = 10;

Bar = 12; %barrier

bar = log(Bar);

% time-space grid

R = 3;

h = 2*R/(N+1);

k = T/M;

NoTau = floor(Tau/k);

x = linspace(-R,R,N+2)';

% compute finite difference matrix A

e = ones(N,1);

alphap = -sigma^2/2/h^2 +(sigma^2/2-r)/2/h;

alpham = -sigma^2/2/h^2 -(sigma^2/2-r)/2/h;

beta = sigma^2/h^2+r;

A = spdiags([alpham*e, beta*e, alphap*e], -1:1, N, N);

% compute matrices for the theta scheme

theta = 0.5;

B = speye(N,N) + theta*k*A;

C = speye(N,N) - (1-theta)*k*A;

% compute initial data

u = max(exp(x)-K,0);

u = repmat(u,1,NoTau+1);

inx = find(x>bar,1,'first');

u(:,1) = 0; %up and out when j=tau

f = zeros(N,1);

% start timestepping

for m = 1:M

lastu = u;

% compute right hand side

for j = 2:NoTau+1

f = C*[lastu(2:inx-2,NoTau+1);lastu(inx-1:end-1,j-1)]; %below using tau=0, above using tau=tau+1;

u(:,j) = zeros(N+2,1);

% solve the linear system

u(2:N+1,j) = B\f;

end

u(inx-1,2:NoTau) = u(inx-1,NoTau+1);%reset value at barrier point for parisian

lastu = u;

end

Plots of the

**Parisian option**and its delta W.R.T stock prices and barrier Tau.**People viewing this post also viewed:**

Hot posts:

Random posts: