| Category: Matlab |
View Full Details
|
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.
|
1129 0 bytes Octave Matlab http://www.quantcode.com/ |
|
| 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.