Package com.opengamma.core.security.impl

Examples of com.opengamma.core.security.impl.SimpleSecurityLink


    message.add(null, FudgeSerializer.TYPES_HEADER_ORDINAL, FudgeWireType.STRING, Trade.class.getName());
    return message;
  }

  protected static SimpleTrade buildObjectImpl(final FudgeDeserializer deserializer, final FudgeMsg message) {
    SimpleSecurityLink secLink = new SimpleSecurityLink();
    if (message.hasField(SECURITY_KEY_FIELD_NAME)) {
      FudgeField secKeyField = message.getByName(SECURITY_KEY_FIELD_NAME);
      if (secKeyField != null) {
        secLink.setExternalId(deserializer.fieldValueToObject(ExternalIdBundle.class, secKeyField));
      }
    }
    if (message.hasField(SECURITY_ID_FIELD_NAME)) {
      FudgeField secIdField = message.getByName(SECURITY_ID_FIELD_NAME);
      if (secIdField != null) {
        secLink.setObjectId(deserializer.fieldValueToObject(ObjectId.class, secIdField));
      }
    }
   
    SimpleTrade trade = new SimpleTrade();
    trade.setSecurityLink(secLink);
View Full Code Here


      }
    }
  }

  protected static SimplePosition buildObjectImpl(final FudgeDeserializer deserializer, final FudgeMsg message) {
    SimpleSecurityLink secLink = new SimpleSecurityLink();
    if (message.hasField(SECURITY_KEY_FIELD_NAME)) {
      FudgeField secKeyField = message.getByName(SECURITY_KEY_FIELD_NAME);
      if (secKeyField != null) {
        secLink.setExternalId(deserializer.fieldValueToObject(ExternalIdBundle.class, secKeyField));
      }
    }
    if (message.hasField(SECURITY_ID_FIELD_NAME)) {
      FudgeField secIdField = message.getByName(SECURITY_ID_FIELD_NAME);
      if (secIdField != null) {
        secLink.setObjectId(deserializer.fieldValueToObject(ObjectId.class, secIdField));
      }
    }
   
    SimplePosition position = new SimplePosition();
    position.setSecurityLink(secLink);
View Full Code Here

    trade.setPremiumCurrency(Currency.USD);
    trade.setQuantity(BigDecimal.valueOf(_random.nextInt(10) + 10));
    trade.setTradeDate(LocalDate.now());
    String providerId = GUIDGenerator.generate().toString();
    trade.addAttribute(PROVIDER_ID_NAME, RANDOM_ID_SCHEME + "~" + providerId);
    trade.setSecurityLink(new SimpleSecurityLink(ExternalSchemes.syntheticSecurityId(securityId)));
    s_logger.debug("Generated {}", trade);
   
    FudgeMsg msg = s_fudgeContext.toFudgeMsg(trade).getMessage();
   
    s_logger.debug("sending {} to {}", msg, destinationName);
View Full Code Here

    SimplePortfolioNode node1 = new SimplePortfolioNode(id("node1"), "node1");
    SimplePortfolioNode node2 = new SimplePortfolioNode(id("node2"), "node2");
    ExternalId securityId = ExternalId.of("sec", "123");
    SimplePosition position = new SimplePosition(id("position"), BigDecimal.ONE, securityId);
    SimpleCounterparty counterparty = new SimpleCounterparty(ExternalId.of("cpty", "123"));
    SimpleSecurityLink securityLink = new SimpleSecurityLink(securityId);
    Trade trade = new SimpleTrade(securityLink, BigDecimal.ONE, counterparty, LocalDate.now(), OffsetTime.now());
    position.addTrade(trade);
    portfolio.setRootNode(root);
    node1.addPosition(position);
    node2.addPosition(position);
View Full Code Here

    securities.addSecurity(security);
    return securities;
  }

  private SecurityLink createSecurityLink(final SecuritySource securities) {
    final SimpleSecurityLink link = new SimpleSecurityLink(ExternalId.of("Security", "Swap"));
    link.resolve(securities);
    return link;
  }
View Full Code Here

TOP

Related Classes of com.opengamma.core.security.impl.SimpleSecurityLink

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.