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

Examples of com.opengamma.analytics.financial.interestrate.future.derivative.InterestRateFutureSecurity


  }

  @Test
  public void toDerivative() {
    final double expirationTime = TimeCalculator.getTimeBetween(REFERENCE_DATE, EXPIRATION_DATE);
    final InterestRateFutureSecurity underlyingFuture = ERU2.toDerivative(REFERENCE_DATE);
    final InterestRateFutureOptionMarginSecurity security = new InterestRateFutureOptionMarginSecurity(underlyingFuture, expirationTime, STRIKE, IS_CALL);
    final InterestRateFutureOptionMarginSecurity convertedSecurity = OPTION_ERU2.toDerivative(REFERENCE_DATE);
    assertTrue("Rate future option with margining security converter", security.equals(convertedSecurity));
  }
View Full Code Here


  @SuppressWarnings("deprecation")
  @Test
  public void toDerivativeDeprecated() {
    final double expirationTime = TimeCalculator.getTimeBetween(REFERENCE_DATE, EXPIRATION_DATE);
    final InterestRateFutureSecurity underlyingFuture = ERU2.toDerivative(REFERENCE_DATE, CURVES_NAMES);
    final InterestRateFutureOptionMarginSecurity security = new InterestRateFutureOptionMarginSecurity(underlyingFuture, expirationTime, STRIKE, IS_CALL);
    final InterestRateFutureOptionMarginSecurity convertedSecurity = OPTION_ERU2.toDerivative(REFERENCE_DATE, CURVES_NAMES);
    assertTrue("Rate future option with margining security converter", security.equals(convertedSecurity));
  }
View Full Code Here

  /**
   * Tests the toDerivative method.
   */
  public void toDerivative() {
    final InterestRateFutureOptionPremiumSecurity optionEDU2Converted = OPTION_EDU2_DEFINITION.toDerivative(REFERENCE_DATE);
    final InterestRateFutureSecurity future = EDU2_DEFINITION.toDerivative(REFERENCE_DATE);
    final double expirationTime = ACT_ACT.getDayCountFraction(REFERENCE_DATE, EXPIRATION_DATE);
    final InterestRateFutureOptionPremiumSecurity optionEDU2 = new InterestRateFutureOptionPremiumSecurity(future, expirationTime, STRIKE, IS_CALL);
    assertEquals("Option on future: to derivative", optionEDU2, optionEDU2Converted);
  }
View Full Code Here

  /**
   * Tests the toDerivative method.
   */
  public void toDerivativeDeprecated() {
    final InterestRateFutureOptionPremiumSecurity optionEDU2Converted = OPTION_EDU2_DEFINITION.toDerivative(REFERENCE_DATE, CURVES);
    final InterestRateFutureSecurity future = EDU2_DEFINITION.toDerivative(REFERENCE_DATE, CURVES);
    final double expirationTime = ACT_ACT.getDayCountFraction(REFERENCE_DATE, EXPIRATION_DATE);
    final InterestRateFutureOptionPremiumSecurity optionEDU2 = new InterestRateFutureOptionPremiumSecurity(future, expirationTime, STRIKE, IS_CALL);
    assertEquals("Option on future: to derivative", optionEDU2, optionEDU2Converted);
  }
View Full Code Here

    final double referencePrice = 0.99;
    final String name = "ERU2";
    final LocalDate REFERENCE_DATE = LocalDate.of(2010, 8, 18);
    final ZonedDateTime REFERENCE_DATE_ZONED = ZonedDateTime.of(LocalDateTime.of(REFERENCE_DATE, LocalTime.MIDNIGHT), ZoneOffset.UTC);
    final InterestRateFutureSecurityDefinition eru2Definition = new InterestRateFutureSecurityDefinition(LAST_TRADING_DATE, EURIBOR3M, noitonal, futuresAccrualFactor, name, calendar);
    final InterestRateFutureSecurity eru2 = eru2Definition.toDerivative(REFERENCE_DATE_ZONED, referencePrice);
    final double factor = MODEL.futuresConvexityFactor(MODEL_PARAMETERS, eru2.getLastTradingTime(), eru2.getFixingPeriodStartTime(), eru2.getFixingPeriodEndTime());
    final double expectedFactor = 1.000079130767980;
    assertEquals("Hull-White one factor: future convexity adjusment factor", expectedFactor, factor, TOLERANCE_RATE);
    // Derivative with respect to volatility parameters
    final int nbSigma = MODEL_PARAMETERS.getVolatility().length;
    final double[] sigmaBar = new double[nbSigma];
    final double factor2 = MODEL.futuresConvexityFactor(MODEL_PARAMETERS, eru2.getLastTradingTime(), eru2.getFixingPeriodStartTime(), eru2.getFixingPeriodEndTime(), sigmaBar);
    assertEquals("Hull-White one factor: future convexity adjusment factor", factor, factor2, TOLERANCE_RATE);
    final double[] sigmaBarExpected = new double[nbSigma];
    final double shift = 1E-6;
    for (int loops = 0; loops < nbSigma; loops++) {
      double[] volBumped = VOLATILITY.clone();
      volBumped[loops] += shift;
      HullWhiteOneFactorPiecewiseConstantParameters parametersBumped = new HullWhiteOneFactorPiecewiseConstantParameters(MEAN_REVERSION, volBumped, VOLATILITY_TIME);
      double factorPlus = MODEL.futuresConvexityFactor(parametersBumped, eru2.getLastTradingTime(), eru2.getFixingPeriodStartTime(), eru2.getFixingPeriodEndTime());
      volBumped[loops] -= 2 * shift;
      parametersBumped = new HullWhiteOneFactorPiecewiseConstantParameters(MEAN_REVERSION, volBumped, VOLATILITY_TIME);
      double factorMinus = MODEL.futuresConvexityFactor(parametersBumped, eru2.getLastTradingTime(), eru2.getFixingPeriodStartTime(), eru2.getFixingPeriodEndTime());
      sigmaBarExpected[loops] = (factorPlus - factorMinus) / (2 * shift);
      assertEquals("Hull-White one factor: future convexity adjusment factor", sigmaBarExpected[loops], sigmaBar[loops], TOLERANCE_RATE);
    }
  }
