interest Security
Return the interest rate for a fully invested security.
Excel: INTRATE
Controller: CodeCogs
Dependents
Interface
C++
InterestSecurity
doubleinterestSecurity( | int | sett | |
int | mat | ||
double | investAm | ||
double | redemAm | ||
Finance::Banking::YearBasis | basis = yb_USA | ) |
- rate is the interest rate for the security,
- redemption is the amount to be received at maturity,
- investment is the amount invested in the security,
- B is the number of days in the year, depending on the year
- and DIM is the number of days from settlement to maturity.
Example 1
#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
Julian date. This is the date after issue when the security is traded to the buyer.
Julian date. The maturity date is the date when the security expires.
Note
- The day count basis is specified using the basis parameter. This basis can be any of the following: yb_USA, yb_EU, yb_Act, yb_Act360 or yb_Act365.
Parameters
sett The settlement date of the security, expressed as a serial mat The maturity date of the security, expressed as a serial investAm The amount invested in the security. redemAm The amount to be received at maturity. basis The day count basis to use. See YearBasis
Returns
- The interest rate for the security.
Authors
- James Warren (August 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.