Skip to content

Instantly share code, notes, and snippets.

View janlukasschroeder's full-sized avatar
🎯
Focusing

Jan janlukasschroeder

🎯
Focusing
View GitHub Profile
[
{
"name": "Aaon Inc",
"ticker": "AAON",
"cik": "824142",
"cusip": "000360206",
"exchange": "NASDAQ",
"isDelisted": false,
"category": "Domestic Common Stock",
"sector": "Basic Materials",
[
{
"name": "International Business Machines Corp",
"ticker": "IBM",
"cik": "51143",
"cusip": "459200101",
"exchange": "NYSE",
"isDelisted": false,
"category": "Domestic Common Stock",
"sector": "Technology",
[
{
"name": "AYRO Inc",
"ticker": "AYRO",
"cik": "1086745",
"cusip": "054748108 92931L302 92931L401 26210U203 26210U104 92931L203 92931L104",
"exchange": "NASDAQ",
"isDelisted": false,
"category": "Domestic Common Stock",
"sector": "Consumer Cyclical",
[
{
"name": "Tesla Inc",
"ticker": "TSLA",
"cik": "1318605",
"cusip": "88160R101",
"exchange": "NASDAQ",
"isDelisted": false,
"category": "Domestic Common Stock",
"sector": "Consumer Cyclical",
from sec_api import XbrlApi
xbrlApi = XbrlApi("YOUR_API_KEY")
# 10-K HTM File URL example
xbrl_json = xbrlApi.xbrl_to_json(
htm_url="https://www.sec.gov/Archives/edgar/data/320193/000032019320000096/aapl-20200926.htm"
)
# access income statement, balance sheet and cash flow statement
@janlukasschroeder
janlukasschroeder / 10-k-section-extraction-api.py
Last active June 12, 2022 13:11
Extract any section from 10-K and 10-Q SEC filings
from sec_api import ExtractorApi
extractorApi = ExtractorApi("YOUR_API_KEY")
# Tesla 10-K filing
filing_url = "https://www.sec.gov/Archives/edgar/data/1318605/000156459021004599/tsla-10k_20201231.htm"
# get the standardized and cleaned text of section 1A "Risk Factors"
section_text = extractorApi.get_section(filing_url, "1A", "text")
import requests
api_endpoint = "https://api.sec-api.io/extractor"
# 10-K filing URL
filing_url = "https://www.sec.gov/Archives/edgar/data/1318605/000156459021004599/tsla-10k_20201231.htm"
# list the items you want to extract.
# seperate multiple items with comma, e.g. "1A,2,5"
item = "1A"
{
"BalanceSheets": {
"CashAndCashEquivalentsAtCarryingValue": [
{
"decimals": "-6",
"unitRef": "usd",
"period": {
"instant": "2020-09-26"
},
"value": "38016000000"
{
"StatementsOfIncome": {
"RevenueFromContractWithCustomerExcludingAssessedTax": [
{
"decimals": "-6",
"unitRef": "usd",
"period": {
"startDate": "2019-09-29",
"endDate": "2020-09-26"
},
{
"CoverPage": {
"DocumentType": "10-K",
"DocumentAnnualReport": "true",
"DocumentPeriodEndDate": "2020-09-26",
"DocumentTransitionReport": "false",
"EntityFileNumber": "001-36743",
"EntityRegistrantName": "Apple Inc.",
"EntityIncorporationStateCountryCode": "CA",
"EntityTaxIdentificationNumber": "94-2404110",