s-leroux / fin

Set of tools for personal investment
MIT License
1 stars 0 forks source link

Download historical data from Yahoo! Finance in chunks #42

Closed s-leroux closed 2 months ago

s-leroux commented 2 months ago

The maximum length on Yahoo! Finance for historical data download is one year. We may overcome that limitation by downloading data in one-year chunks.

s-leroux commented 2 months ago

This was implemented in 0bfffe88e89f67b24227507d89d86f7c8c9d9eca

Note that apparently, you can now (as of 04-2024) download multi-year data in just one request:

https://query1.finance.yahoo.com/v7/finance/download/MCD?period1=-110197800&period2=1713269436&interval=1d&events=history&includeAdjustedClose=true

I don't know if this is a new policy by Yahoo! or if this is a temporary issue. Anyway, chunked downloads shouldn't hurt too much in my common use cases so I leave it for now. Maybe we can add an option to control that behavior?