예제 #1
0
        async Task <WebCallResult <ICommonOrderId> > IExchangeClient.PlaceOrderAsync(string symbol, IExchangeClient.OrderSide side, IExchangeClient.OrderType type, decimal quantity, decimal?price = null, string?accountId = null)
        {
            var result = await PlaceOrderAsync(symbol, GetOrderSide(side), GetOrderType(type), quantity, price : price).ConfigureAwait(false);

            return(result.As <ICommonOrderId>(result.Data));
        }
예제 #2
0
        public async Task <WebCallResult <ICommonOrderId> > PlaceOrderAsync(string symbol, IExchangeClient.OrderSide side, IExchangeClient.OrderType type, decimal quantity, decimal?price = null, string accountId = null)
        {
            var request = new PlaceOrderRequest(symbol)
            {
                Quantity = quantity,
                Side     = side == IExchangeClient.OrderSide.Buy ? BitmexOrderSide.Buy : BitmexOrderSide.Sell,
                Price    = price,
            };

            request.BitmexOrderType = type switch
            {
                IExchangeClient.OrderType.Limit => BitmexOrderType.Limit,
                IExchangeClient.OrderType.Market => BitmexOrderType.Market,
                _ => null
            };
            var result = await PlaceOrderAsync(request);

            return(result.As <ICommonOrderId>(result.Data));
        }