Package com.opengamma.core.position.impl

Examples of com.opengamma.core.position.impl.SimplePortfolio


 
  @Override
  public Portfolio getPortfolio(UniqueId uniqueId, VersionCorrection versionCorrection) {
    ArgumentChecker.notNull(uniqueId, "uniqueId");
    final ManageablePortfolio manPrt = getPortfolioMaster().get(uniqueId).getPortfolio();
    final SimplePortfolio prt = new SimplePortfolio(manPrt.getUniqueId(), manPrt.getName());
    convertNode(manPrt.getRootNode(), prt.getRootNode(), versionCorrection);
    copyAttributes(manPrt, prt);
    return prt;
  }
View Full Code Here


  @Override
  public Portfolio getPortfolio(ObjectId objectId, VersionCorrection versionCorrection) {
    ArgumentChecker.notNull(objectId, "objectId");
    ArgumentChecker.notNull(versionCorrection, "versionCorrection");
    final ManageablePortfolio manPrt = getPortfolioMaster().get(objectId, versionCorrection).getPortfolio();
    final SimplePortfolio prt = new SimplePortfolio(manPrt.getUniqueId(), manPrt.getName());
    convertNode(manPrt.getRootNode(), prt.getRootNode(), versionCorrection);
    copyAttributes(manPrt, prt);
    return prt;
  }
View Full Code Here

    final AtomicInteger num = new AtomicInteger();
    final SimplePortfolioNode root = new SimplePortfolioNode();
    root.setName("Sample");
    root.addChildNode(samplePortfolioNode(num, 2));
    root.addChildNode(samplePortfolioNode(num, 2));
    return new SimplePortfolio(UniqueId.of("Test", "Sample"), "Sample", root);
  }
View Full Code Here

    for (List<AggregationFunction<?>> aggregationFunctions : _aggregationFunctionsList) {
      final SimplePortfolioNode aggregateRoot = new SimplePortfolioNode(buildPortfolioNodeName(aggregationFunctions));
      aggregate(aggregateRoot, flattenedPortfolio, new ArrayDeque<>(aggregationFunctions));
      root.addChildNode(aggregateRoot);
    }
    return new SimplePortfolio(portfolioName, root);
  }
View Full Code Here

   * @param versionCorrection the version-correction for security resolution, not null
   * @return the resolved portfolio, not null
   */
  public static Portfolio resolvePortfolio(final Portfolio portfolio, final ExecutorService executorService,
      final SecuritySource securitySource, final VersionCorrection versionCorrection) {
    final Portfolio cloned = new SimplePortfolio(portfolio);
    new SecurityLinkResolver(executorService, securitySource, versionCorrection).resolveSecurities(cloned.getRootNode());
    return cloned;
  }
View Full Code Here

    if (newRoot.isPresent()) {
      PortfolioNode node = newRoot.get();
      return node.equals(rootNode) ? portfolio : createPortfolioForNode(trimParents(node));
    } else {
      return new SimplePortfolio("Access Denied");
    }
  }
View Full Code Here

        node;
  }

  private Portfolio createPortfolioForNode(PortfolioNode node) {

    return new SimplePortfolio(
        UniqueId.of("RESTRICTED_PORTFOLIO", "PF_" + s_portfolioId++),
        node.getName(),
        new SimplePortfolioNode(node));
  }
View Full Code Here

    }
    if (maxPositions != null) {
      ArgumentChecker.notNegative(maxPositions, "maxPositions");
    }
    if ((maxNodes != null) || (maxPositions != null)) {
      final SimplePortfolio copy = new SimplePortfolio(portfolio.getName());
      copy.setRootNode(copyNode(portfolio.getRootNode(), maxNodes, maxPositions));
      portfolio = copy;
    }
    return PortfolioCompiler.resolvePortfolio(portfolio, getCompiledFunctionService().getExecutorService().asService(), getSecuritySource());
  }
View Full Code Here

  @Test
  public void testSingleNodePortfolioIsUnalteredWhenAllNodesAreAllowed() {

    SimplePortfolioNode root = nodeTree(1);
    Portfolio pf = new SimplePortfolio("node-1", root);

    Portfolio portfolio = new NodeCheckingPortfolioFilter(createAllowNodeChecker()).generateRestrictedPortfolio(pf);
    assertThat(portfolio == pf, is(true));
  }
View Full Code Here

  @Test
  public void testMultiNodePortfolioIsUnalteredWhenAllNodesAreAllowed() {

    SimplePortfolioNode root = nodeTree(1, nodeTree(2, nodeTree(4)), nodeTree(3));
    Portfolio pf = new SimplePortfolio("node-1", root);

    Portfolio portfolio = new NodeCheckingPortfolioFilter(createAllowNodeChecker()).generateRestrictedPortfolio(pf);
    assertThat(portfolio == pf, is(true));
  }
View Full Code Here

TOP

Related Classes of com.opengamma.core.position.impl.SimplePortfolio

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.