예제 #1
0
        public async Task <IActionResult> GetStockItemsAsync()
        {
            var quoteResult = await _stockServices.GetQuoteDetailAsync();

            if (quoteResult.Count == 0)
            {
                return(NotFound());
            }
            var maxQuotePrice = quoteResult.Max(x => x.Price);

            var avgChangesPercentage = quoteResult.Average(x => x.ChangesPercentage);

            return(Ok(new { maxQuotePrice, avgChangesPercentage }));
        }
예제 #2
0
        public async Task <IActionResult> GetStockItemsAsync()
        {
            var url         = "https://financialmodelingprep.com/api/v3/quote/AAWW, AAL, CPAAW,PRAA, PAAS, RYAAY ?apikey=b351eb4b7226aefb40eb0da9df7cc616";
            var quoteResult = await _stockServices.GetQuoteDetailAsync(url);

            if (quoteResult == null || quoteResult.Count == 0)
            {
                return(NotFound());
            }
            var maxQuotePrice = quoteResult.Max(x => x.Price);

            var avgChangesPercentage = quoteResult.Average(x => x.ChangesPercentage);

            return(Ok(new { maxQuotePrice, avgChangesPercentage }));
        }