Hi,
WebClient is giving exception. It is not able to get the data in ResultInCSV.
- try
- {
- string ServiceURL = $"http://finance.yahoo.com/d/quotes.csv?s={symbol}&f=sl1d1nd";
- string ResultInCSV;
- using (WebClient client = new WebClient())
- {
- ResultInCSV = await client.DownloadStringTaskAsync(ServiceURL).ConfigureAwait(false);
- }
- var FirstLine = ResultInCSV.Split('\n')[0];
- var Price = FirstLine.Split(',')[1];
- if (Price != null && Price.Length >= 0)
- {
- double result;
- if (double.TryParse(Price, out result))
- {
- return result;
- }
- }
- return null;
- }
- catch (WebException ex)
- {
- throw ex.InnerException;
- }
- }
Thanks,


Amit GuptaRank #190 · 12.8K reputationPosted Apr 26, 2017, 2:49 AM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Apr 25, 2017, 11:20 PM EDT
Ms_ DevRank #8,652 · 218 reputationPosted Apr 26, 2017, 12:23 AM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Apr 26, 2017, 1:07 AM EDT
Ms_ DevRank #8,652 · 218 reputationPosted Apr 26, 2017, 1:23 AM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Apr 26, 2017, 1:34 AM EDT
Ms_ DevRank #8,652 · 218 reputationPosted Apr 26, 2017, 1:42 AM EDT
Ms_ DevRank #8,652 · 218 reputationPosted Apr 26, 2017, 4:46 AM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Apr 26, 2017, 4:54 AM EDT