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
(Optional) Set API key with .env file
It’s highly recommended to set your API key in a .env file to avoid
setting it in the code.
- Make a copy of the
.env.templatefile in the root directory of the project. - Rename the copied file to
.env. - Open the
.envfile and locate theSECAPIO_API_KEYvariable. - Fill in the value for the
SECAPIO_API_KEYvariable.- You can obtain a free key from sec-api.io.
- Note: The first 100 requests are free.
- Save the
.envfile 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
!pip install -q python-dotenv
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[:65] + '...')
<top-level-section-start-marker id="part1item1" title="Financial Statemen...
<span style="color:#000000;font-family:'Helvetica',sans-serif;fon...
<top-level-section-start-marker id="part1item2" title="Management's Discu...
<span style="color:#000000;font-family:'Helvetica',sans-serif;fon...
<top-level-section-start-marker id="part1item3" title="Quantitative and Q...
<span style="color:#000000;font-family:'Helvetica',sans-serif;fon...
<top-level-section-start-marker id="part1item4" title="Controls and Proce...
<span style="color:#000000;font-family:'Helvetica',sans-serif;fon...
<top-level-section-start-marker id="part2item1" title="Legal Proceedings"...
<span style="color:#000000;font-family:'Helvetica',sans-serif;fon...
<top-level-section-start-marker id="part2item1a" title="Risk Factors" com...
<span style="color:#000000;font-family:'Helvetica',sans-serif;fon...
<top-level-section-start-marker id="part2item2" title="Unregistered Sales...
<span style="color:#000000;font-family:'Helvetica',sans-serif;fon...
<top-level-section-start-marker id="part2item3" title="Defaults Upon Seni...
<span style="color:#000000;font-family:'Helvetica',sans-serif;fon...
<top-level-section-start-marker id="part2item4" title="Mine Safety Disclo...
<span style="color:#000000;font-family:'Helvetica',sans-serif;fon...
<top-level-section-start-marker id="part2item5" title="Other Information"...
<span style="color:#000000;font-family:'Helvetica',sans-serif;fon...
<top-level-section-start-marker id="part2item6" title="Exhibits" comment=...
<span style="color:#000000;font-family:'Helvetica',sans-serif;fon...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sec-api-io-0.0.7.tar.gz.
File metadata
- Download URL: sec-api-io-0.0.7.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b81d18ea118632c3ff49fefeba803f66be2f0259c7d76bde2cebec7493e8d75f
|
|
| MD5 |
21e7894505a8725124edb3407bd2f9ab
|
|
| BLAKE2b-256 |
ab4aa8279134f8e217975f0f94d7f39b800c9d3946c352f5232edd5e11ccbd51
|
File details
Details for the file sec_api_io-0.0.7-py3-none-any.whl.
File metadata
- Download URL: sec_api_io-0.0.7-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c08435e4880645021e915a97a623079142ff9fb518b56020edfe07c980f64ee2
|
|
| MD5 |
e4f7cc91b31284c02a39be0c39a167a1
|
|
| BLAKE2b-256 |
bcb22f82346696256a038c416d1cdfa72b50757f88536ddcefc53275c03ca13e
|