Пример #1
0
        public void CancelTest()
        {
            var content = @"{
                              ""id"": 2157474,
                              ""order_type"": ""limit"",
                              ""quantity"": ""0.01"",
                              ""disc_quantity"": ""0.0"",
                              ""iceberg_total_quantity"": ""0.0"",
                              ""side"": ""sell"",
                              ""filled_quantity"": ""0.0"",
                              ""price"": ""500.0"",
                              ""created_at"": 1462123639,
                              ""updated_at"": 1462123639,
                              ""status"": ""cancelled"",
                              ""leverage_level"": 1,
                              ""source_exchange"": ""QUOINE"",
                              ""product_id"": 1,
                              ""product_code"": ""CASH"",
                              ""funding_currency"": ""JPY"",
                              ""currency_pair_code"": ""BTCJPY""
                            }";

            SetupRestMock(content);
            var ba    = new BrokerAdapter(_restClient.Object, _configStore.Object);
            var order = new Order {
                Broker = Broker.Quoine, BrokerOrderId = "2157479", Size = 0.01m
            };

            ba.Cancel(order);
            Assert.AreEqual(OrderStatus.Canceled, order.Status);
            Assert.IsTrue((order.LastUpdated - DateTime.Now).Seconds < 10);
        }
Пример #2
0
        public void HpxCancelTest()
        {
            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.01m
            };

            ba.Cancel(order);
        }