Package com.opengamma.master.portfolio

Examples of com.opengamma.master.portfolio.PortfolioMaster


    }).each(request.getObjectId().getScheme());
  }

  @Override
  public ManageablePortfolioNode getNode(final UniqueId nodeId) {
    final PortfolioMaster master = getMasterByScheme(nodeId.getScheme());
    if (master != null) {
      return master.getNode(nodeId);
    }
    return (new Try<ManageablePortfolioNode>() {
      @Override
      public ManageablePortfolioNode tryMaster(final PortfolioMaster master) {
        return master.getNode(nodeId);
      }
    }).each(nodeId.getScheme());
  }
View Full Code Here


    s_logger.info("loading portfolios");
    AbstractTool<ToolContext> remoteServerTool = new AbstractTool<ToolContext>() {

      @Override
      protected void doRun() throws Exception {
        PortfolioMaster remotePortfolioMaster = getToolContext().getPortfolioMaster();
        PositionSource remotePositionSource = getToolContext().getPositionSource();
       
        PortfolioSearchRequest request = new PortfolioSearchRequest();
        request.setDepth(0);
        for (PortfolioDocument portfolioDocument : PortfolioSearchIterator.iterable(remotePortfolioMaster, request)) {
View Full Code Here

    AbstractTool<ToolContext> remoteServerTool = new AbstractTool<ToolContext>() {

      @Override
      protected void doRun() throws Exception {
        final ConfigMaster remoteConfigMaster = getToolContext().getConfigMaster();
        final PortfolioMaster remotePortfolioMaster = getToolContext().getPortfolioMaster();
        ConfigSaver configSaver = new ConfigSaver(remoteConfigMaster, remotePortfolioMaster, new ArrayList<String>(), new ArrayList<String>(), true, true);
        ByteArrayOutputStream byteArrayOutput = new ByteArrayOutputStream();
        PrintStream outputStream = new PrintStream(byteArrayOutput);
        configSaver.saveConfigs(outputStream);
        ConfigLoader configLoader = new ConfigLoader(configMaster, portfolioMaster, true, true, true);
View Full Code Here

  //-------------------------------------------------------------------------
  @Override
  protected void doRun() {
    ToolContext toolContext = getToolContext();
    ConfigMaster configMaster = toolContext.getConfigMaster();
    PortfolioMaster portfolioMaster = toolContext.getPortfolioMaster();
    CommandLine commandLine = getCommandLine();
    @SuppressWarnings("unchecked")
    List<String> fileList = commandLine.getArgList();
    boolean portPortfolioRefs = commandLine.hasOption("portable-portfolios");
    boolean verbose = commandLine.hasOption("verbose");
View Full Code Here

  @Override
  protected void doRun() {
    final SecurityMaster securities = getToolContext().getSecurityMaster();
    final PositionMaster positions = getToolContext().getPositionMaster();
    final PortfolioMaster portfolios = getToolContext().getPortfolioMaster();
    final ManageablePortfolio portfolio = new ManageablePortfolio("Tutorial 1");
    final ManageablePortfolioNode root = portfolio.getRootNode();
    final Random rnd = new Random();
    root.setName("Root");
    for (final Tutorial1Security security : loadSecurities()) {
      securities.add(new SecurityDocument(security.toRawSecurity()));
      final ManageablePosition position = new ManageablePosition(new BigDecimal(100 + rnd.nextInt(900)), security.getExternalIdBundle());
      root.addPosition(positions.add(new PositionDocument(position)));
    }
    portfolios.add(new PortfolioDocument(portfolio));
  }
View Full Code Here

  private boolean _publishRest = true;


  @Override
  public void init(final ComponentRepository repo, final LinkedHashMap<String, String> configuration) {
    final PortfolioMaster master = new InMemoryPortfolioMaster();
    final ComponentInfo info = new ComponentInfo(PortfolioMaster.class, getClassifier());
    info.addAttribute(ComponentInfoAttributes.LEVEL, 1);
    info.addAttribute(ComponentInfoAttributes.REMOTE_CLIENT_JAVA, RemotePortfolioMaster.class);
    info.addAttribute(ComponentInfoAttributes.UNIQUE_ID_SCHEME, InMemoryPortfolioMaster.DEFAULT_OID_SCHEME);
    repo.registerComponent(info, master);
View Full Code Here

    new ExampleMultiAssetPortfolioLoader().initAndRun(args, ToolContext.class);
    System.exit(0);
  }

  private void persistToPortfolio() {
    PortfolioMaster portfolioMaster = getToolContext().getPortfolioMaster();
    ManageablePortfolioNode rootNode = new ManageablePortfolioNode(PORTFOLIO_NAME);
    ManageablePortfolio portfolio = new ManageablePortfolio(PORTFOLIO_NAME, rootNode);
    PortfolioDocument portfolioDoc = new PortfolioDocument();
    portfolioDoc.setPortfolio(portfolio);
    addPortfolioNode(rootNode, getIborSwaps(), "Ibor swaps", BigDecimal.ONE);
    addPortfolioNode(rootNode, getCMSwaps(), "CM swaps", BigDecimal.ONE);
    addPortfolioNode(rootNode, getSimpleFX(), "FX forward", BigDecimal.ONE);
    addPortfolioNode(rootNode, getFXOptions(), "FX options", BigDecimal.ONE);
    addPortfolioNode(rootNode, getSwaptions(), "Swaptions", BigDecimal.ONE);
    addPortfolioNode(rootNode, getIborCapFloor(), "Ibor cap/floor", BigDecimal.ONE);
    addPortfolioNode(rootNode, getCMCapFloor(), "CM cap/floor", BigDecimal.ONE);
    portfolioMaster.add(portfolioDoc);
  }
View Full Code Here

 
  private void portfolioWithSecurity(Security security, String portfolioName) {

   
    final PositionMaster posMaster = getToolContext().getPositionMaster();
    final PortfolioMaster portMaster = getToolContext().getPortfolioMaster();
   
    final ManageablePosition position = makePositionAndTrade(security);
    final PositionDocument positionDoc = new PositionDocument(position);
    posMaster.add(positionDoc);
   
    ManageablePortfolio portfolio = new ManageablePortfolio(portfolioName);
    ManageablePortfolioNode rootNode = portfolio.getRootNode();
    rootNode.setName("Root");
    rootNode.addPosition(position.getUniqueId());
   
    PortfolioDocument portfolioDoc = new PortfolioDocument(portfolio);
    portMaster.add(portfolioDoc);

  }
View Full Code Here

    }
    DBTestUtils.cleanUp(CONFIG_RESOURCE_LOCATION);
  }

  private void assertMultiAssetPortfolio(ToolContext toolContext) {
    PortfolioMaster portfolioMaster = toolContext.getPortfolioMaster();
    assertPortfolio(portfolioMaster, ExampleMultiAssetPortfolioLoader.PORTFOLIO_NAME);
  }
View Full Code Here

    PortfolioMaster portfolioMaster = toolContext.getPortfolioMaster();
    assertPortfolio(portfolioMaster, ExampleMultiAssetPortfolioLoader.PORTFOLIO_NAME);
  }

  private void assertEquityPortfolio(ToolContext toolContext) {
    PortfolioMaster portfolioMaster = toolContext.getPortfolioMaster();
    assertPortfolio(portfolioMaster, ExampleEquityPortfolioLoader.PORTFOLIO_NAME);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.master.portfolio.PortfolioMaster

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.