#include <codecogs/finance/banking/billprice.h>
using namespace Finance::Banking;
| double | billPrice (int sett, int mat, double rate) Calculate the price per 100 units face value of a treasury bill.
Excel: TBILLPRICE | |
| Real | cc_billPrice (Integer sett, Integer mat, Real rate) This function is available as a Microsoft Excel add-in. |
| doublebillPrice( | int | sett | |
| int | mat | ||
| double | rate | ) |
#include <stdio.h> #include <codecogs/units/date/date.h> #include <codecogs/finance/banking/billprice.h> int main(int argc, char *argv[]) { int settDate=Units::Date::date(1999, 3, 31); int maturityDate=Units::Date::date(1999, 6, 1); double result=Finance::Banking::billPrice(settDate, maturityDate, 0.09); 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("treasury bill price=%f\n\n", result); settDate=Units::Date::date(2005, 8, 9); maturityDate=Units::Date::date(2005, 12, 30); result=Finance::Banking::billPrice(settDate, maturityDate, 0.11); 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("treasury bill price=%f\n", result); return 0; }Output:
settlement=1999/3/31 maturity=1999/6/1 treasury bill price=98.45 settlement=2005/8/9 maturity=2005/12/30 treasury bill price=95.661111
| 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. |
| rate | The discount rate of the treasury bill. |