コード例 #1
0
        public void StockQuotes_ParsingTest()
        {
            var json    = File.ReadAllText("Data/stock-quotes.json");
            var jObject = (JObject)JsonConvert.DeserializeObject(json);

            var parser = new StockDataParser();
            var result = parser.ParseStockQuotes(jObject);

            Assert.NotNull(result);
            Assert.Equal(3, result.Count);
            Assert.True(
                result.Any(r => r.Symbol == "MSFT") &&
                result.Any(r => r.Symbol == "FB") &&
                result.Any(r => r.Symbol == "AAPL"));
        }
コード例 #2
0
        public async Task <ICollection <StockQuote> > RequestBatchQuotesAsync(string[] symbols)
        {
            var symbolsString = string.Join(",", symbols);

            var query = new Dictionary <string, string>()
            {
                { StockApiQueryVars.BatchSymbols, symbolsString },
            };

            var jObject = await _coreClient.RequestApiAsync(_apiKey, ApiFunction.BATCH_STOCK_QUOTES, query);

            var timeSeries = _parser.ParseStockQuotes(jObject);

            return(timeSeries);
        }