Edgar Data
Overview
One of the easiest methods of retrieving edgar data is to use the python edgartools library.
It connects to the edgar site and pulls data using the edgar api into memory.
In order to connect to edgar, you must provide a valid email to identify yourself.
(Note: it doesnt require an API key)
Setup
To connect to edgar and pull the data, you need to install edgartools in your
Python environment.
pip install edgartools
Sample Code
from edgar import set_identity, Company
# 1. Identify yourself to the SEC (Required)
#set_identity("Your Name your.email@example.com")
set_identity("john.doe@mail.com")
# 2. Get company data by ticker
company = Company("AAPL")
# 3. Pull the latest financial reports
financials = company.get_financials()
# 4. View specific financial statements as DataFrames
income_statement = financials.income_statement()
print(income_statement)
df = income_statement.to_dataframe()
list_of_dicts = df.to_dict(orient='records')