Package com.opengamma.analytics.financial.commodity.definition

Examples of com.opengamma.analytics.financial.commodity.definition.MetalFutureDefinition


          underlyingDefinition,
          commodityOption.getStrike() * 100.0, // TODO: Remove when security stops scaling price
          exerciseType,
          isCall);
    } else if (underlyingSecurity instanceof MetalFutureSecurity) {
      final MetalFutureDefinition underlyingDefinition = (MetalFutureDefinition) underlyingSecurity.accept(_futureSecurityConverter);
      return new MetalFutureOptionDefinition(expiry,
          underlyingDefinition,
          commodityOption.getStrike() * 100.0, // TODO: Remove when security stops scaling price
          exerciseType,
          isCall);
View Full Code Here


  @Test
  public void testMetalFutureOption() {
    final double answer = 4.415360077156871;

    final MetalFutureDefinition definition = new MetalFutureDefinition(EXPIRY_DATE, AN_UNDERLYING, UNIT_AMOUNT, null, null, AMOUNT, "tonnes", SettlementType.CASH, 0,
        Currency.GBP, SETTLEMENT_DATE);
    final MetalFuture future = definition.toDerivative(A_DATE);
    final MetalFutureOption option = new MetalFutureOption(EXPIRY, future, STRIKE, EXERCISE, true);
    final double pv = option.accept(PRICER, MARKET);
    assertEquals(answer, pv * option.getUnderlying().getUnitAmount(), TOLERANCE);
  }
View Full Code Here

                1.0, futures.getUnitName(), futures.getSettlementType(), tradePrice, futures.getCurrency(), futures.getSettlementDate());
          }

          @Override
          public InstrumentDefinitionWithData<?, Double> visitMetalFutureDefinition(final MetalFutureDefinition futures) {
            return new MetalFutureDefinition(futures.getExpiryDate(), futures.getUnderlying(), futures.getUnitAmount(), null, null,
                1.0, futures.getUnitName(), futures.getSettlementType(), tradePrice, futures.getCurrency(), futures.getSettlementDate());
          }

          @Override
          public InstrumentDefinitionWithData<?, Double> visitEquityIndexDividendFutureDefinition(final EquityIndexDividendFutureDefinition futures) {
View Full Code Here

  @Test
  public void testMetalFutureOption() {
    final double answer = 53.948020295136104;

    final MetalFutureDefinition definition = new MetalFutureDefinition(EXPIRY_DATE, AN_UNDERLYING, UNIT_AMOUNT, null, null, AMOUNT, "tonnes", SettlementType.CASH, 0, Currency.GBP,
        SETTLEMENT_DATE);
    final MetalFuture future = definition.toDerivative(A_DATE);
    final MetalFutureOption option = new MetalFutureOption(EXPIRY, future, STRIKE, EXERCISE, true);
    final double pv = option.accept(PRICER, MARKET);
    assertEquals(answer, pv, TOLERANCE);
  }
View Full Code Here

  @Test
  public void testMetalFutureOption() {
    final double answer = 0.018277536548956183;

    final MetalFutureDefinition definition = new MetalFutureDefinition(EXPIRY_DATE, AN_UNDERLYING, UNIT_AMOUNT, null, null, AMOUNT, "tonnes", SettlementType.CASH, 0, Currency.GBP,
        SETTLEMENT_DATE);
    final MetalFuture future = definition.toDerivative(A_DATE);
    final MetalFutureOption option = new MetalFutureOption(EXPIRY, future, STRIKE, EXERCISE, true);
    final double gamma = option.accept(PRICER, MARKET);
    assertEquals(answer, gamma, TOLERANCE);
  }
View Full Code Here

  @Test
  public void testMetalFutureOption() {
    final double answer = -24.356026185994125;

    final MetalFutureDefinition definition = new MetalFutureDefinition(EXPIRY_DATE, AN_UNDERLYING, UNIT_AMOUNT, null, null, AMOUNT, "tonnes", SettlementType.CASH, 0,
        Currency.GBP, SETTLEMENT_DATE);
    final MetalFuture future = definition.toDerivative(A_DATE);
    final MetalFutureOption option = new MetalFutureOption(EXPIRY, future, STRIKE, EXERCISE, true);
    final double pv = option.accept(PRICER, MARKET);
    assertEquals(answer, pv * option.getUnderlying().getUnitAmount(), TOLERANCE);
  }
View Full Code Here

  @Test
  public void testMetalFutureOption() {
    final double answer = 34.09937339281426;

    final MetalFutureDefinition definition = new MetalFutureDefinition(EXPIRY_DATE, AN_UNDERLYING, UNIT_AMOUNT, null, null, AMOUNT, "tonnes", SettlementType.CASH, 0,
        Currency.GBP, SETTLEMENT_DATE);
    final MetalFuture future = definition.toDerivative(A_DATE);
    final MetalFutureOption option = new MetalFutureOption(EXPIRY, future, STRIKE, EXERCISE, true);
    final double pv = option.accept(PRICER, MARKET);
    assertEquals(answer, pv * option.getUnderlying().getUnitAmount(), TOLERANCE);
  }
View Full Code Here

  @Test
  public void testMetalFutureOption() {
    final double answer = -4.26707704009691;

    final MetalFutureDefinition definition = new MetalFutureDefinition(EXPIRY_DATE, AN_UNDERLYING, UNIT_AMOUNT, null, null, AMOUNT, "tonnes", SettlementType.CASH, 0, Currency.GBP,
        SETTLEMENT_DATE);
    final MetalFuture future = definition.toDerivative(A_DATE);
    final MetalFutureOption option = new MetalFutureOption(EXPIRY, future, STRIKE, EXERCISE, true);
    final double pv = option.accept(PRICER, MARKET);
    assertEquals(answer, pv, TOLERANCE);
  }
View Full Code Here

  @Test
  public void testMetalFutureOption() {
    final double answer = 0.8830720154313743;

    final MetalFutureDefinition definition = new MetalFutureDefinition(EXPIRY_DATE, AN_UNDERLYING, UNIT_AMOUNT, null, null, AMOUNT, "tonnes", SettlementType.CASH, 0, Currency.GBP,
        SETTLEMENT_DATE);
    final MetalFuture future = definition.toDerivative(A_DATE);
    final MetalFutureOption option = new MetalFutureOption(EXPIRY, future, STRIKE, EXERCISE, true);
    final double pv = option.accept(PRICER, MARKET);
    assertEquals(answer, pv, TOLERANCE);
  }
View Full Code Here

  @Test
  public void testMetalFutureOption() {
    final double answer = 0.0950818333883517;

    final MetalFutureDefinition definition = new MetalFutureDefinition(EXPIRY_DATE, AN_UNDERLYING, UNIT_AMOUNT, null, null, AMOUNT, "tonnes", SettlementType.CASH, 0,
        Currency.GBP, SETTLEMENT_DATE);
    final MetalFuture future = definition.toDerivative(A_DATE);
    final MetalFutureOption option = new MetalFutureOption(EXPIRY, future, STRIKE, EXERCISE, true);
    final double pv = option.accept(PRICER, MARKET);
    assertEquals(answer, pv * option.getUnderlying().getUnitAmount(), TOLERANCE);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.commodity.definition.MetalFutureDefinition

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.