|
JMSL 2.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.imsl.finance.Bond
Collection of bond functions.
rate is an annualized rate of return based on the par value of the bills.
yield is an annualized rate based on the purchase price and reflects the actual yield to maturity.
coupons are interest payments on a bond.
redemption is the amount a bond pays at maturity.
frequency is the number of times a year that a bond makes interest payments.
basis is the method used to calculate dates. For example, sometimes computations are done assuming 360 days in a year.
issue is the day a bond is first sold.
settlement is the day a purchaser aquires a bond.
maturity is the day a bond's principal is repaid.
pricedisc(rate)priceyield(yield)pricemat(issue, rate, yield)disc(price)yielddisc(price)accrintm,
which returns the interest that has accumulated on the discount bond.
tbillprice(rate)tbillyield(price)tbilleq(rate)price(rate, yield, redemption)yield(rate, price, redemption)received(price, rate)accrint,
which returns the interest that has accumulated at settlement from the previous
coupon date.

coupppcd is the coupon date immediately prior to the settlement date.coupncd is the coupon date immediately after the settlement date.coupdaybs is the number of days from the immediately prior coupon date
to the settlement date.
coupdaysnc is the number of days from the settlement date to the
next coupon date.
coupdays is the number of days between these two coupon dates.
coupnum,
which returns the number of coupons payable between settlement and maturity.
Another related method is yearfrac,
which returns the fraction of the year between two days.
| Field Summary | |
static int |
ANNUAL
|
static int |
QUARTERLY
|
static int |
SEMIANNUAL
|
| Constructor Summary | |
Bond()
|
|
| Method Summary | |
static double |
accrint(GregorianCalendar issue,
GregorianCalendar firstCoupon,
GregorianCalendar settlement,
double rate,
double par,
int frequency,
DayCountBasis basis)
Returns the interest which has accrued on a security that pays interest periodically. |
static double |
accrintm(GregorianCalendar issue,
GregorianCalendar maturity,
double rate,
double par,
DayCountBasis basis)
Returns the interest which has accrued on a security that pays interest at maturity. |
static double |
amordegrc(double cost,
GregorianCalendar issue,
GregorianCalendar firstPeriod,
double salvage,
int period,
double rate,
DayCountBasis basis)
Returns the depreciation for each accounting period. |
static double |
amorlinc(double cost,
GregorianCalendar issue,
GregorianCalendar firstPeriod,
double salvage,
int period,
double rate,
DayCountBasis basis)
Returns the depreciation for each accounting period. |
static double |
convexity(GregorianCalendar settlement,
GregorianCalendar maturity,
double coupon,
double yield,
int frequency,
DayCountBasis basis)
Returns the convexity for a security. |
static int |
coupdaybs(GregorianCalendar settlement,
GregorianCalendar maturity,
int frequency,
DayCountBasis basis)
Returns the number of days starting with the beginning of the coupon period and ending with the settlement date. |
static double |
coupdays(GregorianCalendar settlement,
GregorianCalendar maturity,
int frequency,
DayCountBasis basis)
Returns the number of days in the coupon period containing the settlement date. |
static int |
coupdaysnc(GregorianCalendar settlement,
GregorianCalendar maturity,
int frequency,
DayCountBasis basis)
Returns the number of days starting with the settlement date and ending with the next coupon date. |
static GregorianCalendar |
coupncd(GregorianCalendar settlement,
GregorianCalendar maturity,
int frequency,
DayCountBasis basis)
Returns the first coupon date which follows the settlement date. |
static int |
coupnum(GregorianCalendar settlement,
GregorianCalendar maturity,
int frequency,
DayCountBasis basis)
Returns the number of coupons payable between the settlement date and the maturity date. |
static GregorianCalendar |
couppcd(GregorianCalendar settlement,
GregorianCalendar maturity,
int frequency,
DayCountBasis basis)
Returns the coupon date which immediately precedes the settlement date. |
static double |
disc(GregorianCalendar settlement,
GregorianCalendar maturity,
double price,
double redemption,
DayCountBasis basis)
Returns the implied interest rate of a discount bond. |
static double |
duration(GregorianCalendar settlement,
GregorianCalendar maturity,
double coupon,
double yield,
int frequency,
DayCountBasis basis)
Returns the Macaluey's duration of a security where the security has periodic interest payments. |
static double |
intrate(GregorianCalendar settlement,
GregorianCalendar maturity,
double investment,
double redemption,
DayCountBasis basis)
Returns the interest rate of a fully invested security. |
static double |
mduration(GregorianCalendar settlement,
GregorianCalendar maturity,
double coupon,
double yield,
int frequency,
DayCountBasis basis)
Returns the modified Macauley duration for a security with an assumed par value of $100. |
static double |
price(GregorianCalendar settlement,
GregorianCalendar maturity,
double rate,
double yield,
double redemption,
int frequency,
DayCountBasis basis)
Returns the price, per $100 face value, of a security that pays periodic interest. |
static double |
pricedisc(GregorianCalendar settlement,
GregorianCalendar maturity,
double rate,
double redemption,
DayCountBasis basis)
Returns the price of a discount bond given the discount rate. |
static double |
pricemat(GregorianCalendar settlement,
GregorianCalendar maturity,
GregorianCalendar issue,
double rate,
double yield,
DayCountBasis basis)
Returns the price, per $100 face value, of a discount bond. |
static double |
priceyield(GregorianCalendar settlement,
GregorianCalendar maturity,
double yield,
double redemption,
DayCountBasis basis)
Returns the price of a discount bond given the yield. |
static double |
received(GregorianCalendar settlement,
GregorianCalendar maturity,
double investment,
double rate,
DayCountBasis basis)
Returns the amount one receives when a fully invested security reaches the maturity date. |
static double |
tbilleq(GregorianCalendar settlement,
GregorianCalendar maturity,
double rate)
Returns the bond-equivalent yield of a Treasury bill. |
static double |
tbillprice(GregorianCalendar settlement,
GregorianCalendar maturity,
double rate)
Returns the price, per $100 face value, of a Treasury bill. |
static double |
tbillyield(GregorianCalendar settlement,
GregorianCalendar maturity,
double price)
Returns the yield of a Treasury bill. |
static double |
yearfrac(GregorianCalendar start,
GregorianCalendar end,
DayCountBasis basis)
Returns the fraction of a year represented by the number of whole days between two dates. |
static double |
yield(GregorianCalendar settlement,
GregorianCalendar maturity,
double rate,
double price,
double redemption,
int frequency,
DayCountBasis basis)
Returns the yield of a security that pays periodic interest. |
static double |
yielddisc(GregorianCalendar settlement,
GregorianCalendar maturity,
double price,
double redemption,
DayCountBasis basis)
Returns the annual yield of a discount bond. |
static double |
yieldmat(GregorianCalendar settlement,
GregorianCalendar maturity,
GregorianCalendar issue,
double rate,
double price,
DayCountBasis basis)
Returns the annual yield of a security that pays interest at maturity. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int ANNUAL
public static final int SEMIANNUAL
public static final int QUARTERLY
| Constructor Detail |
public Bond()
| Method Detail |
public static double accrint(GregorianCalendar issue,
GregorianCalendar firstCoupon,
GregorianCalendar settlement,
double rate,
double par,
int frequency,
DayCountBasis basis)
accrint can be found by solving the following:

