Package com.opengamma.analytics.financial.interestrate.annuity.derivative

Examples of com.opengamma.analytics.financial.interestrate.annuity.derivative.AnnuityPaymentFixed.accept()


  @Test
  public void presentValueFixedMiddle() {
    final AnnuityPaymentFixed nominal = (AnnuityPaymentFixed) BOND_DE_SECURITY_DEFINITION.getNominal().toDerivative(REFERENCE_DATE_DE_1, CURVES_NAME);
    final AnnuityCouponFixed coupon = BOND_DE_SECURITY_DEFINITION.getCoupons().trimBefore(SPOT_DATE_DE_1).toDerivative(REFERENCE_DATE_DE_1, CURVES_NAME);
    final double pvNominal = nominal.accept(PVC, CURVES);
    final double pvCoupon = coupon.accept(PVC, CURVES);
    final double pv = METHOD.presentValue(BOND_DE_SECURITY_1, CURVES);
    assertEquals("Fixed coupon bond security: present value", pvNominal + pvCoupon, pv);
  }
View Full Code Here


  public void presentValueFixedMiddle() {
    final AnnuityPaymentFixed nominal = (AnnuityPaymentFixed) BOND_FIXED_SECURITY_DEFINITION.getNominal().toDerivative(REFERENCE_DATE_1);
    AnnuityCouponFixed coupon = BOND_FIXED_SECURITY_DEFINITION.getCoupons().toDerivative(REFERENCE_DATE_1);
    coupon = coupon.trimBefore(REFERENCE_TIME_1);
    final MulticurveProviderInterface multicurvesDecorated = new MulticurveProviderDiscountingDecoratedIssuer(ISSUER_MULTICURVES, CUR, ISSUER);
    final MultipleCurrencyAmount pvNominal = nominal.accept(PVDC, multicurvesDecorated);
    final MultipleCurrencyAmount pvCoupon = coupon.accept(PVDC, multicurvesDecorated);
    final MultipleCurrencyAmount pv = METHOD_BOND_SECURITY.presentValue(BOND_FIXED_SECURITY_1, ISSUER_MULTICURVES);
    assertEquals("Fixed coupon bond security: present value", pvNominal.getAmount(CUR) + pvCoupon.getAmount(CUR), pv.getAmount(CUR), TOLERANCE_PV);
  }
View Full Code Here

  public void presentValueFixedOnCoupon() {
    final AnnuityPaymentFixed nominal = (AnnuityPaymentFixed) BOND_FIXED_SECURITY_DEFINITION.getNominal().toDerivative(REFERENCE_DATE_2);
    AnnuityCouponFixed coupon = BOND_FIXED_SECURITY_DEFINITION.getCoupons().toDerivative(REFERENCE_DATE_2);
    coupon = coupon.trimBefore(REFERENCE_TIME_2);
    final MulticurveProviderInterface multicurvesDecorated = new MulticurveProviderDiscountingDecoratedIssuer(ISSUER_MULTICURVES, CUR, ISSUER);
    final MultipleCurrencyAmount pvNominal = nominal.accept(PVDC, multicurvesDecorated);
    final MultipleCurrencyAmount pvCoupon = coupon.accept(PVDC, multicurvesDecorated);
    final MultipleCurrencyAmount pv = METHOD_BOND_SECURITY.presentValue(BOND_FIXED_SECURITY_2, ISSUER_MULTICURVES);
    assertEquals("Fixed coupon bond security: present value", pvNominal.getAmount(CUR) + pvCoupon.getAmount(CUR), pv.getAmount(CUR), TOLERANCE_PV);
  }
View Full Code Here

  @Test
  public void presentValueFixedMiddle() {
    final AnnuityPaymentFixed nominal = (AnnuityPaymentFixed) BOND_FIXED_SECURITY_DEFINITION.getNominal().toDerivative(REFERENCE_DATE_US_1, CURVES_NAME);
    AnnuityCouponFixed coupon = BOND_FIXED_SECURITY_DEFINITION.getCoupons().toDerivative(REFERENCE_DATE_US_1, CURVES_NAME);
    coupon = coupon.trimBefore(REFERENCE_TIME_1);
    final double pvNominal = nominal.accept(PVC, CURVES);
    final double pvCoupon = coupon.accept(PVC, CURVES);
    final double pv = METHOD.presentValue(BOND_FIXED_SECURITY_1, CURVES);
    assertEquals("Fixed coupon bond security: present value", pvNominal + pvCoupon, pv);
  }
