Evaluates the yield of a Treasury bill.
#include <imsl.h>
float
imsl_f_treasury_bill_yield (struct
tm settlement,
struct
tm maturity, float price)
The type double function is imsl_d_treasury_bill_yield.
struct tm
settlement (Input)
The date on which payment is made to
settle a trade. For a more detailed discussion on dates see the Usage Notes section of
this chapter.
struct tm maturity
(Input)
The date on which the bond comes due, and principal and accrued
interest are paid. For a more detailed discussion on dates see the Usage Notes section of
this chapter.
float price
(Input)
Price per $100 face value of the Treasury bill.
The yield for a Treasury bill. If no result can be computed, NaN is returned.
Function imsl_f_treasury_bill_yield computes the yield for a Treasury bill.
It is computed using the following:

In the equation above, DSM represents the number of days in the period starting with the settlement date and ending with the maturity date (any maturity date that is more than one calendar year after the settlement date is excluded).
In this example, imsl_f_treasury_bill_yield computes the yield for a Treasury bill with the settlement date of July 1, 2000, the maturity date of July 1, 2001, and priced at $94.93.
#include <stdio.h>
#include "imsl.h"
void main()
{
struct tm settlement, maturity;
float price = 94.93;
float yield;
settlement.tm_year = 100;
settlement.tm_mon = 6;
settlement.tm_mday = 1;
maturity.tm_year = 101;
maturity.tm_mon = 6;
maturity.tm_mday = 1;
yield = imsl_f_treasury_bill_yield (settlement, maturity, price);
printf ("The yield for the T-bill is %.2f%%.\n", yield * 100.);
}
The yield for the T-bill is 5.27%.
|
Visual Numerics, Inc. PHONE: 713.784.3131 FAX:713.781.9260 |