@Test public void fixedCost() { MockBarSeries series = new MockBarSeries(numFunction, 100, 105, 110, 100, 95, 105); TradingRecord tradingRecord = new BaseTradingRecord(); Num criterion; tradingRecord.operate(0); tradingRecord.operate(1); criterion = getCriterion(1000d, 0d, 1.3d).calculate(series, tradingRecord); assertNumEquals(2.6d, criterion); tradingRecord.operate(2); tradingRecord.operate(3); criterion = getCriterion(1000d, 0d, 1.3d).calculate(series, tradingRecord); assertNumEquals(5.2d, criterion); tradingRecord.operate(0); criterion = getCriterion(1000d, 0d, 1.3d).calculate(series, tradingRecord); assertNumEquals(6.5d, criterion); }
@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);  }