public static void main(final String[] args) throws Exception {

    final String cfgPath = "/com/sandy/stocktracker/bootstrap-config.xml";
    new Bootstrap().initialize(ScripDataModification.class.getResource(cfgPath));
    OF = (BizObjectFactory) BizObjectFactory.getInstance();

    try {
      new ScripDataModification().updateActiveEOD();
    } finally {
      final IJobSvc svc = ServiceMgr.getJobSvc();
      svc.shutdownScheduler();
    }
  }
  public void updateArchiveEODForSymbol(final String scrip) throws Exception {

    final IScripSvc eodScripSvc = ServiceMgr.getScripSvc();
    final List<ScripEOD> activeEOD = eodScripSvc.getArchivedEODData(scrip);
    double lastClosing = -1;
    for (final ScripEOD eod : activeEOD) {
      if (lastClosing != -1) {
        eod.setPrevClosePrice(lastClosing);
      }
      lastClosing = eod.getClosingPrice();
    }

    final IEODIndexDAO dao = (IEODIndexDAO) OF.getBean("EODIndexDAO");
    dao.updateArchive(activeEOD);
  }
  public void updateActiveEOD() throws Exception {

    final ISymbolDAO symbDAO = (ISymbolDAO) OF.getBean("SymbolDAO");
    final Map<String, Symbol> symbMap = symbDAO.getAllSymbolsMap();

    int i = 0;
    for (final String symbol : symbMap.keySet()) {
      logger.debug(symbMap.size() - i + " left. Updating Active symbol = " + symbol);
      updateActiveEODForSymbol(symbol);
      i++;
    }

    i = 0;
    for (final String symbol : symbMap.keySet()) {
      logger.debug(symbMap.size() - i + " left. Updating Archive symbol = " + symbol);
      updateArchiveEODForSymbol(symbol);
      i++;
    }
  }