Time and frequency from dates
[TFactors, F] = date2time(Settle, Maturity, Compounding, Basis,
Settlement date, a vector specified as serial date numbers, date character vectors, or datetime arrays.
A vector of maturity dates, specified as serial date numbers, date character vectors, or datetime arrays.
(Optional) Scalar value representing the rate at which
the input zero rates were compounded when annualized. The default
(Optional) Day-count basis of the instrument. A vector of integers.
For more information, see basis.
(Optional) End-of-month rule. A vector. This rule applies
[TFactors, F] = date2time(Settle, Maturity, Compounding,
Basis, EndMonthRule) computes time factors appropriate to
compounded rate quotes between the settlement and maturity dates.
TFactors is a vector of time factors.
F is a scalar of related compounding frequencies.
date2time is the inverse of
The difference between
date2time counts full periods as a whole
integer, even if the number of actual days in the periods are different.
not count full periods. For example,
yearfrac('1/1/2000', '1/1/2001', 9)
ans = 1.0167
ICMA) calculates 366/360 = 1.0167. So, even if the dates have the
same month and date, with a difference of 1 in the year, the returned
value may not be exactly 1. On the other hand,
one full year period:
date2time('1/1/2000', '1/1/2001', 1, 9)
ans = 1
To get the
date2time period between '31-Jul-2015' and '30-Sep-2015' using an actual/actual basis:
date2time('31-Jul-2015', '30-Sep-2015', 2, 0, 1)
ans = 0.3333
date2time quasi coupon, two quasi coupon dates are computed for a bond with a maturity corresponding to the
Dates input. In this case, that would be "30-Sep-2015". Assuming that the compounding frequency is
2, the other quasi coupon date is six months prior to this date. Assuming the end of month rule is in place, then the other quasi coupon date is "31-Mar-2015". You can use these two dates to compute the total number of actual days in a period (which is 183). Given this, the fraction of time between the start and end date for the actual/actual basis is computed as follows.
(Actual Days between Start Date and End Date)/(Actual Number of Days between Quasi Coupon Dates)
There are 61 days between 31-Jul-2015 and 30-Sep-2015 and 183 days between the quasi coupon dates ("31-Mar-2015" and "30-Sep-2015") which leads to a final result of 61/183 or exactly 1/3.