示例#1
0
        public async Task PlaceBuyLimitOrder(string productId)
        {
            var product = await MarketData.GetProductAsync(productId);

            var productOrderBook = await MarketData.GetProductOrderBookAsync(productId, AggregatedProductOrderBookLevel.LevelTwo);

            var newOrder = await TradingClient.PlaceNewOrderAsync(new NewOrderParameters
            {
                ProductId = productId,
                Side      = OrderSide.Buy,
                Size      = product?.BaseMinSize,
                Price     = productOrderBook?.GetWorstBid() - product?.QuoteIncrement
            });

            newOrder.ShouldNotBeNull();
            _testOutput.WriteLine($"Placed order {newOrder}");

            var cancelledOrderId = await TradingClient.CancelOrder(newOrder.Id, productId);

            cancelledOrderId.ShouldBe(newOrder.Id);
        }