Datamule XBRL

XBRL Archive

Full parsed XBRL facts, including attributes and contexts, stored as Zstd-compressed JSON files. Requires an XBRL subscription.

Download Archive

Use datamulehub.sec_filings_archive with the same filing filters and output options as the filings archive. See the archive documentation for the full arguments.

from datamulehub import sec_filings_archive


# Download JSON into batch_*.tar shards
sec_filings_archive.download_xbrl(
    cik=320193,
    submission_type="10-K",
    output_dir="apple_xbrl",
)

# Download one filing as an individual JSON file
sec_filings_archive.download_xbrl(
    accession=["0000320193-24-000123"],
    output_dir="filing_xbrl",
    tar_max_size_mb=None,
)

accession must be a non-empty list when supplied, including for one filing. Filters also support ticker, filing date, report date, and detected time.

By default, JSON files are packed into TAR shards up to 512 MB each. Set tar_max_size_mb=None to write filingDate/accession.json files. Set decompress=False to keep .json.zst files. The output directory must be empty unless overwrite=True is passed.

Simple XBRL

See the dataset documentation for download and query options, and products for pricing.

Schema

Table (14 rows)
ColumnType
accessionnumberint64
filingdatestring
_sourcekeystring
context_idint64
decimalsstring
dimensionsarray<struct<dimension:string,type:string,value:string>>
membersstring
namestring
period_end_datestring
period_start_datestring
precisionstring
taxonomystring
unitstring
valuestring

Note that members exists for legacy purposes. Please use the newer dimensions.

Query Database

Use datamulehub.databases.query to write an Athena query result as Parquet files:

from datamulehub import databases


databases.query(
    "SELECT * FROM simple_xbrl LIMIT 10",
    output_dir="simple_xbrl_sample",
)

Use read_query to return the rows in Python:

rows = databases.read_query("SELECT * FROM simple_xbrl LIMIT 10")
print(rows)

Download Dataset

from datamulehub import datasets


# Daily dataset plus recent filings, with duplicates removed
datasets.download("simple_xbrl", filename="simple_xbrl.parquet")

# Published daily dataset only
datasets.download(
    "simple_xbrl",
    filename="simple_xbrl_daily.parquet",
    from_storage="daily",
)

# Recent per-filing files only
datasets.download(
    "simple_xbrl",
    filename="simple_xbrl_delta.parquet",
    from_storage="delta",
)

from_storage="both" is the default. It combines the daily dataset with recent per-filing simple XBRL Parquet files from standard S3, excluding files already in the daily dataset. from_storage="delta" downloads only recent per-filing files.

Download by Accession

Download simple XBRL for one filing as a Parquet file:

from datamulehub import datasets


result = datasets.download(
    "simple_xbrl",
    accession=["0000320193-24-000123"],
    filename="filing_simple_xbrl.parquet",
)