JECSand / yahoofinancials

A powerful financial data module used for pulling data from Yahoo Finance. This module can pull fundamental and technical data for stocks, indexes, currencies, cryptos, ETFs, Mutual Funds, U.S. Treasuries, and commodity futures.
https://pypi.python.org/pypi/yahoofinancials
MIT License
911 stars 215 forks source link

Get_financial_stmts still return None #75

Closed syrakusmrdrte closed 1 year ago

syrakusmrdrte commented 4 years ago

I have tried and tried to search for solutions, but ticker="AAPL" YahooFinancials(ticker).get_financial_stmts("annual",["income","cash","balance"]) returns {'incomeStatementHistory': {'AAPL':None}, 'cashflowStatementHistory':{'AAPL':None}, 'balanceSheetHistory':{'AAPL':None}}

Is there any way to solve this so that I get the financial statements?

CDCDM1986 commented 4 years ago

I have got the same issue. Anyone has any insight?

biggestT commented 4 years ago

Also had the same issue after adding the BeautifulSoup fix, that I got these None results.

@syrakusmrdrte, @CDCDM1986 I Fixed it by adding the second user-agent header change fix. Perhaps Yahoo is blocking the previous one, but seems like they at least respond HTTP 200 so not sure.

Wenseslaus commented 4 years ago

Hey biggestT. I did quite understand your solution.

avelaga commented 4 years ago

wow @biggestT thank you that fixed it!!

Frodriguez9 commented 4 years ago

wow @biggestT thank you that fixed it!!

Can you tell me what did you do?

Frodriguez9 commented 4 years ago

Also had the same issue after adding the BeautifulSoup fix, that I got these None results.

@syrakusmrdrte, @CDCDM1986 I Fixed it by adding the second user-agent header change fix. Perhaps Yahoo is blocking the previous one, but seems like they at least respond HTTP 200 so not sure.

I'm sorry, I am a beginner programer. I am not sure what to do with that information, can you tell me how to actually apply your solution?

My biggest appreciation in advance!

avelaga commented 4 years ago

@Frodriguez9 i made the edits in the yahoofinancials/__init__.py that was linked to. here's the fully fixed file that works for me - https://gist.github.com/avelaga/762142a778c2e3a969fbb78ec351d6e8

you want to replace /yahoofinancials/__init__.py with this fixed __init__.py file. if you can't find the package, run the following: python3 to open a python shell

import sys
print(sys.path)
exit()

to find the python path and search through those to find yahoofinancials

these are the file paths where i found it on different machines: in aws: /usr/local/lib/python3.7/site-packages/yahoofinancials in raspian: /home/pi/.local/lib/python3.7/site-packages/yahoofinancials in macos: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/yahoofinancials

hope that helps!

Frodriguez9 commented 4 years ago

@avelaga thank you so much! it worked!.

I was telling a friend that one of the things I've enjoyed the most since I started to become involved with IT was to find such helpful community of programers. You guys are always willing to assist others.

No wonder why IT keeps evolving more rapidly than all other industries combined. Thank you so much!

avelaga commented 4 years ago

@Frodriguez9 awesome!! yeah the online community is amazing, i've gotten a ton of help myself on reddit especially. its an amazing field and really rewarding to share it with others. im glad i could help :)

wwang184 commented 3 years ago

@biggestT That solution works for me too! Many thanks!