SECEdgar-Python
A simple library to interact with and retrieve information from the SEC Edgar Data.
Dependencies:
- OS
- pandas
- requests
- bs4
Installation
To install the required dependencies, run:
pip install -r requirements.txt
Functions
CIKExtractor() -> list
Extracts the CIK for S&P 500 companies from Wikipedia.
Usage:
from SECedgarpyExtractor import CIKExtractor
cik_list = CIKExtractor()
print(cik_list)
Concepts Used:
- Web scraping using
requestsandBeautifulSoup - Error handling for HTTP requests
GetAllSP500CSV()
Gets all the S&P 500 info in the form of a CSV.
Usage:
from SECedgarpyExtractor import GetAllSP500CSV
GetAllSP500CSV()
Concepts Used:
- Web scraping using
pandas - Saving data to CSV
getCSVfile(URLlist: list[str], nameOfFile: str) -> None
Downloads the XLSX file from the list of URLs and converts them to CSV.
Usage:
from SECedgarpyDownloading import getCSVfile
getCSVfile(["url1", "url2"], "output_file")
Concepts Used:
- HTTP requests
- File handling
- Data conversion using
pandas
getXLSXfile(URLlist: list[str], nameOfFile: str) -> None
Downloads the XLSX file from the list of URLs.
Usage:
from SECedgarpyDownloading import getXLSXfile
getXLSXfile(["url1", "url2"], "output_file")
Concepts Used:
- HTTP requests
- File handling
GenerateCSVreport(nameOfFile)
Generates a CSV report by filtering and keeping the necessary sheets only.
Usage:
from SECedgarpyDownloading import GenerateCSVreport
GenerateCSVreport("input_file")
Concepts Used:
- Data filtering
- Data merging using
pandas
download_and_convert_filtered_xlsx(URLlist: list[str], nameOfFile: str, target_sheets: list[str]) -> None
Downloads and converts filtered XLSX files to CSV.
Usage:
from SECedgarpyDownloading import download_and_convert_filtered_xlsx
download_and_convert_filtered_xlsx(["url1", "url2"], "output_file", ["sheet1", "sheet2"])
Concepts Used:
- HTTP requests
- Data filtering
- Data conversion using
pandas
filter_and_convert_to_csv(xlsx_file_path: str, csv_file_path: str, target_sheets: list[str]) -> None
Filters relevant sheets and converts them to CSV.
Usage:
from SECedgarpyDownloading import filter_and_convert_to_csv
filter_and_convert_to_csv("input.xlsx", "output.csv", ["sheet1", "sheet2"])
Concepts Used:
- Data filtering
- Data conversion using
pandas
filterfunc(a: list) -> bool
Filters out and gets only the 10-K reports.
Usage:
from SECedgarpyProcessing import filterfunc
filtered_list = filter(filterfunc, data_list)
Concepts Used:
- Data filtering using custom functions
extract10Kurl(cikval: str) -> list
Extracts the URL using the CIK which is passed into the function.
Usage:
from SECedgarpyProcessing import extract10Kurl
urls = extract10Kurl("0000320193")
print(urls)
Concepts Used:
- API requests
- Data extraction and transformation
URLtoXLSX(URLlist: list[str]) -> list
Converts the URL to direct XLSX files.
Usage:
from SECedgarpyProcessing import URLtoXLSX
xlsx_urls = URLtoXLSX(["url1", "url2"])
print(xlsx_urls)
Concepts Used:
- URL manipulation
Metadata
Release files for SECEdgar-Python 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| secedgar_python-0.1.1.tar.gz | 5.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| SECEdgar_Python-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.6 kB
Release files / secedgar_python-0.1.1.tar.gz
| Download URL | secedgar_python-0.1.1.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7fc778c8865ea4f42370566213e53f3cb7ccb2fb5b44d3fa98eb9531dfbc046f
|
|
BLAKE2b-256 checksum How to use checksums |
e52b73b61a420e0f9310b4ce0d3aebfcba10e142e06a8895b7eb2ff2ae41c9f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.6
|
Release files / SECEdgar_Python-0.1.1-py3-none-any.whl
| Download URL | SECEdgar_Python-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5866b18946d51773738e5387ae427e2732f32703bb71dad79cb72ef645fb5473
|
|
BLAKE2b-256 checksum How to use checksums |
1e6c483c5d9a60d582b04347b1b56c1c5e5933bbc9c6b07d0d60a1d75231d992
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.6
|