total Received
Returns the total amount received from a financial security at maturity
Excel: RECEIVED
Controller: CodeCogs
| doubletotalReceived( | int | settlement | |
| int | maturity | ||
| double | investment | ||
| double | discount | ||
| YearBasis | basis = yb_USA | ||
| bool | WorkLikeExcel = false | ) |
Calculates the total amount received from a financial security at maturity.
The settlement date is the date a buyer purchases a coupon, such as a bond. The maturity date is the date when a coupon expires. For example, suppose a 30-year bond is issued on January 1, 1996, and is purchased by a buyer six months later. The settlement date is taken to be July 1, 1996, and the maturity date would be January 1, 2026, which is 30 years after the January 1, 1996 issue date.
The function is based on the following equation:
Where
- investment is the value of the investment,
- discount is the discount rate,
- DIM is the days from investment settlement to maturity, and
- B is the number of days in a year, depending on the year basis:
Warning
- 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.
Bug
- We can't replicate all of Microsofts errors, and we are confussed by the difference in the follow situations, the first of which matches Bill's solution perfectly, while the second does not - both example span a leap day:
Here 29 Feb in 2004 is the leap day.
totalReceived(date(2001,5,15), date(2004,3,10), 1000000, 0.0575, yb_Act, true) -> 1193529.940364 RECEIVED('15/5/2001', '10/3/2004', 1000000, 0.0575, 1) -> 1193529.94
And this situation the 29 Feb 1996 is the leap day.totalReceived(date(1995,5,2), date(1996,3,5), 738, 0.057, yb_Act, true) -> 775.236820 RECEIVED('15/5/2001', '10/3/2004', 1000000, 0.0575, 1) -> 775.1833867
If you know the solution please let me know :) If investment or discount is less than 0, or the settlement date is greater than the maturity date, the function will return -1.
Reference
Microsoft Excel Help FileExample 1
#include <iostream> #include <codecogs/finance/banking/totalreceived.h> int main() { std::cout << Finance::Banking::totalReceived(Units::Date::date(1999,2,15), Units::Date::date(1999,5,15), 1000000, 0.0575, Finance::Banking::yb_Act365); return(0); }
Output:1.01442e+006
Parameters
settlement is the date date after the issue date when the security is traded to the buyer in Julian date form maturity is security's maturity date, expressed as a serial Julian date number investment is the value of the investment discount is the security's discount rate basis is the day count basis, whereyb_USA = US (NASD) 30/360,yb_Act = Actual/actualyb_Act360 = Actual/360yb_Act365 = Actual/365yb_EU = European 30/360 WorkLikeExcel emulates Excel's "wrong" calculation of Actual/actual; seedocumentation for details....
Authors
- Alwyn Tan, March 2005
Source Code
Source code is available when you buy a Commercial licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.


6.24
