-
Notifications
You must be signed in to change notification settings - Fork 121
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
Error when running fundlens #17
Comments
When I use different tickers (portfolio= ["TSLA","AMZN","FB","GOOG","AAPL"]), I get a different error: KeyError Traceback (most recent call last) pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc() pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc() pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item() pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item() KeyError: 'inventory' The above exception was the direct cause of the following exception: KeyError Traceback (most recent call last) ~/anaconda3/lib/python3.8/site-packages/empyrial.py in fundlens(my_portfolio, period) ~/anaconda3/lib/python3.8/site-packages/pandas/core/series.py in getitem(self, key) ~/anaconda3/lib/python3.8/site-packages/pandas/core/series.py in _get_value(self, label, takeable) ~/anaconda3/lib/python3.8/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance) KeyError: 'inventory' |
Thanks for raising the issue, just fixed it in the new version =) You can try it out here: https://colab.research.google.com/drive/1x22fJ5bnc5ZVwj05_k-cKarj9GXw5J8W?usp=sharing If it's ok for you, we can close this issue. |
Confirmed working with the new version. |
All functions ran perfectly except for fundlens. I got the following error:
KeyError Traceback (most recent call last)
in
8 )
9
---> 10 fundlens(portfolio)
~/anaconda3/lib/python3.8/site-packages/empyrial.py in fundlens(my_portfolio, period)
484
485 #book value
--> 486 book_value = yahoo_financials.get_book_value()
487
488 #operating income
~/anaconda3/lib/python3.8/site-packages/yahoofinancials/init.py in get_book_value(self)
794 # Financial Statement Data Methods
795 def get_book_value(self):
--> 796 return self._financial_statement_data('balance', 'balanceSheetHistoryQuarterly',
797 'totalStockholderEquity', 'quarterly')
798
~/anaconda3/lib/python3.8/site-packages/yahoofinancials/init.py in _financial_statement_data(self, stmt_type, stmt_code, field_name, freq)
685 except (IndexError, AttributeError, TypeError):
686 date_key = list(re_data[self.ticker][0])[0]
--> 687 data = re_data[self.ticker][0][date_key][field_name]
688 else:
689 data = {}
KeyError: 'totalStockholderEquity'
The text was updated successfully, but these errors were encountered: