Skip to content

Instantly share code, notes, and snippets.

@anshoomehra
Last active November 25, 2025 00:38
Show Gist options
  • Select an option

  • Save anshoomehra/ead8925ea291e233a5aa2dcaa2dc61b2 to your computer and use it in GitHub Desktop.

Select an option

Save anshoomehra/ead8925ea291e233a5aa2dcaa2dc61b2 to your computer and use it in GitHub Desktop.
How to Parse 10-K Report from EDGAR (SEC)
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thegallier

Copy link
Copy Markdown

i think the line below assumes same number of entries for all items, which is not necessarily the case for example nyt. in that case there are more item 1A items then 1B and the approach does not work. I would also add re.IGNORECASE to the re.compile

pos_dat = test_df.sort_values('start', ascending=True).drop_duplicates(subset=['item'], keep='last')

@VadarVillage

Copy link
Copy Markdown

This was very helpful, thank you for taking the time to post this

@niravsatani24

Copy link
Copy Markdown

Amazing! Thanks for sharing.

@rabsher

rabsher commented Dec 4, 2023

Copy link
Copy Markdown

i have Html url i dont know how to get txt url of 10k file after that I am able to use above notebook code

any one can help me please

@versatile712

Copy link
Copy Markdown

Jesus, you saved my life!

@Tarun3679

Copy link
Copy Markdown

I just tried this, and it does not seem to return anything for the example above?

@rabsher

rabsher commented Mar 24, 2025

Copy link
Copy Markdown

I just tried this, and it does not seem to return anything for the example above?

import requests
url = "https://www.sec.gov/Archives/edgar/data/1571996/000157199624000036/dell-20240202.htm" must be .htm
  headers = {
       "User-Agent": 'get it from sec website',  # by SEC website
       'Accept-Encoding': 'gzip, deflate',
       'Host': 'www.sec.gov'
   }
   response = requests.get(file_url, headers=headers)
   html_content = response.text.replace('\xa0', ' ')

you can use this code to parse a 10kfile Once you have HTML you can create your regex function to parse specific content from HTML, or you can get a complete 10k filing as text

@Tarun3679

Copy link
Copy Markdown

Does anyone know any such similar script to retrieve 10-Q?

@john-friedman

Copy link
Copy Markdown

@Tarun3679
https://github.com/john-friedman/datamule-python

from datamule import Portfolio

portfolio = Portfolio('10q')
portfolio.download_submissions(submission_type='10-Q',ticker='MSFT')

for document in portfolio.document_type('10-Q'):
  document.parse()
  print(document.data)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment