%% Compute the Price and Accrued Interest for a Certificate of Deposit Using datetime Inputs
% This example shows how to use datetime inputs to compute the price and the accrued interest due on the settlement date, given a certificate of deposit with the following characteristics.

Yield =  0.0525;
CouponRate =  0.05;
Settle =  datetime('02-Jan-02','Locale','en_US');
Maturity =  datetime('31-Mar-02','Locale','en_US');
IssueDate =  datetime('1-Oct-01','Locale','en_US');

[Price, AccruedInt] = cdprice(Yield, CouponRate, Settle, ...
Maturity, IssueDate)

% Copyright 2012 The MathWorks, Inc.