Esempio n. 1
0
        public CallResult <BinancePlacedOrder> PlaceOrder(string symbol, OrderSide side, OrderType type,
                                                          decimal quantity, string newClientOrderId = null,
                                                          decimal?price      = null, TimeInForce?timeInForce = null, decimal?stopPrice = null,
                                                          decimal?icebergQty = null,
                                                          OrderResponseType?orderResponseType = null, int?receiveWindow = null)
        {
            var order = _implementation.PlaceTestOrder(symbol, side, type, quantity, newClientOrderId, price, timeInForce,
                                                       stopPrice, icebergQty, orderResponseType, receiveWindow);

            if (order.Success)
            {
                var data = order.Data;
                data.OrderId = _orderIdGenerator.Next();

                // PlaceTestOrder does not propagate this data, set it manually.
                data.Type = type;
                data.Side = side;
                var ev = new OrderUpdate(
                    orderId: data.OrderId,
                    tradeId: 0,
                    orderStatus: data.Type == OrderType.Market ? OrderUpdate.OrderStatus.Filled : OrderUpdate.OrderStatus.New,
                    orderType: BinanceUtilities.ToInternal(data.Type),
                    createdTimestamp: 0,
                    setPrice: data.Price,
                    side: BinanceUtilities.ToInternal(data.Side),
                    pair: TradingPair.Parse(symbol),
                    setQuantity: data.OriginalQuantity);
                _parent.ScheduleObserverEvent(ev);
            }

            return(order);
        }
Esempio n. 2
0
        public static Enums.OrderSide ToCoreEquivalent(this BinanceNet.Objects.OrderSide input)
        {
            switch (input)
            {
            case BinanceNet.Objects.OrderSide.Buy:
                return(Enums.OrderSide.Buy);

            case BinanceNet.Objects.OrderSide.Sell:
                return(Enums.OrderSide.Sell);
            }

            throw new ArgumentException($"{input} is an unknown OrderSide");
        }
Esempio n. 3
0
 public Task <CallResult <BinancePlacedOrder> > PlaceTestOrderAsync(string symbol, OrderSide side, OrderType type, decimal quantity,
                                                                    string newClientOrderId = null, decimal?price = null, TimeInForce?timeInForce                 = null, decimal?stopPrice = null,
                                                                    decimal?icebergQty      = null, OrderResponseType?orderResponseType = null, int?receiveWindow = null) => throw new NotImplementedException();