WebCab Bonds Demo
(J2EE Edition)

com.webcab.ejb.finance.bonds
Interface TreasuryPriceLocal

All Superinterfaces:
EJBLocalObject

public interface TreasuryPriceLocal
extends EJBLocalObject

Local interface of TreasuryPrice. This interface provides the same functionality as the TreasuryPrice remote interface.

See Also:
TreasuryPrice

Method Summary
 double parYield(double principalSum, Date evaluationDate, Date maturityDate, boolean annualOrSemi, double maturityZero, Date[] paymentDates, double[] zeroCurveOnCouponPaymentDates, BusinessCalendar businessCalendar)
          Method parYield(double, java.util.Date, java.util.Date, boolean, double, java.util.Date[], double[], webcab.lib.calendar.BusinessCalendar) as defined in the TreasuryPrice remote interface.
 double parYield(double principalSum, double maturity, boolean annualOrSemi, double maturityZero, double[] timeToCoupons, double[] zeroCurveOnCouponPaymentDates)
          Method parYield(double, double, boolean, double, double[], double[]) as defined in the TreasuryPrice remote interface.
 double priceOfBond(double principleSum, Date evaluationDate, Date maturity, double zeroRateAtMaturity, double[] payments, Date[] paymentDates, double[] zeroRates, BusinessCalendar businessCalendar)
          Method priceOfBond(double, java.util.Date, java.util.Date, double, double[], java.util.Date[], double[], webcab.lib.calendar.BusinessCalendar) as defined in the TreasuryPrice remote interface.
 double priceOfBond(double principleSum, double time2Maturity, double zeroRateAtMaturity, double[] payments, double[] time2Payments, double[] zeroRates)
          Method priceOfBond(double, double, double, double[], double[], double[]) as defined in the TreasuryPrice remote interface.
 double tbondPrice(double principleSum, double riskFreeRate, Date evaluationDate, Date maturityDate, double[] coupons, Date[] dateOfCoupons, BusinessCalendar businessCalendar)
          Method tbondPrice(double, double, java.util.Date, java.util.Date, double[], java.util.Date[], webcab.lib.calendar.BusinessCalendar) as defined in the TreasuryPrice remote interface.
 double tbondPrice(double principleSum, double riskFreeRate, double time2Maturity, double[] coupons, double[] time2Coupons)
          Method tbondPrice(double, double, double, double[], double[]) as defined in the TreasuryPrice remote interface.
 double yieldToMaturity(double principalSum, double marketPrice, Date previousCouponDate, Date evaluationDate, Date settlementDate, Date[] paymentDates, Date maturityDate, double[] couponPayments, BusinessCalendar businessCalendar, String dayCountConvention)
          Method yieldToMaturity(double, double, java.util.Date, java.util.Date, java.util.Date, java.util.Date[], java.util.Date, double[], webcab.lib.calendar.BusinessCalendar, java.lang.String) as defined in the TreasuryPrice remote interface.
 double yieldToMaturity(double principalSum, double marketPrice, double time2Maturity, double[] time2Payments, double[] couponPayments)
          Method yieldToMaturity(double, double, double, double[], double[]) as defined in the TreasuryPrice remote interface.
 double yieldToMaturityFromPrice(double price, double[] payments, Date evaluationDate, Date[] paymentDates, BusinessCalendar businessCalendar)
          Method yieldToMaturityFromPrice(double, double[], java.util.Date, java.util.Date[], webcab.lib.calendar.BusinessCalendar) as defined in the TreasuryPrice remote interface.
 double yieldToMaturityFromPrice(double price, double[] payments, double[] time2Payments)
          Method yieldToMaturityFromPrice(double, double[], double[]) as defined in the TreasuryPrice remote interface.
 double zeroTBondPrice(double principle, double riskFreeRate, Date evaluationDate, Date maturityDate, BusinessCalendar businessCalendar)
          Method zeroTBondPrice(double, double, java.util.Date, java.util.Date, webcab.lib.calendar.BusinessCalendar) as defined in the TreasuryPrice remote interface.
 double zeroTBondPrice(double principle, double riskFreeRate, double time2Maturity)
          Method zeroTBondPrice(double, double, double) as defined in the TreasuryPrice remote interface.
 double zeroYieldToMaturity(double principalSum, double marketPrice, Date evaluationDate, Date maturityDate, BusinessCalendar businessCalendar)
          Method zeroYieldToMaturity(double, double, java.util.Date, java.util.Date, webcab.lib.calendar.BusinessCalendar) as defined in the TreasuryPrice remote interface.
 double zeroYieldToMaturity(double principalSum, double marketPrice, double timeToMaturity)
          Method zeroYieldToMaturity(double, double, double) as defined in the TreasuryPrice remote interface.
 
