#include <codecogs/finance/banking/interestsecurity.h>
using namespace Finance::Banking;
| double | interestSecurity (int sett,
int mat,
double investAm,
double redemAm,
Finance::Banking::YearBasis basis=yb_USA) Return the interest rate for a fully invested security.
Excel: INTRATE |
| doubleinterestSecurity( | int | sett | |
| int | mat | ||
| double | investAm | ||
| double | redemAm | ||
| Finance::Banking::YearBasis | basis = yb_USA | ) |
#include <iostream> #include <codecogs/units/date/date.h> #include <codecogs/units/date/dateymd.h> #include <codecogs/finance/banking/interestsecurity.h> int main(int argc, char *argv[]) { int settDate=Units::Date::date(1999, 2, 15); int maturityDate=Units::Date::date(1999, 5, 15); double intRate=Finance::Banking::interestSecurity(settDate, maturityDate, 1000000, 1014420, Finance::Banking::yb_Act360); int y, m, d; Units::Date::dateYMD(settDate, y, m, d); printf("settlement=%i/%i/%i\n", y, m, d); Units::Date::dateYMD(maturityDate, y, m, d); printf("maturity=%i/%i/%i\n", y, m, d); printf("interest rate=%f", intRate); return 1; }Output:
settlement=1999/2/15 maturity=1999/5/15 interest rate=0.058328
| sett | The settlement date of the security, expressed as a serial Julian date. This is the date after issue when the security is traded to the buyer. |
| mat | The maturity date of the security, expressed as a serial Julian date. The maturity date is the date when the security expires. |
| investAm | The amount invested in the security. |
| redemAm | The amount to be received at maturity. |
| basis | The day count basis to use. See YearBasis |