public InterestRateCurveSensitivity presentValueSensitivity( final BondIborTransaction bond, final YieldCurveBundle curves) { final InterestRateCurveSensitivity pvsNominal = new InterestRateCurveSensitivity( bond.getBondTransaction().getNominal().accept(PVSC, curves)); final InterestRateCurveSensitivity pvsCoupon = new InterestRateCurveSensitivity( bond.getBondTransaction().getCoupon().accept(PVSC, curves)); final double settlementAmount = bond.getTransactionPrice() * bond.getBondTransaction() .getCoupon() .getNthPayment(0) .getNotional(); // FIXME: add accrued. LOGGER.error("The FRN settlement amount does not include the accrued interests."); final PaymentFixed settlement = new PaymentFixed( bond.getBondTransaction().getCurrency(), bond.getBondTransaction().getSettlementTime(), settlementAmount, bond.getBondTransaction().getRepoCurveName()); final InterestRateCurveSensitivity pvsSettlement = new InterestRateCurveSensitivity(settlement.accept(PVSC, curves)); return pvsNominal.plus(pvsCoupon).multipliedBy(bond.getQuantity()).plus(pvsSettlement); }
/** * Compute the the present value curve sensitivity of a fixed payment by discounting to a parallel * curve movement. * * @param payment The payment. * @param multicurves The multi-curves provider. * @return The sensitivity. TODO: Should this be multiple-currency? */ public StringAmount presentValueParallelCurveSensitivity( final PaymentFixed payment, final MulticurveProviderInterface multicurves) { final double time = payment.getPaymentTime(); final double sensitivity = -time * payment.getAmount() * multicurves.getDiscountFactor(payment.getCurrency(), time); return StringAmount.from(multicurves.getName(payment.getCurrency()), sensitivity); }
/** * Compute the the present value of a fixed payment by discounting to a parallel curve movement. * * @param payment The payment. * @param multicurves The multi-curve provider. * @return The present value. */ public MultipleCurrencyAmount presentValue( final PaymentFixed payment, final MulticurveProviderInterface multicurves) { ArgumentChecker.notNull(payment, "Payment"); ArgumentChecker.notNull(multicurves, "Multi-curves"); final double pv = payment.getAmount() * multicurves.getDiscountFactor(payment.getCurrency(), payment.getPaymentTime()); return MultipleCurrencyAmount.of(payment.getCurrency(), pv); }
@Override public Map<String, List<DoublesPair>> visitFixedPayment( final PaymentFixed payment, final YieldCurveBundle data) { final String curveName = payment.getFundingCurveName(); final YieldAndDiscountCurve curve = data.getCurve(curveName); final double t = payment.getPaymentTime(); final DoublesPair s = new DoublesPair(t, -t * payment.getAmount() * curve.getDiscountFactor(t)); final List<DoublesPair> list = new ArrayList<DoublesPair>(); list.add(s); final Map<String, List<DoublesPair>> result = new HashMap<String, List<DoublesPair>>(); result.put(curveName, list); return result; }
/** * Computes the present value curve sensitivity of a fixed payment by discounting. * * @param payment The fixed payment. * @param multicurves The multi-curve provider. * @return The sensitivity. */ public MultipleCurrencyMulticurveSensitivity presentValueCurveSensitivity( final PaymentFixed payment, final MulticurveProviderInterface multicurves) { final double time = payment.getPaymentTime(); final DoublesPair s = DoublesPair.of( time, -time * payment.getAmount() * multicurves.getDiscountFactor(payment.getCurrency(), time)); final List<DoublesPair> list = new ArrayList<>(); list.add(s); final Map<String, List<DoublesPair>> result = new HashMap<>(); result.put(multicurves.getName(payment.getCurrency()), list); return MultipleCurrencyMulticurveSensitivity.of( payment.getCurrency(), MulticurveSensitivity.ofYieldDiscounting(result)); }
/** * Compute the present value of a fixed coupon bond transaction. * * @param bond The bond transaction. * @param curves The curve bundle. * @return The present value. */ public double presentValue(final BondFixedTransaction bond, final YieldCurveBundle curves) { final double pvNominal = bond.getBondTransaction().getNominal().accept(PVC, curves); final double pvCoupon = bond.getBondTransaction().getCoupon().accept(PVC, curves); final double settlementAmount = -(bond.getTransactionPrice() * bond.getBondTransaction().getCoupon().getNthPayment(0).getNotional() + bond.getBondTransaction().getAccruedInterest()) * bond.getQuantity(); final PaymentFixed settlement = new PaymentFixed( bond.getBondTransaction().getCurrency(), bond.getBondTransaction().getSettlementTime(), settlementAmount, bond.getBondTransaction().getRepoCurveName()); final double pvSettlement = settlement.accept(PVC, curves); return (pvNominal + pvCoupon) * bond.getQuantity() + pvSettlement; }
/** * Compute the present value of a Ibor coupon bond (FRN) transaction. * * @param bond The bond transaction. * @param curves The curve bundle. * @return The present value. */ public double presentValue(final BondIborTransaction bond, final YieldCurveBundle curves) { final double pvNominal = bond.getBondTransaction().getNominal().accept(PVC, curves); final double pvCoupon = bond.getBondTransaction().getCoupon().accept(PVC, curves); final double settlementAmount = bond.getTransactionPrice() * bond.getBondTransaction() .getCoupon() .getNthPayment(0) .getNotional(); // FIXME: add accrued. LOGGER.error("The FRN settlement amount does not include the accrued interests."); final PaymentFixed settlement = new PaymentFixed( bond.getBondTransaction().getCurrency(), bond.getBondTransaction().getSettlementTime(), settlementAmount, bond.getBondTransaction().getRepoCurveName()); final double pvSettlement = settlement.accept(PVC, curves); return (pvNominal + pvCoupon) * bond.getQuantity() + pvSettlement; }
/** * Compute the present value sensitivity of a bond transaction. * * @param bond The bond transaction. * @param curves The curve bundle. * @return The present value sensitivity. */ public InterestRateCurveSensitivity presentValueSensitivity( final BondFixedTransaction bond, final YieldCurveBundle curves) { final InterestRateCurveSensitivity pvsNominal = new InterestRateCurveSensitivity( bond.getBondTransaction().getNominal().accept(PVSC, curves)); final InterestRateCurveSensitivity pvsCoupon = new InterestRateCurveSensitivity( bond.getBondTransaction().getCoupon().accept(PVSC, curves)); final double settlementAmount = -(bond.getTransactionPrice() * bond.getBondTransaction().getCoupon().getNthPayment(0).getNotional() + bond.getBondTransaction().getAccruedInterest()) * bond.getQuantity(); final PaymentFixed settlement = new PaymentFixed( bond.getBondTransaction().getCurrency(), bond.getBondTransaction().getSettlementTime(), settlementAmount, bond.getBondTransaction().getRepoCurveName()); final InterestRateCurveSensitivity pvsSettlement = new InterestRateCurveSensitivity(settlement.accept(PVSC, curves)); return pvsNominal.plus(pvsCoupon).multipliedBy(bond.getQuantity()).plus(pvsSettlement); }