MATLAB Toolbox installer (recommended)
Zip archive containing all codes
This toolbox computes approximate values of the Black & Scholes implied volatility of VIX options using a perturbative technique applied to the infinitesimal generator of the underlying process. The modelling setup requires that the VIX index dynamics is explicitly computable as a smooth transformation φ of a purely diffusive, one-dimensional Markov process Y. Specifically:
where W denots a Brownian motion. More details can be found in this paper. Please note that this tool is not a standalone software, but it fully relies on the MATLAB suite.This code has been tested on MATLAB R2017a but it should work on any version of MATLAB that supports symbolic calculus. The following MATLAB Toolboxes are required to ensure full compatibility of the code:
- Symbolic Math Toolbox
There are two options to install the VIX Implied Volatility Toolbox on your machine.
- Download the MATLAB Toolbox installer.
- Double-click on the file to start the installation process.
- If the double-click does not work you may alternatively open the file by dragging it into the MATLAB command window.
- Call the main function by viximpv.
- If the installation does not work switch to the next method.
- Download the zip archive containing all the necessary resources.
- Extract the archive contents into a local folder.
- Set the folder containing the extracted file as MATLAB current folder or, alternatively, add it to the MATLAB path list.
- Call the main function by viximpv.
[Sigma,Futures]=VIXIMPV(Mu,Eta,Phi,Y0,K,T,Order)
Mu
: Drift coefficient of Y (function handle)Eta
: Diffusion coefficient of Y (function handle)Phi
: Function mapping Y to VIX (function handle or symbolic function)Y0
: Initial value of Y (scalar)K
: Strike values (vector)T
: Maturity (scalar)Order
: Expansion order (integer between 0 and 4)
Sigma
: Approximate VIX implied volatilityFutures
: Approximate VIX futures price
All the examples provided below are contained in this MATLAB script.
% Setting model parameters
Lambda=3;
Theta=0.04;
Epsilon=0.5;
Y0=0.035;
% Drift
Mu=@(y) Lambda*(Theta-y);
% Diffusion
Eta=@(y) Epsilon*sqrt(y);
% Function Phi
Tau=30/365;
a=(1-exp(-Lambda*Tau))/(Lambda*Tau);
b=Theta*(1-a);
Phi=@(y) sqrt(a*y+b);
% Setting maturity and strikes
T=1/48;
K=.13:.01:.25;
% Computing approximate implied volatilities
Sigma2=viximpv(Mu,Eta,Phi,Y0,K,T,2);
Sigma3=viximpv(Mu,Eta,Phi,Y0,K,T,3);
Sigma4=viximpv(Mu,Eta,Phi,Y0,K,T,4);
% Plotting
plot(K,[Sigma2; Sigma3; Sigma4],'LineWidth',2);
axis tight;
grid on;
Figure: Implied volatility as function of the log-moneyness.
% Setting model parameters
Lambda=3;
Theta=0.04;
Epsilon=1.5;
Delta=1;
Y0=0.035;
% Drift
Mu=@(y) Lambda*(Theta-y);
% Diffusion
Eta=@(y) Epsilon*(y.^Delta);
% Phi
Tau=30/365;
a=(1-exp(-Lambda*Tau))/(Lambda*Tau);
b=Theta*(1-a);
Phi=@(y) sqrt(a*y+b);
% Setting maturity and strikes
T=1/48;
K=.13:.01:.25;
% Computing approximate implied volatilities
Sigma2=viximpv(Mu,Eta,Phi,Y0,K,T,2);
Sigma3=viximpv(Mu,Eta,Phi,Y0,K,T,3);
Sigma4=viximpv(Mu,Eta,Phi,Y0,K,T,4);
% Plotting
plot(K,[Sigma2; Sigma3; Sigma4],'LineWidth',2);
axis tight;
grid on;
Figure: Implied volatility as function of the log-moneyness.
% Setting model parameters
Lambda=10;
Theta=0.02;
Epsilon=3.5;
Y0=-3.3;
% Drift
Mu=@(y) Lambda*(log(Theta)-y);
% Diffusion
Eta=@(y) Epsilon;
% Phi
syms x y;
Tau=30/365;
g=exp(exp(-Lambda*x).*y+log(Theta)*(1-exp(-Lambda*x))+Epsilon^2/(4*Lambda)*(1-exp(-2*Lambda*x)));
Phi=(1/sqrt(Tau))*sqrt(int(g,x,0,Tau));
% Setting maturity and strikes
T=1/48;
K=.13:.01:.25;
% Computing approximate implied volatilities
Sigma2=viximpv(Mu,Eta,Phi,Y0,K,T,2);
Sigma3=viximpv(Mu,Eta,Phi,Y0,K,T,3);
Sigma4=viximpv(Mu,Eta,Phi,Y0,K,T,4);
% Plotting
plot(K,[Sigma2; Sigma3; Sigma4],'LineWidth',2);
axis tight;
grid on;
Figure: Implied volatility as function of the log-moneyness.