templateString = templateString.replace("{REPORTID}", bt.getReportId()); if (bc != null) { templateString = templateString.replace("{MDIS}", ArrayUtils.toString(bc.getMdis())); for (String instrument : bt.getInstrumentIDs()) { log.info("Replacing for " + instrument); String t = new String(instrumentTemplate); t = t.replace("{INSTRUMENTID}", instrument); t = t.replace("{MAXPNL}", "" + bt.getStatistics().get(instrument + ".MAXPNL")); t = t.replace("{TOTALPLACED}", "" + bt.getStatistics().get(instrument + ".TOTALPLACED")); t = t.replace("{TOTALFILLS}", "" + bt.getStatistics().get(instrument + ".TOTALFILLS")); t = t.replace("{TOTALORDERUPDS}", "" + bt.getStatistics().get(instrument + ".TOTALORDERUPDS")); t = t.replace("{TOTALORDERCNCL}", "" + bt.getStatistics().get(instrument + ".TOTALORDERCNCL")); t = t.replace("{FINALPNL}", "" + bt.getStatistics().get(instrument + ".FINALPNL")); t = t.replace("{PNLPERTRADE}", "" + bt.getStatistics().get(instrument + ".PNLPERTRADE"));
BacktestStatistics bs = new BacktestStatistics(); bs.setReportId(new SimpleDateFormat("yyyyMMdd").format(new Date())); bs.calcPNLStats(pnlContainer); bs.calcPosStats(oelistener.getPositionOverTime()); bs.populateOrderStats(oelistener); new CsvMapWriter().write(bs.getStatistics(), fout); fout.close(); } catch (Exception e) {
BacktestStatistics bs = new BacktestStatistics(); bs.setReportId(new SimpleDateFormat("yyyyMMdd").format(new Date())); bs.calcPNLStats(pnlContainer); bs.calcPosStats(posOverTime); bs.populateOrderStats(oel); new CsvMapWriter().write(bs.getStatistics(), fout); fout.close();