Or login with:
| doubleaccruedInterest( | int | issue | |
| int | maturity | ||
| double | rate | ||
| double | par = 1000.0 | ||
| YearBasis | basis = yb_USA | ||
| bool | WorkLikeExcel = false | ) |
accruedInterest(date(1995,5,2), date(1996,3,5), 738, 0.057, yb_Act, true) -> 35.39980328 ACCRINTM('2/5/1995', '5/3/1996', 738 0.057, 1) -> 35.448230If rate or par is less than or equal to 0, or the issue date is greater than the maturity date, the function will return a value of -1.
#include <iostream> #include <codecogs/finance/banking/accruedinterest.h> int main() { std::cout << Finance::Banking::accruedInterest(Units::Date::date(1998,4,1), Units::Date::date(1998,6,15), 0.1, 1000, Finance::Banking::yb_Act365); return 0; }Output:
20.5479the security is issued to the buyer in Julian date form
Julian date number
<div align="center"> <table border="0"> <tr align="center"><td width="100"> <strong>Type</strong></td><td><strong>Value</strong></td><td><strong>Description</strong></td></tr> <tr><td align="center" valign="top"><em>yb_US</em></td><td valign="top">0</td><td>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.</td></tr> <tr><td align="center" valign="top"><em>yb_Act</em></td><td valign="top">1</td><td>Uses the exact number of elapsed days between the two dates, as well as the exact length of the year.</td></tr> <tr><td align="center" valign="top"><em>yb_Act360</em></td><td valign="top">2</td><td>Uses the exact number of elapsed days between two dates but assumes the year only have 360 days</td></tr> <tr><td align="center" valign="top"><em>yb_Act365</em></td><td valign="top">3</td><td>Uses the exact number of elapsed days between two dates but assumes the year always has 365 days</td></tr> <tr><td align="center" valign="top"><em>yb_EU</em></td><td valign="top">4</td><td>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.</td></tr> </table> </div>
| issue | is the issue date when |
| maturity | is security's maturity date, expressed as a serial |
| 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: |
| WorkLikeExcel | emulates Excel's "wrong" calculation of Actual/actual; see documentation for details.... |
Source code is available when you agree to a GP Licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.
You must login to leave a messge