Time and frequency from dates
date2timeUsing an actual/actual Basis
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.
Settle— Settlement date
Settlement date, specified as a serial date number, date character vector, or datetime array.
Maturity— Maturity date
Maturity date, specified as a scalar or
using serial date numbers, date character vectors, or datetime arrays.
Compounding— Rate at which input zero rates are compounded when annualized
2(Semiannual compounding) (default) | scalar with numeric values of
Rate at which input zero rates are compounded when annualized,
specified as a scalar with numeric values of:
–1. Allowed values are defined as:
0 — Simple interest (no
1 — Annual compounding
2 — Semiannual compounding
3 — Compounding three times
4 — Quarterly compounding
6 — Bimonthly compounding
12 — Monthly compounding
365 — Daily compounding
-1 — Continuous compounding
Compounding argument determines
the formula for the discount factors (
Disc = 1/(1 + Z * T), where
time in years and simple interest assumes annual times
Disc = (1 + Z/F)^(-T), where
the compounding frequency,
Z is the zero rate,
T is the time in periodic units, for example,
= F is one year.
Disc = (1 + Z/F)^(-T), where
the number of days in the basis year and
T is a
number of days elapsed computed by basis.
Disc = exp(-T*Z), where
time in years.
Basis— Day-count basis
0(actual/actual) (default) | numeric with value
13| vector of numerics with values
Day-count basis, specified as an integer with a value
1 vector of integers
0 = actual/actual (default)
1 = 30/360 (SIA)
2 = actual/360
3 = actual/365
4 = 30/360 (BMA)
5 = 30/360 (ISDA)
6 = 30/360 (European)
7 = actual/365 (Japanese)
8 = actual/actual (ICMA)
9 = actual/360 (ICMA)
10 = actual/365 (ICMA)
11 = 30/360E (ICMA)
12 = actual/365 (ISDA)
13 = BUS/252
For more information, see basis.
EndMonthRule— End-of-month rule flag for month having 30 or fewer days
1(in effect) (default) | nonnegative integer
End-of-month rule flag for month having 30 or fewer days, specified
as scalar nonnegative integer [
or a using a
1 vector of
values. This rule applies only when
an end-of-month date for a month having 30 or fewer days.
0 = Ignore rule, meaning that a
payment date is always the same numerical day of the month.
1 = Set rule on, meaning that a
payment date is always the last actual day of the month.
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.
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