Code covered by the BSD License  

Highlights from
volatility to premium for swaptions (Black76 model)

volatility to premium for swaptions (Black76 model)

by

 

This function convert ATM volatility surface into swaption premiums and par rates.

vol2par_swaption( curve, V, period )
function [ bmk_swp_premium, par_rate ] = vol2par_swaption( curve, V, period )

% This function determines the matrix of swaption premiums
% and the corresponding ATM par rates. The structure of the output
% is identical to the Volatility surface matrix V, which is assumed
% to be 10y X 10y of Expiry X Maturity.
% It is assumed single curve discounting and 1,000 notional.
%
% input
% Curve : interest rate curve object
% V : volatility matrix
% Period : frequency of payments of the underlying swaps

%-------------------------------------------------------------------------------
% determine the equivalent premium of the ATM swaptions
%-------------------------------------------------------------------------------

F = curve.getDiscountFactors(datenum(year(curve.Settle)+(1:20)',month(curve.Settle),day(curve.Settle)));
[F1, F2]=meshgrid(F,F);
D=tril(F1-F2);
D1=zeros(10);
for i=1:10;
    d=diag(D,-i);
    D1(:,i)=d(1:end-(10-i));% Fwd factors
end
%D1=D1'; % make it Exp_X_Mat
bmk_swp_premium=1000*D1.*(2*normcdf(V/100.*sqrt(repmat((1:10)',1,10))/2)-1);% price of the bmk ATM swaptions
%-------------------------------------------------------------------------------

CFlowDates=cfdates(curve.Settle,addtodate(curve.Settle,20,'year'),period,curve.Basis,0)'; % the only scope of this cf is feeding the curve to RateSpec

%-------------------------------------------------------------------------------
% get the par rate for the fwd swap component of the ATM Vol Matrix
%-------------------------------------------------------------------------------

d=datenum(year(curve.Settle)+(1:10)',month(curve.Settle),day(curve.Settle));
par_rate=zeros(10);
for i=1:10,
[~, u2]=swapbyzero(curve.toRateSpec(CFlowDates),repmat([NaN 0],10,1),d(i),datenum(year(d(i))+(1:10)',month(d(i)),day(d(i))),[period period],curve.Basis,1000,repmat([1 0],10,1),0);
par_rate(i,:)=u2';
end
%-------------------------------------------------------------------------------


end

Contact us