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

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


  @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


    assertFalse(OPTION_TRANSACTION.equals(modifidOption));
  }

  @Test
  public void toDerivativeTradeInPast() {
    final InterestRateFutureOptionMarginSecurity securityConverted = OPTION_ERU2.toDerivative(REFERENCE_DATE);
    final double lastMarginPrice = 0.99;
    final InterestRateFutureOptionMarginTransaction transactionConverted = OPTION_TRANSACTION.toDerivative(REFERENCE_DATE, lastMarginPrice);
    final InterestRateFutureOptionMarginTransaction transaction = new InterestRateFutureOptionMarginTransaction(securityConverted, QUANTITY, lastMarginPrice);
    assertTrue("Conversion with trade date in the past", transactionConverted.equals(transaction));
  }
View Full Code Here

  }

  @Test
  public void toDerivativeTradeToday() {
    final ZonedDateTime referenceDate = TRADE_DATE;
    final InterestRateFutureOptionMarginSecurity securityConverted = OPTION_ERU2.toDerivative(referenceDate);
    final double lastMarginPrice = 0.99;
    final InterestRateFutureOptionMarginTransaction transactionConverted = OPTION_TRANSACTION.toDerivative(referenceDate, lastMarginPrice);
    final InterestRateFutureOptionMarginTransaction transaction = new InterestRateFutureOptionMarginTransaction(securityConverted, QUANTITY, TRADE_PRICE);
    assertTrue("Conversion with trade date in the past", transactionConverted.equals(transaction));
  }
View Full Code Here

  }

  @SuppressWarnings("deprecation")
  @Test
  public void toDerivativeTradeInPastDeprecated() {
    final InterestRateFutureOptionMarginSecurity securityConverted = OPTION_ERU2.toDerivative(REFERENCE_DATE, CURVES_NAMES);
    final double lastMarginPrice = 0.99;
    final InterestRateFutureOptionMarginTransaction transactionConverted = OPTION_TRANSACTION.toDerivative(REFERENCE_DATE, lastMarginPrice, CURVES_NAMES);
    final InterestRateFutureOptionMarginTransaction transaction = new InterestRateFutureOptionMarginTransaction(securityConverted, QUANTITY, lastMarginPrice);
    assertTrue("Conversion with trade date in the past", transactionConverted.equals(transaction));
  }
View Full Code Here

  @SuppressWarnings("deprecation")
  @Test
  public void toDerivativeTradeTodayDeprecated() {
    final ZonedDateTime referenceDate = TRADE_DATE;
    final InterestRateFutureOptionMarginSecurity securityConverted = OPTION_ERU2.toDerivative(referenceDate, CURVES_NAMES);
    final double lastMarginPrice = 0.99;
    final InterestRateFutureOptionMarginTransaction transactionConverted = OPTION_TRANSACTION.toDerivative(referenceDate, lastMarginPrice, CURVES_NAMES);
    final InterestRateFutureOptionMarginTransaction transaction = new InterestRateFutureOptionMarginTransaction(securityConverted, QUANTITY, TRADE_PRICE);
    assertTrue("Conversion with trade date in the past", transactionConverted.equals(transaction));
  }
View Full Code Here

  /**
   * Test the option price from the future price. Standard option.
   */
  public void priceFromFuturePriceStandard() {
    final double expirationTime = ACT_ACT.getDayCountFraction(REFERENCE_DATE, LAST_TRADING_DATE);
    final InterestRateFutureOptionMarginSecurity optionEDU2Standard = new InterestRateFutureOptionMarginSecurity(EDU2, expirationTime, STRIKE, IS_CALL);
    final double priceFuture = 0.9905;
    final double priceOption = METHOD_OPT_FUT_SEC_SABR.priceFromFuturePrice(optionEDU2Standard, SABR_MULTICURVES, priceFuture);
    final double delay = 0.0;
    final double volatility = SABR_PARAMETERS.getVolatility(expirationTime, delay, 1 - STRIKE, 1 - priceFuture);
    final BlackPriceFunction blackFunction = new BlackPriceFunction();
View Full Code Here

  /**
   * Test the option price from the future price. Standard option.
   */
  public void priceStandard() {
    final double expirationTime = ACT_ACT.getDayCountFraction(REFERENCE_DATE, LAST_TRADING_DATE);
    final InterestRateFutureOptionMarginSecurity optionEDU2Standard = new InterestRateFutureOptionMarginSecurity(EDU2, expirationTime, STRIKE, IS_CALL);
    final double priceOption = METHOD_OPT_FUT_SEC_SABR.price(optionEDU2Standard, SABR_MULTICURVES);
    final double priceFuture = METHOD_DSC_FUT.price(EDU2, MULTICURVES);
    final double priceOptionExpected = METHOD_OPT_FUT_SEC_SABR.priceFromFuturePrice(optionEDU2Standard, SABR_MULTICURVES, priceFuture);
    assertEquals("Future option with SABR volatilities: option price", priceOptionExpected, priceOption);
  }
View Full Code Here

  /**
   * 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 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

    /**
     * Test the option price from the future price. Standard option.
     */
    public void priceFromFuturePriceStandard() {
      final double expirationTime = ACT_ACT.getDayCountFraction(REFERENCE_DATE, LAST_TRADING_DATE);
      final InterestRateFutureOptionMarginSecurity optionEDU2Standard = new InterestRateFutureOptionMarginSecurity(EDU2, expirationTime, STRIKE, IS_CALL);
      final double priceFuture = 0.9905;
      final double priceOption = METHOD.optionPriceFromFuturePrice(optionEDU2Standard, SABR_BUNDLE, priceFuture);
      final double delay = 0.0;
      final double volatility = SABR_PARAMETER.getVolatility(expirationTime, delay, 1 - STRIKE, 1 - priceFuture);
      final BlackPriceFunction blackFunction = new BlackPriceFunction();
View Full Code Here

TOP

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

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.