示例#1
0
        public static GlobalMarketView GetObject(string json, string curSymbol = "")
        {
            GlobalMarketView gmv = null;

            if (!string.IsNullOrEmpty(curSymbol))
            {
                string[] currencySymbols = new string[] { _totalMarketCapConvert + curSymbol.ToLower(), _Total24hVolumeConvert + curSymbol.ToLower() };

                json = json.Replace(currencySymbols[0], "total_market_cap_convert_currency");
                json = json.Replace(currencySymbols[1], "total_24h_volume_convert_currency");
            }
            try
            {
                gmv = SerializeDeserialize <GlobalMarketView> .FromJSONString(json);

                return(gmv);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public GlobalMarketView GetGlobalMarketView(string symbol = "")
        {
            string url     = GetUrl(Path_BaseGlobal);
            string convert = string.Empty;

            if (!string.IsNullOrEmpty(symbol))
            {
                convert = string.Format(OPR_Symbol, symbol);
            }

            var dataObj = CallService(url, convert);

            if (dataObj != null)
            {
                var obj = GlobalMarketView.GetObject(dataObj, symbol);
                return(obj);
            }
            else
            {
                return(null);
            }
        }