@Test public void calculateOpenSellTrade() { int currentIndex = 4; Trade trade = new Trade(Order.OrderType.SELL, new ZeroCostModel(), borrowingModel); trade.operate(0, DoubleNum.valueOf(100), DoubleNum.valueOf(1)); Num costsFromTrade = trade.getHoldingCost(currentIndex); Num costsFromModel = borrowingModel.calculate(trade, currentIndex); assertNumEquals(costsFromModel, costsFromTrade); assertNumEquals(costsFromModel, DoubleNum.valueOf(4)); }
public Num calculate(Num price, Num amount) { return price.numOf(0); }
LinearBorrowingCostModel implements CostModel { public Num calculate(Num price, Num amount) { return price.numOf(0); } }
LinearBorrowingCostModel implements CostModel { public Num calculate(Num price, Num amount) { return price.numOf(0); } LinearBorrowingCostModel(double feePerPeriod); }
LinearBorrowingCostModel implements CostModel { public Num calculate(Num price, Num amount) { return price.numOf(0); } LinearBorrowingCostModel(double feePerPeriod); Num calculate(Num price, Num amount); Num calculate(Trade trade); Num calculate(Trade trade, int currentIndex); boolean equals(CostModel otherModel); }
LinearBorrowingCostModel implements CostModel { public Num calculate(Num price, Num amount) { return price.numOf(0); } LinearBorrowingCostModel(double feePerPeriod); Num calculate(Num price, Num amount); Num calculate(Trade trade); Num calculate(Trade trade, int currentIndex); boolean equals(CostModel otherModel);  }