Code covered by the BSD License

Modern Pricing Method using Transforms

Kienitz Wetterau FinModelling (view profile)

25 Jul 2012 (Updated )

COS, CONV, Lewis Option Pricing Methods including Bermudan and American Options.

TestCOSMethod.m
```% This is material illustrating the methods from the book
% Financial Modelling  - Theory, Implementation and Practice with Matlab
% source
% Wiley Finance Series
% ISBN 978-0-470-74489-5
%
% Date: 02.05.2012
%
% Authors:  Joerg Kienitz
%           Daniel Wetterau
%
% kienitzwetterau_FinModelling@gmx.de
%
% (C) Joerg Kienitz, Daniel Wetterau
%
% Since this piece of code is distributed via the mathworks file-exchange
% it is covered by the BSD license
%
% This code is being provided solely for information and general
% illustrative purposes. The authors will not be responsible for the
% consequences of reliance upon using the code or for numbers produced
% from using the code.

n = 6;          % choose number of grid points (applied to Bermudan only), N = 2^n

S0 = 100;       % price of underlying
strike = 100;   % strike price
r = 0.1;        % annual risk-free rate
t = 5;          % term to maturity
q = 0;          % annual dividend yield

cp = 1;         % choice of call (=1) or put (=-1)

type = 'VarianceGamma';       % choice of asset price model

sigma = 0.18;                % volatility of the share, per sqrt(unit) time
theta = -0.13;
nu = 0.25;

L = 1:1:100;

mu = (r - q + 1/nu * log(1 - theta * nu - 0.5 * nu * sigma^2));

% cumulants
c1 = (mu + theta) * t;
c2 = (sigma^2 + nu * theta^2) * t;
c4 = 3 * (sigma^4 * nu + 2 * theta^4 * nu^3 + 4 * (sigma * theta * nu)^2) * t;
c = [c1, c2, c4];

pricefunc = @(x) double(FFTCOS_E(n, x, c, cp, type, S0, t, r, q, strike, sigma, nu, theta));

num = size(L, 2);
p_COS_E = zeros(num, 2);

for j = 1:size(L,2)
p_COS_E(j, 2) = pricefunc(L(j));
p_COS_E(j, 1) = L(j);
end

plot(p_COS_E(:,1),p_COS_E(:,2),'-o');
title(['Call Prices for ', type, ' model and COS method']);
legend('Call Prices for different values of L');

% values for multiple strikes
L = 10;
pricefunc = @(x) double(FFTCOS_E(n, L, c, cp, type, S0, t, r, q, x, sigma, nu, theta));

xval = 1:1:200;
yval = pricefunc(xval');
figure; plot(xval,yval,'-o');
title(['Call Prices for ', type, ' model and COS method']);
legend('Call Prices for different strikes');```