I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
this unit 6.24
sub units 9.05

total Received

Returns the total amount received from a financial security at maturity Excel: RECEIVED
Controller: CodeCogs






YearBasisbasis = yb_USA
boolWorkLikeExcel = 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:

  • 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:
yb_US0US (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_Act1Uses the exact number of elapsed days between the two dates, as well as the exact length of the year.
yb_Act3602Uses the exact number of elapsed days between two dates but assumes the year only have 360 days
yb_Act3653Uses the exact number of elapsed days between two dates but assumes the year always has 365 days
yb_EU4European 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.


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.


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.


Microsoft Excel Help File

Example 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);


settlementis the date date after the issue date when the security is traded to the buyer in Julian date form
maturityis security's maturity date, expressed as a serial Julian date number
investmentis the value of the investment
discountis the security's discount rate
basisis the day count basis, whereyb_USA = US (NASD) 30/360,yb_Act = Actual/actualyb_Act360 = Actual/360yb_Act365 = Actual/365yb_EU = European 30/360
WorkLikeExcelemulates Excel's "wrong" calculation of Actual/actual; seedocumentation for details....


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.