/** * @param args * @throws FileNotFoundException */ public static void main(String[] args) throws Exception { /* new TransactionInputToReport( "/home/ustaudinger/work/activequant/trunk/src/test/resources/transactions/transactions.csv", "/home/ustaudinger/work/activequant/trunk/src/test/resources/transactions/report.config", "/home/ustaudinger/work/activequant/trunk/src/test/resources/transactions/", "reporting.pecoracapital.com"); */ new TransactionInputToReport(args[0], args[1], args[2], args[3]); // // // SimpleDateFormat newYorkTimeFormatter = new SimpleDateFormat("HH"); // newYorkTimeFormatter.setTimeZone(TimeZone.getTimeZone("America/New_York")); // // // // SimpleDateFormat localTimeFormatter = new SimpleDateFormat("HH"); // // System.out.println(newYorkTimeFormatter.format(new Date()) + " -- " + // localTimeFormatter.format(new Date())); }
PNLChangeEvent pce = prc.execution(ofe.getTimeStamp(), ofe.getOptionalInstId(), ofe.getFillPrice(), ofe.getSide().getSide() * ofe.getFillAmount()); increaseTransactionCount(ofe.getOptionalInstId()); } else if (se instanceof OHLCV) { OHLCV o = (OHLCV) se; TSContainer2 deltaCashPositionsOverTime = calcCashPositions(posDeltaOverTime, executionPricesOverTime); TSContainer2 inflatedCashPositionSeries = resampleSeries(deltaCashPositionsOverTime, TimeFrame.HOURS_1, startTimeStamp, endTimeStamp); TSContainer2 borrowingAndLendingContainer = calcInterestChanges(startTimeStamp, endTimeStamp, TimeFrame.HOURS_1, inflatedCashPositionSeries); inflatedCashPositionSeries = resampleSeries(inflatedCashPositionSeries, timeFrame, startTimeStamp, endTimeStamp); borrowingAndLendingContainer = tcm.resampleWithSum(borrowingAndLendingContainer, timeFrame.getNanoseconds()); fout.close(); TSContainer2 inflatedPositionSeries = resampleSeries(oel.getPositionOverTime(), timeFrame, startTimeStamp, endTimeStamp); inflatedPositionSeries = tcm.overwriteNull(inflatedPositionSeries);
private TSContainer2 resampleSeries(TSContainer2 container, TimeFrame timeFrame, TimeStamp startTimeStamp, TimeStamp endTimeStamp) { // resample the position series. TSContainer2 resampled = getEmptyContainer(container.getColumnHeaders(), startTimeStamp, endTimeStamp, timeFrame); List<String> headers = container.getColumnHeaders(); for (int i = 0; i < container.getTimeStamps().size(); i++) { TimeStamp ts = container.getTimeStamps().get(i); Object[] o = container.getRow(ts); for (int j = 0; j < o.length; j++) { if (o[j] != null) { resampled.setValue(headers.get(j), ts, (Double) o[j]); } } } return resampled; }
addColAndInit(cashPositionsOverTime, base, timeStamps); addColAndInit(cashPositionsOverTime, quotee, timeStamps);
public void run(String reportId, String folder) throws DaoException, FileNotFoundException, IOException{ Report r = reportDao.load(reportId); r.setStatus("PROCESSING"); reportDao.update(r); try{ new TransactionInputToReport( folder + "/transactions.csv", folder + "/report.config", folder, "localhost"); // r.setStatus("DONE"); reportDao.update(r); } catch(Exception ex){ r.setStatus("ERROR: " + ex); reportDao.update(r); } }