ranaroussi / yfinance

Download market data from Yahoo! Finance's API
https://aroussi.com/post/python-yahoo-finance
Apache License 2.0
13.02k stars 2.31k forks source link

After so many requests, the timeout limit is always reached #1007

Closed BoeingConstrictor closed 1 year ago

BoeingConstrictor commented 2 years ago

READ BEFORE POSTING

Before posting an issue - please upgrade to the latest version and confirm the issue/bug is still there.

Upgrade using: $ pip install yfinance --upgrade --no-cache-dir

Bug still there? Delete this content and submit your bug report here...

I am running analysis each day on 8-10 stocks over a 365 day period, and after about 90 days of analysis the ticker.history function is continually reaching the timeout limit of 5 seconds, and returns nothing. Is this an issue with the scraper, or some sort of Yahoo internal limit?

ValueRaider commented 2 years ago

My understanding is this is Yahoo rate-limiting API access. So you have to rate-limit your own data requests, implement some form of caching.

... which is why I'm working on a caching wrapper for yf, because everyone has this issue. Smart caching that only contacts Yahoo if enough time has passed for new data, and then only requests the new data and integrates it into cache. Not simply caching http requests. Not quite ready yet but close, so feel free to follow me.

AnatoleT commented 2 years ago

Hi @ValueRaider, I'm searching a cache solution too on YF. Did you release yours ?

ValueRaider commented 2 years ago

Hi @ValueRaider, I'm searching a cache solution too on YF. Did you release yours ?

It's almost ready. Just fixing some type issues (date vs datetime vs pd.Timestamp)

ValueRaider commented 2 years ago

@AnatoleT Actually I also need one significant yfinance fix to be tested, can you volunteer? Info here: https://github.com/ranaroussi/yfinance/issues/954#issuecomment-1182558587

AnatoleT commented 2 years ago

Hi @ValueRaider, I'm searching a cache solution too on YF. Did you release yours ? It's almost ready. Just fixing some type issues (date vs datetime vs pd.Timestamp)

Awesome, excited to try your new versions. Sure, I'll clone your branch and give you some feedback.