public async Task <List <StockListItem> > GetStockListAsync() { using (FinancialModelingHttpClient client = _httpClientFactory.CreateHttpClient()) { string uri = "stock/list"; List <StockListItem> stockList = await client.GetAsync <List <StockListItem> >(uri); return(stockList); } }
public async Task <List <FinancialRatio> > GetFinancialRatiosAsync(string symbol) { using (FinancialModelingHttpClient client = _httpClientFactory.CreateHttpClient()) { string uri = $"ratios/{symbol}"; List <FinancialRatio> ratios = await client.GetAsync <List <FinancialRatio> >(uri); return(ratios); } }
public async Task <MajorIndex> GetMajorIndexAsync(MajorIndexType indexType) { using (FinancialModelingHttpClient client = _httpClientFactory.CreateHttpClient()) { string uri = "majors-indexes/" + GetUriSuffix(indexType); MajorIndex majorIndex = await client.GetAsync <MajorIndex>(uri); majorIndex.Type = indexType; return(majorIndex); } }
public async Task <CompanyRaitingFinMod> GetCompanyRaitingAsync(string symbol) { using (FinancialModelingHttpClient client = _httpClientFactory.CreateHttpClient()) { string uri = $"rating/{symbol}"; List <CompanyRaitingFinMod> ratings = await client.GetAsync <List <CompanyRaitingFinMod> >(uri); if (!ratings.Any()) { throw new InvalidSymbolException(symbol); } return(ratings.First()); } }
public async Task <double> GetPriceAsync(string symbol) { using (FinancialModelingHttpClient client = _httpClientFactory.CreateHttpClient()) { string uri = "stock/real-time-price/" + symbol; StockPriceResult stockPriceResult = await client.GetAsync <StockPriceResult>(uri); if (stockPriceResult.Price == 0) { throw new InvalidSymbolException(symbol); } return(stockPriceResult.Price); } }