public async Task <MajorIndex> GetMajorIndex(MajorIndexType indexType) { using (FinancialMarketPrepHttpClient client = new FinancialMarketPrepHttpClient()) { string uri = "majors-indexes/" + GetUriSuffix(indexType); MajorIndex majorIndex = await client.GetAsync <MajorIndex>(uri); majorIndex.Type = indexType; return(majorIndex); } }
public async Task <double> GetPrice(string symbol) { using (FinancialMarketPrepHttpClient client = new FinancialMarketPrepHttpClient()) { string uri = "stock/real-time-price/" + symbol; StockPriceResult stockPrice = await client.GetAsync <StockPriceResult>(uri); if (stockPrice.Price == 0) { throw new InvalidSymbolException(symbol); } return(stockPrice.Price); } }