Class Bond

  • All Implemented Interfaces:
    AnalyticProduct, Product

    public class Bond
    extends AbstractAnalyticProduct
    implements AnalyticProduct
    Implements the valuation of a bond (zero-coupon, fixed coupon or floating coupon) with unit notional of 1 using curves:
    • a forward curve, if the bond has floating rate coupons
    • a discount curve as a base curve for discounting
    • a survival probability curve for additional credit risk related discount factor
    • a basis factor curve for additional bond related discount factor
    Support for day counting is provided via the class implementing Schedule. The effective bond curve is a combination of the discount curve (risk free curve), the basis factor curve (which could be considers as an additional industry specific factor) and the issuer specific survival probalbilty. The effective discount factor is the product of the three: discountFactor * survivalProbabilityFactor * basisFactorFactor You may set the arguments for the survival probability curve and the basis factor curve to null.
    Version:
    1.1
    Author:
    Moritz Scherrmann, Chrisitan Fries
    • Constructor Detail

      • Bond

        public Bond​(Schedule schedule,
                    String discountCurveName,
                    String forwardCurveName,
                    String survivalProbabilityCurveName,
                    String basisFactorCurveName,
                    double fixedCoupon,
                    double floatingSpread,
                    double recoveryRate)
        Creates a bond.
        Parameters:
        schedule - ScheduleFromPeriods of the bond.
        discountCurveName - Name of the discount curve.
        forwardCurveName - Name of the forward curve, leave empty if this is a fix coupon bond or a zero-coupon bond.
        survivalProbabilityCurveName - Name of the survival probability curve.
        basisFactorCurveName - Name of the basis factor curve.
        fixedCoupon - The fixed coupon of the bond expressed as absolute value.
        floatingSpread - The floating spread of the bond expressed as absolute value.
        recoveryRate - The recovery rate of the bond.
      • Bond

        public Bond​(Schedule schedule,
                    String discountCurveName,
                    String survivalProbabilityCurveName,
                    String basisFactorCurveName,
                    double fixedCoupon,
                    double recoveryRate)
        Creates a fixed coupon bond with recovery rate.
        Parameters:
        schedule - ScheduleFromPeriods of the bond.
        discountCurveName - Name of the discount curve.
        survivalProbabilityCurveName - Name of the survival probability curve.
        basisFactorCurveName - Name of the basis factor curve.
        fixedCoupon - The fixed coupon of the bond expressed as absolute value.
        recoveryRate - The recovery rate of the bond.
      • Bond

        public Bond​(Schedule schedule,
                    String discountCurveName,
                    String forwardCurveName,
                    String survivalProbabilityCurveName,
                    String basisFactorCurveName,
                    double fixedCoupon,
                    double floatingSpread)
        Creates a fixed or floating bond without recovery rate.
        Parameters:
        schedule - ScheduleFromPeriods of the bond.
        discountCurveName - Name of the discount curve.
        forwardCurveName - Name of the forward curve, leave empty if this is a fix coupon bond or a zero-coupon bond.
        survivalProbabilityCurveName - Name of the survival probability curve.
        basisFactorCurveName - Name of the basis factor curve.
        fixedCoupon - The fixed coupon of the bond expressed as absolute value.
        floatingSpread - The floating spread of the bond expressed as absolute value.
      • Bond

        public Bond​(Schedule schedule,
                    String discountCurveName,
                    String survivalProbabilityCurveName,
                    String basisFactorCurveName,
                    double fixedCoupon)
        Creates a fixed coupon bond without recovery rate.
        Parameters:
        schedule - ScheduleFromPeriods of the bond.
        discountCurveName - Name of the discount curve.
        survivalProbabilityCurveName - Name of the survival probability curve.
        basisFactorCurveName - Name of the basis factor curve.
        fixedCoupon - The fixed coupon of the bond expressed as absolute value.
      • Bond

        public Bond​(Schedule schedule,
                    String discountCurveName,
                    double fixedCoupon)
        Creates a fixed coupon bond using a single discount curve only.
        Parameters:
        schedule - ScheduleFromPeriods of the bond.
        discountCurveName - Name of the discount curve.
        fixedCoupon - The fixed coupon of the bond expressed as absolute value.
    • Method Detail

      • getValue

        public double getValue​(double evaluationTime,
                               AnalyticModel model)
        Description copied from interface: AnalyticProduct
        Return the valuation of the product using the given model. The model has to implement the modes of AnalyticModel.
        Specified by:
        getValue in interface AnalyticProduct
        Parameters:
        evaluationTime - The evaluation time as double. Cash flows prior and including this time are not considered.
        model - The model under which the product is valued.
        Returns:
        The value of the product using the given model.
      • getCouponPayment

        public double getCouponPayment​(int periodIndex,
                                       AnalyticModel model)
        Returns the coupon payment of the period with the given index. The analytic model is needed in case of floating bonds.
        Parameters:
        periodIndex - The index of the period of interest.
        model - The model under which the product is valued.
        Returns:
        The value of the coupon payment in the given period.
      • getValueWithGivenSpreadOverCurve

        public double getValueWithGivenSpreadOverCurve​(double evaluationTime,
                                                       Curve referenceCurve,
                                                       double spread,
                                                       AnalyticModel model)
        Returns the value of the sum of discounted cash flows of the bond where the discounting is done with the given reference curve and an additional spread. This method can be used for optimizer.
        Parameters:
        evaluationTime - The evaluation time as double. Cash flows prior and including this time are not considered.
        referenceCurve - The reference curve used for discounting the coupon payments.
        spread - The spread which should be added to the discount curve.
        model - The model under which the product is valued.
        Returns:
        The value of the bond for the given curve and spread.
      • getValueWithGivenYield

        public double getValueWithGivenYield​(double evaluationTime,
                                             double rate,
                                             AnalyticModel model)
        Returns the value of the sum of discounted cash flows of the bond where the discounting is done with the given yield curve. This method can be used for optimizer.
        Parameters:
        evaluationTime - The evaluation time as double. Cash flows prior and including this time are not considered.
        rate - The yield which is used for discounted the coupon payments.
        model - The model under which the product is valued.
        Returns:
        The value of the bond for the given yield.
      • getSpread

        public double getSpread​(double bondPrice,
                                Curve referenceCurve,
                                AnalyticModel model)
        Returns the spread value such that the sum of cash flows of the bond discounted with a given reference curve with the additional spread coincides with a given price.
        Parameters:
        bondPrice - The target price as double.
        referenceCurve - The reference curve used for discounting the coupon payments.
        model - The model under which the product is valued.
        Returns:
        The optimal spread value.
      • getYield

        public double getYield​(double bondPrice,
                               AnalyticModel model)
        Returns the yield value such that the sum of cash flows of the bond discounted with the yield curve coincides with a given price.
        Parameters:
        bondPrice - The target price as double.
        model - The model under which the product is valued.
        Returns:
        The optimal yield value.
      • getAccruedInterest

        public double getAccruedInterest​(LocalDate date,
                                         AnalyticModel model)
        Returns the accrued interest of the bond for a given date.
        Parameters:
        date - The date of interest.
        model - The model under which the product is valued.
        Returns:
        The accrued interest.
      • getAccruedInterest

        public double getAccruedInterest​(double time,
                                         AnalyticModel model)
        Returns the accrued interest of the bond for a given time.
        Parameters:
        time - The time of interest as double.
        model - The model under which the product is valued.
        Returns:
        The accrued interest.
      • getSchedule

        public Schedule getSchedule()
      • getDiscountCurveName

        public String getDiscountCurveName()
      • getForwardCurveName

        public String getForwardCurveName()
      • getSurvivalProbabilityCurveName

        public String getSurvivalProbabilityCurveName()
      • getBasisFactorCurveName

        public String getBasisFactorCurveName()
      • getFixedCoupon

        public double getFixedCoupon()
      • getFloatingSpread

        public double getFloatingSpread()
      • getRecoveryRate

        public double getRecoveryRate()