@Test public void cashFlowValueWithTwoTradesAndLongTimeWithoutOrders() { TimeSeries sampleTimeSeries = new MockTimeSeries(1d, 2d, 4d, 8d, 16d, 32d); TradingRecord tradingRecord = new BaseTradingRecord( Order.buyAt(1), Order.sellAt(2), Order.buyAt(4), Order.sellAt(5)); CashFlow cashFlow = new CashFlow(sampleTimeSeries, tradingRecord); assertDecimalEquals(cashFlow.getValue(0), 1); assertDecimalEquals(cashFlow.getValue(1), 1); assertDecimalEquals(cashFlow.getValue(2), 2); assertDecimalEquals(cashFlow.getValue(3), 2); assertDecimalEquals(cashFlow.getValue(4), 2); assertDecimalEquals(cashFlow.getValue(5), 4); }
@Override public Decimal getValue(int index) { return values.get(index); }
CashFlow implements Indicator<Decimal> { @Override public Decimal getValue(int index) { return values.get(index); } }
CashFlow implements Indicator<Decimal> { @Override public Decimal getValue(int index) { return values.get(index); } CashFlow(TimeSeries timeSeries, Trade trade);  CashFlow(TimeSeries timeSeries, TradingRecord tradingRecord); }
CashFlow implements Indicator<Decimal> { @Override public Decimal getValue(int index) { return values.get(index); } CashFlow(TimeSeries timeSeries, Trade trade);  CashFlow(TimeSeries timeSeries, TradingRecord tradingRecord); @Override Decimal getValue(int index); @Override TimeSeries getTimeSeries(); int getSize(); }
CashFlow implements Indicator<Decimal> { @Override public Decimal getValue(int index) { return values.get(index); } CashFlow(TimeSeries timeSeries, Trade trade);  CashFlow(TimeSeries timeSeries, TradingRecord tradingRecord); @Override Decimal getValue(int index); @Override TimeSeries getTimeSeries(); int getSize();  }