image thumbnail
from Modeling Variable Annuities with MATLAB by Yi Wang
This demo shows how to price variable annuity product (Guaranteed Minimum Withdrawal Benefit)

calcGMWB(tickers, holdings, startDate, endDate, aWRate, aFee, rfRate)
function [cost, fee, probRuin, avgRet, vol]= calcGMWB(tickers, holdings, startDate, endDate, aWRate, aFee, rfRate)

% Portfolio
EP.Ticker = tickers;
% Range for historical data.
EP.FromDate = startDate;
EP.ToDate = endDate;
EP.Period = 'm';
% Assuming we're holding 10 shares of each stock in EP.Ticker
EP.Holdings = holdings;

va = GMWB(aWRate, aFee, rfRate, EP, [], []);
[cost, fee, probRuin] = va.price('display');
[avgRet, vol, ~] = va.calcRetSigCorr();

end

Contact us