FUNCTION
billYield
Calculate the yield for a treasury bill. <span align="right" style="background-color:99FF99"><strong>Excel: TBILLYIELD</strong></span>
You're viewing an older version of this page (#304). View the current version.
Interface
#include <codecogs/finance/banking/billyield.h>
using namespace Finance::Banking;
This function calculates the yield for a treasury bill. It is equivalent to the Microsoft Excel function TBILLYIELD. The following equation is used to calculate the result:
Where: yield is the yield of the treasury bill, pr is the price per 100 (currency units) face value, and DSM is the number of days from settlement to maturity.
Example:
#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
References
Microsoft Excel help file
Parameters
This is the date after issue when the treasury bill is traded to the buyer.
Parameters
Julian date. This is the date when the treasury bill expires.
Parameters
(expressed in the appropriate currency units).
Returns
maturity dates more than 1 yeaer after the settlement date cause an error message to be issued.
Interactive Calculator
Computing…
Set a range above first to export a graph.