Returns the accrued interest for a security that pays interest at
maturity.
The function is based on the following equation:
(1)
Where
par is the par value of the security (if not specified, $1,000 is assumed),
rate is the security's annual coupon rate
A is the days from the issue date to maturity, and
D is the number of days in a year, depending on the year basis.
Warnings:
This function differs from its Excel cousin in that it performs a more accurate calculation of securities using the Actual/Actual day count basis, when WorkLikeExcel=false. Specifically, it accurately determines if the settlement date falls in a leap year (Excel thinks that every 4th year is a leap year, see isleapyear), and we also check if the 'leap day'; on the 29th Feb falls between the maturity and settlement dates. Only when these two conditions are satisfied is the year assumed to have 366 days. In insances when the settlement to maturity span several years, and one or more of these years is a leap years, then the average of the year lengths is used.
Bugs:
See totalreceived for details of an ongoing very minor bug to the calculations using yb_Act when replicating Excel's behaviour. The following example illustrates the difference with this function:
is the issue date when
the security is issued to the buyer in Julian date form
maturity
is security's maturity date, expressed as a serial
Julian date number
rate
is the coupon rate of the security
par
is the value of the security (defaults to $1,000 if omitted)
basis
is the day count basis, where:
Type
Value
Description
yb_US
0
US (NASD) 30/360 - As with the European 30/360 (yb_EU, with the additional provision that if the end date occurs on the 31st of a month it is moved to the 1st of the next month if the start date is earlier than the 30th.
yb_Act
1
Uses the exact number of elapsed days between the two dates, as well as the exact length of the year.
yb_Act360
2
Uses the exact number of elapsed days between two dates but assumes the year only have 360 days
yb_Act365
3
Uses the exact number of elapsed days between two dates but assumes the year always has 365 days
yb_EU
4
European 30/360 - Each month is assumed to have 30 days, such that the year has only 360 days. Start and end dates that occur on the 31st of a month become equal to the 30th of the same month.
WorkLikeExcel
emulates Excel's "wrong" calculation of Actual/actual; see documentation for details....