-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting older data - is there a usage limit? #151
Comments
Unable to load the text file in the main so have attached here |
Do you have the symbol or symbols where we can view this behavior? And, what you’re expecting vs what’s being returned. |
It seems there may be a fix if you wait longer between calls. Is this something that would be worth trying? |
Ya, my guess is that YF is providing bad data when it detects programmatic requests with little time between. Might be a good idea to put in some class Ticker:
def __init__(self, ...):
... # all the other stuff
time.sleep_between = kwargs.get('sleep_between', SLEEP_BETWEEN_DEFAULT) Then the internal requests methods would need to be refactored slightly to account for that. |
Odd data issues do arise when spamming Yahoo, but cannot say if intentional e.g. might be different data sources? IMO best way to rate-limit is a specialised module like |
Much better way than I described above. Thanks @ValueRaider |
Awesome, cheers @dpguthrie and @ValueRider. I have tried the time.sleep at 1 sec and 5 sec and didn't work for me. Someone else in the discussions said that 1sec (time.sleep(1)) worked for them with only financial_data. Planning to give the IMO a trial now thank you! |
Hi guys, not sure if I'm doing something wrong but I trialed the following with @ValueRaider @dpguthrie: `import requests requests_cache.install_cache('yahoo_api_cache', expire_after=3600) rate_limiter = RateLimiter(max_calls=1, period=5) for ticker in Stocks:
|
Mistakenly closed |
@EnigmaNZ Your code looks like what ChatGPT would generate - nonsense. Just copy-paste the example in |
@ValueRaider Very true about ChatGPT. I pulled the logic from ChatGPT (ended up being nonsense as you said) but I could understand the logic behind what was produced by it so could attempt to fix in comparison to yfinance example. Prior to the mess around with ChatGPT, I attempted to copy-paste the example from yfinance readme but ended up with the screenshot errors attached (unfortunately for me this is where I turned to ChatGPT to see if I could try combine them and understand a bit more of how this function failed - didn't work though...). Also trialed with "yfinance.cache" to see if I needed to directly copy paste to get the same error. I'm pretty confident there is going to be a really simple fix to this but I have no idea where sorry. Also attached two versions of the code (with and without the commented out code for simplicity if it helps to not have the mess) |
Ah, with @dpguthrie Might be worth |
Describe the bug
I apologise if this has already been covered but I couldn't find a title that appeared to match:
I am grabbing a bit of data using the different functions listed below (in one script) and am getting up to date information on the initial one function but older info in the later functions (compared with the live values in Yahoo Finance). I've listed below the functions used and whether up to date or not:
Within financial_data:
currentPrice = Up to Date
totalCash = Up to Date
totalDebt = Up to Date
Within index_trend:
+5y growth estimates = Out of Date
Within key_stats:
priceToBook = Out of Date
enterpriseValue = Out of Date
Within summary_detail:
trailingPE = Out of Date
priceToSalesTrailing12Months = Out of Date
marketCap = Out of Date
Within cash_flow:
FreeCashFlow = Out of Date
To Reproduce
Attached a text file with the for function that's pulling the data of 15 stocks
Expected behavior
Up-to-date information
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: