Ejemplo n.º 1
0
        public QuoteData GatherData(string symbol)
        {
            string content = string.Empty;

            using (HttpClient client = new HttpClient())
            {
                client.BaseAddress = new Uri(Endpoints.baseurl);
                content            = client.GetAsync("/quotes/" + symbol + "/").Result.Content.ReadAsStringAsync().Result;
            }
            return(JsonParse.ParseQuote(content));
        }
Ejemplo n.º 2
0
        public QuoteData[] GatherMultipleData(string[] symbols)
        {
            string[]    data      = new string[symbols.Length];
            QuoteData[] quoteData = new QuoteData[data.Length];

            using (HttpClient client = new HttpClient())
            {
                client.BaseAddress = new Uri(Endpoints.baseurl);

                for (int i = 0; i < symbols.Length; i++)
                {
                    data[i] = client.GetAsync("/quotes/" + symbols[i] + "/").Result.Content.ReadAsStringAsync().Result;
                }
            }

            for (int i = 0; i < data.Length; i++)
            {
                quoteData[i] = JsonParse.ParseQuote(data[i]);
            }

            return(quoteData);
        }