Package com.opengamma.integration.copier.portfolio.writer

Examples of com.opengamma.integration.copier.portfolio.writer.MasterPortfolioWriter


      // Check that the portfolio name was specified on the command line
      if (portfolioName == null) {
        throw new OpenGammaRuntimeException("Portfolio name omitted, cannot persist to OpenGamma masters");
      }
      // Create a portfolio writer to persist imported positions, trades and securities to the OG masters
      return new MasterPortfolioWriter(portfolioName, portfolioMaster, positionMaster, securityMaster, false, false, false);
    } else {
      // Create a dummy portfolio writer to pretty-print instead of persisting
      return new PrettyPrintingPortfolioWriter(true);        
   
  }
View Full Code Here


      if (portfolioName == null) {
        throw new OpenGammaRuntimeException("Portfolio name omitted, cannot persist to OpenGamma masters");
      }

      // Create a portfolio writer to persist imported positions, trades and securities to the OG masters
      return new MasterPortfolioWriter(portfolioName,
                                       toolContext.getPortfolioMaster(),
                                       toolContext.getPositionMaster(),
                                       toolContext.getSecurityMaster(),
                                       mergePositions,
                                       keepCurrentPositions,
View Full Code Here

                                                                           _historicalTimeSeriesProvider,
                                                                           _referenceDataProvider,
                                                                           dataProvider,
                                                                           dataFields);
      final PortfolioWriter portfolioWriter =
          new MasterPortfolioWriter(portfolioName, _portfolioMaster, _positionMaster, _securityMaster, false, false, true);
      SheetFormat format = getFormatForFileName(fileName);
      RowParser rowParser = new ExchangeTradedRowParser(_securityProvider);
      final PortfolioReader portfolioReader = new SingleSheetSimplePortfolioReader(format, fileStream, rowParser);
      StreamingOutput streamingOutput = new StreamingOutput() {
        @Override
View Full Code Here

  }

  private void xmlPortfolioCopy(PortfolioReader portfolioReader) {

    SimplePortfolioCopier copier = new SimplePortfolioCopier(null);
    final PortfolioWriter portfolioWriter = new MasterPortfolioWriter(portfolioReader.getPortfolioName(),
                                                                      _portfolioMaster, _positionMaster,
                                                                      _securityMaster, false, false, true);
    // Call the portfolio loader with the supplied arguments
    copier.copy(portfolioReader, portfolioWriter);
    // close stuff
    portfolioReader.close();
    portfolioWriter.close();
  }
View Full Code Here

   
    // file to masters
    PortfolioReader portfolioReader =
        new SingleSheetSimplePortfolioReader(PORTFOLIO_FILE, SECURITY_TYPE);
    PortfolioWriter portfolioWriter =
        new MasterPortfolioWriter(PORTFOLIO_NAME, portfolioMaster, positionMaster, securityMaster, false, false, false);
    portfolioCopier.copy(portfolioReader, portfolioWriter);
    portfolioReader.close();
    portfolioWriter.close();

    portSearchResult.setDocuments(Collections.singletonList(portfolioDocument));
   
    // Masters to file
    portfolioReader = new MasterPortfolioReader(PORTFOLIO_NAME, portfolioMaster, positionMaster, securitySource);
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    portfolioWriter = new SingleSheetSimplePortfolioWriter(SheetFormat.CSV, outputStream, SECURITY_TYPE);
    portfolioCopier.copy(portfolioReader, portfolioWriter);
    portfolioReader.close();
    portfolioWriter.close();

    // Compare source and destination
    try (CSVReader sourceReader = new CSVReader(new InputStreamReader(new FileInputStream(PORTFOLIO_FILE)))) {
      try (CSVReader destReader = new CSVReader(new InputStreamReader(new ByteArrayInputStream(outputStream.toByteArray())))) {
        int j = 1;
View Full Code Here

TOP

Related Classes of com.opengamma.integration.copier.portfolio.writer.MasterPortfolioWriter

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.