View Full Code Here

  @Test
  public void presentValueFixedOnCoupon() {
    final AnnuityPaymentFixed nominal = (AnnuityPaymentFixed) BOND_FIXED_SECURITY_DEFINITION.getNominal().toDerivative(REFERENCE_DATE_US_2, CURVES_NAME);
    AnnuityCouponFixed coupon = BOND_FIXED_SECURITY_DEFINITION.getCoupons().toDerivative(REFERENCE_DATE_US_2, CURVES_NAME);
    coupon = coupon.trimBefore(REFERENCE_TIME_2);
    final double pvNominal = nominal.accept(PVC, CURVES);
    final double pvCoupon = coupon.accept(PVC, CURVES);
    final double pv = METHOD.presentValue(BOND_FIXED_SECURITY_2, CURVES);
    assertEquals("Fixed coupon bond security: present value", pvNominal + pvCoupon, pv);
  }
View Full Code Here

    final double beta = CURVES.getCurve(FORWARD_CURVE_NAME).getDiscountFactor(cpnIbor.getFixingPeriodStartTime()) /
        CURVES.getCurve(FORWARD_CURVE_NAME).getDiscountFactor(cpnIbor.getFixingPeriodEndTime())
        * CURVES.getCurve(FUNDING_CURVE_NAME).getDiscountFactor(cpnIbor.getPaymentTime()) / CURVES.getCurve(FUNDING_CURVE_NAME).getDiscountFactor(cpnIbor.getFixingPeriodStartTime());
    assertEquals("Fixed coupon: Amount", beta * NOTIONAL * (FIXED_IS_PAYER ? 1.0 : -1.0) * cpnIbor.getPaymentYearFraction() / cpnIbor.getFixingAccrualFactor(), cfe.getNthPayment(0).getAmount(), 1E-4);
    final double pvCpn = cpn.accept(PVC, CURVES);
    final double pvCfe = cfe.accept(PVC, CURVES);
    assertEquals("Cash flow equivalent - Swap: present value", pvCpn, pvCfe, 1E-5);
  }

  @Test
  /**
 
View Full Code Here

    for (int loopcf = 0; loopcf < leg.getNumberOfPayments(); loopcf++) {
      assertEquals("Fixed leg: Time", leg.getNthPayment(loopcf).getPaymentTime(), cfe.getNthPayment(loopcf).getPaymentTime(), 1E-5);
      assertEquals("Fixed leg: Amount", leg.getNthPayment(loopcf).getAmount(), cfe.getNthPayment(loopcf).getAmount(), 1E-2);
    }
    final double pvLeg = leg.accept(PVC, CURVES);
    final double pvCfe = cfe.accept(PVC, CURVES);
    assertEquals("Cash flow equivalent - Swap: present value", pvLeg, pvCfe, 1E-5);
  }

  @Test
  /**
 
View Full Code Here

      assertEquals("Ibor leg: Time", leg.getNthPayment(loopcf - 1).getPaymentTime(), cfe.getNthPayment(loopcf).getPaymentTime(), 1E-5);
    }
    assertEquals("Ibor leg: Amount", -1 * NOTIONAL * (FIXED_IS_PAYER ? 1.0 : -1.0), cfe.getNthPayment(leg.getNumberOfPayments()).getAmount(), 1E-4);
    assertEquals("Ibor leg: Time", leg.getNthPayment(leg.getNumberOfPayments() - 1).getPaymentTime(), cfe.getNthPayment(leg.getNumberOfPayments()).getPaymentTime(), 1E-5);
    final double pvLeg = leg.accept(PVC, CURVES);
    final double pvCfe = cfe.accept(PVC, CURVES);
    assertEquals("Cash flow equivalent - Swap: present value", pvLeg, pvCfe, 1E-5);
  }

  @Test
  /**
 
View Full Code Here

    }
    assertEquals("Swap: Amount", (-1 * NOTIONAL * (FIXED_IS_PAYER ? 1.0 : -1.0)) + SWAP.getFixedLeg().getNthPayment(SWAP.getFixedLeg().getNumberOfPayments() - 1).getAmount(),
        cfe.getNthPayment(leg.getNumberOfPayments()).getAmount(), 1E-4);
    assertEquals("Swap: Time", leg.getNthPayment(leg.getNumberOfPayments() - 1).getPaymentTime(), cfe.getNthPayment(leg.getNumberOfPayments()).getPaymentTime(), 1E-5);
    final double pvSwap = SWAP.accept(PVC, CURVES);
    final double pvCfe = cfe.accept(PVC, CURVES);
    assertEquals("Cash flow equivalent - Swap: present value", pvSwap, pvCfe, 1E-5);
  }

}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.