finMath lib documentation
net.finmath.marketdata.model.bond

## 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.
Version:
1.0
Author:
Moritz Scherrmann, Chrisitan Fries
• ### Constructor Summary

Constructors
Constructor and Description
Bond(Schedule schedule, String discountCurveName, String survivalProbabilityCurveName, String basisFactorCurveName, double fixedCoupon)
Creates a fixed coupon bond without recovery rate.
Bond(Schedule schedule, String discountCurveName, String survivalProbabilityCurveName, String basisFactorCurveName, double fixedCoupon, double recoveryRate)
Creates a fixed coupon bond with recovery rate.
Bond(Schedule schedule, String discountCurveName, String forwardCurveName, String survivalProbabilityCurveName, String basisFactorCurveName, double fixedCoupon, double floatingSpread)
Creates a fixed or floating bond without recovery rate.
Bond(Schedule schedule, String discountCurveName, String forwardCurveName, String survivalProbabilityCurveName, String basisFactorCurveName, double fixedCoupon, double floatingSpread, double recoveryRate)
Creates a bond.
• ### Method Summary

All Methods
Modifier and Type Method and Description
double getAccruedInterest(double time, AnalyticModel model)
Returns the accrued interest of the bond for a given time.
double getAccruedInterest(LocalDate date, AnalyticModel model)
Returns the accrued interest of the bond for a given date.
String getBasisFactorCurveName()
double getCouponPayment(int periodIndex, AnalyticModel model)
Returns the coupon payment of the period with the given index.
String getDiscountCurveName()
double getFixedCoupon()
double getFloatingSpread()
String getForwardCurveName()
double getRecoveryRate()
Schedule getSchedule()
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.
String getSurvivalProbabilityCurveName()
double getValue(double evaluationTime, AnalyticModel model)
Return the valuation of the product using the given model.
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.
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.
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.
String toString()
• ### Methods inherited from class net.finmath.marketdata.products.AbstractAnalyticProduct

getValue, getValue
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
• ### Methods inherited from interface net.finmath.modelling.Product

getValue, getValues
• ### Constructor Detail

• #### Bond

public Bond(Schedule schedule,
String discountCurveName,
String forwardCurveName,
String survivalProbabilityCurveName,
String basisFactorCurveName,
double fixedCoupon,
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.
• ### 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.

public double getValueWithGivenSpreadOverCurve(double evaluationTime,
Curve referenceCurve,
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.

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:
• #### 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()

public double getFloatingSpread()
• #### getRecoveryRate

public double getRecoveryRate()
• #### toString

public String toString()
Overrides:
toString in class Object