View Full Code Here

   */
  public void deltaVsCurveSensitivity() {

    final double dOptionDFuture = METHOD_SECURITY_OPTION_BLACK.optionPriceDelta(OPTION_ERU2, BLACK_BUNDLE);
    final YieldAndDiscountCurve fwdCurve = BLACK_BUNDLE.getCurve(OPTION_ERU2.getForwardCurveName());
    final InterestRateFutureSecurity future = OPTION_ERU2.getUnderlyingFuture();
    final double tStart = future.getFixingPeriodStartTime();
    final double tEnd = future.getFixingPeriodEndTime();
    final double tau = future.getFixingPeriodAccrualFactor();
    final double dfStart = fwdCurve.getDiscountFactor(tStart);
    final double dfEnd = fwdCurve.getDiscountFactor(tEnd);
    final double dFdrStart = (tStart * dfStart) / (tau * dfEnd);
    final double dFdrEnd = (-tEnd * dfStart) / (tau * dfEnd);

    final InterestRateCurveSensitivity methodSens = METHOD_SECURITY_OPTION_BLACK.priceCurveSensitivity(OPTION_ERU2, BLACK_BUNDLE);
    final double sensStart = methodSens.getSensitivities().get(future.getForwardCurveName()).get(0).getSecondDouble();
    final double sensEnd = methodSens.getSensitivities().get(future.getForwardCurveName()).get(1).getSecondDouble();

    assertEquals("dOption / dRateStart: ", sensStart, dOptionDFuture * dFdrStart, 1.0e-8);
    assertEquals("dOption / dRateEnd: ", sensEnd, dOptionDFuture * dFdrEnd, 1.0e-8);
  }
View Full Code Here

    @Override
    public Double visitInterestRateFutureOptionPremiumSecurity(final InterestRateFutureOptionPremiumSecurity option) {
      final double t = option.getExpirationTime();
      final double k = option.getStrike();
      final boolean isCall = option.isCall();
      final InterestRateFutureSecurity irFuture = option.getUnderlyingFuture();
      final double f = 1 - _futurePricer.price(irFuture, _curves);
      final BlackFunctionData blackData = new BlackFunctionData(f, 1, 0);
      final EuropeanVanillaOption vanillaOption = new EuropeanVanillaOption(k, t, isCall);
      final HestonCharacteristicExponent ce = getModelParameters(_target, _inputs, t, k);
      return _fourierPricer.price(blackData, vanillaOption, ce, _alpha, _tolerance, true);
View Full Code Here

    @Override
    public Double visitInterestRateFutureOptionMarginSecurity(final InterestRateFutureOptionMarginSecurity option) {
      final double t = option.getExpirationTime();
      final double k = option.getStrike();
      final boolean isCall = option.isCall();
      final InterestRateFutureSecurity irFuture = option.getUnderlyingFuture();
      final double f = 1 - _futurePricer.price(irFuture, _curves);
      final BlackFunctionData blackData = new BlackFunctionData(f, 1, 1e-6);
      final EuropeanVanillaOption vanillaOption = new EuropeanVanillaOption(k, t, isCall);
      final HestonCharacteristicExponent ce = getModelParameters(_target, _inputs, t, k);
      return _fourierPricer.price(blackData, vanillaOption, ce, _alpha, _tolerance, true);
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.interestrate.future.derivative.InterestRateFutureSecurity

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.