@Test public void test() { CashFlowToChart.main(null); }
public static void main(String[] args) { BarSeries series = CsvTradesLoader.loadBitstampSeries(); Strategy strategy = MovingMomentumStrategy.buildStrategy(series); BarSeriesManager seriesManager = new BarSeriesManager(series); TradingRecord tradingRecord = seriesManager.run(strategy); CashFlow cashFlow = new CashFlow(series, tradingRecord); TimeSeriesCollection datasetAxis1 = new TimeSeriesCollection(); datasetAxis1.addSeries(buildChartBarSeries(series, new ClosePriceIndicator(series), "Bitstamp Bitcoin (BTC)")); TimeSeriesCollection datasetAxis2 = new TimeSeriesCollection(); datasetAxis2.addSeries(buildChartBarSeries(series, cashFlow, "Cash Flow")); JFreeChart chart = ChartFactory.createTimeSeriesChart("Bitstamp BTC", "Date", "Price", datasetAxis1, true, true, false ); XYPlot plot = (XYPlot) chart.getPlot(); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MM-dd HH:mm")); addCashFlowAxis(plot, datasetAxis2); displayChart(chart); }
CashFlowToChart { public static void main(String[] args) { BarSeries series = CsvTradesLoader.loadBitstampSeries(); Strategy strategy = MovingMomentumStrategy.buildStrategy(series); BarSeriesManager seriesManager = new BarSeriesManager(series); TradingRecord tradingRecord = seriesManager.run(strategy); CashFlow cashFlow = new CashFlow(series, tradingRecord); TimeSeriesCollection datasetAxis1 = new TimeSeriesCollection(); datasetAxis1.addSeries(buildChartBarSeries(series, new ClosePriceIndicator(series), "Bitstamp Bitcoin (BTC)")); TimeSeriesCollection datasetAxis2 = new TimeSeriesCollection(); datasetAxis2.addSeries(buildChartBarSeries(series, cashFlow, "Cash Flow")); JFreeChart chart = ChartFactory.createTimeSeriesChart("Bitstamp BTC", "Date", "Price", datasetAxis1, true, true, false ); XYPlot plot = (XYPlot) chart.getPlot(); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MM-dd HH:mm")); addCashFlowAxis(plot, datasetAxis2); displayChart(chart); } }
CashFlowToChart { public static void main(String[] args) { BarSeries series = CsvTradesLoader.loadBitstampSeries(); Strategy strategy = MovingMomentumStrategy.buildStrategy(series); BarSeriesManager seriesManager = new BarSeriesManager(series); TradingRecord tradingRecord = seriesManager.run(strategy); CashFlow cashFlow = new CashFlow(series, tradingRecord); TimeSeriesCollection datasetAxis1 = new TimeSeriesCollection(); datasetAxis1.addSeries(buildChartBarSeries(series, new ClosePriceIndicator(series), "Bitstamp Bitcoin (BTC)")); TimeSeriesCollection datasetAxis2 = new TimeSeriesCollection(); datasetAxis2.addSeries(buildChartBarSeries(series, cashFlow, "Cash Flow")); JFreeChart chart = ChartFactory.createTimeSeriesChart("Bitstamp BTC", "Date", "Price", datasetAxis1, true, true, false ); XYPlot plot = (XYPlot) chart.getPlot(); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MM-dd HH:mm")); addCashFlowAxis(plot, datasetAxis2); displayChart(chart); }  }
CashFlowToChart { public static void main(String[] args) { BarSeries series = CsvTradesLoader.loadBitstampSeries(); Strategy strategy = MovingMomentumStrategy.buildStrategy(series); BarSeriesManager seriesManager = new BarSeriesManager(series); TradingRecord tradingRecord = seriesManager.run(strategy); CashFlow cashFlow = new CashFlow(series, tradingRecord); TimeSeriesCollection datasetAxis1 = new TimeSeriesCollection(); datasetAxis1.addSeries(buildChartBarSeries(series, new ClosePriceIndicator(series), "Bitstamp Bitcoin (BTC)")); TimeSeriesCollection datasetAxis2 = new TimeSeriesCollection(); datasetAxis2.addSeries(buildChartBarSeries(series, cashFlow, "Cash Flow")); JFreeChart chart = ChartFactory.createTimeSeriesChart("Bitstamp BTC", "Date", "Price", datasetAxis1, true, true, false ); XYPlot plot = (XYPlot) chart.getPlot(); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MM-dd HH:mm")); addCashFlowAxis(plot, datasetAxis2); displayChart(chart); }  static void main(String[] args); }
CashFlowToChart { public static void main(String[] args) { BarSeries series = CsvTradesLoader.loadBitstampSeries(); Strategy strategy = MovingMomentumStrategy.buildStrategy(series); BarSeriesManager seriesManager = new BarSeriesManager(series); TradingRecord tradingRecord = seriesManager.run(strategy); CashFlow cashFlow = new CashFlow(series, tradingRecord); TimeSeriesCollection datasetAxis1 = new TimeSeriesCollection(); datasetAxis1.addSeries(buildChartBarSeries(series, new ClosePriceIndicator(series), "Bitstamp Bitcoin (BTC)")); TimeSeriesCollection datasetAxis2 = new TimeSeriesCollection(); datasetAxis2.addSeries(buildChartBarSeries(series, cashFlow, "Cash Flow")); JFreeChart chart = ChartFactory.createTimeSeriesChart("Bitstamp BTC", "Date", "Price", datasetAxis1, true, true, false ); XYPlot plot = (XYPlot) chart.getPlot(); DateAxis axis = (DateAxis) plot.getDomainAxis(); axis.setDateFormatOverride(new SimpleDateFormat("MM-dd HH:mm")); addCashFlowAxis(plot, datasetAxis2); displayChart(chart); }  static void main(String[] args);  }