Class DiscountingCapitalIndexedBondProductPricer


  • public class DiscountingCapitalIndexedBondProductPricer
    extends Object
    Pricer for capital indexed bond products.

    This function provides the ability to price a ResolvedCapitalIndexedBond.

    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​(ResolvedCapitalIndexedBond bond,
                                           RatesProvider ratesProvider,
                                           LegalEntityDiscountingProvider discountingProvider)
        Calculates the present value of the bond.

        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
        ratesProvider - the rates provider, used to determine price index values
        discountingProvider - the discount factors provider
        Returns:
        the present value of the product
      • presentValueWithZSpread

        public CurrencyAmount presentValueWithZSpread​(ResolvedCapitalIndexedBond bond,
                                                      RatesProvider ratesProvider,
                                                      LegalEntityDiscountingProvider discountingProvider,
                                                      double zSpread,
                                                      CompoundedRateType compoundedRateType,
                                                      int periodsPerYear)
        Calculates the present value of the 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
        ratesProvider - the rates provider, used to determine price index values
        discountingProvider - the discount factors provider
        zSpread - the z-spread
        compoundedRateType - the compounded rate type
        periodsPerYear - the number of periods per year
        Returns:
        the present value of the bond product
      • presentValueSensitivity

        public PointSensitivityBuilder presentValueSensitivity​(ResolvedCapitalIndexedBond bond,
                                                               RatesProvider ratesProvider,
                                                               LegalEntityDiscountingProvider discountingProvider)
        Calculates the present value sensitivity of the bond product.

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

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        discountingProvider - the discount factors provider
        Returns:
        the present value curve sensitivity of the product
      • presentValueSensitivityWithZSpread

        public PointSensitivityBuilder presentValueSensitivityWithZSpread​(ResolvedCapitalIndexedBond bond,
                                                                          RatesProvider ratesProvider,
                                                                          LegalEntityDiscountingProvider discountingProvider,
                                                                          double zSpread,
                                                                          CompoundedRateType compoundedRateType,
                                                                          int periodsPerYear)
        Calculates the present value sensitivity of the bond product 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
        ratesProvider - the rates provider, used to determine price index values
        discountingProvider - the discount factors 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
      • currencyExposure

        public MultiCurrencyAmount currencyExposure​(ResolvedCapitalIndexedBond bond,
                                                    RatesProvider ratesProvider,
                                                    LegalEntityDiscountingProvider discountingProvider,
                                                    LocalDate referenceDate)
        Calculates the currency exposure of the bond product.
        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        discountingProvider - the discount factors provider
        referenceDate - the reference date
        Returns:
        the currency exposure of the product
      • currencyExposureWithZSpread

        public MultiCurrencyAmount currencyExposureWithZSpread​(ResolvedCapitalIndexedBond bond,
                                                               RatesProvider ratesProvider,
                                                               LegalEntityDiscountingProvider discountingProvider,
                                                               LocalDate referenceDate,
                                                               double zSpread,
                                                               CompoundedRateType compoundedRateType,
                                                               int periodsPerYear)
        Calculates the currency exposure of the bond product with z-spread.

        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
        ratesProvider - the rates provider, used to determine price index values
        discountingProvider - the discount factors provider
        referenceDate - the reference date
        zSpread - the z-spread
        compoundedRateType - the compounded rate type
        periodsPerYear - the number of periods per year
        Returns:
        the currency exposure of the product
      • currentCash

        public CurrencyAmount currentCash​(ResolvedCapitalIndexedBond bond,
                                          RatesProvider ratesProvider,
                                          LocalDate settlementDate)
        Calculates the current cash of the bond product.
        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        settlementDate - the settlement date
        Returns:
        the current cash of the product
      • dirtyNominalPriceFromCurves

        public double dirtyNominalPriceFromCurves​(ResolvedCapitalIndexedBond bond,
                                                  RatesProvider ratesProvider,
                                                  LegalEntityDiscountingProvider discountingProvider,
                                                  ReferenceData refData)
        Calculates the dirty price of the bond security.

        The 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
        ratesProvider - the rates provider, used to determine price index values
        discountingProvider - the discount factors provider
        refData - the reference data used to calculate the settlement date
        Returns:
        the dirty price of the bond security
      • dirtyNominalPriceFromCurvesWithZSpread

        public double dirtyNominalPriceFromCurvesWithZSpread​(ResolvedCapitalIndexedBond bond,
                                                             RatesProvider ratesProvider,
                                                             LegalEntityDiscountingProvider discountingProvider,
                                                             ReferenceData refData,
                                                             double zSpread,
                                                             CompoundedRateType compoundedRateType,
                                                             int periodsPerYear)
        Calculates the dirty price of the bond security with z-spread.

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

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

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        discountingProvider - the discount factors 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 bond security
      • dirtyNominalPriceSensitivity

        public PointSensitivityBuilder dirtyNominalPriceSensitivity​(ResolvedCapitalIndexedBond bond,
                                                                    RatesProvider ratesProvider,
                                                                    LegalEntityDiscountingProvider discountingProvider,
                                                                    ReferenceData refData)
        Calculates the dirty price sensitivity of the bond security.

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

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        discountingProvider - the discount factors provider
        refData - the reference data used to calculate the settlement date
        Returns:
        the dirty price curve sensitivity of the security
      • dirtyNominalPriceSensitivityWithZSpread

        public PointSensitivityBuilder dirtyNominalPriceSensitivityWithZSpread​(ResolvedCapitalIndexedBond bond,
                                                                               RatesProvider ratesProvider,
                                                                               LegalEntityDiscountingProvider discountingProvider,
                                                                               ReferenceData refData,
                                                                               double zSpread,
                                                                               CompoundedRateType compoundedRateType,
                                                                               int periodsPerYear)
        Calculates the dirty price sensitivity of the bond security with z-spread.

        The dirty price sensitivity of the security is the sensitivity of the dirty price 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
        ratesProvider - the rates provider, used to determine price index values
        discountingProvider - the discount factors 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
      • dirtyPriceFromRealYield

        public double dirtyPriceFromRealYield​(ResolvedCapitalIndexedBond bond,
                                              RatesProvider ratesProvider,
                                              LocalDate settlementDate,
                                              double yield)
        Computes the dirty price from the conventional real yield.

        The resulting dirty price is real price or nominal price depending on the yield convention.

        The input yield and output are expressed in fraction.

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        settlementDate - the settlement date
        yield - the yield
        Returns:
        the dirty price of the product
      • cleanPriceFromRealYield

        public double cleanPriceFromRealYield​(ResolvedCapitalIndexedBond bond,
                                              RatesProvider ratesProvider,
                                              LocalDate settlementDate,
                                              double yield)
        Computes the clean price from the conventional real yield.

        The resulting clean price is real price or nominal price depending on the yield convention.

        The input yield and output are expressed in fraction.

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

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        settlementDate - the settlement date
        yield - the yield
        Returns:
        the clean price of the product
      • realYieldFromDirtyPrice

        public double realYieldFromDirtyPrice​(ResolvedCapitalIndexedBond bond,
                                              RatesProvider ratesProvider,
                                              LocalDate settlementDate,
                                              double dirtyPrice)
        Computes the conventional real yield from the dirty price.

        The input dirty price should be real price or nominal price depending on the yield convention. This is coherent to the implementation of dirtyPriceFromRealYield(ResolvedCapitalIndexedBond, RatesProvider, LocalDate, double).

        The input price and output are expressed in fraction.

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        settlementDate - the settlement date
        dirtyPrice - the bond dirty price
        Returns:
        the yield of the product
      • realYieldFromCurves

        public double realYieldFromCurves​(ResolvedCapitalIndexedBond bond,
                                          RatesProvider ratesProvider,
                                          LegalEntityDiscountingProvider discountingProvider,
                                          ReferenceData refData)
        Computes the conventional real yield from the curves.

        The yield is in the bill yield convention.

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        discountingProvider - the discount factors provider
        refData - the reference data used to calculate the settlement date
        Returns:
        the yield of the product
      • dirtyPriceFromStandardYield

        public double dirtyPriceFromStandardYield​(ResolvedCapitalIndexedBond bond,
                                                  RatesProvider ratesProvider,
                                                  LocalDate settlementDate,
                                                  double yield)
        Computes the dirty price from the standard yield.

        The input yield and output are expressed in fraction.

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        settlementDate - the settlement date
        yield - the standard yield
        Returns:
        the dirty price of the product
      • modifiedDurationFromRealYieldFiniteDifference

        public double modifiedDurationFromRealYieldFiniteDifference​(ResolvedCapitalIndexedBond bond,
                                                                    RatesProvider ratesProvider,
                                                                    LocalDate settlementDate,
                                                                    double yield)
        Calculates the modified duration from the conventional real yield using finite difference approximation.

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

        The clean price here is real price or nominal price depending on the yield convention. This is coherent to the implementation of dirtyPriceFromRealYield(ResolvedCapitalIndexedBond, RatesProvider, LocalDate, double).

        The input yield and output are expressed in fraction.

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        settlementDate - the settlement date
        yield - the yield
        Returns:
        the modified duration of the product
      • convexityFromRealYieldFiniteDifference

        public double convexityFromRealYieldFiniteDifference​(ResolvedCapitalIndexedBond bond,
                                                             RatesProvider ratesProvider,
                                                             LocalDate settlementDate,
                                                             double yield)
        Calculates the convexity from the conventional real yield using finite difference approximation.

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

        The clean price here is real price or nominal price depending on the yield convention. This is coherent to the implementation of dirtyPriceFromRealYield(ResolvedCapitalIndexedBond, RatesProvider, LocalDate, double).

        The input yield and output are expressed in fraction.

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        settlementDate - the settlement date
        yield - the yield
        Returns:
        the covexity of the product
      • modifiedDurationFromStandardYield

        public double modifiedDurationFromStandardYield​(ResolvedCapitalIndexedBond bond,
                                                        RatesProvider ratesProvider,
                                                        LocalDate settlementDate,
                                                        double yield)
        Computes the modified duration from the standard 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 and output are expressed in fraction.

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        settlementDate - the settlement date
        yield - the standard yield
        Returns:
        the modified duration of the product
      • convexityFromStandardYield

        public double convexityFromStandardYield​(ResolvedCapitalIndexedBond bond,
                                                 RatesProvider ratesProvider,
                                                 LocalDate settlementDate,
                                                 double yield)
        Computes the covexity from the standard yield.

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

        The input yield and output are expressed in fraction.

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        settlementDate - the settlement date
        yield - the standard yield
        Returns:
        the convexity of the product
      • dirtyRealPriceFromCleanRealPrice

        public double dirtyRealPriceFromCleanRealPrice​(ResolvedCapitalIndexedBond bond,
                                                       LocalDate settlementDate,
                                                       double cleanPrice)
        Calculates the dirty real price of the bond from its settlement date and clean real price.
        Parameters:
        bond - the product
        settlementDate - the settlement date
        cleanPrice - the clean real price
        Returns:
        the price of the bond product
      • cleanRealPriceFromDirtyRealPrice

        public double cleanRealPriceFromDirtyRealPrice​(ResolvedCapitalIndexedBond bond,
                                                       LocalDate settlementDate,
                                                       double dirtyPrice)
        Calculates the clean real price of the bond from its settlement date and dirty real price.
        Parameters:
        bond - the product
        settlementDate - the settlement date
        dirtyPrice - the dirty real price
        Returns:
        the price of the bond product
      • dirtyNominalPriceFromCleanNominalPrice

        public double dirtyNominalPriceFromCleanNominalPrice​(ResolvedCapitalIndexedBond bond,
                                                             RatesProvider ratesProvider,
                                                             LocalDate settlementDate,
                                                             double cleanPrice)
        Calculates the dirty nominal price of the bond from its settlement date and clean nominal price.
        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        settlementDate - the settlement date
        cleanPrice - the clean nominal price
        Returns:
        the price of the bond product
      • cleanNominalPriceFromDirtyNominalPrice

        public double cleanNominalPriceFromDirtyNominalPrice​(ResolvedCapitalIndexedBond bond,
                                                             RatesProvider ratesProvider,
                                                             LocalDate settlementDate,
                                                             double dirtyPrice)
        Calculates the clean nominal price of the bond from its settlement date and dirty nominal price.
        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        settlementDate - the settlement date
        dirtyPrice - the dirty nominal price
        Returns:
        the price of the bond product
      • realPriceFromNominalPrice

        public double realPriceFromNominalPrice​(ResolvedCapitalIndexedBond bond,
                                                RatesProvider ratesProvider,
                                                LocalDate settlementDate,
                                                double nominalPrice)
        Calculates the real price of the bond from its settlement date and nominal price.

        The input and output prices are both clean or dirty.

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        settlementDate - the settlement date
        nominalPrice - the nominal price
        Returns:
        the price of the bond product
      • nominalPriceFromRealPrice

        public double nominalPriceFromRealPrice​(ResolvedCapitalIndexedBond bond,
                                                RatesProvider ratesProvider,
                                                LocalDate settlementDate,
                                                double realPrice)
        Calculates the nominal price of the bond from its settlement date and real price.

        The input and output prices are both clean or dirty.

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        settlementDate - the settlement date
        realPrice - the real price
        Returns:
        the price of the bond product
      • zSpreadFromCurvesAndCleanPrice

        public double zSpreadFromCurvesAndCleanPrice​(ResolvedCapitalIndexedBond bond,
                                                     RatesProvider ratesProvider,
                                                     LegalEntityDiscountingProvider discountingProvider,
                                                     ReferenceData refData,
                                                     double cleanPrice,
                                                     CompoundedRateType compoundedRateType,
                                                     int periodsPerYear)
        Calculates the z-spread of the bond from curves and clean price.

        The input clean price is real price or nominal price depending on the yield convention.

        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 present value.

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        discountingProvider - the discount factors provider
        refData - the reference data used to calculate the settlement date
        cleanPrice - the clean price
        compoundedRateType - the compounded rate type
        periodsPerYear - the number of periods per year
        Returns:
        the z-spread of the bond security
      • zSpreadFromCurvesAndPv

        public double zSpreadFromCurvesAndPv​(ResolvedCapitalIndexedBond bond,
                                             RatesProvider ratesProvider,
                                             LegalEntityDiscountingProvider discountingProvider,
                                             ReferenceData refData,
                                             CurrencyAmount presentValue,
                                             CompoundedRateType compoundedRateType,
                                             int periodsPerYear)
        Calculates the z-spread of the bond from curves and present value.

        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 present value.

        Parameters:
        bond - the product
        ratesProvider - the rates provider, used to determine price index values
        discountingProvider - the discount factors provider
        refData - the reference data used to calculate the settlement date
        presentValue - the present value
        compoundedRateType - the compounded rate type
        periodsPerYear - the number of periods per year
        Returns:
        the z-spread of the bond product