Closed david08-08 closed 2 weeks ago
Can you post the error here? Thanks
if name == 'main': output_path = Path('/Users/name/Documents/Apple_Financials_2013_2023.xlsx')
with output_path.open('wb') as f:
with ExcelWriter(f, engine='xlsxwriter') as writer:
for year in range(2013, 2023 + 1):
try:
# Retrieve the 10-K filing for the given year
filings = Company("AAPL").get_filings(form="10-K")
filing_for_year = next(filing for filing in filings if filing.filing_date.year == year)
# Process the XBRL data for the filing
xbrl = filing_for_year.xbrl()
# Write the statements to the Excel workbook
write_statements(xbrl, writer, year)
except StopIteration:
print(f"No 10-K filing found for year {year}")
except Exception as e:
print(f"Error processing year {year} for AAPL: {str(e)}")
This is implemented in the latest version
from edgar import *
company = Company("MSFT")
filings = company.get_filings(form="10-K").latest(9)
financials = MultiFinancials(filings)
financials.get_balance_sheet()
financials.get_cash_flow_statement()
financials.get_income_statement()
filings represents multiple filings. You need a single one. Use filings[0] or filings.latest(1)On Oct 5, 2024, at 8:19 PM, unparadise @.> wrote: I am testing pulling financial data from XBRL. But the following code is giving me grief. ''' from edgar import set_identity("Frank Chen **@.***") filings = Company("AAPL").get_filings(form="10-K") print(filings.xbrl()) ''' Error message Traceback (most recent call last): File "/path_to_file/edgar_xbrl_test.py", line 6, in print(filings.xbrl()) ^^^^^^^^^^^^ AttributeError: 'EntityFilings' object has no attribute 'xbrl' What's the right way to access the xbrl object? Thank you very much!
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
Dgunning, thank you for your reply. I was able to figure out the problem myself. I opened another issue regarding some data missing from the return of the XBRL get_statement function.
I am trying to pull 10-K for multiple years but I keep getting an error in the output. Can someone please give me some guidance on how to put the code together for this task. Below is what I put together but I keep getting an error. Thank you.
if name == 'main': output_path = Path('/Users/name/Documents/Apple_Financials_2013_2023.xlsx')