Skip to content
All library documents

Yahoo Finance Historical Data Changes and Their Effect on Forex Scraping

Article Quant Q&A · Author: ddm-j

Summary

The document addresses failures in Python workflows that previously fetched foreign-exchange and other historical price data through Yahoo or Google with tools such as pandas datareader and ffn. The accepted answer attributes the Yahoo failure to changes in its download process: requests use a newer URL structure, Unix timestamps for dates, and a cookie-linked validation value. Scrapers therefore need to handle the site’s cookie requirements.

Other replies offer differing observations: one suggests a browser-like user agent may help in another environment, while another says the former Yahoo API had been closed and mentions commercial data providers as alternatives. These replies reflect the discussion at the time and are not a current guarantee about provider availability or access policies. The document is primarily about maintaining data acquisition for strategy development; it provides no assessment of forex data quality, licensing terms, or the suitability of any provider for live trading.

Key ideas

  • The reported data download failures followed changes to Yahoo Finance’s historical-data access process.
  • The newer download approach described uses Unix timestamps and cookie-linked validation.
  • Scraping workflows may need to account for cookies and request headers.
  • The replies give conflicting descriptions of API availability and suggest third-party providers.
  • The information is historical and does not establish current service access or data quality.

Tags

Full text
# Does Yahoo/Google no longer support web-scraping of FOREX data?


# Does Yahoo/Google no longer support web-scraping of FOREX data?












I use Python 3.6 to develop quantitative FOREX trading strategies. I used to use Yahoo or Google in conjunction with `pandas.datareader` in order to collect forex data for day to day strategy development. However, lately, these the `pandas` API hasn't been working at all. I'm not sure if they changed the way FOREX data is accessed... Using something like `EURUSD=X' or`EUR=X`usually works as an argument for the 'name' of the security.

I've also tried using `ffn` for python. It is a package that makes downloading data/backtesting very simple. However, I've found that even this has stopped functioning.

Did yahoo and google change their data policies surrounding FOREX data? Or am I doing something completely wrong?

The datareader and ffn are both trying to access this URL to no avail: Yahoo: http://ichart.finance.yahoo.com/table.csv

## Answer by Brian from QuantRocket (score 6, accepted)

https://quant.stackexchange.com/a/34260

Yahoo has changed their site structure. The new download URLs look like this:

https://query1.finance.yahoo.com/v7/finance/download/MSFT?period1=1463461200&period2=1494910800&interval=1d&events=history&crumb=lHxk.yfuuzZ

These links originate from pages like this: https://finance.yahoo.com/quote/MSFT/history?period1=1463461200&period2=1494910800&interval=1d&filter=history&frequency=1d

They've switched to Unix timestamps for the date format, and the download URL now validates a cookie (the `crumb` param in the query string), which means that anyone who wants to scrape the data will need to deal with cookies.

There's a fuller discussion at Elite Trader: https://www.elitetrader.com/et/threads/yahoo-historical-data-did-they-change-the-url-recently.309554/

## Answer by siegel (score 2)

https://quant.stackexchange.com/a/34253

They are trying to make this more difficult. In matlab, you can bypass it by pretending to be a chrome user using weboptions, and pretending to access from Chrome:

https://www.mathworks.com/help/matlab/ref/weboptions.html

```
options.UserAgent = 'Chrome';
```

Maybe something similar is possible in python?

## Answer by Denis Alaev (score 0)

https://quant.stackexchange.com/a/34751

It seems that after several changes Yahoo Finance closed their API forever. The API was closed on May 15, one month ago already.

I've tested several alternatives and found that https://eodhistoricaldata.com the best one for those who used Yahoo Finance. They provide raw data, adjusted closes and splits/dividends.

They also have CSV output, with very similar format for Yahoo Finance users. Also there is a https://intrinio.com/ data provider, looks good, but they much more expensive, have no data for Mutual Funds and API is very different in compare to Yahoo Finance. Then you need to significantly change your code.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.