public void HpxRefreshTest() { var configStore = new JsonConfigStore("config.json", new List <IConfigValidator>()); var ba = new BrokerAdapter(new RestClient(), configStore); var order = new Order { Broker = Broker.Hpx, BrokerOrderId = "2157479", Size = 0.1m }; ba.Refresh(order); }
public void RefreshTest() { var content = @"{ ""id"": 2157479, ""order_type"": ""limit"", ""quantity"": ""0.01"", ""disc_quantity"": ""0.0"", ""iceberg_total_quantity"": ""0.0"", ""side"": ""sell"", ""filled_quantity"": ""0.01"", ""price"": ""500.0"", ""created_at"": 1462123639, ""updated_at"": 1462123639, ""status"": ""filled"", ""leverage_level"": 2, ""source_exchange"": ""QUOINE"", ""product_id"": 1, ""product_code"": ""CASH"", ""funding_currency"": ""JPY"", ""currency_pair_code"": ""BTCJPY"", ""order_fee"": ""0.0"", ""executions"": [ { ""id"": 4566133, ""quantity"": ""0.01"", ""price"": ""500.0"", ""taker_side"": ""buy"", ""my_side"": ""sell"", ""created_at"": 1465396785 } ] }"; SetupRestMock <OrderStateReply>(content); var ba = new BrokerAdapter(_restClient.Object, _configStore.Object); var order = new Order { Broker = Broker.Quoine, BrokerOrderId = "2157479", Size = 0.01m }; ba.Refresh(order); Assert.AreEqual(0.01m, order.FilledSize); Assert.AreEqual(0m, order.PendingSize); Assert.AreEqual(OrderStatus.Filled, order.Status); Assert.AreEqual(0.01m, order.Executions[0].Size); Assert.AreEqual(OrderSide.Buy, order.Executions[0].Side); Assert.IsTrue((order.LastUpdated - DateTime.Now).Seconds < 10); }