Liking cljdoc? Tell your friends :D

edgar.fsds

SEC Financial Statement Data Sets (DERA) access. https://www.sec.gov/dera/data/financial-statement-data-sets

Quarterly ZIPs containing four tab-delimited tables: sub — one row per submission: adsh, cik, name, sic, form, period, fy, fp, filed, and filer metadata num — one row per numeric fact: adsh, tag, version, ddate, qtrs, uom, segments, value pre — statement placement: adsh, stmt (BS/IS/CF/EQ/CI), report, line, tag — i.e. which statement each tag appeared on and in what order tag — tag metadata: version, custom flag, datatype, iord (instant/ duration), crdr (credit/debit), label, documentation

Why this matters for standardization: unlike the companyfacts API, these sets include company extension tags and statement placement — the two ingredients Compustat-style cross-company standardization needs most. One bulk download covers every filer for a quarter, instead of one HTTP call per company.

Two access styles:

  1. Managed (what the :compustat statement view uses): enable the local quarter cache and let per-filing contexts stream what they need — (fsds/enable-cache!) ; or (e/enable-fsds!) (fsds/annual-filing-context "1018724" "2026-02-06") ;=> {:adsh ... :placement {tag #{"IS" ...}} :is-extension-values [...]}

  2. Manual table access for ad-hoc analysis: (require '[edgar.fsds :as fsds]) (def zip (fsds/download-quarter! 2026 1 "/data/fsds")) (def sub (fsds/load-table zip :sub)) (def pre (fsds/load-table zip :pre)) (def num (fsds/load-table zip :num)) ; millions of rows — needs heap

;; Find a company's filing in the quarter: (def adsh (-> (fsds/find-submissions sub :cik "1018724" :form "10-K") (ds/column :adsh) first))

;; Income statement exactly as presented — extension tags included ;; (their :version is the filing's adsh instead of a us-gaap release): (fsds/presentation pre adsh :stmt "IS")

;; Which statement does each tag sit on? The Compustat-reclass guard ;; question: D&A on "CF" only means it is embedded in the income ;; statement expense lines (strip it); D&A presented on "IS" means ;; the expense lines already exclude it: (get (fsds/statement-placement pre adsh) "DepreciationDepletionAndAmortization") ;=> #{"CF"} for AMZN

;; Values for extension tags the companyfacts API cannot see (e.g. ;; AMZN's Fulfillment / Technology and infrastructure, which Compustat ;; folds into XSGA/XRD — FY2025 TechnologyAndInfrastructureExpense ;; equals Compustat XRD exactly): (fsds/facts-for num adsh :qtrs 4 :tag "FulfillmentExpense")

SEC Financial Statement Data Sets (DERA) access.
https://www.sec.gov/dera/data/financial-statement-data-sets

Quarterly ZIPs containing four tab-delimited tables:
  sub — one row per submission: adsh, cik, name, sic, form, period,
        fy, fp, filed, and filer metadata
  num — one row per numeric fact: adsh, tag, version, ddate, qtrs,
        uom, segments, value
  pre — statement placement: adsh, stmt (BS/IS/CF/EQ/CI), report, line,
        tag — i.e. which statement each tag appeared on and in what order
  tag — tag metadata: version, custom flag, datatype, iord (instant/
        duration), crdr (credit/debit), label, documentation

Why this matters for standardization: unlike the companyfacts API, these
sets include company extension tags and statement placement — the two
ingredients Compustat-style cross-company standardization needs most.
One bulk download covers every filer for a quarter, instead of one HTTP
call per company.

Two access styles:

1. Managed (what the :compustat statement view uses): enable the local
   quarter cache and let per-filing contexts stream what they need —
     (fsds/enable-cache!)                        ; or (e/enable-fsds!)
     (fsds/annual-filing-context "1018724" "2026-02-06")
     ;=> {:adsh ... :placement {tag #{"IS" ...}} :is-extension-values [...]}

2. Manual table access for ad-hoc analysis:
  (require '[edgar.fsds :as fsds])
  (def zip (fsds/download-quarter! 2026 1 "/data/fsds"))
  (def sub (fsds/load-table zip :sub))
  (def pre (fsds/load-table zip :pre))
  (def num (fsds/load-table zip :num))     ; millions of rows — needs heap

  ;; Find a company's filing in the quarter:
  (def adsh (-> (fsds/find-submissions sub :cik "1018724" :form "10-K")
                (ds/column :adsh) first))

  ;; Income statement exactly as presented — extension tags included
  ;; (their :version is the filing's adsh instead of a us-gaap release):
  (fsds/presentation pre adsh :stmt "IS")

  ;; Which statement does each tag sit on? The Compustat-reclass guard
  ;; question: D&A on "CF" only means it is embedded in the income
  ;; statement expense lines (strip it); D&A presented on "IS" means
  ;; the expense lines already exclude it:
  (get (fsds/statement-placement pre adsh)
       "DepreciationDepletionAndAmortization")   ;=> #{"CF"} for AMZN

  ;; Values for extension tags the companyfacts API cannot see (e.g.
  ;; AMZN's Fulfillment / Technology and infrastructure, which Compustat
  ;; folds into XSGA/XRD — FY2025 TechnologyAndInfrastructureExpense
  ;; equals Compustat XRD exactly):
  (fsds/facts-for num adsh :qtrs 4 :tag "FulfillmentExpense")
raw docstring

annual-filing-contextclj

(annual-filing-context cik filed-date & {:keys [dir]})

FSDS context of the 10-K a company filed in the quarter containing filed-date: {:adsh accession number :placement {tag #{"IS" "CF" ...}} (statement placement, all tags) :is-extension-values [{:tag :label :value :end}] (annual values of extension tags presented on the income statement; :end is the FSDS month-end period date)} Returns nil when the quarter isn't cached/published or the filing isn't found. Results are cached per [cik year quarter] for the session.

FSDS context of the 10-K a company filed in the quarter containing
filed-date:
  {:adsh      accession number
   :placement {tag #{"IS" "CF" ...}}   (statement placement, all tags)
   :is-extension-values [{:tag :label :value :end}]  (annual values of
                         extension tags presented on the income statement;
                         :end is the FSDS month-end period date)}
Returns nil when the quarter isn't cached/published or the filing isn't
found. Results are cached per [cik year quarter] for the session.
sourceraw docstring

cache-enabled?clj

(cache-enabled?)
source

cached-quarter!clj

(cached-quarter! year quarter & {:keys [dir]})

Path of the year/quarter FSDS zip in the local cache, downloading it on first use. Returns nil when the quarter isn't published (404 remembered for the session) or the cache is disabled and no :dir is given.

Path of the year/quarter FSDS zip in the local cache, downloading it on
first use. Returns nil when the quarter isn't published (404 remembered
for the session) or the cache is disabled and no :dir is given.
sourceraw docstring

default-cache-dirclj

source

disable-cache!clj

(disable-cache!)

Disable the local FSDS quarter cache. Cached files stay on disk.

Disable the local FSDS quarter cache. Cached files stay on disk.
sourceraw docstring

download-quarter!clj

(download-quarter! year quarter dir & {:keys [force?]})

Download the FSDS zip for year/quarter into dir. Skips the download when the file already exists unless :force? is true. Returns the path of the zip file.

Note: these files are large (tens to hundreds of MB).

Download the FSDS zip for year/quarter into dir.
Skips the download when the file already exists unless :force? is true.
Returns the path of the zip file.

Note: these files are large (tens to hundreds of MB).
sourceraw docstring

enable-cache!clj

(enable-cache! & {:keys [dir]})

Enable the local FSDS quarter cache (downloads on first use per quarter). Options: :dir (default ~/.edgarjure/fsds). Returns the active config. When enabled, the income statement's :view :compustat augments its reclassification rules with FSDS statement placement and extension-tag operands for 10-K periods.

Enable the local FSDS quarter cache (downloads on first use per quarter).
Options: :dir (default ~/.edgarjure/fsds). Returns the active config.
When enabled, the income statement's :view :compustat augments its
reclassification rules with FSDS statement placement and extension-tag
operands for 10-K periods.
sourceraw docstring

facts-forclj

(facts-for num-ds adsh & {:keys [qtrs tag]})

Numeric facts (num rows) for one submission (adsh), extension tags included. Options: :qtrs - restrict to a window length in quarters (0 = instant, 1 = quarterly flow, 4 = annual flow) :tag - restrict to one tag name Returns a dataset with :tag :version :ddate :qtrs :uom :value ...

Numeric facts (num rows) for one submission (adsh), extension tags
included.
Options:
  :qtrs - restrict to a window length in quarters (0 = instant,
          1 = quarterly flow, 4 = annual flow)
  :tag  - restrict to one tag name
Returns a dataset with :tag :version :ddate :qtrs :uom :value ...
sourceraw docstring

filing-rowsclj

(filing-rows zip-path table adsh)

One filing's :pre or :num rows streamed from a quarter zip (all FSDS tables are adsh-first, so this never loads the full table). All values are strings; callers parse what they need.

One filing's :pre or :num rows streamed from a quarter zip (all FSDS
tables are adsh-first, so this never loads the full table). All values
are strings; callers parse what they need.
sourceraw docstring

find-submissionsclj

(find-submissions sub-ds & {:keys [cik form]})

Filter a loaded :sub table to a company's submissions. Options: :cik - company CIK (string or number; FSDS stores unpadded numbers) :form - form type string, e.g. "10-K" Returns a dataset sorted by :filed descending (most recent first).

Filter a loaded :sub table to a company's submissions.
Options:
  :cik  - company CIK (string or number; FSDS stores unpadded numbers)
  :form - form type string, e.g. "10-K"
Returns a dataset sorted by :filed descending (most recent first).
sourceraw docstring

load-tableclj

(load-table zip-path table)

Load one FSDS table from a downloaded zip as a tech.ml.dataset. table: :sub | :num | :pre | :tag Columns are keywordized. num.txt for a busy quarter has millions of rows — loading it needs a correspondingly sized heap.

Load one FSDS table from a downloaded zip as a tech.ml.dataset.
table: :sub | :num | :pre | :tag
Columns are keywordized. num.txt for a busy quarter has millions of rows —
loading it needs a correspondingly sized heap.
sourceraw docstring

presentationclj

(presentation pre-ds adsh & {:keys [stmt]})

Presentation rows for one submission (adsh), sorted in statement order. Options: :stmt - restrict to one statement code, e.g. "IS" "BS" "CF" Returns a dataset with :stmt :report :line :tag :version :plabel ...; extension tags have the filer's own :version (e.g. "amzn/2025") rather than a us-gaap release.

Presentation rows for one submission (adsh), sorted in statement order.
Options:
  :stmt - restrict to one statement code, e.g. "IS" "BS" "CF"
Returns a dataset with :stmt :report :line :tag :version :plabel ...;
extension tags have the filer's own :version (e.g. "amzn/2025") rather
than a us-gaap release.
sourceraw docstring

quarter-of-dateclj

(quarter-of-date d)

The FSDS [year quarter] whose dataset contains filings RECEIVED on date (ISO string or LocalDate).

The FSDS [year quarter] whose dataset contains filings RECEIVED on date
(ISO string or LocalDate).
sourceraw docstring

quarter-urlclj

(quarter-url year quarter)

URL of the FSDS zip for a year/quarter, e.g. (quarter-url 2024 1).

URL of the FSDS zip for a year/quarter, e.g. (quarter-url 2024 1).
sourceraw docstring

statement-placementclj

(statement-placement pre-ds adsh)

Map of tag name -> set of statement codes for one submission (adsh). Example: {"DepreciationDepletionAndAmortization" #{"CF"} ...} A tag mapped to #{"CF"} but not "IS" is presented on the cash flow statement only — the signal the Compustat reclassification rules need to decide whether D&A is embedded in the income statement expense lines.

Map of tag name -> set of statement codes for one submission (adsh).
Example: {"DepreciationDepletionAndAmortization" #{"CF"} ...}
A tag mapped to #{"CF"} but not "IS" is presented on the cash flow
statement only — the signal the Compustat reclassification rules need to
decide whether D&A is embedded in the income statement expense lines.
sourceraw docstring

submission-rowclj

(submission-row zip-path cik & {:keys [form]})

The sub.txt row (keywordized string map) of a company's latest submission of the given form in a quarter zip, or nil. cik may be padded or not.

The sub.txt row (keywordized string map) of a company's latest submission
of the given form in a quarter zip, or nil. cik may be padded or not.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close