Methods inherited from interface javax.ejb.EJBLocalObject
getEJBLocalHome, getPrimaryKey, isIdentical, remove
 

Method Detail

priceOfBond

public double priceOfBond(double principleSum,
                          Date evaluationDate,
                          Date maturity,
                          double zeroRateAtMaturity,
                          double[] payments,
                          Date[] paymentDates,
                          double[] zeroRates,
                          BusinessCalendar businessCalendar)
                   throws TreasuryPriceDemoException
Method priceOfBond(double, java.util.Date, java.util.Date, double, double[], java.util.Date[], double[], webcab.lib.calendar.BusinessCalendar) as defined in the TreasuryPrice remote interface.

Description copied from the TreasuryPrice interface:

Evaluates the price of a Treasury bond by discounting the cash flows until maturity in accordance with the corresponding continuously compounded zero rate.

Parameters:
principleSum - the principle sum of the bond which will be repaid at maturity
zeroRateAtMaturity - the corresponding continuously compounded zero rate of the maturity
payments - an array of doubles where the first element represents the first payments from the bond, the second the second payment and so on.
zeroRates - an array where the first element is the zero rate on the first payment date and the second term is the zero rate on the second payment date and so on.
evaluationDate - the date on which the price of the bond is evaluated
maturity - the date on which the bond matures
paymentDates - an array of dates where the first element corresponds to the date of the first payment and the second element corresponds to the date of the second payment and so on.
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
TreasuryPriceDemoException
See Also:
TreasuryPrice.priceOfBond(double, java.util.Date, java.util.Date, double, double[], java.util.Date[], double[], webcab.lib.calendar.BusinessCalendar)

priceOfBond

public double priceOfBond(double principleSum,
                          double time2Maturity,
                          double zeroRateAtMaturity,
                          double[] payments,
                          double[] time2Payments,
                          double[] zeroRates)
                   throws TreasuryPriceDemoException
Method priceOfBond(double, double, double, double[], double[], double[]) as defined in the TreasuryPrice remote interface.

Description copied from the TreasuryPrice interface:

Evaluates the price of a Treasury bond by discounting the cash flows until maturity in accordance with the corresponding continuously compounded zero rate.

Parameters:
principleSum - the principle sum of the bond which will be repaid at maturity
time2Maturity - the time in years until the bond matures
zeroRateAtMaturity - the corresponding continuously compounded zero rate of the maturity
payments - an array of doubles where the first element represents the first payments from the bond, the second the second payment and so on.
time2Payments - an array of doubles where the first element represents the time until the first payment is made, the second the time until the second payment is made and so on.
zeroRates - an array where the first element is the zero rate on the first payment date and the second term is the zero rate on the second payment date and so on.
TreasuryPriceDemoException
See Also:
TreasuryPrice.priceOfBond(double, double, double, double[], double[], double[])

tbondPrice

public double tbondPrice(double principleSum,
                         double riskFreeRate,
                         Date evaluationDate,
                         Date maturityDate,
                         double[] coupons,
                         Date[] dateOfCoupons,
                         BusinessCalendar businessCalendar)
                  throws TreasuryPriceDemoException
