| Financial Toolbox™ | ![]() |
Dates = time2date(Settle, TFactors, Compounding, Basis, EndMonthRule)
Settle | Settlement date. A vector of serial date numbers or date strings. |
TFactors | A vector of time factors corresponding to the compounding value. TFactors must be equal to or greater than zero. |
Compounding | (Optional) Scalar value representing the rate at which the input zero rates were compounded when annualized. Default = 2. This argument determines the formula for the discount factors: Compounding = 1, 2, 3, 4, 6, 12 Disc = (1 + Z/F)^(-T), where F is the compounding frequency, Z is the zero rate, and T is the time in periodic units; for example,T = F is one year. Compounding = 365 Disc = (1 + Z/F)^(-T), where F is the number of days in the basis year and T is a number of days elapsed computed by basis. Compounding = -1 Disc = exp(-T*Z), where T is time in years. |
Basis | (Optional) Day-count basis of the instrument. A vector of integers.
|
EndMonthRule | (Optional) End-of-month rule. A vector. This rule applies only when Maturity is an end-of-month date for a month having 30 or fewer days. 0 = ignore rule, meaning that a bond's coupon payment date is always the same numerical day of the month. 1 = set rule on (default), meaning that a bond's coupon payment date is always the last actual day of the month. |
Dates = time2date(Settle, TFactors, Compounding, Basis, EndMonthRule) computes dates corresponding to the times occurring beyond the settlement date.
The time2date function is the inverse of date2time.
Show that date2time and time2date are the inverse of each other. First compute the time factors using date2time.
Settle = '1-Sep-2002';
Dates = datenum(['31-Aug-2005'; '28-Feb-2006'; '15-Jun-2006';
'31-Dec-2006']);
Compounding = 2;
Basis = 0;
EndMonthRule = 1;
TFactors = date2time(Settle, Dates, Compounding, Basis,...
EndMonthRule)
TFactors =
5.9945
6.9945
7.5738
8.6576
Now use the calculated TFactors in time2date and compare the calculated dates with the original set.
Dates_calc = time2date(Settle, TFactors, Compounding, Basis,...
EndMonthRule)
Dates_calc =
732555
732736
732843
733042
datestr(Dates_calc)
ans =
31-Aug-2005
28-Feb-2006
15-Jun-2006
31-Dec-2006
![]() | tick2ret (fts) | times | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |