Esempio n. 1
0
        public async void CanPlaceAndCancelAndOrder()
        {
            var buyOrder = NewOrder.Buy(TickerSymbol.XBTUSD, CurrencyCode.XBT, 1, 210);
            var newOrder = await _client.NewOrderAsync(_walletId, buyOrder);

            var order = await _client.GetOrderAsync(_walletId, newOrder.Id);

            await _client.CancelOrderAsync(_walletId, order.Id);

            order = await _client.GetOrderAsync(_walletId, newOrder.Id);

            Assert.AreEqual(OrderStatus.cancelled, order.Status);
        }
        /// <summary>
        /// 撤单
        /// </summary>
        /// <param name="contractCode"></param>
        /// <param name="orderId"></param>
        private static void CancelOrder(string contractCode, long orderId)
        {
            if (orderId <= 0)
            {
                AppLogger.Error($"invalid orderId");
                return;
            }

            _logger.Start();
            var data = _tradeClient.CancelOrderAsync(contractCode, orderId).Result;

            _logger.StopAndLog();

            AppLogger.Info($"cancel order orderId:{orderId} done, result:{data}");
        }