@Test public void calculateWithNoTradesShouldReturn1() { MockBarSeries series = new MockBarSeries(numFunction, 100, 95, 100, 80, 85, 70); AnalysisCriterion profit = getCriterion(); assertNumEquals(1d, profit.calculate(series, new BaseTradingRecord())); }
@Override public Num calculate(BarSeries series, TradingRecord tradingRecord) { return tradingRecord.getTrades().stream().map(trade -> calculateProfit(series, trade)).reduce(series.numOf(1), Num::multipliedBy); }
TotalProfitCriterion extends AbstractAnalysisCriterion { @Override public Num calculate(BarSeries series, TradingRecord tradingRecord) { return tradingRecord.getTrades().stream().map(trade -> calculateProfit(series, trade)).reduce(series.numOf(1), Num::multipliedBy); } }
TotalProfitCriterion extends AbstractAnalysisCriterion { @Override public Num calculate(BarSeries series, TradingRecord tradingRecord) { return tradingRecord.getTrades().stream().map(trade -> calculateProfit(series, trade)).reduce(series.numOf(1), Num::multipliedBy); }  }
TotalProfitCriterion extends AbstractAnalysisCriterion { @Override public Num calculate(BarSeries series, TradingRecord tradingRecord) { return tradingRecord.getTrades().stream().map(trade -> calculateProfit(series, trade)).reduce(series.numOf(1), Num::multipliedBy); }  @Override Num calculate(BarSeries series, TradingRecord tradingRecord); @Override Num calculate(BarSeries series, Trade trade); @Override boolean betterThan(Num criterionValue1, Num criterionValue2); }
TotalProfitCriterion extends AbstractAnalysisCriterion { @Override public Num calculate(BarSeries series, TradingRecord tradingRecord) { return tradingRecord.getTrades().stream().map(trade -> calculateProfit(series, trade)).reduce(series.numOf(1), Num::multipliedBy); }  @Override Num calculate(BarSeries series, TradingRecord tradingRecord); @Override Num calculate(BarSeries series, Trade trade); @Override boolean betterThan(Num criterionValue1, Num criterionValue2);  }