Package com.opengamma.financial.security.future

Examples of com.opengamma.financial.security.future.IndexFutureSecurity


          return security;
        }

        @Override
        public FutureSecurity visitIndexFutureType(IndexFutureBean bean) {
          final IndexFutureSecurity security = new IndexFutureSecurity(
            expiryBeanToExpiry(bean.getExpiry()),
            bean.getTradingExchange().getName(),
            bean.getSettlementExchange().getName(),
            currencyBeanToCurrency(bean.getCurrency()),
            bean.getUnitAmount(),
            bean.getCategory().getName());
          security.setUnderlyingId(externalIdBeanToExternalId(bean
            .getUnderlying()));
          return security;
        }

        @Override
        public FutureSecurity visitStockFutureType(StockFutureBean bean) {
          final StockFutureSecurity security = new StockFutureSecurity(
            expiryBeanToExpiry(bean.getExpiry()),
            bean.getTradingExchange().getName(),
            bean.getSettlementExchange().getName(),
            currencyBeanToCurrency(bean.getCurrency()),
            bean.getUnitAmount(),
            bean.getCategory().getName());
          security.setUnderlyingId(externalIdBeanToExternalId(bean
            .getUnderlying()));
          return security;
        }

        @Override
View Full Code Here


    assertEquals(ExternalId.of(SCHEME, "FUTURE"), ids.get(0));
  }

  @Test
  public void testIndexFutureSecurity() {
    final IndexFutureSecurity future = ExposureFunctionTestHelper.getIndexFutureSecurity();
    final List<ExternalId> ids = future.accept(EXPOSURE_FUNCTION);
    assertEquals(1, ids.size());
    assertEquals(ExternalId.of(SCHEME, "FUTURE"), ids.get(0));
  }
View Full Code Here

    assertTrue(ids.containsAll(Arrays.asList(ExternalId.of(SCHEME, "FUTURE_EUR"), ExternalId.of(SCHEME, "FUTURE_USD"))));
  }

  @Test
  public void testIndexFutureSecurity() {
    final IndexFutureSecurity future = ExposureFunctionTestHelper.getIndexFutureSecurity();
    final List<ExternalId> ids = future.accept(EXPOSURE_FUNCTION);
    assertEquals(1, ids.size());
    assertEquals(ExternalId.of(SCHEME, "FUTURE_EUR"), ids.get(0));
  }
View Full Code Here

    assertNull(ids);
  }

  @Test
  public void testIndexFutureSecurity() {
    final IndexFutureSecurity future = ExposureFunctionTestHelper.getIndexFutureSecurity();
    final List<ExternalId> ids = future.accept(EXPOSURE_FUNCTION);
    assertNull(ids);
  }
View Full Code Here

    assertTrue(ids.containsAll(Arrays.asList(ExternalId.of(SCHEME, "USD"), ExternalId.of(SCHEME, "EUR"))));
  }

  @Test
  public void testIndexFutureSecurity() {
    final IndexFutureSecurity future = ExposureFunctionTestHelper.getIndexFutureSecurity();
    final List<ExternalId> ids = future.accept(EXPOSURE_FUNCTION);
    assertEquals(1, ids.size());
    assertEquals(ExternalId.of(SCHEME, "EUR"), ids.get(0));
  }
View Full Code Here

    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "78"));
    return security;
  }

  public static IndexFutureSecurity getIndexFutureSecurity() {
    final IndexFutureSecurity security = new IndexFutureSecurity(new Expiry(DateUtils.getUTCDate(2013, 12, 1)), TRADING, SETTLEMENT, EUR, 1000, "Equity Index");
    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "2345"));
    return security;
  }
View Full Code Here

      throw new OpenGammaRuntimeException("Underlying security " + underlyingIdentifier + " of option " + security.getExternalIdBundle().toString() + " was not found in database");
    }
   
    IndexFutureDefinition underlying = null;
    if (underlyingSecurity instanceof IndexFutureSecurity) {
      final IndexFutureSecurity underlyingFuture = ((IndexFutureSecurity) underlyingSecurity);
      underlying = (IndexFutureDefinition) underlyingFuture.accept(_futureSecurityConverter);
    } else if (underlyingSecurity instanceof EquityFutureSecurity) {
      final EquityFutureSecurity underlyingFuture = ((EquityFutureSecurity) underlyingSecurity);
      EquityFutureDefinition eqFut = (EquityFutureDefinition) underlyingFuture.accept(_futureSecurityConverter);
      underlying = new IndexFutureDefinition(eqFut.getExpiryDate(), eqFut.getSettlementDate(), eqFut.getStrikePrice(), eqFut.getCurrency(), eqFut.getUnitAmount(), underlyingFuture.getUnderlyingId());
    }
  
    final double strike = security.getStrike();
    final ExerciseDecisionType exerciseType = security.getExerciseType().accept(ExerciseTypeAnalyticsVisitorAdapter.getInstance());
    final boolean isCall = security.getOptionType() == OptionType.CALL;
View Full Code Here

    if (expiry == null) {
      return null;
    }
    Currency currency = Currency.parse(currencyStr);

    IndexFutureSecurity security = new IndexFutureSecurity(expiry, micExchangeCode, micExchangeCode, currency, Double.valueOf(unitAmount), category);
    security.setName(name);
    security.setUnderlyingId(underlying);   
    // set identifiers
    parseIdentifiers(fieldData, security);
    return security;
  }
View Full Code Here

    final String tradingExchange = exchange();
    final String settlementExchange = exchange();
    final Currency currency = currency();
    final double unitAmount = 0;
    final String category = "category";
    final IndexFutureSecurity security = new IndexFutureSecurity(expiry, tradingExchange, settlementExchange, currency, unitAmount, category);
    store(security);
    return security;
  }
View Full Code Here

    assertEquals(ExternalId.of(ExposureFunction.SECURITY_IDENTIFIER, "FUTURE_X"), ids.get(0));
  }

  @Test
  public void testIndexFutureSecurity() {
    final IndexFutureSecurity future = ExposureFunctionTestHelper.getIndexFutureSecurity();
    final List<ExternalId> ids = future.accept(EXPOSURE_FUNCTION);
    assertEquals(1, ids.size());
    assertEquals(ExternalId.of(ExposureFunction.SECURITY_IDENTIFIER, "FUTURE_X"), ids.get(0));
  }
View Full Code Here

TOP

Related Classes of com.opengamma.financial.security.future.IndexFutureSecurity

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.