@Test public void externalData() throws Exception { BarSeries xlsSeries = xls.getSeries(); TradingRecord xlsTradingRecord = xls.getTradingRecord(); Num value; value = getCriterion(1000d, 0.005, 0.2).calculate(xlsSeries, xlsTradingRecord); assertNumEquals(xls.getFinalCriterionValue(1000d, 0.005, 0.2).doubleValue(), value); assertNumEquals(843.5492, value); value = getCriterion(1000d, 0.1, 1.0).calculate(xlsSeries, xlsTradingRecord); assertNumEquals(xls.getFinalCriterionValue(1000d, 0.1, 1.0).doubleValue(), value); assertNumEquals(1122.4410, value); }
@Override public Num calculate(BarSeries series, Trade trade) { return getTradeCost(series, trade, series.numOf(initialAmount)); }
LinearTransactionCostCriterion extends AbstractAnalysisCriterion { @Override public Num calculate(BarSeries series, Trade trade) { return getTradeCost(series, trade, series.numOf(initialAmount)); } }
LinearTransactionCostCriterion extends AbstractAnalysisCriterion { @Override public Num calculate(BarSeries series, Trade trade) { return getTradeCost(series, trade, series.numOf(initialAmount)); } LinearTransactionCostCriterion(double initialAmount, double a);  LinearTransactionCostCriterion(double initialAmount, double a, double b); }
LinearTransactionCostCriterion extends AbstractAnalysisCriterion { @Override public Num calculate(BarSeries series, Trade trade) { return getTradeCost(series, trade, series.numOf(initialAmount)); } LinearTransactionCostCriterion(double initialAmount, double a);  LinearTransactionCostCriterion(double initialAmount, double a, double b); @Override Num calculate(BarSeries series, Trade trade); @Override Num calculate(BarSeries series, TradingRecord tradingRecord); @Override boolean betterThan(Num criterionValue1, Num criterionValue2); }
LinearTransactionCostCriterion extends AbstractAnalysisCriterion { @Override public Num calculate(BarSeries series, Trade trade) { return getTradeCost(series, trade, series.numOf(initialAmount)); } LinearTransactionCostCriterion(double initialAmount, double a);  LinearTransactionCostCriterion(double initialAmount, double a, double b); @Override Num calculate(BarSeries series, Trade trade); @Override Num calculate(BarSeries series, TradingRecord tradingRecord); @Override boolean betterThan(Num criterionValue1, Num criterionValue2);  }