As I understand you want to download all possible data for a specific ticker. So to do this you actually dont need to provide period1 parameter, if you provide 0 in the place of period1 then Yahoo API puts as default the oldest date.

To download quotes using the way you showed in the question we unfortunately have to deal with cookies. I will let myself provide solution without using Scrapy, only ticker itself is required:

def get_yahoo_ticker_data(ticker): res = requests.get( + ticker + /history) yahoo_cookie = res.cookies[B] yahoo_crumb = None pattern = re.compile(.*CrumbStore:/{crumb:(?P<crumb>[^]+)/}) for line in res.text.splitlines(): m = pattern.match(line) if m is not None: yahoo_crumb = m.groupdict()[crumb] cookie_tuple = yahoo_cookie, yahoo_crumb current_date = int(time.time()) url_kwargs = {symbol: ticker, timestamp_end: current_date, crumb: cookie_tuple[1]} url_price = / {symbol}?period1=0&period2={timestamp_end}&interval=1d&events=history / &crumb={crumb}.format(**url_kwargs) response = requests.get(url_price, cookies={B: cookie_tuple[0]}) return pd.read_csv(StringIO(response.text), parse_dates=[Date]) 

If you really need the oldest date then you can use the code above and extract the first date from the response.


I do know that web scraping is not an efficient option but its the only option we have because Yahoo already decommissioned all APIs. You might find some third party solution but all of them use scraping inside their source code and they add some additional boiler plate code that decreases overall performance.

Tell us about you

Find us at the office

Eastmond- Sukel street no. 62, 79540 Hanga Roa, Easter Island

Give us a ring

Jaquelinee Wrate
+74 201 709 645
Mon - Fri, 9:00-15:00

Reach out