## Class DiscountingFixedCouponBondProductPricer

• java.lang.Object
• com.opengamma.strata.pricer.bond.DiscountingFixedCouponBondProductPricer

• public class DiscountingFixedCouponBondProductPricer
extends java.lang.Object
Pricer for fixed coupon bond products.

This function provides the ability to price a ResolvedFixedCouponBond.

#### Price

Strata uses decimal prices for bonds in the trade model, pricers and market data. For example, a price of 99.32% is represented in Strata by 0.9932.
• ### Field Summary

Fields
Modifier and Type Field Description
static DiscountingFixedCouponBondProductPricer DEFAULT
Default implementation.
• ### Constructor Summary

Constructors
Constructor Description
DiscountingFixedCouponBondProductPricer​(DiscountingFixedCouponBondPaymentPeriodPricer periodPricer, DiscountingPaymentPricer nominalPricer)
Creates an instance.
• ### Method Summary

All Methods
Modifier and Type Method Description
double accruedInterest​(ResolvedFixedCouponBond bond, java.time.LocalDate settlementDate)
Calculates the accrued interest of the fixed coupon bond with the specified settlement date.
double accruedYearFraction​(ResolvedFixedCouponBond bond, java.time.LocalDate settlementDate)
Calculates the accrued year fraction of the fixed coupon bond with the specified settlement date.
double cleanPriceFromDirtyPrice​(ResolvedFixedCouponBond bond, java.time.LocalDate settlementDate, double dirtyPrice)
Calculates the clean price of the fixed coupon bond from its settlement date and dirty price.
double convexityFromYield​(ResolvedFixedCouponBond bond, java.time.LocalDate settlementDate, double yield)
Calculates the convexity of the fixed coupon bond product from yield.
double dirtyPriceFromCleanPrice​(ResolvedFixedCouponBond bond, java.time.LocalDate settlementDate, double cleanPrice)
Calculates the dirty price of the fixed coupon bond from its settlement date and clean price.
double dirtyPriceFromCurves​(ResolvedFixedCouponBond bond, LegalEntityDiscountingProvider provider, ReferenceData refData)
Calculates the dirty price of the fixed coupon bond.
double dirtyPriceFromCurves​(ResolvedFixedCouponBond bond, LegalEntityDiscountingProvider provider, java.time.LocalDate settlementDate)
Calculates the dirty price of the fixed coupon bond under the specified settlement date.
double dirtyPriceFromCurvesWithZSpread​(ResolvedFixedCouponBond bond, LegalEntityDiscountingProvider provider, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear, java.time.LocalDate settlementDate)
Calculates the dirty price of the fixed coupon bond under the specified settlement date with z-spread.
double dirtyPriceFromCurvesWithZSpread​(ResolvedFixedCouponBond bond, LegalEntityDiscountingProvider provider, ReferenceData refData, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear)
Calculates the dirty price of the fixed coupon bond with z-spread.
double dirtyPriceFromYield​(ResolvedFixedCouponBond bond, java.time.LocalDate settlementDate, double yield)
Calculates the dirty price of the fixed coupon bond from yield.
PointSensitivityBuilder dirtyPriceSensitivity​(ResolvedFixedCouponBond bond, LegalEntityDiscountingProvider provider, ReferenceData refData)
Calculates the dirty price sensitivity of the fixed coupon bond product.
PointSensitivityBuilder dirtyPriceSensitivityWithZspread​(ResolvedFixedCouponBond bond, LegalEntityDiscountingProvider provider, ReferenceData refData, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear)
Calculates the dirty price sensitivity of the fixed coupon bond with z-spread.
double macaulayDurationFromYield​(ResolvedFixedCouponBond bond, java.time.LocalDate settlementDate, double yield)
Calculates the Macaulay duration of the fixed coupon bond product from yield.
double modifiedDurationFromYield​(ResolvedFixedCouponBond bond, java.time.LocalDate settlementDate, double yield)
Calculates the modified duration of the fixed coupon bond product from yield.
CurrencyAmount presentValue​(ResolvedFixedCouponBond bond, LegalEntityDiscountingProvider provider)
Calculates the present value of the fixed coupon bond product.
PointSensitivityBuilder presentValueSensitivity​(ResolvedFixedCouponBond bond, LegalEntityDiscountingProvider provider)
Calculates the present value sensitivity of the fixed coupon bond product.
PointSensitivityBuilder presentValueSensitivityWithZSpread​(ResolvedFixedCouponBond bond, LegalEntityDiscountingProvider provider, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear)
Calculates the present value sensitivity of the fixed coupon bond with z-spread.
CurrencyAmount presentValueWithZSpread​(ResolvedFixedCouponBond bond, LegalEntityDiscountingProvider provider, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear)
Calculates the present value of the fixed coupon bond product with z-spread.
double yieldFromDirtyPrice​(ResolvedFixedCouponBond bond, java.time.LocalDate settlementDate, double dirtyPrice)
Calculates the yield of the fixed coupon bond product from dirty price.
double zSpreadFromCurvesAndDirtyPrice​(ResolvedFixedCouponBond bond, LegalEntityDiscountingProvider provider, ReferenceData refData, double dirtyPrice, CompoundedRateType compoundedRateType, int periodsPerYear)
Calculates the z-spread of the fixed coupon bond from curves and dirty price.
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Field Detail

