@Override public PresentValueSABRSensitivityDataBundle visitGenericAnnuity( final Annuity<? extends Payment> annuity, final SABRSwaptionProviderInterface sabr) { ArgumentChecker.notNull(annuity, "Annuity"); PresentValueSABRSensitivityDataBundle cs = visit(annuity.getNthPayment(0), sabr); for (int loopp = 1; loopp < annuity.getNumberOfPayments(); loopp++) { cs = cs.plus(visit(annuity.getNthPayment(loopp), sabr)); } return cs; }
@Override public MultipleCurrencyCurveSensitivityMarket visitGenericAnnuity( final Annuity<? extends Payment> annuity, final IMarketBundle market) { ArgumentChecker.notNull(annuity, "Annuity"); ArgumentChecker.notNull(market, "Market"); MultipleCurrencyCurveSensitivityMarket cs = visit(annuity.getNthPayment(0), market); for (int loopp = 1; loopp < annuity.getNumberOfPayments(); loopp++) { cs = cs.plus(visit(annuity.getNthPayment(loopp), market)); } return cs; }
@Override public double[] visitGenericAnnuity( final Annuity<? extends Payment> annuity, final YieldCurveBundle curves) { final int n = annuity.getNumberOfPayments(); final double[] fractions = new double[n]; for (int i = 0; i < n; i++) { fractions[i] = annuity.getNthPayment(i).accept(COUPON_VISITOR, curves); } return fractions; }
/** * This gives you the bond coupon, for a given yield curve, that renders the bond par (present * value of all cash flows equal to 1.0) * * @param bond the bond * @param curves the input curves * @return the par rate */ @Override public Double visitBondFixedSecurity( final BondFixedSecurity bond, final YieldCurveBundle curves) { final Annuity<CouponFixed> coupons = bond.getCoupon(); final int n = coupons.getNumberOfPayments(); final CouponFixed[] unitCoupons = new CouponFixed[n]; for (int i = 0; i < n; i++) { unitCoupons[i] = coupons.getNthPayment(i).withUnitCoupon(); } final Annuity<CouponFixed> unitCouponAnnuity = new Annuity<>(unitCoupons); final double pvann = unitCouponAnnuity.accept(PVC, curves); final double matPV = bond.getNominal().accept(PVC, curves); return (1 - matPV) / pvann; }