@Test public void cashFlowWithSellAndBuyOrders() { TimeSeries sampleTimeSeries = new MockTimeSeries(2, 1, 3, 5, 6, 3, 20); TradingRecord tradingRecord = new BaseTradingRecord( Order.buyAt(0), Order.sellAt(1), Order.buyAt(3), Order.sellAt(4), Order.sellAt(5), Order.buyAt(6)); CashFlow cashFlow = new CashFlow(sampleTimeSeries, tradingRecord); assertDecimalEquals(cashFlow.getValue(0), 1); assertDecimalEquals(cashFlow.getValue(1), "0.5"); assertDecimalEquals(cashFlow.getValue(2), "0.5"); assertDecimalEquals(cashFlow.getValue(3), "0.5"); assertDecimalEquals(cashFlow.getValue(4), "0.6"); assertDecimalEquals(cashFlow.getValue(5), "0.6"); assertDecimalEquals(cashFlow.getValue(6), "0.09"); }
@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();  }