Method tbondPrice(double, double, java.util.Date, java.util.Date, double[], java.util.Date[], webcab.lib.calendar.BusinessCalendar) as defined in the TreasuryPrice remote interface.

Description copied from the TreasuryPrice interface:

Evaluates the price of a Treasury bond by discounting the future cash flows in accordance with the risk free interest rate.

Parameters:
principleSum - the principle sum which will be repaid at expiry
riskFreeRate - the continuously compounded annual risk free interest rate expressed in decimal format
coupons - an array where the first term corresponds to the amount paid by the next coupon payment and the second term corresponds to the amount paid by the coupon payment after that and so on
evaluationDate - the date of the evaluation of the price of the government backed bond
maturityDate - the date when the bond matures
dateOfCoupons - an array of dates where the first element corresponds to the date of the next coupon payment and the second term corresponds to the second coupon payment and so on.
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
TreasuryPriceDemoException
See Also:
TreasuryPrice.tbondPrice(double, double, java.util.Date, java.util.Date, double[], java.util.Date[], webcab.lib.calendar.BusinessCalendar)

tbondPrice

public double tbondPrice(double principleSum,
                         double riskFreeRate,
                         double time2Maturity,
                         double[] coupons,
                         double[] time2Coupons)
                  throws TreasuryPriceDemoException
Method tbondPrice(double, double, double, double[], double[]) as defined in the TreasuryPrice remote interface.

Description copied from the TreasuryPrice interface:

Evaluates the price of a Treasury bond by discounting the future cash flows in accordance with the risk free interest rate.

Parameters:
principleSum - the principle sum which will be repaid at expiry
riskFreeRate - the continuously compounded annual risk free interest rate expressed in decimal format
time2Maturity - the number of years until the bond matures expressed in decimal format
coupons - an array where the first term corresponds to the amount paid by the next coupon payment and the second term corresponds to the amount paid by the coupon payment after that and so on
time2Coupons - an array where the first term corresponds to the number of years until the first coupon payment and the second term corresponds to the number of years until the second payment is made and so on... Note that the number of years must be expressed in decimal format (i.e. 3 years 6 months = 3.5)
TreasuryPriceDemoException
See Also:
TreasuryPrice.tbondPrice(double, double, double, double[], double[])

zeroTBondPrice

public double zeroTBondPrice(double principle,
                             double riskFreeRate,
                             Date evaluationDate,
                             Date maturityDate,
                             BusinessCalendar businessCalendar)
                      throws TreasuryPriceDemoException
Method zeroTBondPrice(double, double, java.util.Date, java.util.Date, webcab.lib.calendar.BusinessCalendar) as defined in the TreasuryPrice remote interface.

Description copied from the TreasuryPrice interface:

This method returns the price of a zero-coupon Treasury bond.

Parameters:
principle - the amount which is repaid at maturity of the bond
riskFreeRate - the risk free interest rate in the local currency expressed in decimal format (i.e. 1 percent = 0.01)
evaluationDate - the date on which the bonds price is evaluated
maturityDate - the date on which the bond matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
TreasuryPriceDemoException
See Also:
TreasuryPrice.zeroTBondPrice(double, double, java.util.Date, java.util.Date, webcab.lib.calendar.BusinessCalendar)

zeroTBondPrice

public double zeroTBondPrice(double principle,
                             double riskFreeRate,
                             double time2Maturity)
                      throws TreasuryPriceDemoException
Method zeroTBondPrice(double, double, double) as defined in the TreasuryPrice remote interface.

Description copied from the TreasuryPrice interface:

This method returns the price of a zero-coupon Treasury bond.

Parameters:
principle - the amount which is repaid at maturity of the bond
riskFreeRate - the risk free interest rate in the local currency expressed in decimal format (i.e. 1 percent = 0.01)
time2Maturity - the time in years (in decimal format) until the bond matures
TreasuryPriceDemoException
See Also:
TreasuryPrice.zeroTBondPrice(double, double, double)

