A simple library to interact with and retrieve information from the SEC Edgar Data.
- OS
- pandas
- requests
- bs4
To install the required dependencies, run:
pip install -r requirements.txtExtracts 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
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
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
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
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
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
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
Converts the URL to direct XLSX files.
Usage:
from SECedgarpyProcessing import URLtoXLSX
xlsx_urls = URLtoXLSX(["url1", "url2"])
print(xlsx_urls)Concepts Used:
- URL manipulation