Package com.opengamma.analytics.financial.instrument.future

Examples of com.opengamma.analytics.financial.instrument.future.InterestRateFutureOptionMarginSecurityDefinition


    final ZonedDateTime expirationDate = security.getExpiry().getExpiry();
    final double strike = security.getStrike();
    final boolean isCall = security.getOptionType() == OptionType.CALL ? true : false;
    final boolean isMargined = security.isMargined();
    if (isMargined) {
      return new InterestRateFutureOptionMarginSecurityDefinition(underlyingFuture, expirationDate, strike, isCall);
    }
    return new InterestRateFutureOptionPremiumSecurityDefinition(underlyingFuture, expirationDate, strike, isCall);
  }
View Full Code Here


    final ZonedDateTime expirationDate = security.getExpiry().getExpiry();
    final double strike = security.getStrike();
    final boolean isCall = security.getOptionType() == OptionType.CALL ? true : false;
    final boolean isMargined = security.isMargined();
    if (isMargined) {
      return new InterestRateFutureOptionMarginSecurityDefinition(underlyingFuture, expirationDate, strike, isCall);
    }
    return new InterestRateFutureOptionPremiumSecurityDefinition(underlyingFuture, expirationDate, strike, isCall);
  }
View Full Code Here

    final Double tradePrice = trade.getPremium();
    ArgumentChecker.notNull(tradePrice, "IRFutureOption trade must have a premium set. The interpretation of premium is the market price, without unit, i.e. not %");
    // TODO: The premium is not the right place to store the trade price...

    if (securityDefinition instanceof InterestRateFutureOptionMarginSecurityDefinition) {
      final InterestRateFutureOptionMarginSecurityDefinition underlyingOption = (InterestRateFutureOptionMarginSecurityDefinition) securityDefinition;
      return new InterestRateFutureOptionMarginTransactionDefinition(underlyingOption, quantity, tradeDate, tradePrice);
    }
    final InterestRateFutureOptionPremiumSecurityDefinition underlyingOption = (InterestRateFutureOptionPremiumSecurityDefinition) securityDefinition;
    return new InterestRateFutureOptionPremiumTransactionDefinition(underlyingOption, quantity, tradeDate, tradePrice);
  }
View Full Code Here

  @Test
  /**
   * Tests the price for very deep out-of-the-money options.
   */
  public void priceDeepOTM() {
    final InterestRateFutureOptionMarginSecurityDefinition callDefinition = new InterestRateFutureOptionMarginSecurityDefinition(ERH3_DEFINITION, OPT_EXP_MAR13, 1.25, true);
    final InterestRateFutureOptionMarginSecurity call = callDefinition.toDerivative(REFERENCE_DATE);
    final double priceCallDeep = METHOD_OPT_SEC.price(call, HW_MULTICURVES);
    assertEquals("InterestRateFutureOptionMarginSecurityHullWhiteMethod: price", 0.0, priceCallDeep, TOLERANCE_PRICE);
    final InterestRateFutureOptionMarginSecurityDefinition putDefinition = new InterestRateFutureOptionMarginSecurityDefinition(ERH3_DEFINITION, OPT_EXP_MAR13, 0.75, false);
    final InterestRateFutureOptionMarginSecurity put = putDefinition.toDerivative(REFERENCE_DATE);
    final double pricePutDeep = METHOD_OPT_SEC.price(put, HW_MULTICURVES);
    assertEquals("InterestRateFutureOptionMarginSecurityHullWhiteMethod: price", 0.0, pricePutDeep, TOLERANCE_PRICE);
  }
View Full Code Here

    final double minStrike = 0.9700;
    final double maxStrike = 1.0100;
    final double nbStrikes = 20;
    for (int loopstrike = 0; loopstrike <= nbStrikes; loopstrike++) {
      final double strike = minStrike + loopstrike * (maxStrike - minStrike) / nbStrikes;
      final InterestRateFutureOptionMarginSecurityDefinition callDefinition = new InterestRateFutureOptionMarginSecurityDefinition(ERH3_DEFINITION, OPT_EXP_MAR13, strike, true);
      final InterestRateFutureOptionMarginSecurity call = callDefinition.toDerivative(REFERENCE_DATE);
      final double priceCall = METHOD_OPT_SEC.price(call, HW_MULTICURVES);
      assertTrue("InterestRateFutureOptionMarginSecurityHullWhiteMethod: price", priceCall > 0);
      final InterestRateFutureOptionMarginSecurityDefinition putDefinition = new InterestRateFutureOptionMarginSecurityDefinition(ERH3_DEFINITION, OPT_EXP_MAR13, strike, false);
      final InterestRateFutureOptionMarginSecurity put = putDefinition.toDerivative(REFERENCE_DATE);
      final double pricePut = METHOD_OPT_SEC.price(put, HW_MULTICURVES);
      assertTrue("InterestRateFutureOptionMarginSecurityHullWhiteMethod: price", pricePut > 0);
    }
  }
View Full Code Here

    final LocalTime tradeTime = trade.getTradeTime() == null ? LocalTime.of(0, 0) : trade.getTradeTime().toLocalTime();
    final ZonedDateTime tradeDate = trade.getTradeDate().atTime(tradeTime).atZone(ZoneOffset.UTC); //TODO get the real time zone
    final Double tradePrice = trade.getPremium();
    ArgumentChecker.notNull(tradePrice, "IRFutureOption trade must have a premium set. The interpretation of premium is the market price, without unit, i.e. not %");
    if (securityDefinition instanceof InterestRateFutureOptionMarginSecurityDefinition) {
      final InterestRateFutureOptionMarginSecurityDefinition underlyingOption = (InterestRateFutureOptionMarginSecurityDefinition) securityDefinition;
      return new InterestRateFutureOptionMarginTransactionDefinition(underlyingOption, quantity, tradeDate, tradePrice);
    }
    final InterestRateFutureOptionPremiumSecurityDefinition underlyingOption = (InterestRateFutureOptionPremiumSecurityDefinition) securityDefinition;
    return new InterestRateFutureOptionPremiumTransactionDefinition(underlyingOption, quantity, tradeDate, tradePrice);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.instrument.future.InterestRateFutureOptionMarginSecurityDefinition

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.