@Test public void calculateFixedCostWithOneTrade() { MockTimeSeries series = new MockTimeSeries(100, 95, 100, 80, 85, 70); Trade trade = new Trade(); AnalysisCriterion transactionCost = new LinearTransactionCostCriterion(1000, 0, 0.75d); assertEquals(0, (int) transactionCost.calculate(series, trade)); trade.operate(1); assertEquals(0.75d, transactionCost.calculate(series, trade), TATestsUtils.TA_OFFSET); trade.operate(3); assertEquals(1.5d, transactionCost.calculate(series, trade), TATestsUtils.TA_OFFSET); trade.operate(4); assertEquals(1.5d, transactionCost.calculate(series, trade), 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);  }