• #### DEFAULT

public static final DiscountingFixedCouponBondProductPricer DEFAULT
Default implementation.
• ### Constructor Detail

• #### DiscountingFixedCouponBondProductPricer

public DiscountingFixedCouponBondProductPricer​(DiscountingFixedCouponBondPaymentPeriodPricer periodPricer,
DiscountingPaymentPricer nominalPricer)
Creates an instance.
Parameters:
periodPricer - the pricer for FixedCouponBondPaymentPeriod
nominalPricer - the pricer for Payment
• ### Method Detail

• #### presentValue

public CurrencyAmount presentValue​(ResolvedFixedCouponBond bond,
LegalEntityDiscountingProvider provider)
Calculates the present value of the fixed coupon bond product.

The present value of the product is the value on the valuation date. The result is expressed using the payment currency of the bond.

Coupon payments of the product are considered based on the valuation date.

Parameters:
bond - the product
provider - the discounting provider
Returns:
the present value of the fixed coupon bond product

public CurrencyAmount presentValueWithZSpread​(ResolvedFixedCouponBond bond,
LegalEntityDiscountingProvider provider,
CompoundedRateType compoundedRateType,
int periodsPerYear)
Calculates the present value of the fixed coupon bond product with z-spread.

The present value of the product is the value on the valuation date. The result is expressed using the payment currency of the bond.

The z-spread is a parallel shift applied to continuously compounded rates or periodic compounded rates of the issuer discounting curve.

Parameters:
bond - the product
provider - the discounting provider
zSpread - the z-spread
compoundedRateType - the compounded rate type
periodsPerYear - the number of periods per year
Returns:
the present value of the fixed coupon bond product
• #### dirtyPriceFromCurves

public double dirtyPriceFromCurves​(ResolvedFixedCouponBond bond,
LegalEntityDiscountingProvider provider,
ReferenceData refData)
Calculates the dirty price of the fixed coupon bond.

The fixed coupon bond is represented as Security where standard ID of the bond is stored.

Strata uses decimal prices for bonds. For example, a price of 99.32% is represented in Strata by 0.9932.

Parameters:
bond - the product
provider - the discounting provider
refData - the reference data used to calculate the settlement date
Returns:
the dirty price of the fixed coupon bond security
• #### dirtyPriceFromCurves

public double dirtyPriceFromCurves​(ResolvedFixedCouponBond bond,
LegalEntityDiscountingProvider provider,
java.time.LocalDate settlementDate)
Calculates the dirty price of the fixed coupon bond under the specified settlement date.

The fixed coupon bond is represented as Security where standard ID of the bond is stored.

Parameters:
bond - the product
provider - the discounting provider
settlementDate - the settlement date
Returns:
the dirty price of the fixed coupon bond security

public double dirtyPriceFromCurvesWithZSpread​(ResolvedFixedCouponBond bond,
LegalEntityDiscountingProvider provider,
ReferenceData refData,
CompoundedRateType compoundedRateType,
int periodsPerYear)
Calculates the dirty price of the fixed coupon bond with z-spread.

The z-spread is a parallel shift applied to continuously compounded rates or periodic compounded rates of the discounting curve.

The fixed coupon bond is represented as Security where standard ID of the bond is stored.

