public class DiscountingCapitalIndexedBondProductPricer extends Object
This function provides the ability to price a ResolvedCapitalIndexedBond
.
Modifier and Type | Field and Description |
---|---|
static DiscountingCapitalIndexedBondProductPricer |
DEFAULT
Default implementation.
|
Constructor and Description |
---|
DiscountingCapitalIndexedBondProductPricer(DiscountingCapitalIndexedBondPaymentPeriodPricer periodPricer)
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
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.
|
double |
cleanPriceFromRealYield(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LocalDate settlementDate,
double yield)
Computes the clean price from the conventional real yield.
|
double |
cleanRealPriceFromDirtyRealPrice(ResolvedCapitalIndexedBond bond,
LocalDate settlementDate,
double dirtyPrice)
Calculates the clean real price of the bond from its settlement date and dirty real price.
|
double |
convexityFromRealYieldFiniteDifference(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LocalDate settlementDate,
double yield)
Calculates the convexity from the conventional real yield using finite difference approximation.
|
double |
convexityFromStandardYield(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LocalDate settlementDate,
double yield)
Computes the covexity from the standard yield.
|
MultiCurrencyAmount |
currencyExposure(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LegalEntityDiscountingProvider discountingProvider,
LocalDate referenceDate)
Calculates the currency exposure of the bond product.
|
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.
|
CurrencyAmount |
currentCash(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LocalDate settlementDate)
Calculates the current cash of the bond product.
|
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.
|
double |
dirtyNominalPriceFromCurves(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LegalEntityDiscountingProvider discountingProvider,
ReferenceData refData)
Calculates the dirty price of the bond security.
|
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.
|
PointSensitivityBuilder |
dirtyNominalPriceSensitivity(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LegalEntityDiscountingProvider discountingProvider,
ReferenceData refData)
Calculates the dirty price sensitivity of the bond security.
|
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.
|
double |
dirtyPriceFromRealYield(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LocalDate settlementDate,
double yield)
Computes the dirty price from the conventional real yield.
|
double |
dirtyPriceFromStandardYield(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LocalDate settlementDate,
double yield)
Computes the dirty price from the standard yield.
|
double |
dirtyRealPriceFromCleanRealPrice(ResolvedCapitalIndexedBond bond,
LocalDate settlementDate,
double cleanPrice)
Calculates the dirty real price of the bond from its settlement date and clean real price.
|
DiscountingCapitalIndexedBondPaymentPeriodPricer |
getPeriodPricer()
Obtains the period pricer.
|
double |
modifiedDurationFromRealYieldFiniteDifference(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LocalDate settlementDate,
double yield)
Calculates the modified duration from the conventional real yield using finite difference approximation.
|
double |
modifiedDurationFromStandardYield(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LocalDate settlementDate,
double yield)
Computes the modified duration from the standard yield.
|
double |
nominalPriceFromRealPrice(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LocalDate settlementDate,
double realPrice)
Calculates the nominal price of the bond from its settlement date and real price.
|
CurrencyAmount |
presentValue(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LegalEntityDiscountingProvider discountingProvider)
Calculates the present value of the bond.
|
PointSensitivityBuilder |
presentValueSensitivity(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LegalEntityDiscountingProvider discountingProvider)
Calculates the present value sensitivity of the bond product.
|
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.
|
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.
|
double |
realPriceFromNominalPrice(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LocalDate settlementDate,
double nominalPrice)
Calculates the real price of the bond from its settlement date and nominal price.
|
double |
realYieldFromCurves(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LegalEntityDiscountingProvider discountingProvider,
ReferenceData refData)
Computes the conventional real yield from the curves.
|
double |
realYieldFromDirtyPrice(ResolvedCapitalIndexedBond bond,
RatesProvider ratesProvider,
LocalDate settlementDate,
double dirtyPrice)
Computes the conventional real yield from the dirty price.
|
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.
|
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.
|
public static final DiscountingCapitalIndexedBondProductPricer DEFAULT
public DiscountingCapitalIndexedBondProductPricer(DiscountingCapitalIndexedBondPaymentPeriodPricer periodPricer)
periodPricer
- the pricer for CapitalIndexedBondPaymentPeriod
.public DiscountingCapitalIndexedBondPaymentPeriodPricer getPeriodPricer()
public CurrencyAmount presentValue(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LegalEntityDiscountingProvider discountingProvider)
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.
bond
- the productratesProvider
- the rates provider, used to determine price index valuesdiscountingProvider
- the discount factors providerpublic CurrencyAmount presentValueWithZSpread(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LegalEntityDiscountingProvider discountingProvider, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear)
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.
bond
- the productratesProvider
- the rates provider, used to determine price index valuesdiscountingProvider
- the discount factors providerzSpread
- the z-spreadcompoundedRateType
- the compounded rate typeperiodsPerYear
- the number of periods per yearpublic PointSensitivityBuilder presentValueSensitivity(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LegalEntityDiscountingProvider discountingProvider)
The present value sensitivity of the product is the sensitivity of the present value to the underlying curves.
bond
- the productratesProvider
- the rates provider, used to determine price index valuesdiscountingProvider
- the discount factors providerpublic PointSensitivityBuilder presentValueSensitivityWithZSpread(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LegalEntityDiscountingProvider discountingProvider, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear)
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.
bond
- the productratesProvider
- the rates provider, used to determine price index valuesdiscountingProvider
- the discount factors providerzSpread
- the z-spreadcompoundedRateType
- the compounded rate typeperiodsPerYear
- the number of periods per yearpublic MultiCurrencyAmount currencyExposure(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LegalEntityDiscountingProvider discountingProvider, LocalDate referenceDate)
bond
- the productratesProvider
- the rates provider, used to determine price index valuesdiscountingProvider
- the discount factors providerreferenceDate
- the reference datepublic MultiCurrencyAmount currencyExposureWithZSpread(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LegalEntityDiscountingProvider discountingProvider, LocalDate referenceDate, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear)
The z-spread is a parallel shift applied to continuously compounded rates or periodic compounded rates of the issuer discounting curve.
bond
- the productratesProvider
- the rates provider, used to determine price index valuesdiscountingProvider
- the discount factors providerreferenceDate
- the reference datezSpread
- the z-spreadcompoundedRateType
- the compounded rate typeperiodsPerYear
- the number of periods per yearpublic CurrencyAmount currentCash(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LocalDate settlementDate)
bond
- the productratesProvider
- the rates provider, used to determine price index valuessettlementDate
- the settlement datepublic double dirtyNominalPriceFromCurves(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LegalEntityDiscountingProvider discountingProvider, ReferenceData refData)
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.
bond
- the productratesProvider
- the rates provider, used to determine price index valuesdiscountingProvider
- the discount factors providerrefData
- the reference data used to calculate the settlement datepublic double dirtyNominalPriceFromCurvesWithZSpread(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LegalEntityDiscountingProvider discountingProvider, ReferenceData refData, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear)
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.
bond
- the productratesProvider
- the rates provider, used to determine price index valuesdiscountingProvider
- the discount factors providerrefData
- the reference data used to calculate the settlement datezSpread
- the z-spreadcompoundedRateType
- the compounded rate typeperiodsPerYear
- the number of periods per yearpublic PointSensitivityBuilder dirtyNominalPriceSensitivity(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LegalEntityDiscountingProvider discountingProvider, ReferenceData refData)
The dirty price sensitivity of the security is the sensitivity of the dirty price value to the underlying curves.
bond
- the productratesProvider
- the rates provider, used to determine price index valuesdiscountingProvider
- the discount factors providerrefData
- the reference data used to calculate the settlement datepublic PointSensitivityBuilder dirtyNominalPriceSensitivityWithZSpread(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LegalEntityDiscountingProvider discountingProvider, ReferenceData refData, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear)
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.
bond
- the productratesProvider
- the rates provider, used to determine price index valuesdiscountingProvider
- the discount factors providerrefData
- the reference data used to calculate the settlement datezSpread
- the z-spreadcompoundedRateType
- the compounded rate typeperiodsPerYear
- the number of periods per yearpublic double dirtyPriceFromRealYield(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LocalDate settlementDate, double 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.
bond
- the productratesProvider
- the rates provider, used to determine price index valuessettlementDate
- the settlement dateyield
- the yieldpublic double cleanPriceFromRealYield(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LocalDate settlementDate, double 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.
bond
- the productratesProvider
- the rates provider, used to determine price index valuessettlementDate
- the settlement dateyield
- the yieldpublic double realYieldFromDirtyPrice(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LocalDate settlementDate, double dirtyPrice)
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.
bond
- the productratesProvider
- the rates provider, used to determine price index valuessettlementDate
- the settlement datedirtyPrice
- the bond dirty pricepublic double realYieldFromCurves(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LegalEntityDiscountingProvider discountingProvider, ReferenceData refData)
The yield is in the bill yield convention.
bond
- the productratesProvider
- the rates provider, used to determine price index valuesdiscountingProvider
- the discount factors providerrefData
- the reference data used to calculate the settlement datepublic double dirtyPriceFromStandardYield(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LocalDate settlementDate, double yield)
The input yield and output are expressed in fraction.
bond
- the productratesProvider
- the rates provider, used to determine price index valuessettlementDate
- the settlement dateyield
- the standard yieldpublic double modifiedDurationFromRealYieldFiniteDifference(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LocalDate settlementDate, double yield)
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.
bond
- the productratesProvider
- the rates provider, used to determine price index valuessettlementDate
- the settlement dateyield
- the yieldpublic double convexityFromRealYieldFiniteDifference(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LocalDate settlementDate, double yield)
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.
bond
- the productratesProvider
- the rates provider, used to determine price index valuessettlementDate
- the settlement dateyield
- the yieldpublic double modifiedDurationFromStandardYield(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LocalDate settlementDate, double 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.
bond
- the productratesProvider
- the rates provider, used to determine price index valuessettlementDate
- the settlement dateyield
- the standard yieldpublic double convexityFromStandardYield(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LocalDate settlementDate, double 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.
bond
- the productratesProvider
- the rates provider, used to determine price index valuessettlementDate
- the settlement dateyield
- the standard yieldpublic double dirtyRealPriceFromCleanRealPrice(ResolvedCapitalIndexedBond bond, LocalDate settlementDate, double cleanPrice)
bond
- the productsettlementDate
- the settlement datecleanPrice
- the clean real pricepublic double cleanRealPriceFromDirtyRealPrice(ResolvedCapitalIndexedBond bond, LocalDate settlementDate, double dirtyPrice)
bond
- the productsettlementDate
- the settlement datedirtyPrice
- the dirty real pricepublic double dirtyNominalPriceFromCleanNominalPrice(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LocalDate settlementDate, double cleanPrice)
bond
- the productratesProvider
- the rates provider, used to determine price index valuessettlementDate
- the settlement datecleanPrice
- the clean nominal pricepublic double cleanNominalPriceFromDirtyNominalPrice(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LocalDate settlementDate, double dirtyPrice)
bond
- the productratesProvider
- the rates provider, used to determine price index valuessettlementDate
- the settlement datedirtyPrice
- the dirty nominal pricepublic double realPriceFromNominalPrice(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LocalDate settlementDate, double nominalPrice)
The input and output prices are both clean or dirty.
bond
- the productratesProvider
- the rates provider, used to determine price index valuessettlementDate
- the settlement datenominalPrice
- the nominal pricepublic double nominalPriceFromRealPrice(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LocalDate settlementDate, double realPrice)
The input and output prices are both clean or dirty.
bond
- the productratesProvider
- the rates provider, used to determine price index valuessettlementDate
- the settlement daterealPrice
- the real pricepublic double zSpreadFromCurvesAndCleanPrice(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LegalEntityDiscountingProvider discountingProvider, ReferenceData refData, double cleanPrice, CompoundedRateType compoundedRateType, int periodsPerYear)
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.
bond
- the productratesProvider
- the rates provider, used to determine price index valuesdiscountingProvider
- the discount factors providerrefData
- the reference data used to calculate the settlement datecleanPrice
- the clean pricecompoundedRateType
- the compounded rate typeperiodsPerYear
- the number of periods per yearpublic double zSpreadFromCurvesAndPv(ResolvedCapitalIndexedBond bond, RatesProvider ratesProvider, LegalEntityDiscountingProvider discountingProvider, ReferenceData refData, CurrencyAmount presentValue, CompoundedRateType compoundedRateType, int periodsPerYear)
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.
bond
- the productratesProvider
- the rates provider, used to determine price index valuesdiscountingProvider
- the discount factors providerrefData
- the reference data used to calculate the settlement datepresentValue
- the present valuecompoundedRateType
- the compounded rate typeperiodsPerYear
- the number of periods per yearCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.