viximpv

VIX Implied Volatility Toolbox (MATLAB)


Current version
17.11
Author
Andrea Barletta


Latest downloads

MATLAB Toolbox installer (recommended)
Zip archive containing all codes


Getting Started

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.

Prerequisites

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:

Installing rndfittool

There are two options to install the VIX Implied Volatility Toolbox on your machine.

Installing viximpv through zip archive


Usage

Syntax

[Sigma,Futures]=VIXIMPV(Mu,Eta,Phi,Y0,K,T,Order)

Input

Output


Examples

All the examples provided below are contained in this MATLAB script.

Heston model

Definition

MATLAB code

% 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.

Mean-reverting CEV model

Definition

MATLAB code

% 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.

Exp-OU model

Definition

MATLAB code

% 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.