Esempio n. 1
0
        public int CloseOrder(BinanceApiClient client, string side = "")
        {
            if (m_NewOrder == null)
            {
                return(-1);
            }
            var order = client.GetOrder(m_Symbol, m_NewOrder.OrderId);

            if (side != "" && order.Side != side)
            {
                return(1);
            }

            /*if (order.Status == "FILLED" || order.Status == "PARTIALLY_FILLED")
             * {
             *  if (order.Side == "BUY")
             *  {
             *      client.PostNewOrder(m_Symbol, order.ExecutedQty, 0.0m, OrderSide.SELL, OrderType.MARKET);
             *  }
             *  else if (order.Side == "SELL")
             *  {
             *      client.PostNewOrder(m_Symbol, order.ExecutedQty, 0.0m, OrderSide.BUY, OrderType.MARKET);
             *  }
             * }
             * else if (order.Status == "NEW")
             * {
             *  client.CancelOrder(m_Symbol, order.OrderId);
             * }*/
            m_NewOrder = null;
            return(0);
        }
Esempio n. 2
0
        public OrderResponse GetOrder(string pair, string orderId)
        {
            var response = binance.GetOrder(pair, Int64.Parse(orderId));

            return(BinanceOrderResponseToOrderResponse(response));
        }