Ejemplo n.º 1
0
        public async Task <IOrder> CheckOrder(string uuid, string symbol)
        {
            var    timestamp   = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
            string totalParams = string.Format("symbol={0}&orderId={1}&timestamp={2}", symbol, uuid, timestamp);
            string sign        = CalculateSignature(totalParams, _config.Secret);

            var data = new Dictionary <string, object> {
                { "symbol", symbol },
                { "orderId", uuid },
                { "timestamp", timestamp },
                { "signature", sign }
            };


            var order = await _binance.GetOrder(_config.ApiKey, data);

            var trades = await GetTrades(symbol, order.time);

            ITicker bnbTicker = null;

            if (symbol.Contains("BTC"))
            {
                bnbTicker = await Ticker("BNBBTC");
            }
            else if (symbol.Contains("ETH"))
            {
                bnbTicker = await Ticker("BNBETH");
            }

            return(new Order(order, trades.Where(t => t.time == order.time), bnbTicker));
        }