public async Task <MajorIndex> GetMajorIndex(MajorIndexType indexType) { using (FinancialModelingPreHttpClient client = new FinancialModelingPreHttpClient()) { string uri = "major-indexes/" + GetUriSuffix(indexType); MajorIndex majorIndex = await client.GetAsync <MajorIndex>(uri); majorIndex.Type = indexType; return(majorIndex); } }
public async Task <double> GetPrice(string symbol) { using (FinancialModelingPreHttpClient client = new FinancialModelingPreHttpClient()) { 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); } }