Skip to main content

Unofficial facade for the sec-api.io, SEC EDGAR 10-Q document downloader

Project description

sec-api-io

Install and Setup

Run in terminal:

pip install sec_api_io

How to use

Set API key

  1. Make a copy of the .env.template file in the root directory of the project.
  2. Rename the copied file to .env.
  3. Open the .env file and locate the SECAPIO_API_KEY variable.
  4. Fill in the value for the SECAPIO_API_KEY variable.
    • You can obtain a free key from sec-api.io.
    • Note: The first 100 requests are free.
  5. Save the .env file next to your notebook or script.

Important Note: Depending on your geographical location, you might need to use a VPN set to a United States location to access sec-api.io API.

Let’s load the API key from .env file into the environment variable SECAPIO_API_KEY

import os 
from dotenv import load_dotenv

if 'SECAPIO_API_KEY' not in os.environ:
    assert load_dotenv()

Get latest 10-Q report by ticker

from sec_api_io.secapio_data_retriever import SecapioDataRetriever

retriever = SecapioDataRetriever()
# retriever = SecapioDataRetriever(api_key=...) # If you don't want to use .env file

metadata = retriever.retrieve_report_metadata('10-Q', latest_from_ticker='AAPL')
url = metadata["linkToFilingDetails"]

assert url.startswith('https://www.sec.gov/Archives/edgar/data/')
url
'https://www.sec.gov/Archives/edgar/data/320193/000032019323000077/aapl-20230701.htm'

Download 10-Q HTML split into sections

html = retriever.get_report_html('10-Q', url)
assert html
for line in html.splitlines():
    print(line[:50] + '...')
<document-root-section comment="This tag was added...
<span style="color:#000000;font-family:'Helvetica'...
<document-root-section comment="This tag was added...
<span style="color:#000000;font-family:'Helvetica'...
<document-root-section comment="This tag was added...
<span style="color:#000000;font-family:'Helvetica'...
<document-root-section comment="This tag was added...
<span style="color:#000000;font-family:'Helvetica'...
<document-root-section comment="This tag was added...
<span style="color:#000000;font-family:'Helvetica'...
<document-root-section comment="This tag was added...
<span style="color:#000000;font-family:'Helvetica'...
<document-root-section comment="This tag was added...
<span style="color:#000000;font-family:'Helvetica'...
<document-root-section comment="This tag was added...
<span style="color:#000000;font-family:'Helvetica'...
<document-root-section comment="This tag was added...
<span style="color:#000000;font-family:'Helvetica'...
<document-root-section comment="This tag was added...
<span style="color:#000000;font-family:'Helvetica'...
<document-root-section comment="This tag was added...
<span style="color:#000000;font-family:'Helvetica'...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sec-api-io-0.0.3.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sec_api_io-0.0.3-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

Details for the file sec-api-io-0.0.3.tar.gz.

File metadata

  • Download URL: sec-api-io-0.0.3.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for sec-api-io-0.0.3.tar.gz
Algorithm Hash digest
SHA256 de35840775cd47dfcd78610fa26254053d7f87e10bce52cd7b11402b3b211fe6
MD5 8d243d465d90d3ed3a96ec26ea082eeb
BLAKE2b-256 a8feb3b2069a498a754dde35f258f1a01033fd3ba9dc2cad43f4c6f6da7cf702

See more details on using hashes here.

File details

Details for the file sec_api_io-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: sec_api_io-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for sec_api_io-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4f3603d12990a350f823c11d57928791a01b894fc8b590ad85f1486a1ad43be7
MD5 e8c76cc4798e603e8d467225f154ecdc
BLAKE2b-256 ede68f7cb8c1f3a9c6cb1e693edf21540a51373aede142eb4ed5632d8faec484

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page