Examples of PortfolioDocument


Examples of com.opengamma.master.portfolio.PortfolioDocument

    }
       
    @Override
    public void run() {  
     
      PortfolioDocument portfolioDocument = getPortfolioMaster().get(_portfolioId, VersionCorrection.LATEST);
      s_logger.debug("Updating portfolio {} with {}", portfolioDocument.getUniqueId(), _trade);
      ManageablePortfolio portfolio = portfolioDocument.getPortfolio();
      ManageablePortfolioNode root = portfolio.getRootNode();

      ManageablePosition position = new ManageablePosition();
      position.getSecurityLink().setExternalId(_trade.getSecurityLink().getExternalId());
      position.setQuantity(_trade.getQuantity());
      String providerIdStr = _trade.getAttributes().get(getProviderIdName());
      ManageableTrade manageableTrade = new ManageableTrade(_trade);
      if (providerIdStr != null) {
        ExternalId providerId = ExternalId.parse(providerIdStr);
        position.setProviderId(providerId);
        manageableTrade.setProviderId(providerId);
      }
      position.addTrade(manageableTrade);
      PositionDocument addedPosition = getPositionMaster().add(new PositionDocument(position));
      root.addPosition(addedPosition.getUniqueId());

      PortfolioDocument currentPortfolio = getPortfolioMaster().update(new PortfolioDocument(portfolio));
      s_logger.info("Portfolio ID {} updated", currentPortfolio.getUniqueId());

      restartViewCalculation();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.