private CurrencyAmount presentValuePayment(ResolvedFixedCouponBondTrade trade, LegalEntityDiscountingProvider provider) { RepoCurveDiscountFactors repoDf = DiscountingFixedCouponBondProductPricer.repoCurveDf(trade.getProduct(), provider); Payment upfrontPayment = upfrontPayment(trade); return paymentPricer.presentValue(upfrontPayment, repoDf.getDiscountFactors()); }
/** * Calculates the dirty price of the fixed coupon bond under the specified settlement date. * <p> * The fixed coupon bond is represented as {@link Security} where standard ID of the bond is stored. * * @param bond the product * @param provider the discounting provider * @param settlementDate the settlement date * @return the dirty price of the fixed coupon bond security */ public double dirtyPriceFromCurves( ResolvedFixedCouponBond bond, LegalEntityDiscountingProvider provider, LocalDate settlementDate) { CurrencyAmount pv = presentValue(bond, provider, settlementDate); RepoCurveDiscountFactors repoDf = repoCurveDf(bond, provider); double df = repoDf.discountFactor(settlementDate); double notional = bond.getNotional(); return pv.getAmount() / df / notional; }
private PointSensitivityBuilder presentValueSensitivityPayment( ResolvedFixedCouponBondTrade trade, LegalEntityDiscountingProvider provider) { RepoCurveDiscountFactors repoDf = DiscountingFixedCouponBondProductPricer.repoCurveDf(trade.getProduct(), provider); Payment upfrontPayment = upfrontPayment(trade); PointSensitivityBuilder pt = paymentPricer.presentValueSensitivity( upfrontPayment, repoDf.getDiscountFactors()); if (pt instanceof ZeroRateSensitivity) { return RepoCurveZeroRateSensitivity.of((ZeroRateSensitivity) pt, repoDf.getRepoGroup()); } return pt; // NoPointSensitivity }
/** * Calculates the dirty price of the fixed coupon bond under the specified settlement date with z-spread. * <p> * The z-spread is a parallel shift applied to continuously compounded rates or periodic * compounded rates of the discounting curve. * <p> * The fixed coupon bond is represented as {@link Security} where standard ID of the bond is stored. * * @param bond the product * @param provider the discounting provider * @param zSpread the z-spread * @param compoundedRateType the compounded rate type * @param periodsPerYear the number of periods per year * @param settlementDate the settlement date * @return the dirty price of the fixed coupon bond security */ public double dirtyPriceFromCurvesWithZSpread( ResolvedFixedCouponBond bond, LegalEntityDiscountingProvider provider, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear, LocalDate settlementDate) { CurrencyAmount pv = presentValueWithZSpread(bond, provider, zSpread, compoundedRateType, periodsPerYear, settlementDate); RepoCurveDiscountFactors repoDf = repoCurveDf(bond, provider); double df = repoDf.discountFactor(settlementDate); double notional = bond.getNotional(); return pv.getAmount() / df / notional; }
PointSensitivityBuilder dirtyPriceSensitivity( ResolvedFixedCouponBond bond, LegalEntityDiscountingProvider provider, LocalDate referenceDate) { RepoCurveDiscountFactors repoDf = repoCurveDf(bond, provider); double df = repoDf.discountFactor(referenceDate); CurrencyAmount pv = presentValue(bond, provider); double notional = bond.getNotional(); PointSensitivityBuilder pvSensi = presentValueSensitivity(bond, provider).multipliedBy(1d / df / notional); RepoCurveZeroRateSensitivity dfSensi = repoDf.zeroRatePointSensitivity(referenceDate) .multipliedBy(-pv.getAmount() / df / df / notional); return pvSensi.combinedWith(dfSensi); }
PointSensitivityBuilder dirtyPriceSensitivityWithZspread( ResolvedFixedCouponBond bond, LegalEntityDiscountingProvider provider, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear, LocalDate referenceDate) { RepoCurveDiscountFactors repoDf = repoCurveDf(bond, provider); double df = repoDf.discountFactor(referenceDate); CurrencyAmount pv = presentValueWithZSpread(bond, provider, zSpread, compoundedRateType, periodsPerYear); double notional = bond.getNotional(); PointSensitivityBuilder pvSensi = presentValueSensitivityWithZSpread( bond, provider, zSpread, compoundedRateType, periodsPerYear).multipliedBy(1d / df / notional); RepoCurveZeroRateSensitivity dfSensi = repoDf.zeroRatePointSensitivity(referenceDate) .multipliedBy(-pv.getAmount() / df / df / notional); return pvSensi.combinedWith(dfSensi); }
LocalDate tradeSettlementDate = settlementDate(trade, provider.getValuationDate()); Currency currency = product.getCurrency(); RepoCurveDiscountFactors repoDf = DiscountingFixedCouponBondProductPricer.repoCurveDf(product, provider); double df = repoDf.discountFactor(standardSettlementDate); double pvStandard =
LocalDate tradeSettlementDate = settlementDate(trade, provider.getValuationDate()); Currency currency = product.getCurrency(); RepoCurveDiscountFactors repoDf = DiscountingFixedCouponBondProductPricer.repoCurveDf(product, provider); double df = repoDf.discountFactor(standardSettlementDate); double pvStandard =