Quantitative finance collector
C++ Matlab VBA/Excel Java Mathematica R/Splus Net Code Site Other
Nov 3

Using Quadrature method for option valuation

Posted by abiao at 16:58 | Code » Matlab | Comments(0) | Reads(6863)
Reading an interesting paper "universal option valuation using quadrature methods", which provides an alternative method to value options. Compared with lattice (binomial and trinomial trees), finite difference, and Monte Carlo techniques,  quadrature method (QUAD) possesses exceptional accuracy and speed, while isn't harder to implement. Basically what we need to do is to write down the problem in an integral function and to solve the function with techniques like Simpson's rule or Gauss Quadature, ect.

For s short comparison, a simple QUAD code to price a vanilla European call option is as follows, please refer to the original paper for the meaning of symbols:
%using QUAD to calculate a vanila european call
x0 = log(s/k);
kappa = 2*(r-d)/vol^2-1;
dt = t;
ymax = 3;
A = 1/(sqrt(2*vol^2*pi*dt))*exp(-(kappa*x0/2)-(vol^2*kappa^2*dt/8)-r*dt);
q = quadl(@myquad,0,ymax,[],[],x0,dt,vol,kappa,k); %Matlab embedded quadrature
callprice = A*q;

function f = myquad(x,x0,dt,vol,kappa,k)
B = exp(-((x0-x).^2./(2*vol^2*dt))+kappa*x/2);
f = B.*max(exp(x)-1,0)*k;

Here I arbitrarily set ymax=3, which is enough for this simple example, the result for a European call option with strike price 9, stock price 10, volatility 20%, risk free rate 2%, dividend 1%, time to maturity 2 years is 1.71429100893328, with 0.005681 seconds elapsed time using my humble laptop, in contrast with the embedded Black Scholes matlab function value 1.71429100824415, and 100 time steps binomial tree value 1.71422035929822. QUAD performs quite good, isn't it?

The exotic option pricing is left for further experiment, have a nice evening.
PS: i was seriously drunken last weekend, my poor stomach.

Add a comment
Enable HTML
Enable UBB
Enable Emots
Nickname   Password   Optional
Site URI   Email   [Register]