yieldToMaturity

public double yieldToMaturity(double principalSum,
                              double marketPrice,
                              Date previousCouponDate,
                              Date evaluationDate,
                              Date settlementDate,
                              Date[] paymentDates,
                              Date maturityDate,
                              double[] couponPayments,
                              BusinessCalendar businessCalendar,
                              String dayCountConvention)
                       throws TreasuryPriceDemoException
Method yieldToMaturity(double, double, java.util.Date, java.util.Date, java.util.Date, java.util.Date[], java.util.Date, double[], webcab.lib.calendar.BusinessCalendar, java.lang.String) as defined in the TreasuryPrice remote interface.

Description copied from the TreasuryPrice interface:

The yield to maturity (YTM) (also known as the internal rate of return) with continuous compounding is calculated for a traded bond. Note that the bond may be of any corporate or treasury type.

Remark: This method uses the Newton-Raphson procedure and produces a result which is accurate to 10 decimal places.

Parameters:
principalSum - the principal sum which will be repaid at expiry
marketPrice - the market price of the bond
couponPayments - an array where the first term corresponds to the amount paid by the next coupon payment and the second term corresponds to the amount paid by the coupon payment after that and so on
previousCouponDate - the date of the last payment before the evaluation date, or the date of the issue of the bond. Set to the evaluation or settlement date if does not apply.
evaluationDate - the date on which the yield to maturity (YTM) is evaluated
settlementDate - the date when the contract is being fulfilled
maturityDate - the date on which the bond matures
paymentDates - an array of dates where the first term corresponds to the date of the first payment and the second term corresponds to the date of the second payment and so on.
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
dayCountConvention - A string constant identifying one of the implemented day count conventions in the DayCountConventions class. The default day count convention is `Actual/Actual', identified by the "A/A" string constant.
TreasuryPriceDemoException
See Also:
TreasuryPrice.yieldToMaturity(double, double, java.util.Date, java.util.Date, java.util.Date, java.util.Date[], java.util.Date, double[], webcab.lib.calendar.BusinessCalendar, java.lang.String)

yieldToMaturity

public double yieldToMaturity(double principalSum,
                              double marketPrice,
                              double time2Maturity,
                              double[] time2Payments,
                              double[] couponPayments)
                       throws TreasuryPriceDemoException
Method yieldToMaturity(double, double, double, double[], double[]) as defined in the TreasuryPrice remote interface.

Description copied from the TreasuryPrice interface:

The yield to maturity (YTM) (also known as the internal rate of return) with continuous compounding is calculated for a traded bond. Note that the bond may be of any corporate or treasury type.

Remark: This method uses the Newton-Raphson procedure and produces a result which is accurate to 10 decimal places.

Parameters:
principalSum - the principal sum which will be repaid at expiry
marketPrice - the market price of the bond
time2Maturity - the number of years until the bond matures expressed in decimal format
couponPayments - an array where the first term corresponds to the amount paid by the next coupon payment and the second term corresponds to the amount paid by the coupon payment after that and so on
time2Payments - an array where the first term corresponds to the number of years until the first coupon payment and the second term corresponds to the number of years until the second payment is made and so on... Note that the number of years must be expressed in decimal format.
TreasuryPriceDemoException
See Also:
TreasuryPrice.yieldToMaturity(double, double, double, double[], double[])

zeroYieldToMaturity

public double zeroYieldToMaturity(double principalSum,
                                  double marketPrice,
                                  Date evaluationDate,
                                  Date maturityDate,
                                  BusinessCalendar businessCalendar)
                           throws TreasuryPriceDemoException
Method zeroYieldToMaturity(double, double, java.util.Date, java.util.Date, webcab.lib.calendar.BusinessCalendar) as defined in the TreasuryPrice remote interface.

Description copied from the TreasuryPrice interface:

Evaluates the yield to maturity (YTM) (also known as the internal rate of return) of a zero coupon bond. Note, that this method can be applied to all bonds (i.e. corporate and treasury)

Parameters:
principalSum - the principal sum which will be repaid at expiry
marketPrice - the present market price of the bond
evaluationDate - the date on which the yield to maturity (YTM) of the zero bond is evaluated
maturityDate - the date when the zero bond matures
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
TreasuryPriceDemoException
See Also:
TreasuryPrice.zeroYieldToMaturity(double, double, java.util.Date, java.util.Date, webcab.lib.calendar.BusinessCalendar)

zeroYieldToMaturity

public double zeroYieldToMaturity(double principalSum,
                                  double marketPrice,
                                  double timeToMaturity)
                           throws TreasuryPriceDemoException
Method zeroYieldToMaturity(double, double, double) as defined in the TreasuryPrice remote interface.

Description copied from the TreasuryPrice interface:

Evaluates the yield to maturity (YTM) (also known as the internal rate of return) of a zero coupon bond. Note, that this method can be applied to all bonds (i.e. corporate and treasury)

Parameters:
principalSum - the principal sum which will be repaid at expiry
marketPrice - the present market price of the bond
timeToMaturity - the time in years (expressed in decimal format) until the bond matures
TreasuryPriceDemoException
See Also:
TreasuryPrice.zeroYieldToMaturity(double, double, double)

yieldToMaturityFromPrice

public double yieldToMaturityFromPrice(double price,
                                       double[] payments,
                                       Date evaluationDate,
                                       Date[] paymentDates,
                                       BusinessCalendar businessCalendar)
                                throws TreasuryPriceDemoException
Method yieldToMaturityFromPrice(double, double[], java.util.Date, java.util.Date[], webcab.lib.calendar.BusinessCalendar) as defined in the TreasuryPrice remote interface.

Description copied from the TreasuryPrice interface:

Here the yield to maturity of a bond is derived from its price, payments and time of these payments. Note that these payments will include the payment of the principal sum at the maturity of the bond.

Parameters:
price - the market price of the bond
payments - an array of doubles where the first element represents the first coupon payment the second element the second coupon payment and so on until the final payment, which will represent the payment of the bonds principal sum
evaluationDate - the date when the yield of the bond is evaluated
paymentDates - an array of dates where the first term corresponds to the first payment date, the second term corresponds to the second payment date and so on, until the final term which will represent the payment of the principal sum at the maturity of the bond
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
TreasuryPriceDemoException
See Also:
TreasuryPrice.yieldToMaturityFromPrice(double, double[], java.util.Date, java.util.Date[], webcab.lib.calendar.BusinessCalendar)

yieldToMaturityFromPrice

public double yieldToMaturityFromPrice(double price,
                                       double[] payments,
                                       double[] time2Payments)
                                throws TreasuryPriceDemoException
Method yieldToMaturityFromPrice(double, double[], double[]) as defined in the TreasuryPrice remote interface.

Description copied from the TreasuryPrice interface:

Here the yield to maturity of a bond is derived from its price, payments and time of these payments. Note that these payments will include the payment of the principal sum at the maturity of the bond.

Parameters:
price - the market price of the bond
payments - an array of doubles where the first element represents the first coupon payment the second element the second coupon payment and so on until the final payment, which will represent the payment of the bonds principal sum
time2Payments - an array of doubles where the first element represents the time in years until the first payment, the second term represents the time in years until the second payment and so on... Until the final term which represents the time in years until the principal sum of bond is paid, or equivalently the time in years until expiry.
TreasuryPriceDemoException
See Also:
TreasuryPrice.yieldToMaturityFromPrice(double, double[], double[])

parYield

public double parYield(double principalSum,
                       Date evaluationDate,
                       Date maturityDate,
                       boolean annualOrSemi,
                       double maturityZero,
                       Date[] paymentDates,
                       double[] zeroCurveOnCouponPaymentDates,
                       BusinessCalendar businessCalendar)
                throws TreasuryPriceDemoException
Method parYield(double, java.util.Date, java.util.Date, boolean, double, java.util.Date[], double[], webcab.lib.calendar.BusinessCalendar) as defined in the TreasuryPrice remote interface.

Description copied from the TreasuryPrice interface:

We evaluate the Par Yield of a Treasury bond which pays annual or semi-annual coupons. Recall, that the Par yield for a given maturity is the yield to causes the bonds price to equal the principle sum (or face value) repaid at maturity.

The Treasury bonds Par yield is evaluated using the zero term structure of the corresponding Treasury zero curve. In order to apply this approach the zero curve will need to be evaluated on maturities which correspond to the coupon payment dates. For example, if we consider a two year bond which pays a semiannual coupon then the Treasury zero rates will need to be known for the maturities 0.5, 1, 1.5 and 2 years.

Parameters:
principalSum - the principal sum (also known as the face value) of the bond
annualOrSemi - when the coupon is paid annually then this parameter is true and if the coupon is paid semi-annually then it is false
maturityZero - the zero rate for the maturity of the bond under consideration
zeroCurveOnCouponPaymentDates - an array where the first term is the Treasury zero interest rate of maturity equal to the time until the first coupon payment, and the second term is the Treasury zero interest rate of maturity equal to the time until the second coupon payment, and so on...
evaluationDate - the date when the Par Yield is evaluated
maturityDate - the date when the bond matures
paymentDates - an array of dates where the first element is the date of the first coupon payment and the second element is the date of the second coupon payment and so on
businessCalendar - The instance of a BusinessCalendar interface implementation. Specify null to select the London business calendar.
TreasuryPriceDemoException
See Also:
TreasuryPrice.parYield(double, java.util.Date, java.util.Date, boolean, double, java.util.Date[], double[], webcab.lib.calendar.BusinessCalendar)

parYield

public double parYield(double principalSum,
                       double maturity,
                       boolean annualOrSemi,
                       double maturityZero,
                       double[] timeToCoupons,
                       double[] zeroCurveOnCouponPaymentDates)
                throws TreasuryPriceDemoException
Method parYield(double, double, boolean, double, double[], double[]) as defined in the TreasuryPrice remote interface.

Description copied from the TreasuryPrice interface:

We evaluate the Par Yield of a Treasury bond which pays annual or semi-annual coupons. Recall, that the Par yield for a given maturity is the yield to causes the bonds price to equal the principle sum (or face value) repaid at maturity.

The Treasury bonds Par yield is evaluated using the zero term structure of the corresponding Treasury zero curve. In order to apply this approach the zero curve will need to be evaluated on maturities which correspond to the coupon payment dates. For example, if we consider a two year bond which pays a semiannual coupon then the Treasury zero rates will need to be known for the maturities 0.5, 1, 1.5 and 2 years.

Parameters:
principalSum - the principal sum (also known as the face value) of the bond
maturity - the maturity of the bond in years expressed in decimal format
annualOrSemi - when the coupon is paid annually then this parameter is true and if the coupon is paid semi-annually then it is false
maturityZero - the zero rate for the maturity of the bond under consideration
timeToCoupons - an array where the first term is the number of years expressed as a decimal until the first coupon payment is made, and the second term is the number of years until the second coupon payment is made and so on...
zeroCurveOnCouponPaymentDates - an array where the first term is the Treasury zero interest rate of maturity equal to the time until the first coupon payment, and the second term is the Treasury zero interest rate of maturity equal to the time until the second coupon payment, and so on...
TreasuryPriceDemoException
See Also:
TreasuryPrice.parYield(double, double, boolean, double, double[], double[])

WebCab Bonds Demo
(J2EE Edition)