VIX Implied Volatility Toolbox (MATLAB)
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:
There are two options to install the VIX Implied Volatility Toolbox on your machine.
[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 priceAll 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.