@Test public void calculatePerTrade() { ZeroCostModel model = new ZeroCostModel(); int holdingPeriod = 2; Order entry = Order.buyAt(0, DoubleNum.valueOf(100), DoubleNum.valueOf(1), model); Order exit = Order.sellAt(holdingPeriod, DoubleNum.valueOf(110), DoubleNum.valueOf(1), model); Trade trade = new Trade(entry, exit, model, model); Num cost = model.calculate(trade, holdingPeriod); assertNumEquals(cost, DoubleNum.valueOf(0)); }
public Num calculate(Trade trade) { return calculate(trade, 0); }
ZeroCostModel implements CostModel { public Num calculate(Trade trade) { return calculate(trade, 0); } }
ZeroCostModel implements CostModel { public Num calculate(Trade trade) { return calculate(trade, 0); } ZeroCostModel(); }
ZeroCostModel implements CostModel { public Num calculate(Trade trade) { return calculate(trade, 0); } ZeroCostModel(); Num calculate(Trade trade); Num calculate(Trade trade, int currentIndex); Num calculate(Num price, Num amount); boolean equals(CostModel otherModel); }
ZeroCostModel implements CostModel { public Num calculate(Trade trade) { return calculate(trade, 0); } ZeroCostModel(); Num calculate(Trade trade); Num calculate(Trade trade, int currentIndex); Num calculate(Num price, Num amount); boolean equals(CostModel otherModel);  }