-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 7400174
Showing
23 changed files
with
5,820 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Sitemap: https://Elijas.github.io/sec-downloader/sitemap.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[ | ||
{ | ||
"objectID": "index.html", | ||
"href": "index.html", | ||
"title": "sec-downloader", | ||
"section": "", | ||
"text": "A better version of sec-edgar-downloader. Includes an alternative implementation (a wrapper instead of a fork), to keep compatibility with new sec-edgar-downloader releases. This library partially uses nbdev." | ||
}, | ||
{ | ||
"objectID": "index.html#download-the-metadata", | ||
"href": "index.html#download-the-metadata", | ||
"title": "sec-downloader", | ||
"section": "Download the metadata", | ||
"text": "Download the metadata\n\nNote The company name and email address are used to form a user-agent string that adheres to the SEC EDGAR’s fair access policy for programmatic downloading. Source\n\n\nfrom sec_downloader import Downloader\n\ndl = Downloader(\"MyCompanyName\", \"[email protected]\")\n\nFind a filing with an Accession Number\n\nmetadatas = dl.get_filing_metadatas(\"AAPL/0000320193-23-000077\")\nprint(metadatas)\n\n[FilingMetadata(accession_number='0000320193-23-000077',\n form_type='10-Q',\n primary_doc_url='https://www.sec.gov/Archives/edgar/data/320193/000032019323000077/aapl-20230701.htm',\n items='',\n primary_doc_description='10-Q',\n filing_date='2023-08-04',\n report_date='2023-07-01',\n cik='0000320193',\n company_name='Apple Inc.',\n tickers=[Ticker(symbol='AAPL', exchange='Nasdaq')])]\n\n\nAlternatively, you can also use any of these to get the same answer:\nmetadatas = dl.get_filing_metadatas(\"aapl/000032019323000077\")\nmetadatas = dl.get_filing_metadatas(\"320193/000032019323000077\")\nmetadatas = dl.get_filing_metadatas(\"320193/0000320193-23-000077\")\nmetadatas = dl.get_filing_metadatas(\"0000320193/0000320193-23-000077\")\nmetadatas = dl.get_filing_metadatas(CompanyAndAccessionNumber(ticker_or_cik=\"320193\", accession_number=\"0000320193-23-000077\"))\nFind the filing matching a SEC EDGAR Filing URL. Only CIK and Accession Number are used from the URL:\n\nmetadatas = dl.get_filing_metadatas(\n \"https://www.sec.gov/ix?doc=/Archives/edgar/data/0001067983/000119312523272204/d564412d8k.htm\"\n)\nprint(metadatas)\n\n[FilingMetadata(accession_number='0001193125-23-272204',\n form_type='8-K',\n primary_doc_url='https://www.sec.gov/Archives/edgar/data/1067983/000119312523272204/d564412d8k.htm',\n items='2.02,9.01',\n primary_doc_description='8-K',\n filing_date='2023-11-07',\n report_date='2023-11-04',\n cik='0001067983',\n company_name='BERKSHIRE HATHAWAY INC',\n tickers=[Ticker(symbol='BRK-B', exchange='NYSE'),\n Ticker(symbol='BRK-A', exchange='NYSE')])]\n\n\nAlternatively, you can also URLs in other formats and get the same answer:\nmetadatas = dl.get_filing_metadatas(\"https://www.sec.gov/Archives/edgar/data/1067983/000119312523272204/d564412d8k.htm\")\nFind latest filings by company ticker or CIK:\n\nfrom sec_downloader.types import RequestedFilings\n\nmetadatas = dl.get_filing_metadatas(\n RequestedFilings(ticker_or_cik=\"MSFT\", form_type=\"10-K\", limit=2)\n)\nprint(metadatas)\n\n[FilingMetadata(accession_number='0000950170-23-035122',\n form_type='10-K',\n primary_doc_url='https://www.sec.gov/Archives/edgar/data/789019/000095017023035122/msft-20230630.htm',\n items='',\n primary_doc_description='10-K',\n filing_date='2023-07-27',\n report_date='2023-06-30',\n cik='0000789019',\n company_name='MICROSOFT CORP',\n tickers=[Ticker(symbol='MSFT', exchange='Nasdaq')]),\n FilingMetadata(accession_number='0001564590-22-026876',\n form_type='10-K',\n primary_doc_url='https://www.sec.gov/Archives/edgar/data/789019/000156459022026876/msft-10k_20220630.htm',\n items='',\n primary_doc_description='10-K',\n filing_date='2022-07-28',\n report_date='2022-06-30',\n cik='0000789019',\n company_name='MICROSOFT CORP',\n tickers=[Ticker(symbol='MSFT', exchange='Nasdaq')])]\n\n\nAlternatively, you can also use any of these to get the same answer:\nmetadatas = dl.get_filing_metadatas(\"2/msft/10-K\")\nmetadatas = dl.get_filing_metadatas(\"2/789019/10-K\")\nmetadatas = dl.get_filing_metadatas(\"2/0000789019/10-K\")\nThe parameters limit and form_type are optional. If omitted, limit defaults to 1, and form_type defaults to ‘10-Q’.\n\nmetadatas = dl.get_filing_metadatas(\"NFLX\")\nprint(metadatas)\n\n[FilingMetadata(accession_number='0001065280-23-000273',\n form_type='10-Q',\n primary_doc_url='https://www.sec.gov/Archives/edgar/data/1065280/000106528023000273/nflx-20230930.htm',\n items='',\n primary_doc_description='10-Q',\n filing_date='2023-10-20',\n report_date='2023-09-30',\n cik='0001065280',\n company_name='NETFLIX INC',\n tickers=[Ticker(symbol='NFLX', exchange='Nasdaq')])]\n\n\nAlternatively, you can also use any of these to get the same answer:\nmetadatas = dl.get_filing_metadatas(\"nflx\")\nmetadatas = dl.get_filing_metadatas(\"1/NFLX\")\nmetadatas = dl.get_filing_metadatas(\"NFLX/10-Q\")\nmetadatas = dl.get_filing_metadatas(\"1/NFLX/10-Q\")\nmetadatas = dl.get_filing_metadatas(RequestedFilings(ticker_or_cik=\"NFLX\"))\nmetadatas = dl.get_filing_metadatas(RequestedFilings(limit=1, ticker_or_cik=\"NFLX\", form_type=\"10-Q\"))" | ||
}, | ||
{ | ||
"objectID": "index.html#download-the-html-files", | ||
"href": "index.html#download-the-html-files", | ||
"title": "sec-downloader", | ||
"section": "Download the HTML files", | ||
"text": "Download the HTML files\nAfter obtaining the Primary Document URL, for example from the metadata, you can proceed to download the HTML using this URL.\n\nfor metadata in metadatas:\n html = dl.download_filing(url=metadata.primary_doc_url).decode()\n print(html[:50])\n break # same for all filings, let's just print the first one\n\n'<?xml version=\"1.0\" ?><!--XBRL Document Created wi'" | ||
}, | ||
{ | ||
"objectID": "00_types.html", | ||
"href": "00_types.html", | ||
"title": "sec-downloader", | ||
"section": "", | ||
"text": "source\n\nFilingMetadata\n\n FilingMetadata (accession_number:str, form_type:str, primary_doc_url:str,\n items:str, primary_doc_description:str, filing_date:str,\n report_date:str, cik:str, company_name:str,\n tickers:list[__main__.Ticker])\n\n\nsource\n\n\nTicker\n\n Ticker (symbol:str, exchange:str)\n\n\nsource\n\n\nRequestedFilings\n\n RequestedFilings (ticker_or_cik:str, form_type:str='10-Q', limit:int=1)\n\n\n# Define test cases and expected results\ntest_cases = [\n (\"3/AAPL/10-Q\", RequestedFilings(limit=3, ticker_or_cik=\"AAPL\", form_type=\"10-Q\")),\n (\"MSFT/10-K\", RequestedFilings(ticker_or_cik=\"MSFT\", form_type=\"10-K\")),\n (\"1/GOOG\", RequestedFilings(limit=1, ticker_or_cik=\"GOOG\")),\n (\"BRK.A\", RequestedFilings(ticker_or_cik=\"BRK.A\")),\n]\n\n# Run test cases and assert expected results\nfor test_string, expected in test_cases:\n result = RequestedFilings.from_string(test_string)\n assert (\n result == expected\n ), f\"Test case failed for input: {test_string}. Expected: {expected}, Got: {result}\"\n\n\nsource\n\n\nCompanyAndAccessionNumber\n\n CompanyAndAccessionNumber (ticker_or_cik:str, accession_number:str)\n\n\ntest_cases = [\n (\n \"AAPL/0000320193-20-000052\",\n CompanyAndAccessionNumber(\n ticker_or_cik=\"AAPL\", accession_number=\"0000320193-20-000052\"\n ),\n ),\n (\n \"0001193125/000119312520036918\",\n CompanyAndAccessionNumber(\n ticker_or_cik=\"0001193125\", accession_number=\"000119312520036918\"\n ),\n ),\n (\n \"1193125/000119312520036918\",\n CompanyAndAccessionNumber(\n ticker_or_cik=\"1193125\", accession_number=\"000119312520036918\"\n ),\n ),\n (\"INVALID_STRING\", None),\n]\n\nfor test_input, expected in test_cases:\n result = CompanyAndAccessionNumber.from_string(test_input, must_match=False)\n assert (\n result == expected\n ), f\"Test case failed for input: {test_input}. Expected: {expected}, Got: {result}\"" | ||
} | ||
] |
Oops, something went wrong.