%% Compute Zero Curve Given Par Yield Curve Using datetime Inputs
% Use datetime inputs to compute the zero curve given the par yield curve.

Settle = datenum('01-Feb-2013');

CurveDates = [datenum('01-Feb-2014')
    datenum('01-Feb-2015')
    datenum('01-Feb-2016')
    datenum('01-Feb-2018')
    datenum('01-Feb-2020')
    datenum('01-Feb-2023')
    datenum('01-Feb-2033')
    datenum('01-Feb-2043')];

OriginalParRates = [0.11 0.30 0.64 1.42 2.02 2.51 3.10 3.31]'/100;

InputCompounding = 1;
InputBasis = 0;
OutputCompounding = 1;
OutputBasis = 0;

Settle = datetime(Settle, 'ConvertFrom', 'datenum','Locale','en_US');
CurveDates = datetime(CurveDates, 'ConvertFrom', 'datenum','Locale','en_US');
[ZeroRates Dates] = pyld2zero(OriginalParRates, CurveDates, Settle, ...
'OutputCompounding', OutputCompounding, 'OutputBasis', OutputBasis, ...
'InputCompounding', InputCompounding, 'InputBasis', InputBasis)

% Copyright 2012 The MathWorks, Inc.