AttributeError: 'EntityFilings' object has no attribute 'statements'
I have this code:
from edgar import *
company = Company('AAPL')
filings = company.get_filings(form="10-K").latest(9)
financials = MultiFinancials(filings)
balance_sheet = financials.balance_sheet()
I got this error:
File "/Users/user/PythonProject/example/.venv/lib/python3.9/site-packages/edgar/financials.py", line 77, in balance_sheet
return self.xbs.statements.balance_sheet()
AttributeError: 'EntityFilings' object has no attribute 'statements'
Do you know what I am doing wrong?
Thank you in advance!
Battling with this as well.
Great if we could get an update.
By the docs:
company = Company("AAPL") // Works
filings = company.latest("10-K", 5) // Works
financials = MultiFinancials(filings) // Returns None because AttributeError: 'EntityFilings' object has no attribute 'statements'
Using financials = MultiFinancials.extract(filings) at least returns a
Solved it.
def get_financials(ticker):
company = Company(ticker)
filings = company.latest("10-K", 5)
financials = MultiFinancials.extract(filings)
income_statement = financials.income_statement()
return repr(income_statement)
Remember to return repr( )
--
Will send a PR
Hi @Danfraga33 , wonder if you konw why I am getting this error: AttributeError: 'EntityData' object has no attribute 'latest'
I'm checking. Will update tomorrow
MultiFinancials.extract(filings) is the correct way instead of MultiFinancials(filings)
With the rewrite of XBRL we added XBRLS as the top level object for the multiple financials so the call was XBRLS(filings).
For legacy reasons. we retained MultiFinancials and inside of it we used xbs = XBRLS.from_filings(xbs).
So there are 2 ways to do this which isn't ideal. I will improve the documentation and then on the weekend think about how to streamline the API
Thank you, @dgunning MultiFinancials.extract(filings) works, but I got no data on Revenue for the last 10-K for AAPL:
company = Company('AAPL')
filings = company.get_filings(form="10-K").latest(9)
financials = MultiFinancials.extract(filings)
balance_sheet = financials.balance_sheet().to_dataframe()
income_statement = financials.income_statement().to_dataframe()
cash_flow = financials.cashflow_statement().to_dataframe()
print(financials.income_statement().render('html'))
Checking ... will let you know later
This is fixed in the latest release