@Test public void fixedCostWithOneTrade() { MockBarSeries series = new MockBarSeries(numFunction, 100, 95, 100, 80, 85, 70); Trade trade = new Trade(); Num criterion; criterion = getCriterion(1000d, 0d, 0.75d).calculate(series, trade); assertNumEquals(0d, criterion); trade.operate(1); criterion = getCriterion(1000d, 0d, 0.75d).calculate(series, trade); assertNumEquals(0.75d, criterion); trade.operate(3); criterion = getCriterion(1000d, 0d, 0.75d).calculate(series, trade); assertNumEquals(1.5d, criterion); trade.operate(4); criterion = getCriterion(1000d, 0d, 0.75d).calculate(series, trade); assertNumEquals(1.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);  }