Parameters:
bond - the product
provider - the discounting provider
refData - the reference data used to calculate the settlement date
zSpread - the z-spread
compoundedRateType - the compounded rate type
periodsPerYear - the number of periods per year
Returns:
the dirty price of the fixed coupon bond security

public double dirtyPriceFromCurvesWithZSpread​(ResolvedFixedCouponBond bond,
LegalEntityDiscountingProvider provider,
CompoundedRateType compoundedRateType,
int periodsPerYear,
java.time.LocalDate settlementDate)
Calculates the dirty price of the fixed coupon bond under the specified settlement date with z-spread.

The z-spread is a parallel shift applied to continuously compounded rates or periodic compounded rates of the discounting curve.

The fixed coupon bond is represented as Security where standard ID of the bond is stored.

Parameters:
bond - the product
provider - the discounting provider
zSpread - the z-spread
compoundedRateType - the compounded rate type
periodsPerYear - the number of periods per year
settlementDate - the settlement date
Returns:
the dirty price of the fixed coupon bond security
• #### dirtyPriceFromCleanPrice

public double dirtyPriceFromCleanPrice​(ResolvedFixedCouponBond bond,
java.time.LocalDate settlementDate,
double cleanPrice)
Calculates the dirty price of the fixed coupon bond from its settlement date and clean price.
Parameters:
bond - the product
settlementDate - the settlement date
cleanPrice - the clean price
Returns:
the present value of the fixed coupon bond product
• #### cleanPriceFromDirtyPrice

public double cleanPriceFromDirtyPrice​(ResolvedFixedCouponBond bond,
java.time.LocalDate settlementDate,
double dirtyPrice)
Calculates the clean price of the fixed coupon bond from its settlement date and dirty price.

Strata uses decimal prices for bonds. For example, a price of 99.32% is represented in Strata by 0.9932.

Parameters:
bond - the product
settlementDate - the settlement date
dirtyPrice - the dirty price
Returns:
the present value of the fixed coupon bond product

public double zSpreadFromCurvesAndDirtyPrice​(ResolvedFixedCouponBond bond,
LegalEntityDiscountingProvider provider,
ReferenceData refData,
double dirtyPrice,
CompoundedRateType compoundedRateType,
int periodsPerYear)
Calculates the z-spread of the fixed coupon bond from curves and dirty price.

The z-spread is a parallel shift applied to continuously compounded rates or periodic compounded rates of the discounting curve associated to the bond (Issuer Entity) to match the dirty price.

Parameters:
bond - the product
provider - the discounting provider
refData - the reference data used to calculate the settlement date
dirtyPrice - the dirtyPrice
compoundedRateType - the compounded rate type
periodsPerYear - the number of periods per year
Returns:
the z-spread of the fixed coupon bond security
• #### presentValueSensitivity

public PointSensitivityBuilder presentValueSensitivity​(ResolvedFixedCouponBond bond,
LegalEntityDiscountingProvider provider)
Calculates the present value sensitivity of the fixed coupon bond product.

The present value sensitivity of the product is the sensitivity of the present value to the underlying curves.

Parameters:
bond - the product
provider - the discounting provider
Returns:
the present value curve sensitivity of the product

public PointSensitivityBuilder presentValueSensitivityWithZSpread​(ResolvedFixedCouponBond bond,
LegalEntityDiscountingProvider provider,
CompoundedRateType compoundedRateType,
int periodsPerYear)
Calculates the present value sensitivity of the fixed coupon bond with z-spread.

The present value sensitivity of the product is the sensitivity of the present value to the underlying curves.

The z-spread is a parallel shift applied to continuously compounded rates or periodic compounded rates of the issuer discounting curve.

Parameters:
bond - the product
provider - the discounting provider
zSpread - the z-spread
compoundedRateType - the compounded rate type
periodsPerYear - the number of periods per year
Returns:
the present value curve sensitivity of the product
• #### dirtyPriceSensitivity

public PointSensitivityBuilder dirtyPriceSensitivity​(ResolvedFixedCouponBond bond,
LegalEntityDiscountingProvider provider,
ReferenceData refData)
Calculates the dirty price sensitivity of the fixed coupon bond product.

The dirty price sensitivity of the security is the sensitivity of the present value to the underlying curves.

