Examples of CapFloorIborLMMDDMethod


Examples of com.opengamma.analytics.financial.interestrate.payments.method.CapFloorIborLMMDDMethod

        FIRST_CPN_RATE, mainIbor, floorIbor, capIbor, TARGET);
    final AnnuityCouponIborRatchet ratchetFixed = ratchetFixedDefinition.toDerivative(REFERENCE_DATE, FIXING_TS, CURVES_NAMES);
    final AnnuityCapFloorIborDefinition capDefinition = AnnuityCapFloorIborDefinition.from(SETTLEMENT_DATE, SETTLEMENT_DATE.plus(ANNUITY_TENOR), NOTIONAL, INDEX_EURIBOR3M, IS_PAYER, strike, true, TARGET);
    final Annuity<? extends Payment> cap = capDefinition.toDerivative(REFERENCE_DATE, FIXING_TS, CURVES_NAMES);
    final LiborMarketModelMonteCarloMethod methodMC = new LiborMarketModelMonteCarloMethod(new NormalRandomNumberGenerator(0.0, 1.0, new MersenneTwister()), nbPath);
    final CapFloorIborLMMDDMethod methodCapLMM = new CapFloorIborLMMDDMethod();
    final AnnuityCouponFixedDefinition fixedDefinition = AnnuityCouponFixedDefinition.from(EUR, SETTLEMENT_DATE, ANNUITY_TENOR, INDEX_EURIBOR3M.getTenor(), TARGET, INDEX_EURIBOR3M.getDayCount(),
        INDEX_EURIBOR3M.getBusinessDayConvention(), INDEX_EURIBOR3M.isEndOfMonth(), NOTIONAL, strike, IS_PAYER);
    final AnnuityCouponFixed fixed = fixedDefinition.toDerivative(REFERENCE_DATE, CURVES_NAMES);
    double pvFlooredExpected = 0.0;
    pvFlooredExpected += ratchetFixed.getNthPayment(0).accept(PVC, CURVES);
    for (int loopcpn = 1; loopcpn < cap.getNumberOfPayments(); loopcpn++) {
      pvFlooredExpected += factor * methodCapLMM.presentValue(cap.getNthPayment(loopcpn), BUNDLE_LMM).getAmount();
      pvFlooredExpected += factor * fixed.getNthPayment(loopcpn).accept(PVC, CURVES);
    }
    final CurrencyAmount pvFloorMC = methodMC.presentValue(ratchetFixed, EUR, CURVES.getCurve(CURVES_NAMES[0]), BUNDLE_LMM);
    assertEquals("Annuity Ratchet Ibor - Hull-White - LMM - Degenerate in floor leg", pvFlooredExpected, pvFloorMC.getAmount(), 2.5E+3);
    // For 500,000 path the difference is 561.70
View Full Code Here

Examples of com.opengamma.analytics.financial.interestrate.payments.provider.CapFloorIborLMMDDMethod

        FIRST_CPN_RATE, mainIbor, floorIbor, capIbor, TARGET);
    final AnnuityCouponIborRatchet ratchetFixed = ratchetFixedDefinition.toDerivative(REFERENCE_DATE, FIXING_TS);
    final AnnuityCapFloorIborDefinition capDefinition = AnnuityCapFloorIborDefinition.from(SETTLEMENT_DATE, SETTLEMENT_DATE.plus(ANNUITY_TENOR), NOTIONAL, EURIBOR3M, IS_PAYER, strike, true, TARGET);
    final Annuity<? extends Payment> cap = capDefinition.toDerivative(REFERENCE_DATE, FIXING_TS);
    final LiborMarketModelMonteCarloMethod methodMC = new LiborMarketModelMonteCarloMethod(new NormalRandomNumberGenerator(0.0, 1.0, new MersenneTwister()), nbPath);
    final CapFloorIborLMMDDMethod methodCapLMM = CapFloorIborLMMDDMethod.getInstance();
    final AnnuityCouponFixedDefinition fixedDefinition = AnnuityCouponFixedDefinition.from(EUR, SETTLEMENT_DATE, ANNUITY_TENOR, EURIBOR3M.getTenor(), TARGET, EURIBOR3M.getDayCount(),
        EURIBOR3M.getBusinessDayConvention(), EURIBOR3M.isEndOfMonth(), NOTIONAL, strike, IS_PAYER);
    final AnnuityCouponFixed fixed = fixedDefinition.toDerivative(REFERENCE_DATE);
    MultipleCurrencyAmount pvFlooredExpected = MultipleCurrencyAmount.of(EUR, 0.0);
    pvFlooredExpected = pvFlooredExpected.plus(ratchetFixed.getNthPayment(0).accept(PVDC, MULTICURVES));
    for (int loopcpn = 1; loopcpn < cap.getNumberOfPayments(); loopcpn++) {
      pvFlooredExpected = pvFlooredExpected.plus(methodCapLMM.presentValue((CapFloorIbor) cap.getNthPayment(loopcpn), LMM_MULTICURVES).multipliedBy(factor));
      pvFlooredExpected = pvFlooredExpected.plus(fixed.getNthPayment(loopcpn).accept(PVDC, MULTICURVES).multipliedBy(factor));
    }
    final MultipleCurrencyAmount pvFloorMC = methodMC.presentValue(ratchetFixed, EUR, LMM_MULTICURVES);
    assertEquals("Annuity Ratchet Ibor - Hull-White - LMM - Degenerate in floor leg", pvFlooredExpected.getAmount(EUR), pvFloorMC.getAmount(EUR), TOLERANCE_PV_MC);
    // For 500,000 path the difference is xxx
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.