Class DiscountingFixedCouponBondProductPricer


  • public class DiscountingFixedCouponBondProductPricer
    extends 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.
    • 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
      • presentValueWithZSpread

        public 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.

        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,
                                           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
      • dirtyPriceFromCurvesWithZSpread

        public 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.

        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
      • dirtyPriceFromCurvesWithZSpread

        public double dirtyPriceFromCurvesWithZSpread​(ResolvedFixedCouponBond bond,
                                                      LegalEntityDiscountingProvider provider,
                                                      double zSpread,
                                                      CompoundedRateType compoundedRateType,
                                                      int periodsPerYear,
                                                      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,
                                               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,
                                               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
      • zSpreadFromCurvesAndDirtyPrice

        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
      • presentValueSensitivityWithZSpread

        public 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.

        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
      • dirtyPriceSensitivityWithZspread

        public 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.

        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,
                                      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,
                                          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,
                                          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
      • dirtyPriceFromYieldAd

        public ValueDerivatives dirtyPriceFromYieldAd​(ResolvedFixedCouponBond bond,
                                                      LocalDate settlementDate,
                                                      double yield)
        Calculates the dirty price of the fixed coupon bond from yield and its derivative wrt to the 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 and its derivative
      • yieldFromDirtyPrice

        public double yieldFromDirtyPrice​(ResolvedFixedCouponBond bond,
                                          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
      • yieldFromDirtyPriceAd

        public ValueDerivatives yieldFromDirtyPriceAd​(ResolvedFixedCouponBond bond,
                                                      LocalDate settlementDate,
                                                      double dirtyPrice)
        Calculates the yield of the fixed coupon bond product from dirty price and its derivative wrt the 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,
                                                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
      • modifiedDurationFromYieldAd

        public ValueDerivatives modifiedDurationFromYieldAd​(ResolvedFixedCouponBond bond,
                                                            LocalDate settlementDate,
                                                            double yield)
        Calculates the modified duration of the fixed coupon bond product from yield and its derivative wrt to the 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,
                                                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,
                                         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