Directory of Open Source for Quantitative Finance and Trading
Username: Password: Not registered?
 
Quick Search:    (AJAX based: No need to press button)

Main : Matlab : 


Category: Matlab View Full Details
Download Now!Local volatility surface
Submitter: vanna Date: 2008/11/20
Description:
The function LocalVolSurface uses an implied volatility surface and returns a local volatiltiy surface.

It is based on the follwoing equation:



Following are inputs of the function:
1.ImpliedVolSurface - an m x n matrix of implied volatilties where strikes are laid out in rows and time steps on the columns
2.S - spot price
3.r - risk free rate
4.Kvec - vector of m strikes
5.Tvec - vector of n times

Demo usage of this function is here:
%%%%%%%%% parameters setting  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
r=0.05; %risk free rate
S0=50; %underlying price 1

%create an implied volatiltiy surface using below parameters:
basevol=0.25; %implied volatility at time t=0 and strike=0
skewT=0.002; %change in vol for one unit change in maturity
skewK=-0.0005; %change in vol for one unit change in strike
nK=20; %no. of strike steps
nT=10; %no. of time steps
Tmax=1; %maximum value of time axis
Kmax=100; %maximum value of strike price axis
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


dt=Tmax/(nT-1);
Tvec=0:dt:1;
dk=Kmax/(nK-1);
Kvec=0:dk:Kmax;
Tvec=Tvec';
Kvec=Kvec';
nK=size(Kvec,1);
nT=size(Tvec,1);
dvolT=ones(nK,nT)*(skewT*dt);
dvolT=cumsum(dvolT,2);
dvolK=ones(nK,nT)*(skewK*dk);
dvolK=cumsum(dvolK,1);


ImpliedVolSurface=ones(nK,nT)*.15+dvolT+dvolK

LocalVol_Surface=LocalVolSurface(ImpliedVolSurface,S0,r,Kvec,Tvec)



Got a question or problem with this link? Just enter your message and click on submit. No registration is required.

Note: A copy of this message will also be emailed to the submitter of this link
Downloaded 1129 times  1129  File Size 0 bytes  Supported Platforms Octave Matlab  Home Page http://www.quantcode.com/
Rating: 0.00 (0 votes)
Rate this File | Modify | Delete | Report Broken File | Tell a Friend | Comments (16)

Poster Thread
Anonymous
Posted: 2011/3/2 13:33  Updated: 2011/3/2 13:33
 Local volatility surface
What's LocalVolSurface function ? where is it defined ?

Poster Thread
Anonymous
Posted: 2011/3/2 14:38  Updated: 2011/3/2 14:38
 Local volatility surface
"What's LocalVolSurface function ? where is it defined ?"
the attached code, when click on the save icon!

Poster Thread
Anonymous
Posted: 2011/6/13 19:33  Updated: 2011/6/13 19:33
 Local volatility surface
my matlab doesn't seem to find 'LocalVolSurface' Function. Do ypu happen to have it in another program? 10x

Poster Thread
Anonymous
Posted: 2012/1/28 8:56  Updated: 2012/1/28 18:42
 Local volatility surface
Hi, is it possible to use this same function on interest rates? I know Dt should be zero in this case, but what do I do with r?

Thanks!

Discuss this file. Just enter your message and click on submit. No registration is required.
Similar Links:
Volatility Surface (Forum)
volatility surface (Forum)
implied volatility surface (Forum)
Implied Volatility Surface (Software)
Local volatility tree (Software)

Subscribe to RSS or daily email updates of latest quantitative finance code listings
Email address :
Copyright © 2011 QuantCode Inc. All rights reserved.