issue - the GregorianCalendar issue date of the securityfirstCoupon - the GregorianCalendar date of the security's first
interest datesettlement - the GregorianCalendar settlement date of the securityrate - a double, the security's annual coupon ratepar - a double, the security's par valuefrequency - an int, the number of coupon payments per year,
1 for annual, 2 for semiannual, 4 for quarterlybasis - a DayCountBasis object which contains the type of
day count basis to use
double, the accrued interest
public static double accrintm(GregorianCalendar issue,
GregorianCalendar maturity,
double rate,
double par,
DayCountBasis basis)
![]()
issue - the GregorianCalendar issue date of the securitymaturity - the GregorianCalendar date of the security's
maturityrate - a double, the security's annual coupon ratepar - a double, the security's par valuebasis - a DayCountBasis object which contains the type of
day count basis to use
double, the accrued interest
public static double amordegrc(double cost,
GregorianCalendar issue,
GregorianCalendar firstPeriod,
double salvage,
int period,
double rate,
DayCountBasis basis)
amorlinc. However, in this
function a depreciation coefficient based on the asset life is
applied during the evaluation of the function.
cost - a double, the cost of the assetissue - the GregorianCalendar issue date of the assetfirstPeriod - the GregorianCalendar date of the end of the first
periodsalvage - a double, the asset's salvage value at the
end of the life of the assetperiod - an int, the periodrate - a double, the rate of depreciationbasis - a DayCountBasis object which contains the type of
day count basis to use
double, the depreciation
public static double amorlinc(double cost,
GregorianCalendar issue,
GregorianCalendar firstPeriod,
double salvage,
int period,
double rate,
DayCountBasis basis)
amordegrc, except that amordegrc has a
depreciation coefficient that is applied during the evaluation that
is based on the asset life.
cost - a double, the cost of the assetissue - the GregorianCalendar issue date of the assetfirstPeriod - the GregorianCalendar date of the end of the first
periodsalvage - a double, the asset's salvage value at the
end of the life of the assetperiod - an int, the periodrate - a double, the rate of depreciationbasis - a DayCountBasis object which contains the type of
day count basis to use
double, the depreciation
public static double coupdays(GregorianCalendar settlement,
GregorianCalendar maturity,
int frequency,
DayCountBasis basis)
settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityfrequency - an int, the number of coupon payments per yearbasis - a DayCountBasis object which contains the type of
day count basis to use
int, the number of days in the coupon period that
contains the settlement date
public static int coupdaybs(GregorianCalendar settlement,
GregorianCalendar maturity,
int frequency,
DayCountBasis basis)
settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityfrequency - an int, the number of coupon payments per yearbasis - a DayCountBasis object which contains the type of
day count basis to use
int, the number of days from the beginning of the coupon
period to the settlement date
public static int coupdaysnc(GregorianCalendar settlement,
GregorianCalendar maturity,
int frequency,
DayCountBasis basis)
settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityfrequency - an int, the number of coupon payments per yearbasis - a DayCountBasis object which contains the type of
day count basis to use
int, the number of days from the settlement date to the
next coupon date
public static GregorianCalendar couppcd(GregorianCalendar settlement,
GregorianCalendar maturity,
int frequency,
DayCountBasis basis)
settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityfrequency - an int, the number of coupon payments per yearbasis - a DayCountBasis object which contains the type of
day count basis to use
int, the previous coupon date before the
settlement date
public static GregorianCalendar coupncd(GregorianCalendar settlement,
GregorianCalendar maturity,
int frequency,
DayCountBasis basis)
settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityfrequency - an int, the number of coupon payments per yearbasis - a DayCountBasis object which contains the type of
day count basis to use
int, the next coupon date after the
settlement date
public static int coupnum(GregorianCalendar settlement,
GregorianCalendar maturity,
int frequency,
DayCountBasis basis)
settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityfrequency - an int, the number of coupon payments per yearbasis - a DayCountBasis object which contains the type of
day count basis to use
int, the number of coupons payable between the
settlement date and maturity date
public static double disc(GregorianCalendar settlement,
GregorianCalendar maturity,
double price,
double redemption,
DayCountBasis basis)
![]()
settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityprice - a double, the security's price per $100 face valueredemption - a double, the security's redemption value per
$100 face valuebasis - a DayCountBasis object which contains the type of
day count basis to use
double, the discount rate for a security
public static double duration(GregorianCalendar settlement,
GregorianCalendar maturity,
double coupon,
double yield,
int frequency,
DayCountBasis basis)

settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securitycoupon - a double, the security's annual coupon rateyield - a double, the security's annual yieldfrequency - an int, the number of coupon payments per year,
1 for annual, 2 for semiannual, 4 for quarterlybasis - a DayCountBasis object which contains the type of
day count basis to use
double, the annual duration of a security with
periodic interest payments
public static double convexity(GregorianCalendar settlement,
GregorianCalendar maturity,
double coupon,
double yield,
int frequency,
DayCountBasis basis)

coupnum, and
settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securitycoupon - a double, the security's annual coupon rateyield - a double, the security's annual yieldfrequency - an int, the number of coupon payments per year,
1 for annual, 2 for semiannual, 4 for quarterlybasis - a DayCountBasis object which contains the type of
day count basis to use
double, the convexity for a security
public static double intrate(GregorianCalendar settlement,
GregorianCalendar maturity,
double investment,
double redemption,
DayCountBasis basis)
![]()
settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityinvestment - a double, the amount investedredemption - a double, the amount to be received at maturitybasis - a DayCountBasis object which contains the type of
day count basis to use
double, the interest rate for a fully
invested security
public static double mduration(GregorianCalendar settlement,
GregorianCalendar maturity,
double coupon,
double yield,
int frequency,
DayCountBasis basis)
![]()
mduration.
settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securitycoupon - a double, the security's annual coupon rateyield - a double, the security's annual yieldfrequency - an int, the number of coupon payments per year,
1 for annual, 2 for semiannual, 4 for quarterlybasis - a DayCountBasis object which contains the type of
day count basis to use
double, the modified Macauley duration for a
security with an assumed par value of $100
public static double price(GregorianCalendar settlement,
GregorianCalendar maturity,
double rate,
double yield,
double redemption,
int frequency,
DayCountBasis basis)

settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityrate - a double, the security's annual coupon rateyield - a double, the security's annual yieldredemption - a double, the security's redemption value per
$100 face valuefrequency - an int, the number of coupon payments per year,
1 for annual, 2 for semiannual, 4 for quarterlybasis - a DayCountBasis object which contains the type of
day count basis to use
double, the price per $100 face value of a security
that pays periodic interest
public static double pricedisc(GregorianCalendar settlement,
GregorianCalendar maturity,
double rate,
double redemption,
DayCountBasis basis)
![]()
settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityrate - a double, the security's discount rateredemption - a double, the security's redemption value per
$100 face valuebasis - a DayCountBasis object which contains the type of
day count basis to use
double, the price per $100 face value of a discounted
security
public static double priceyield(GregorianCalendar settlement,
GregorianCalendar maturity,
double yield,
double redemption,
DayCountBasis basis)

settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityyield - a double, the security's yieldredemption - a double, the security's redemption value per
$100 face valuebasis - a DayCountBasis object which contains the type of
day count basis to use
double, the price per $100 face value of a discounted
security
public static double pricemat(GregorianCalendar settlement,
GregorianCalendar maturity,
GregorianCalendar issue,
double rate,
double yield,
DayCountBasis basis)

settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityissue - the GregorianCalendar issue date of the securityrate - a double, the security's interest rate at issue dateyield - a double, the security's annual yieldbasis - a DayCountBasis object which contains the type of
day count basis to use
double, the price per $100 face value of a
security that pays interest at maturity
public static double received(GregorianCalendar settlement,
GregorianCalendar maturity,
double investment,
double rate,
DayCountBasis basis)

settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityinvestment - a double, the amount invested in the securityrate - a double, the security's rate at issue datebasis - a DayCountBasis object which contains the type of
day count basis to use
double, the amount received at maturity for a
fully invested security
public static double tbilleq(GregorianCalendar settlement,
GregorianCalendar maturity,
double rate)
If ![]()


