@Test public void singleReturnTradeArith() { BarSeries sampleBarSeries = new MockBarSeries(numFunction, 1d, 2d); TradingRecord tradingRecord = new BaseTradingRecord(Order.buyAt(0, sampleBarSeries), Order.sellAt(1, sampleBarSeries)); Returns return1 = new Returns(sampleBarSeries, tradingRecord, Returns.ReturnType.ARITHMETIC); assertNumEquals(NaN.NaN, return1.getValue(0)); assertNumEquals(1.0, return1.getValue(1)); }
@Override public Num getValue(int index) { return values.get(index); }
Returns implements Indicator<Num> { @Override public Num getValue(int index) { return values.get(index); } }
Returns implements Indicator<Num> { @Override public Num getValue(int index) { return values.get(index); } Returns(BarSeries barSeries, Trade trade, ReturnType type);  Returns(BarSeries barSeries, TradingRecord tradingRecord, ReturnType type); }
Returns implements Indicator<Num> { @Override public Num getValue(int index) { return values.get(index); } Returns(BarSeries barSeries, Trade trade, ReturnType type);  Returns(BarSeries barSeries, TradingRecord tradingRecord, ReturnType type); List<Num> getValues(); @Override Num getValue(int index); @Override BarSeries getBarSeries(); @Override Num numOf(Number number); int getSize(); void calculate(Trade trade); void calculate(Trade trade, int finalIndex); }
Returns implements Indicator<Num> { @Override public Num getValue(int index) { return values.get(index); } Returns(BarSeries barSeries, Trade trade, ReturnType type);  Returns(BarSeries barSeries, TradingRecord tradingRecord, ReturnType type); List<Num> getValues(); @Override Num getValue(int index); @Override BarSeries getBarSeries(); @Override Num numOf(Number number); int getSize(); void calculate(Trade trade); void calculate(Trade trade, int finalIndex);  }