FUNCTION
interestSecurity
Return the interest rate for a fully invested security. <span align="right" style="background-color:99FF99"><strong>Excel: INTRATE</strong></span>
Interface
#include <codecogs/finance/banking/interestsecurity.h>
using namespace Finance::Banking;
Returns the interest rate for a fully invested security. The function works using the following equation:
(1)
where:
- 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
basis,
- 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.058328Parameters
sett
The settlement date of the security, expressed as a serial
Blank
Julian date. This is the date after issue when the security is traded to the buyer.
Parameters
mat
The maturity date of the security, expressed as a serial
Blank
Julian date. The maturity date is the date when the security expires.
Parameters
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.
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.
This function's source code is only visible to registered users — documentation and the calculator above are free to use either way. Sign in to see it.