Package com.opengamma.financial.security.future

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


          return security;
        }

        @Override
        public FutureSecurity visitMetalFutureType(MetalFutureBean bean) {
          final MetalFutureSecurity security = new MetalFutureSecurity(
            expiryBeanToExpiry(bean.getExpiry()),
            bean.getTradingExchange().getName(),
            bean.getSettlementExchange().getName(),
            currencyBeanToCurrency(bean.getCurrency()),
            bean.getUnitAmount(),
            bean.getCategory().getName());
          security.setUnitNumber(bean.getUnitNumber());
          if (bean.getUnitName() != null) {
            security.setUnitName(bean.getUnitName().getName());
          }
          security.setUnderlyingId(externalIdBeanToExternalId(bean
            .getUnderlying()));
          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 testMetalFutureSecurity() {
    final MetalFutureSecurity future = ExposureFunctionTestHelper.getMetalFutureSecurity();
    final List<ExternalId> ids = future.accept(EXPOSURE_FUNCTION);
    assertEquals(1, ids.size());
    assertEquals(ExternalId.of(SCHEME, "FUTURE"), ids.get(0));
  }
View Full Code Here

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

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

    assertEquals(ExternalSchemes.syntheticSecurityId("Fed Funds"), ids.get(0));
  }

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

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

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

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

  public static MetalFutureSecurity getMetalFutureSecurity() {
    final MetalFutureSecurity security = new MetalFutureSecurity(new Expiry(DateUtils.getUTCDate(2013, 4, 1)), TRADING, SETTLEMENT, USD, 100, "Commodity");
    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "23456"));
    return security;
  }
View Full Code Here

    Expiry expiry = decodeExpiry(expiryDate, futureTradingHours);
    if (expiry == null) {
      return null;
    }
    Currency currency = Currency.parse(currencyStr);
    MetalFutureSecurity security = new MetalFutureSecurity(expiry, micExchangeCode, micExchangeCode, currency, unitAmount, category);
    security.setUnitNumber(unitNumber);
    security.setUnitName(unitName);
    security.setUnderlyingId(underlying);
    security.setName(name);
    // 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 MetalFutureSecurity security = new MetalFutureSecurity(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 testMetalFutureSecurity() {
    final MetalFutureSecurity future = ExposureFunctionTestHelper.getMetalFutureSecurity();
    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

    assertNull(ids);
  }

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

TOP

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

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.