54 lines
1.7 KiB
Python
54 lines
1.7 KiB
Python
import sys
|
|
from edgar import Company, set_identity
|
|
|
|
# Set your identity (required by SEC regulations)
|
|
# Replace with your actual email address
|
|
set_identity("your.email@example.com")
|
|
|
|
if len(sys.argv) != 2:
|
|
print("Usage: python get_company_details.py <TICKER>")
|
|
print("Example: python get_company_details.py AAPL")
|
|
sys.exit(1)
|
|
|
|
ticker = sys.argv[1].upper()
|
|
|
|
try:
|
|
company = Company(ticker)
|
|
|
|
if company.not_found:
|
|
print(f"Company with ticker '{ticker}' not found.")
|
|
sys.exit(1)
|
|
|
|
print(f"Company Details for {ticker}:")
|
|
print(f"Name: {company.name}")
|
|
print(f"CIK: {company.cik}")
|
|
print(f"Display Name: {company.display_name}")
|
|
print(f"Tickers: {', '.join(company.tickers)}")
|
|
print(f"Industry: {company.industry}")
|
|
print(f"SIC Code: {company.sic}")
|
|
print(f"Fiscal Year End: {company.fiscal_year_end}")
|
|
|
|
# Business address
|
|
address = company.business_address()
|
|
if address:
|
|
print(f"Business Address: {address.street1}")
|
|
if address.street2:
|
|
print(f" {address.street2}")
|
|
print(f" {address.city}, {address.state_or_country} {address.zipcode}")
|
|
|
|
# Mailing address (if different)
|
|
mailing = company.mailing_address()
|
|
if mailing and mailing != address:
|
|
print(f"Mailing Address: {mailing.street1}")
|
|
if mailing.street2:
|
|
print(f" {mailing.street2}")
|
|
print(f" {mailing.city}, {mailing.state_or_country} {mailing.zipcode}")
|
|
|
|
# Exchanges
|
|
exchanges = company.get_exchanges()
|
|
if exchanges:
|
|
print(f"Exchanges: {', '.join(exchanges)}")
|
|
|
|
except Exception as e:
|
|
print(f"Error retrieving company details: {e}")
|
|
sys.exit(1) |