public void ReturnLongOrderTakerFees(OrderTestParameters parameters) { IFeeModel feeModel = new BitfinexFeeModel(); Order order = parameters.CreateLongOrder(Quantity); var price = order.Type == OrderType.Limit ? ((LimitOrder)order).LimitPrice : HighPrice; Assert.AreEqual( BitfinexFeeModel.TakerFee * price * Math.Abs(Quantity), feeModel.GetOrderFee(Security, order)); }
public void ReturnShortOrderMakerFees(OrderTestParameters parameters) { IFeeModel feeModel = new BitfinexFeeModel(); Order order = parameters.CreateShortOrder(Quantity); var price = order.Type == OrderType.Limit ? ((LimitOrder)order).LimitPrice : LowPrice; var fee = feeModel.GetOrderFee(new OrderFeeParameters(Security, order)); Assert.AreEqual( BitfinexFeeModel.MakerFee * price * Math.Abs(Quantity), fee.Value.Amount); Assert.AreEqual(Currencies.USD, fee.Value.Currency); }
public void Setup() { unit = new BitfinexFeeModel(); symbol = Symbol.Create("BTCUSD", SecurityType.Forex, Market.Bitfinex); //hack: no parameterless constructors sub = (SubscriptionDataConfig)System.Runtime.Serialization.FormatterServices.GetUninitializedObject(typeof(SubscriptionDataConfig)); security = new Mock <Security>(SecurityExchangeHours.AlwaysOpen(DateTimeZone.Utc), sub, new Cash("USD", 1, 1), new SymbolProperties("", "USD", 1, 1, 1)); security.Setup(s => s.Price).Returns(price); security.Setup(s => s.AskPrice).Returns(price + 2); security.Setup(s => s.BidPrice).Returns(price - 2); }