protected void On24HourTickerRecv(string[] item)
        {
            string symbolName = item[2];
            Ticker first      = null;

            for (int i = 0; i < Tickers.Count; i++)
            {
                Ticker tt = Tickers[i];
                if (tt.Name == symbolName)
                {
                    first = tt;
                    break;
                }
            }
            BinanceTicker t = (BinanceTicker)first;

            if (t == null)
            {
                throw new DllNotFoundException("binance symbol not found " + symbolName);
            }
            t.Change     = FastValueConverter.Convert(item[4]);
            t.HighestBid = FastValueConverter.Convert(item[9]);
            t.LowestAsk  = FastValueConverter.Convert(item[11]);
            t.Hr24High   = FastValueConverter.Convert(item[14]);
            t.Hr24Low    = FastValueConverter.Convert(item[15]);
            t.BaseVolume = FastValueConverter.Convert(item[16]);
            t.Volume     = FastValueConverter.Convert(item[17]);

            t.UpdateTrailings();

            lock (t) {
                RaiseTickerChanged(t);
            }
        }
        public override bool UpdateTickersInfo()
        {
            string address = "https://api.binance.com/api/v1/ticker/24hr";
            string text    = string.Empty;

            try {
                text = GetDownloadString(address);
            }
            catch (Exception) {
                return(false);
            }
            if (string.IsNullOrEmpty(text))
            {
                return(false);
            }
            JArray res = JsonConvert.DeserializeObject <JArray>(text);

            for (int index = 0; index < res.Count; index++)
            {
                JObject item         = (JObject)res[index];
                string  currencyPair = item.Value <string>("symbol");
                Ticker  first        = null;
                for (int i = 0; i < Tickers.Count; i++)
                {
                    Ticker tr = Tickers[i];
                    if (tr.CurrencyPair == currencyPair)
                    {
                        first = tr;
                        break;
                    }
                }
                BinanceTicker t = (BinanceTicker)first;
                if (t == null)
                {
                    continue;
                }
                t.Last       = item.Value <double>("lastPrice");
                t.LowestAsk  = item.Value <double>("askPrice");
                t.HighestBid = item.Value <double>("bidPrice");
                t.Change     = item.Value <double>("priceChangePercent");
                t.BaseVolume = item.Value <double>("volume");
                t.Volume     = item.Value <double>("quoteVolume");
                t.Hr24High   = item.Value <double>("highPrice");
                t.Hr24Low    = item.Value <double>("lowPrice");
            }
            return(true);
        }
        protected void On24HourTickerRecv(string[] item)
        {
            string        symbolName = item[2];
            BinanceTicker t          = (BinanceTicker)Tickers.FirstOrDefault(tt => tt.Name == symbolName);

            if (t == null)
            {
                throw new DllNotFoundException("binance symbol not found " + symbolName);
            }
            t.Change     = FastValueConverter.Convert(item[4]);
            t.HighestBid = FastValueConverter.Convert(item[9]);
            t.LowestAsk  = FastValueConverter.Convert(item[11]);
            t.Hr24High   = FastValueConverter.Convert(item[14]);
            t.Hr24Low    = FastValueConverter.Convert(item[15]);
            t.BaseVolume = FastValueConverter.Convert(item[16]);
            t.Volume     = FastValueConverter.Convert(item[17]);

            t.UpdateTrailings();

            lock (t) {
                RaiseTickerUpdate(t);
            }
        }
        public override bool UpdateTickersInfo()
        {
            string address = "https://api.binance.com/api/v1/ticker/24hr";
            string text    = string.Empty;

            try {
                text = GetDownloadString(address);
            }
            catch (Exception) {
                return(false);
            }
            if (string.IsNullOrEmpty(text))
            {
                return(false);
            }
            JArray res = JsonConvert.DeserializeObject <JArray>(text);

            foreach (JObject item in res)
            {
                string        currencyPair = item.Value <string>("symbol");
                BinanceTicker t            = (BinanceTicker)Tickers.FirstOrDefault(tr => tr.CurrencyPair == currencyPair);
                if (t == null)
                {
                    continue;
                }
                t.Last       = item.Value <double>("lastPrice");
                t.LowestAsk  = item.Value <double>("askPrice");
                t.HighestBid = item.Value <double>("bidPrice");
                t.Change     = item.Value <double>("priceChangePercent");
                t.BaseVolume = item.Value <double>("volume");
                t.Volume     = item.Value <double>("quoteVolume");
                t.Hr24High   = item.Value <double>("highPrice");
                t.Hr24Low    = item.Value <double>("lowPrice");
            }
            return(true);
        }
        public override bool ObtainExchangeSettings()
        {
            string address = "https://api.binance.com/api/v1/exchangeInfo";
            string text    = string.Empty;

            try {
                text = GetDownloadString(address);
            }
            catch (Exception e) {
                Telemetry.Default.TrackException(e);
                return(false);
            }
            if (string.IsNullOrEmpty(text))
            {
                return(false);
            }

            JObject settings   = JsonConvert.DeserializeObject <JObject>(text);
            JArray  rateLimits = settings.Value <JArray>("rateLimits");

            RequestRate = new List <RateLimit>();
            OrderRate   = new List <RateLimit>();
            for (int i = 0; i < rateLimits.Count; i++)
            {
                JObject rateLimit = (JObject)rateLimits[i];
                string  rateType  = rateLimit.Value <string>("rateLimitType");
                if (rateType == "REQUESTS")
                {
                    RequestRate.Add(GetRateLimit(rateLimit));
                }
                if (rateType == "ORDERS")
                {
                    OrderRate.Add(GetRateLimit(rateLimit));
                }
            }
            JArray symbols = settings.Value <JArray>("symbols");

            for (int i = 0; i < symbols.Count; i++)
            {
                JObject       s = (JObject)symbols[i];
                BinanceTicker t = new BinanceTicker(this);
                t.CurrencyPair   = s.Value <string>("symbol");
                t.MarketCurrency = s.Value <string>("baseAsset");
                t.BaseCurrency   = s.Value <string>("quoteAsset");
                if (Tickers.FirstOrDefault(tt => tt.CurrencyPair == t.CurrencyPair) != null)
                {
                    continue;
                }
                Tickers.Add(t);
                JArray filters = s.Value <JArray>("filters");
                for (int fi = 0; fi < filters.Count; fi++)
                {
                    JObject filter     = (JObject)filters[fi];
                    string  filterType = filter.Value <string>("filterType");
                    if (filterType == "PRICE_FILTER")
                    {
                        t.PriceFilter = new TickerFilter()
                        {
                            MinValue = filter.Value <double>("minPrice"), MaxValue = filter.Value <double>("maxPrice"), TickSize = filter.Value <double>("tickSize")
                        }
                    }
                    ;
                    else if (filterType == "LOT_SIZE")
                    {
                        t.QuantityFilter = new TickerFilter()
                        {
                            MinValue = filter.Value <double>("minQty"), MaxValue = filter.Value <double>("maxQty"), TickSize = filter.Value <double>("stepSize")
                        }
                    }
                    ;
                    else if (filterType == "MIN_NOTIONAL")
                    {
                        t.NotionalFilter = new TickerFilter()
                        {
                            MinValue = filter.Value <double>("minNotional"), MaxValue = double.MaxValue
                        }
                    }
                    ;
                }
            }
            return(true);
        }
        public override void ObtainExchangeSettings()
        {
            string address = "https://api.binance.com/api/v1/exchangeInfo";
            string text    = string.Empty;

            try {
                text = GetDownloadString(address);
            }
            catch (Exception) {
                return;
            }
            if (string.IsNullOrEmpty(text))
            {
                return;
            }

            JObject settings   = JsonConvert.DeserializeObject <JObject>(text);
            JArray  rateLimits = settings.Value <JArray>("rateLimits");

            RequestRate = new List <RateLimit>();
            OrderRate   = new List <RateLimit>();
            foreach (JObject rateLimit in rateLimits)
            {
                string rateType = rateLimit.Value <string>("rateLimitType");
                if (rateType == "REQUESTS")
                {
                    RequestRate.Add(GetRateLimit(rateLimit));
                }
                if (rateType == "ORDERS")
                {
                    OrderRate.Add(GetRateLimit(rateLimit));
                }
            }

            JArray symbols = settings.Value <JArray>("symbols");

            foreach (JObject s in symbols)
            {
                BinanceTicker t = new BinanceTicker(this);
                t.CurrencyPair   = s.Value <string>("symbol");
                t.MarketCurrency = s.Value <string>("baseAsset");
                t.BaseCurrency   = s.Value <string>("quoteAsset");
                Tickers.Add(t);

                JArray filters = s.Value <JArray>("filters");
                foreach (JObject filter in filters)
                {
                    string filterType = filter.Value <string>("filterType");
                    if (filterType == "PRICE_FILTER")
                    {
                        t.PriceFilter = new TickerFilter()
                        {
                            MinValue = filter.Value <double>("minPrice"), MaxValue = filter.Value <double>("maxPrice"), TickSize = filter.Value <double>("tickSize")
                        }
                    }
                    ;
                    else if (filterType == "LOT_SIZE")
                    {
                        t.QuantityFilter = new TickerFilter()
                        {
                            MinValue = filter.Value <double>("minQty"), MaxValue = filter.Value <double>("maxQty"), TickSize = filter.Value <double>("stepSize")
                        }
                    }
                    ;
                }
            }
        }