Exemplo n.º 1
0
        public ParserReply GetInfo(string symbol, string token)
        {
            Symbol = symbol;
            Token  = token;
            Console.WriteLine(Url);
            var httpResponse = new HttpApiClient().Get(Url).Result;

            if (ReferenceEquals(httpResponse, null))
            {
                return(null);
            }
            var http = JsonConvert.DeserializeObject <Dictionary <string, string> >(httpResponse);

            var currentPrice = http["iexRealtimePrice"];

            if (ReferenceEquals(currentPrice, null) || currentPrice == "0")
            {
                currentPrice = http["latestPrice"];
            }
            var result = new ParserReply
            {
                Symbol       = symbol,
                CurrentPrice = currentPrice
            };

            return(result);
        }
Exemplo n.º 2
0
        public ParserReply GetInfo(string symbol, string token)
        {
            Symbol = symbol;
            Token  = token;
            Console.WriteLine(Url);
            var http   = JsonConvert.DeserializeObject <Dictionary <string, string> >(new HttpApiClient().Get(Url).Result);
            var result = new ParserReply
            {
                Symbol       = symbol,
                CurrentPrice = http["c"]
            };

            return(result);
        }