Parameters:
bond - the product
provider - the discounting provider
refData - the reference data used to calculate the settlement date
Returns:
the dirty price value curve sensitivity of the security

public PointSensitivityBuilder dirtyPriceSensitivityWithZspread​(ResolvedFixedCouponBond bond,
LegalEntityDiscountingProvider provider,
ReferenceData refData,
CompoundedRateType compoundedRateType,
int periodsPerYear)
Calculates the dirty price sensitivity of the fixed coupon bond with z-spread.

The dirty price sensitivity of the security is the sensitivity of the present value to the underlying curves.

The z-spread is a parallel shift applied to continuously compounded rates or periodic compounded rates of the discounting curve.

Parameters:
bond - the product
provider - the discounting provider
refData - the reference data used to calculate the settlement date
zSpread - the z-spread
compoundedRateType - the compounded rate type
periodsPerYear - the number of periods per year
Returns:
the dirty price curve sensitivity of the security
• #### accruedInterest

public double accruedInterest​(ResolvedFixedCouponBond bond,
java.time.LocalDate settlementDate)
Calculates the accrued interest of the fixed coupon bond with the specified settlement date.
Parameters:
bond - the product
settlementDate - the settlement date
Returns:
the accrued interest of the product
• #### accruedYearFraction

public double accruedYearFraction​(ResolvedFixedCouponBond bond,
java.time.LocalDate settlementDate)
Calculates the accrued year fraction of the fixed coupon bond with the specified settlement date.
Parameters:
bond - the product
settlementDate - the settlement date
Returns:
the accrued year fraction of the product
• #### dirtyPriceFromYield

public double dirtyPriceFromYield​(ResolvedFixedCouponBond bond,
java.time.LocalDate settlementDate,
double yield)
Calculates the dirty price of the fixed coupon bond from yield.

The yield must be fractional. The dirty price is computed for FixedCouponBondYieldConvention, and the result is expressed in fraction.

Parameters:
bond - the product
settlementDate - the settlement date
yield - the yield
Returns:
the dirty price of the product
• #### yieldFromDirtyPrice

public double yieldFromDirtyPrice​(ResolvedFixedCouponBond bond,
java.time.LocalDate settlementDate,
double dirtyPrice)
Calculates the yield of the fixed coupon bond product from dirty price.

The dirty price must be fractional. If the analytic formula is not available, the yield is computed by solving a root-finding problem with dirtyPriceFromYield(ResolvedFixedCouponBond, LocalDate, double). The result is also expressed in fraction.

Parameters:
bond - the product
settlementDate - the settlement date
dirtyPrice - the dirty price
Returns:
the yield of the product
• #### modifiedDurationFromYield

public double modifiedDurationFromYield​(ResolvedFixedCouponBond bond,
java.time.LocalDate settlementDate,
double yield)
Calculates the modified duration of the fixed coupon bond product from yield.

The modified duration is defined as the minus of the first derivative of dirty price with respect to yield, divided by the dirty price.

The input yield must be fractional. The dirty price and its derivative are computed for FixedCouponBondYieldConvention, and the result is expressed in fraction.

Parameters:
bond - the product
settlementDate - the settlement date
yield - the yield
Returns:
the modified duration of the product
• #### macaulayDurationFromYield

public double macaulayDurationFromYield​(ResolvedFixedCouponBond bond,
java.time.LocalDate settlementDate,
double yield)
Calculates the Macaulay duration of the fixed coupon bond product from yield.

Macaulay defined an alternative way of weighting the future cash flows.

The input yield must be fractional. The dirty price and its derivative are computed for FixedCouponBondYieldConvention, and the result is expressed in fraction.

Parameters:
bond - the product
settlementDate - the settlement date
yield - the yield
Returns:
the modified duration of the product
• #### convexityFromYield

public double convexityFromYield​(ResolvedFixedCouponBond bond,
java.time.LocalDate settlementDate,
double yield)
Calculates the convexity of the fixed coupon bond product from yield.

The convexity is defined as the second derivative of dirty price with respect to yield, divided by the dirty price.

The input yield must be fractional. The dirty price and its derivative are computed for FixedCouponBondYieldConvention, and the result is expressed in fraction.

Parameters:
bond - the product
settlementDate - the settlement date
yield - the yield
Returns:
the convexity of the product