Package com.opengamma.master.security

Examples of com.opengamma.master.security.ManageableSecurityLink$Meta


                     meta.premiumTime());
    tradeBuilder.set(meta.attributes(), tradeData.getMapValues(meta.attributes().name()));
    String idBundleStr = (String) tradeData.getValue(SECURITY_ID_BUNDLE);
    // TODO check the security exists and load it if not? and the underlying?
    ExternalIdBundle securityIdBundle = getStringConvert().convertFromString(ExternalIdBundle.class, idBundleStr);
    tradeBuilder.set(meta.securityLink(), new ManageableSecurityLink(securityIdBundle));
    // this property is done manually so the client can just provide the counterparty name but the counterparty
    // on the trade is an external ID with the standard counterparty scheme
    String counterparty = (String) tradeData.getValue(COUNTERPARTY);
    if (StringUtils.isEmpty(counterparty)) {
      counterparty = DEFAULT_COUNTERPARTY;
View Full Code Here


      ManageableSecurity savedUnderlying = getSecurityMaster().add(new SecurityDocument(underlying)).getSecurity();
      security = buildSecurity(securityData, savedUnderlying);
    }
    ManageableSecurity savedSecurity = getSecurityMaster().add(new SecurityDocument(security)).getSecurity();
    ManageableTrade trade = buildTrade(tradeData);
    trade.setSecurityLink(new ManageableSecurityLink(savedSecurity.getUniqueId()));
    ManageablePosition position = new ManageablePosition();
    position.setQuantity(BigDecimal.ONE);
    position.setSecurityLink(new ManageableSecurityLink(trade.getSecurityLink()));
    position.setTrades(Lists.newArrayList(trade));
    ManageablePosition savedPosition = getPositionMaster().add(new PositionDocument(position)).getPosition();
    ManageableTrade savedTrade = savedPosition.getTrades().get(0);

    PortfolioSearchRequest searchRequest = new PortfolioSearchRequest();
View Full Code Here

    // need to set the unique ID to the ID from the previous version, securities aren't allowed to change
    // any changes in the security data are interpreted as edits to the security
    validateSecurity(security, previousSecurity);
    security.setUniqueId(previousSecurity.getUniqueId());
    ManageableSecurity savedSecurity = getSecurityMaster().update(new SecurityDocument(security)).getSecurity();
    trade.setSecurityLink(new ManageableSecurityLink(savedSecurity.getUniqueId()));
    ManageablePosition position = getPositionMaster().get(positionId).getPosition();
    position.setTrades(Lists.newArrayList(trade));
    ManageablePosition savedPosition = getPositionMaster().update(new PositionDocument(position)).getPosition();
    ManageableTrade savedTrade = savedPosition.getTrades().get(0);
    return savedTrade.getUniqueId();
View Full Code Here

                     meta.premiumDate(),
                     meta.premiumTime());
    tradeBuilder.set(meta.attributes(), tradeData.getMapValues(meta.attributes().name()));
    tradeBuilder.set(meta.quantity(), BigDecimal.ONE);
    // the link needs to be non-null but the real ID can't be set until the security has been created later
    tradeBuilder.set(meta.securityLink(), new ManageableSecurityLink());
    String counterparty = (String) tradeData.getValue(COUNTERPARTY);
    if (StringUtils.isEmpty(counterparty)) {
      counterparty = DEFAULT_COUNTERPARTY;
    }
    tradeBuilder.set(meta.counterpartyExternalId(), ExternalId.of(CPTY_SCHEME, counterparty));
View Full Code Here

 
  private URI addPosition(BigDecimal quantity, UniqueId secUid, Collection<ManageableTrade> trades) {
    ExternalIdBundle secId = data().getSecuritySource().get(secUid).getExternalIdBundle();
    ManageablePosition position = new ManageablePosition(quantity, secId);
    for (ManageableTrade trade : trades) {
      trade.setSecurityLink(new ManageableSecurityLink(secId));
      position.addTrade(trade);
    }
    PositionDocument doc = new PositionDocument(position);
    doc = data().getPositionMaster().add(doc);
    data().setPosition(doc);
View Full Code Here

  /**
   * Construct an empty instance that must be populated via setters.
   */
  public ManageableTrade() {
    _securityLink = new ManageableSecurityLink();
  }
View Full Code Here

   */
  public ManageableTrade(final Trade trade) {
    ArgumentChecker.notNull(trade, "trade");
    ArgumentChecker.notNull(trade.getAttributes(), "trade.attributes");
    _quantity = trade.getQuantity();
    _securityLink = new ManageableSecurityLink(trade.getSecurityLink());
    _tradeDate = trade.getTradeDate();
    _tradeTime = trade.getTradeTime();
    // this is a bug - PLAT-3117 - counterparty ID isn't nullable. use a default or throw an exception?
    _counterpartyExternalId = (trade.getCounterparty() != null ? trade.getCounterparty().getExternalId() : null);
    _premium = trade.getPremium();
View Full Code Here

    ArgumentChecker.notNull(securityId, "securityId");
    _quantity = quantity;
    _tradeDate = tradeDate;
    _tradeTime = tradeTime;
    _counterpartyExternalId = counterpartyId;
    _securityLink = new ManageableSecurityLink(securityId);
  }
View Full Code Here

    ArgumentChecker.notNull(counterpartyId, "counterpartyId");
    _quantity = quantity;
    _tradeDate = tradeDate;
    _tradeTime = tradeTime;
    _counterpartyExternalId = counterpartyId;
    _securityLink = new ManageableSecurityLink(securityId);
  }
View Full Code Here

  public void test() {
    ManageableTrade obj = new ManageableTrade();
    obj.setUniqueId(UniqueId.of("U", "1"));
    obj.setQuantity(BigDecimal.ONE);
    obj.setSecurityLink(new ManageableSecurityLink(ExternalId.of("A", "B")));
    obj.getSecurityLink().setObjectId(ObjectId.of("O", "1"));
    obj.setTradeDate(LocalDate.of(2011, 6, 1));
    obj.setCounterpartyExternalId(ExternalId.of("C", "D"));
    testFudgeMessage(obj);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.master.security.ManageableSecurityLink$Meta

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.