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

Examples of com.opengamma.analytics.financial.interestrate.payments.derivative.CapFloorCMSSpread


  @Test
  /**
   * Tests the long/short parity for the present value curve sensitivity of a floor.
   */
  public void presentValueCurveSensitivityFloorLongShortParity() {
    final CapFloorCMSSpread cmsCapSpreadShort = new CapFloorCMSSpread(EUR, PAYMENT_TIME, PAYMENT_ACCRUAL_FACTOR, -NOTIONAL, FIXING_TIME, SWAP_1, CMS_INDEX_1, SWAP_2, CMS_INDEX_2, SETTLEMENT_TIME,
        STRIKE, !IS_CAP);
    MultipleCurrencyMulticurveSensitivity pvcsLong = METHOD_CMS_SPREAD.presentValueCurveSensitivity(CMS_FLOOR_SPREAD, SABR_MULTICURVES);
    pvcsLong = pvcsLong.cleaned();
    MultipleCurrencyMulticurveSensitivity pvcsShort = METHOD_CMS_SPREAD.presentValueCurveSensitivity(cmsCapSpreadShort, SABR_MULTICURVES);
    pvcsShort = pvcsShort.multipliedBy(-1);
View Full Code Here


  @Test
  /**
   * Tests the long/short parity for the present value SABR sensitivity.
   */
  public void presentValueSABRSensitivityLongShortParity() {
    final CapFloorCMSSpread cmsSpreadShort = new CapFloorCMSSpread(EUR, PAYMENT_TIME, PAYMENT_ACCRUAL_FACTOR, -NOTIONAL, FIXING_TIME, SWAP_1, CMS_INDEX_1, SWAP_2, CMS_INDEX_2, SETTLEMENT_TIME,
        STRIKE, IS_CAP);
    final PresentValueSABRSensitivityDataBundle pvssLong = METHOD_CMS_SPREAD.presentValueSABRSensitivity(CMS_CAP_SPREAD, SABR_MULTICURVES);
    PresentValueSABRSensitivityDataBundle pvssShort = METHOD_CMS_SPREAD.presentValueSABRSensitivity(cmsSpreadShort, SABR_MULTICURVES);
    pvssShort = pvssShort.multiplyBy(-1);
    assertEquals("CMS spread: Long/Short parity", pvssLong, pvssShort);
View Full Code Here

      yieldCurveNames2 = yieldCurveNames;
    } else {
      yieldCurveNames2 = new String[] {yieldCurveNames[0], yieldCurveNames[2] };
    }
    final SwapFixedCoupon<Coupon> swap2 = _underlyingSwap2.toDerivative(date, yieldCurveNames2);
    return new CapFloorCMSSpread(getCurrency(), paymentTime, getPaymentYearFraction(), getNotional(), fixingTime, swap1, _cmsIndex1, swap2, _cmsIndex2, settlementTime, _strike, _isCap,
        fundingCurveName);
  }
View Full Code Here

      yieldCurveNames2 = yieldCurveNames;
    } else {
      yieldCurveNames2 = new String[] {yieldCurveNames[0], yieldCurveNames[2] };
    }
    final SwapFixedCoupon<Coupon> swap2 = _underlyingSwap2.toDerivative(date, yieldCurveNames2);
    return new CapFloorCMSSpread(getCurrency(), paymentTime, getPaymentYearFraction(), getNotional(), fixingTime, swap1, _cmsIndex1, swap2, _cmsIndex2, settlementTime, _strike, _isCap,
        fundingCurveName);
  }
View Full Code Here

    // CMS spread is not fixed yet, all the details are required.
    final double fixingTime = TimeCalculator.getTimeBetween(date, getFixingDate());
    final double settlementTime = TimeCalculator.getTimeBetween(date, _underlyingSwap1.getFixedLeg().getNthPayment(0).getAccrualStartDate());
    final SwapFixedCoupon<Coupon> swap1 = _underlyingSwap1.toDerivative(date);
    final SwapFixedCoupon<Coupon> swap2 = _underlyingSwap2.toDerivative(date);
    return new CapFloorCMSSpread(getCurrency(), paymentTime, getPaymentYearFraction(), getNotional(), fixingTime, swap1, _cmsIndex1, swap2, _cmsIndex2, settlementTime, _strike, _isCap);
  }
View Full Code Here

    // CMS spread is not fixed yet, all the details are required.
    final double fixingTime = TimeCalculator.getTimeBetween(date, getFixingDate());
    final double settlementTime = TimeCalculator.getTimeBetween(date, _underlyingSwap1.getFixedLeg().getNthPayment(0).getAccrualStartDate());
    final SwapFixedCoupon<Coupon> swap1 = _underlyingSwap1.toDerivative(date);
    final SwapFixedCoupon<Coupon> swap2 = _underlyingSwap2.toDerivative(date);
    return new CapFloorCMSSpread(getCurrency(), paymentTime, getPaymentYearFraction(), getNotional(), fixingTime, swap1, _cmsIndex1, swap2, _cmsIndex2, settlementTime, _strike, _isCap);
  }
View Full Code Here

  @SuppressWarnings("deprecation")
  @Test
  public void testToDerivativeDeprecated() {
    final SwapFixedCoupon<? extends Payment> swap1 = SWAP_DEFINITION_1.toDerivative(REFERENCE_DATE, CURVES_2_NAME);
    final SwapFixedCoupon<? extends Payment> swap2 = SWAP_DEFINITION_2.toDerivative(REFERENCE_DATE, CURVES_2_NAME);
    final CapFloorCMSSpread cmsSpread = (CapFloorCMSSpread) CMS_SPREAD_DEFINITION.toDerivative(REFERENCE_DATE, CURVES_2_NAME);
    assertEquals(swap1, cmsSpread.getUnderlyingSwap1());
    assertEquals(swap2, cmsSpread.getUnderlyingSwap2());
    final CapFloorCMSSpread cmsSpreadExpected = new CapFloorCMSSpread(CUR, PAYMENT_TIME, PAYMENT_ACCRUAL_FACTOR, NOTIONAL, FIXING_TIME, swap1, CMS_INDEX_1, swap2, CMS_INDEX_2, SETTLEMENT_TIME,
        STRIKE, IS_CAP, FUNDING_CURVE_NAME);
    assertEquals("CMS Spread to derivatives", cmsSpreadExpected, cmsSpread);
  }
View Full Code Here

  @Test
  public void testToDerivative() {
    final SwapFixedCoupon<? extends Payment> swap1 = SWAP_DEFINITION_1.toDerivative(REFERENCE_DATE);
    final SwapFixedCoupon<? extends Payment> swap2 = SWAP_DEFINITION_2.toDerivative(REFERENCE_DATE);
    final CapFloorCMSSpread cmsSpread = (CapFloorCMSSpread) CMS_SPREAD_DEFINITION.toDerivative(REFERENCE_DATE);
    assertEquals(swap1, cmsSpread.getUnderlyingSwap1());
    assertEquals(swap2, cmsSpread.getUnderlyingSwap2());
    final CapFloorCMSSpread cmsSpreadExpected = new CapFloorCMSSpread(CUR, PAYMENT_TIME, PAYMENT_ACCRUAL_FACTOR, NOTIONAL, FIXING_TIME, swap1, CMS_INDEX_1, swap2, CMS_INDEX_2, SETTLEMENT_TIME,
        STRIKE, IS_CAP);
    assertEquals("CMS Spread to derivatives", cmsSpreadExpected, cmsSpread);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.interestrate.payments.derivative.CapFloorCMSSpread

Copyright © 2018 www.massapicom. 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.