settlement - the GregorianCalendar settlement date of the Treasury
bill.maturity - the GregorianCalendar maturity date of the Treasury
bill. The maturity cannot be more than a year after the settlement.rate - a double, the Treasury bill's discount rate at issue date.
The discount rate is an annualized rate of return based
on the par value of the bills. The discount rate is calculated
on a 360-day basis (twelve 30-day months).
double, the bond-equivalent yield for
the Treasury bill.
This is an annualized rate based on the purchase price
of the bills and reflects the actual yield to maturity.
public static double tbillprice(GregorianCalendar settlement,
GregorianCalendar maturity,
double rate)

settlement - the GregorianCalendar settlement date of the Treasury
bill.maturity - the GregorianCalendar maturity date of the Treasury
bill. The maturity cannot be more than a year after the settlement.rate - a double, the Treasury bill's discount rate at issue date.
The discount rate is an annualized rate of return based
on the par value of the bills. The discount rate is calculated
on a 360-day basis (twelve 30-day months).
double, the price per $100 face value for the Treasury bill
public static double tbillyield(GregorianCalendar settlement,
GregorianCalendar maturity,
double price)
![]()
settlement - the GregorianCalendar settlement date of the Treasury
bill.maturity - the GregorianCalendar maturity date of the Treasury
bill. The maturity cannot be more than a year after the settlement.price - a double, the Treasury bill's price per
$100 face value
double, the yield for the Treasury bill.
This is an annualized rate based on the purchase price
of the bills and reflects the actual yield to maturity.
public static double yielddisc(GregorianCalendar settlement,
GregorianCalendar maturity,
double price,
double redemption,
DayCountBasis basis)
![]()
settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityprice - a double, the security's price per $100 face valueredemption - a double, the security's redemption value per $100 face valuebasis - a DayCountBasis object which contains the type of
day count basis to use
double, the annual yield for a discounted security
public static double yield(GregorianCalendar settlement,
GregorianCalendar maturity,
double rate,
double price,
double redemption,
int frequency,
DayCountBasis basis)
![{{{left( {{{it redemption} over
{100}} + {{it rate} over {it frequency}}} right) - left[
{{{it price} over {100}} + left( {{A over E} times {{it rate}
over {it frequency}}} right)} right]} over {{{it price} over
{100}} + left( {{A over E} times {{it rate} over {it frequency}}}
right)}}} times {{{{it frequency} times E} over
{it DSR}}}](Bond_54.png)
If there is more than one coupon period use the following:

settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityrate - a double, the security's annual coupon rateprice - a double, the security's price per $100 face valueredemption - a double, the security's redemption value per $100 face valuefrequency - an int, the number of coupon payments per year,
1 for annual, 2 for semiannual, 4 for quarterlybasis - a DayCountBasis object which contains the type of
day count basis to use
double, the yield of a security that pays periodic
interest
public static double yieldmat(GregorianCalendar settlement,
GregorianCalendar maturity,
GregorianCalendar issue,
double rate,
double price,
DayCountBasis basis)
![{{{left[ {1 + left( {{{it DIM}
over B} times {it rate}} right)} right] - left[ {{{it price}
over {100}} + left( {{A over B} times {it rate}} right)}
right]} over {{{it price} over {100}} + left( {{A over B}
times {it rate}} right)}}} times {{B over {it DSM}}}](Bond_63.png)
settlement - the GregorianCalendar settlement date of the securitymaturity - the GregorianCalendar maturity date of the securityissue - the GregorianCalendar issue date of the securityrate - a double, the security's interest rate at date of issueprice - a double, the security's price per $100 face valuebasis - a DayCountBasis object which contains the type of
day count basis to use
double, the annual yield of a security that pays interest
at maturity
public static double yearfrac(GregorianCalendar start,
GregorianCalendar end,
DayCountBasis basis)
![]()
start to end,
start - the GregorianCalendar start date of the securityend - the GregorianCalendar end date of the securitybasis - a DayCountBasis object which contains the type of
day count basis to use
double, the annual yield of a security that pays interest
at maturity
|
JMSL 2.0 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||