-
Notifications
You must be signed in to change notification settings - Fork 157
Open
Description
Hello - I am using package “sec_edgar_downloader" (version 5.0.3), downloaded from pypi.org.
The package installs correctly, and I believe I am using the most recent version. When I run function dl.get for a given ticker the returned object lists a number, but no file names. When I check my directory structure, no files appear to be downloaded. See example code below:
import os
import pandas as pd
from sec_edgar_downloader import Downloader
def Find_Edgar_Data_for_Tickers(banks_csv, download_folder, email_address):
"""
Reads a CSV file with bank names and tickers, then downloads the latest 10-K filing for each valid ticker
using the SEC EDGAR database. The downloaded filings are saved in the specified output folder.
Parameters:
banks_csv (str): Path to the CSV file containing bank data. Must include "Bank Name" and "Ticker".
download_folder (str): Folder where the downloaded filings will be saved.
email_address (str): Email address required by the SEC EDGAR Downloader.
"""
# Create the download folder if it does not exist
if not os.path.exists(download_folder):
os.makedirs(download_folder)
# Read CSV file into a DataFrame
try:
df = pd.read_csv(banks_csv)
except Exception as e:
print(f"Error reading CSV file '{banks_csv}': {e}")
return
# Initialize the SEC EDGAR Downloader with the given folder and email address
dl = Downloader(download_folder, email_address)
# Process each row in the DataFrame
for index, row in df.iterrows():
bank_name = row.get("Bank Name", "Unknown Bank")
ticker = str(row.get("Ticker", "")).strip()
if not ticker or ticker.lower() == "ticker not found":
print(f"Skipping {bank_name}: No valid ticker provided.")
continue
try:
print(f"\nDownloading latest 10-K for {bank_name} (Ticker: {ticker})...")
# dl.get returns a list of file paths for the downloaded filings
downloaded_files = dl.get("10-K", ticker)
print(f"Downloaded files for {ticker}: {downloaded_files}")
except Exception as e:
print(f"Error downloading 10-K for {ticker} ({bank_name}): {e}")
I have checked the documentation and believe I am doing everything correctly. Can you help?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels