@Test public void calculateFixedCost() { MockTimeSeries series = new MockTimeSeries(100, 105, 110, 100, 95, 105); AnalysisCriterion transactionCost = new LinearTransactionCostCriterion(1000, 0, 1.3d); TradingRecord tradingRecord = new BaseTradingRecord(Order.buyAt(0), Order.sellAt(1)); assertEquals(2.6d, transactionCost.calculate(series, tradingRecord), TATestsUtils.TA_OFFSET); tradingRecord.operate(2); tradingRecord.operate(3); assertEquals(5.2d, transactionCost.calculate(series, tradingRecord), TATestsUtils.TA_OFFSET); tradingRecord.operate(0); assertEquals(6.5d, transactionCost.calculate(series, tradingRecord), TATestsUtils.TA_OFFSET); }
@Override public double calculate(TimeSeries series, Trade trade) { return getTradeCost(series, trade, initialAmount); }
LinearTransactionCostCriterion extends AbstractAnalysisCriterion { @Override public double calculate(TimeSeries series, Trade trade) { return getTradeCost(series, trade, initialAmount); } }
LinearTransactionCostCriterion extends AbstractAnalysisCriterion { @Override public double calculate(TimeSeries series, Trade trade) { return getTradeCost(series, trade, initialAmount); } LinearTransactionCostCriterion(double initialAmount, double a);  LinearTransactionCostCriterion(double initialAmount, double a, double b); }
LinearTransactionCostCriterion extends AbstractAnalysisCriterion { @Override public double calculate(TimeSeries series, Trade trade) { return getTradeCost(series, trade, initialAmount); } LinearTransactionCostCriterion(double initialAmount, double a);  LinearTransactionCostCriterion(double initialAmount, double a, double b); @Override double calculate(TimeSeries series, Trade trade); @Override double calculate(TimeSeries series, TradingRecord tradingRecord); @Override boolean betterThan(double criterionValue1, double criterionValue2); }
LinearTransactionCostCriterion extends AbstractAnalysisCriterion { @Override public double calculate(TimeSeries series, Trade trade) { return getTradeCost(series, trade, initialAmount); } LinearTransactionCostCriterion(double initialAmount, double a);  LinearTransactionCostCriterion(double initialAmount, double a, double b); @Override double calculate(TimeSeries series, Trade trade); @Override double calculate(TimeSeries series, TradingRecord tradingRecord); @Override boolean betterThan(double criterionValue1, double criterionValue2);  }