Package com.opengamma.integration.copier.portfolio.reader

Examples of com.opengamma.integration.copier.portfolio.reader.SingleSheetSimplePortfolioReader


    SheetFormat sheetFormat = SheetFormat.of(filename);
    switch (sheetFormat) {
      case XLS:
      case CSV:
        // Check that the asset class was specified on the command line
        return new SingleSheetSimplePortfolioReader(sheetFormat, stream, new ExchangeTradedRowParser(securityProvider));

      default:
        throw new OpenGammaRuntimeException("Input filename should end in .CSV or .XLS");
    }
  }
View Full Code Here


          throw new OpenGammaRuntimeException("Could not import as no asset class was specified for file " + filename);
        } else {
//          if (securityType.equalsIgnoreCase("exchangetraded")) {
//            return new SingleSheetSimplePortfolioReader(filename, new ExchangeTradedRowParser(s_context.getBloombergSecuritySource()));
//          } else {
          return ImmutableList.of(new SingleSheetSimplePortfolioReader(filename, securityType));
//          }
        }
      case XML:
        // XMl multi-asset portfolio
        try {
View Full Code Here

                                                                           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
        public void write(OutputStream output) throws IOException, WebApplicationException {
          // TODO callback for progress updates as portoflio is copied
          copier.copy(portfolioReader, portfolioWriter);
View Full Code Here

    portfolioDocument.setPortfolio(portfolio);
    when(portfolioMaster.add(any(PortfolioDocument.class))).thenReturn(portfolioDocument);
   
    // 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())))) {
View Full Code Here

TOP

Related Classes of com.opengamma.integration.copier.portfolio.reader.SingleSheetSimplePortfolioReader

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.