Loathing
Loathing

Reputation: 5256

Yahoo Finance indicates symbol doesn't exist when it actually does exist

On a daily basis, I download a fixed set of 100 closing prices, using the tickers, from Yahoo!. They all work as expected 99% of the time. This is done using an HttpWebRequest to download a web page.

However, occasionally Yahoo! will return html that indicates that the symbol doesn't exist.

E.g. the returned HTML will contain something like: Symbols similar to 'XOM'

Symbols similar to 'XOM'

However, if that same URL is pasted into a browser, then the actual expected HTML is downloaded.

Sample URL: https://finance.yahoo.com/quote/XOM/history/?p=XOM&period1=1729839600&period2=1729925999

Code to download webpage:

HttpWebRequest wr = (HttpWebRequest) HttpWebRequest.Create(url);
wr.Proxy = null;
wr.UserAgent = userAgent; // copied from browser

String html = null;
var r = wr.GetResponse();
using (r) {
    using (StreamReader sr = new StreamReader(r.GetResponseStream(), true)) {
        html = sr.ReadToEnd();
    }
}

Any ideas why Yahoo! sometimes doesn't recognize a symbol as existing?

Upvotes: 0

Views: 94

Answers (0)

Related Questions