#include <codecogs/finance/banking/billyield.h>
using namespace Finance::Banking;
| double | billYield (int sett, int mat, double price) Calculate the yield for a treasury bill.
Excel: TBILLYIELD | |
| Real | cc_billYield (Integer sett, Integer mat, Real price) This function is available as a Microsoft Excel add-in. |
| doublebillYield( | int | sett | |
| int | mat | ||
| double | price | ) |
#include <iostream> #include <codecogs/units/date/date.h> #include <codecogs/units/date/dateymd.h> #include <codecogs/finance/banking/billyield.h> int main() { int settDate=Units::Date::date(1999, 3, 31); int maturityDate=Units::Date::date(1999, 6, 1); double yield=Finance::Banking::billYield(settDate, maturityDate, 98.45); 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("bill yield=%f\n", yield); return 1; }Output:
settlement=1999/3/31 maturity=1999/6/1 bill yield=0.091417
| sett | The settlement date, expressed as a serial Julian date. This is the date after issue when the treasury bill is traded to the buyer. |
| mat | The maturity date of the settlement, expressed as a serial Julian date. This is the date when the treasury bill expires. |
| price | The price per 100 face value of the treasury bill (expressed in the appropriate currency units). |