# Example to calculate the Bond Price for 1.5% fixed coupon Principal

#1

If some could help by giving example for the following problem,

1. If there is a way to use OpenGamma library to get discounting curve from the yield curve
2. And, how the discounting curve is used in calculating the Bond Price. Is the curve data used as –is or some manipulation of discounting curve is done before using it to calculate the PV with Settlement Amount =0.

#2
1. The basic block for interest rate curves is the “YieldAndDiscountCurve”. This is a class that provides discount factors (getDiscountFactor) and yield (getInterestRate; continuously compounded rate). The methods signature is independent of how the curves is stored. It can be stored as “DiscountCurve”, where the discount factors are stored, or as a “YieldCurve”, where the yield are stored.

2. The fundamental classes for bond pricing are “BondSecurityDiscountingMethod” and “BondTransactionDiscountingMethod”. The first one contains the methods related to the “security”, i.e. the fungible generic bond (price, yield, etc.), while the second contains methods related to a specific transaction for a given date and price on that bond (present value, settlement amount, etc.)

You can calculate the bond (dirty) price from the curves with “BondSecurityDiscountingMethod.dirtyPriceFromCurves”. There will be two curves used; one “credit” or “issuer” curve to discount the different cash-flows to today and one “risk-free” or “repo” curve to deal with settlement (i.e. the price is not paid today be at the settlement date, which is usually 1 to 3 days from now). More explanation on the bonds methodology is provided in our documentation “Bond Pricing”, available at http://docs.opengamma.com/display/DOC/Quantitative+Documentation

If you compute the present value of a bond transaction with settlement amount 0, (BondTransactionDiscountingMethod.presentValue), you have only the discounted value of the notional and the coupons (multiplied by the quantity) using the “credit” curve.

I hope this helps,

Regards,

Marc
OpenGamma