Liking cljdoc? Tell your friends :D

edgar.financials

Financial statement extraction with normalization and standardization.

Three output views for each statement (:view option): :as-reported - raw XBRL observations for the statement's concepts, exactly as filed; no deduplication, no label mapping :normalized - (default) fallback chains map variant tags to canonical labels; restatements deduplicated by most-recent-filed :standardized - :normalized plus derived line items imputed from arithmetic identities (e.g. Gross Profit = Revenue - Cost of Revenue). Derived rows carry :method :derived and :derived-from for auditability.

Concept fallback chains: each line item is a vector of concept names tried in order; the first one present in the facts data wins. Chains are loaded from EDN files under resources/edgar/concepts/ and exposed as public vars, so power users can inspect them or pass their own via :concepts.

Industry routing: banks (SIC 6000-6199, 6712) and insurers (SIC 6300-6399, 6411) use fundamentally different income statement line items. When no explicit :industry or :concepts is given, income-statement auto-routes on the company's SIC code. Pass :industry :standard to force generic chains.

Duration vs instant: Income statement + cash flow -> duration observations (row has :start date) Balance sheet -> instant observations (row has no :start date)

Point-in-time / look-ahead-safe mode: Pass :as-of "YYYY-MM-DD" to any public function to restrict to filings where :filed <= as-of-date. Without :as-of the latest restated value is returned (always-latest behaviour).

Quarterly and LTM derivation (10-Q only, flow variables only): :duration-months - 3/6/9/12 classification of the observation window :val-q - single-quarter value. Derived from actual period dates: a ~3-month row is used as-is; a YTD row minus the YTD row one quarter shorter (same fiscal-year start) yields the quarter ending at the longer row's end. The SEC :fy/:fp fields are deliberately NOT used — they describe the filing, not the observation, and collide across comparative periods. :val-ltm - last-twelve-months: sum of four consecutive derived quarters matched on period-end dates (±14 days tolerance for 52/53-week fiscal calendars). 10-K annual rows participate in the derivation so that Q4 = FY - 9M YTD.

Unmapped-concept logging: every statement call records us-gaap concepts in the company's facts that no active chain matched. See unmapped-concepts, clear-unmapped-concepts!, save-unmapped-concepts!.

Financial statement extraction with normalization and standardization.

Three output views for each statement (:view option):
  :as-reported   - raw XBRL observations for the statement's concepts,
                   exactly as filed; no deduplication, no label mapping
  :normalized    - (default) fallback chains map variant tags to canonical
                   labels; restatements deduplicated by most-recent-filed
  :standardized  - :normalized plus derived line items imputed from
                   arithmetic identities (e.g. Gross Profit = Revenue -
                   Cost of Revenue). Derived rows carry :method :derived
                   and :derived-from for auditability.

Concept fallback chains: each line item is a vector of concept names tried
in order; the first one present in the facts data wins. Chains are loaded
from EDN files under resources/edgar/concepts/ and exposed as public vars,
so power users can inspect them or pass their own via :concepts.

Industry routing: banks (SIC 6000-6199, 6712) and insurers (SIC 6300-6399,
6411) use fundamentally different income statement line items. When no
explicit :industry or :concepts is given, income-statement auto-routes on
the company's SIC code. Pass :industry :standard to force generic chains.

Duration vs instant:
  Income statement + cash flow -> duration observations (row has :start date)
  Balance sheet               -> instant observations  (row has no :start date)

Point-in-time / look-ahead-safe mode:
  Pass :as-of "YYYY-MM-DD" to any public function to restrict to filings
  where :filed <= as-of-date.  Without :as-of the latest restated value is
  returned (always-latest behaviour).

Quarterly and LTM derivation (10-Q only, flow variables only):
  :duration-months - 3/6/9/12 classification of the observation window
  :val-q   - single-quarter value. Derived from actual period dates:
             a ~3-month row is used as-is; a YTD row minus the YTD row one
             quarter shorter (same fiscal-year start) yields the quarter
             ending at the longer row's end. The SEC :fy/:fp fields are
             deliberately NOT used — they describe the filing, not the
             observation, and collide across comparative periods.
  :val-ltm - last-twelve-months: sum of four consecutive derived quarters
             matched on period-end dates (±14 days tolerance for 52/53-week
             fiscal calendars). 10-K annual rows participate in the
             derivation so that Q4 = FY - 9M YTD.

Unmapped-concept logging: every statement call records us-gaap concepts in
the company's facts that no active chain matched. See unmapped-concepts,
clear-unmapped-concepts!, save-unmapped-concepts!.
raw docstring

balance-sheetclj

(balance-sheet ticker-or-cik & {:as opts})

Return normalized balance sheet as a long-format dataset.

Options: :form - "10-K" (default) or "10-Q" :concepts - override balance-sheet-concepts :shape - :long (default) or :wide :view - :normalized (default) | :as-reported | :standardized (:standardized imputes e.g. Total Liabilities, Total Equity = SE + NCI, and a derived-only "Working Capital" item) :as-of - ISO date string "YYYY-MM-DD" (default nil). When set, excludes filings where :filed > as-of-date, giving point-in-time / look-ahead-safe results.

Return normalized balance sheet as a long-format dataset.

Options:
  :form     - "10-K" (default) or "10-Q"
  :concepts - override balance-sheet-concepts
  :shape    - :long (default) or :wide
  :view     - :normalized (default) | :as-reported | :standardized
              (:standardized imputes e.g. Total Liabilities, Total Equity
              = SE + NCI, and a derived-only "Working Capital" item)
  :as-of    - ISO date string "YYYY-MM-DD" (default nil).
              When set, excludes filings where :filed > as-of-date,
              giving point-in-time / look-ahead-safe results.
sourceraw docstring

balance-sheet-concept-mapclj

Full EDN concept map (with metadata) for the balance sheet. Source: resources/edgar/concepts/balance-sheet.edn

Full EDN concept map (with metadata) for the balance sheet.
Source: resources/edgar/concepts/balance-sheet.edn
sourceraw docstring

balance-sheet-conceptsclj

Balance sheet fallback chains: [[label concept1 concept2 ...] ...]

Balance sheet fallback chains: [[label concept1 concept2 ...] ...]
sourceraw docstring

balance-sheet-identitiesclj

Arithmetic identities for balance sheet imputation (:view :standardized). Working Capital is derived-only (never a reported XBRL line).

Arithmetic identities for balance sheet imputation (:view :standardized).
Working Capital is derived-only (never a reported XBRL line).
sourceraw docstring

bank-income-concept-mapclj

Income statement concept map for banks (SIC 6000-6199, 6712). Source: resources/edgar/concepts/bank-income.edn

Income statement concept map for banks (SIC 6000-6199, 6712).
Source: resources/edgar/concepts/bank-income.edn
sourceraw docstring

bank-income-conceptsclj

Bank income statement fallback chains.

Bank income statement fallback chains.
sourceraw docstring

cash-flowclj

(cash-flow ticker-or-cik & {:as opts})

Return normalized cash flow statement as a long-format dataset.

Options: :form - "10-K" (default) or "10-Q" :concepts - override cash-flow-concepts :shape - :long (default) or :wide :view - :normalized (default) | :as-reported | :standardized (:standardized adds a derived "Free Cash Flow" line item and imputes "D&A" for filers tagging depreciation and intangible amortization separately) :as-of - ISO date string "YYYY-MM-DD" (default nil). When set, excludes filings where :filed > as-of-date, giving point-in-time / look-ahead-safe results.

For 10-Q queries, long-format output includes :duration-months, :val-q (single-quarter value) and :val-ltm (trailing twelve months) columns derived from actual period-date windows.

Return normalized cash flow statement as a long-format dataset.

Options:
  :form     - "10-K" (default) or "10-Q"
  :concepts - override cash-flow-concepts
  :shape    - :long (default) or :wide
  :view     - :normalized (default) | :as-reported | :standardized
              (:standardized adds a derived "Free Cash Flow" line item
              and imputes "D&A" for filers tagging depreciation and
              intangible amortization separately)
  :as-of    - ISO date string "YYYY-MM-DD" (default nil).
              When set, excludes filings where :filed > as-of-date,
              giving point-in-time / look-ahead-safe results.

For 10-Q queries, long-format output includes :duration-months, :val-q
(single-quarter value) and :val-ltm (trailing twelve months) columns
derived from actual period-date windows.
sourceraw docstring

cash-flow-concept-mapclj

Full EDN concept map (with metadata) for the cash flow statement. Source: resources/edgar/concepts/cash-flow.edn

Full EDN concept map (with metadata) for the cash flow statement.
Source: resources/edgar/concepts/cash-flow.edn
sourceraw docstring

cash-flow-conceptsclj

Cash flow fallback chains: [[label concept1 concept2 ...] ...]

Cash flow fallback chains: [[label concept1 concept2 ...] ...]
sourceraw docstring

cash-flow-identitiesclj

Arithmetic identities for cash flow imputation (:view :standardized). Free Cash Flow is a derived-only item (never reported directly in XBRL). D&A is imputed for filers that tag depreciation and intangible amortization separately (e.g. MSFT, IBM) instead of a combined tag.

Arithmetic identities for cash flow imputation (:view :standardized).
Free Cash Flow is a derived-only item (never reported directly in XBRL).
D&A is imputed for filers that tag depreciation and intangible
amortization separately (e.g. MSFT, IBM) instead of a combined tag.
sourceraw docstring

clear-unmapped-concepts!clj

(clear-unmapped-concepts!)

Reset the unmapped-concept registry.

Reset the unmapped-concept registry.
sourceraw docstring

concepts-forclj

(concepts-for statement & {:keys [industry] :or {industry :standard}})

Return the active concept chains for a statement, for inspection/extension. statement: :income | :balance | :cash-flow Options: :industry - :standard (default) | :bank | :insurance (income only) Returns {:chains [[label c1 c2 ...] ...] :meta <EDN map metadata>}

Return the active concept chains for a statement, for inspection/extension.
statement: :income | :balance | :cash-flow
Options:
  :industry - :standard (default) | :bank | :insurance (income only)
Returns {:chains [[label c1 c2 ...] ...] :meta <EDN map metadata>}
sourceraw docstring

get-financialsclj

(get-financials ticker-or-cik
                &
                {:keys [form shape as-of view industry]
                 :or {form "10-K" shape :long view :normalized}})

Return all three normalized statements for a company.

Returns {:income-statement ds :balance-sheet ds :cash-flow ds}

Options: :form - "10-K" (default) or "10-Q" :shape - :long (default) or :wide :view - :normalized (default) | :as-reported | :standardized :industry - :standard | :bank | :insurance (income statement only; auto-detected from SIC when omitted) :as-of - ISO date string "YYYY-MM-DD" (default nil). All three statements use point-in-time deduplication: filings where :filed > as-of-date are excluded.

For 10-Q queries, long-format income and cash flow include :val-q and :val-ltm columns. Balance sheet is unaffected (instant observations).

Return all three normalized statements for a company.

Returns {:income-statement ds :balance-sheet ds :cash-flow ds}

Options:
  :form     - "10-K" (default) or "10-Q"
  :shape    - :long (default) or :wide
  :view     - :normalized (default) | :as-reported | :standardized
  :industry - :standard | :bank | :insurance (income statement only;
              auto-detected from SIC when omitted)
  :as-of    - ISO date string "YYYY-MM-DD" (default nil).
              All three statements use point-in-time deduplication:
              filings where :filed > as-of-date are excluded.

For 10-Q queries, long-format income and cash flow include :val-q and
:val-ltm columns. Balance sheet is unaffected (instant observations).
sourceraw docstring

income-statementclj

(income-statement ticker-or-cik & {:as opts})

Return normalized income statement as a long-format dataset.

Options: :form - "10-K" (default) or "10-Q" :concepts - override the fallback chains (disables industry routing) :shape - :long (default) or :wide :view - :normalized (default) | :as-reported | :standardized :as-reported skips dedup and label mapping entirely; :standardized additionally imputes missing line items from arithmetic identities (rows carry :method :derived) :industry - :standard | :bank | :insurance. When omitted, auto-detected from the company's SIC code (banks and insurers get industry-specific chains) :as-of - ISO date string "YYYY-MM-DD" (default nil). When set, excludes filings where :filed > as-of-date, giving point-in-time / look-ahead-safe results suitable for backtesting and event studies.

For 10-Q queries, long-format output includes :duration-months, :val-q (single-quarter value) and :val-ltm (trailing twelve months) columns derived from actual period-date windows.

Return normalized income statement as a long-format dataset.

Options:
  :form     - "10-K" (default) or "10-Q"
  :concepts - override the fallback chains (disables industry routing)
  :shape    - :long (default) or :wide
  :view     - :normalized (default) | :as-reported | :standardized
              :as-reported skips dedup and label mapping entirely;
              :standardized additionally imputes missing line items from
              arithmetic identities (rows carry :method :derived)
  :industry - :standard | :bank | :insurance. When omitted, auto-detected
              from the company's SIC code (banks and insurers get
              industry-specific chains)
  :as-of    - ISO date string "YYYY-MM-DD" (default nil).
              When set, excludes filings where :filed > as-of-date,
              giving point-in-time / look-ahead-safe results suitable
              for backtesting and event studies.

For 10-Q queries, long-format output includes :duration-months, :val-q
(single-quarter value) and :val-ltm (trailing twelve months) columns
derived from actual period-date windows.
sourceraw docstring

income-statement-concept-mapclj

Full EDN concept map (with metadata) for the standard income statement. Source: resources/edgar/concepts/income-statement.edn

Full EDN concept map (with metadata) for the standard income statement.
Source: resources/edgar/concepts/income-statement.edn
sourceraw docstring

income-statement-conceptsclj

Income statement fallback chains: [[label concept1 concept2 ...] ...]

Income statement fallback chains: [[label concept1 concept2 ...] ...]
sourceraw docstring

income-statement-identitiesclj

Arithmetic identities used by :view :standardized to impute missing income statement line items. Applied per [unit start end] period group, only when the target is absent and all operands are present.

Arithmetic identities used by :view :standardized to impute missing income
statement line items. Applied per [unit start end] period group, only when
the target is absent and all operands are present.
sourceraw docstring

industry-for-sicclj

(industry-for-sic sic)

Map a SIC code (string or number) to an industry keyword: :bank - SIC 6000-6199 or 6712 (bank holding companies) :insurance - SIC 6300-6399 or 6411 :reit - SIC 6500-6553 (no dedicated chains yet; treated as :standard) :standard - everything else (or unknown SIC)

Map a SIC code (string or number) to an industry keyword:
:bank      - SIC 6000-6199 or 6712 (bank holding companies)
:insurance - SIC 6300-6399 or 6411
:reit      - SIC 6500-6553 (no dedicated chains yet; treated as :standard)
:standard  - everything else (or unknown SIC)
sourceraw docstring

insurance-income-concept-mapclj

Income statement concept map for insurers (SIC 6300-6399, 6411). Source: resources/edgar/concepts/insurance-income.edn

Income statement concept map for insurers (SIC 6300-6399, 6411).
Source: resources/edgar/concepts/insurance-income.edn
sourceraw docstring

insurance-income-conceptsclj

Insurance income statement fallback chains.

Insurance income statement fallback chains.
sourceraw docstring

save-unmapped-concepts!clj

(save-unmapped-concepts! & {:keys [path]})

Write the unmapped-concept registry as EDN. Options: :path - output file (default ~/.edgarjure/unmapped-concepts.edn) Returns the path written.

Write the unmapped-concept registry as EDN.
Options:
  :path - output file (default ~/.edgarjure/unmapped-concepts.edn)
Returns the path written.
sourceraw docstring

unmapped-conceptsclj

(unmapped-concepts & {:keys [top]})

Return the unmapped-concept registry accumulated this session: {concept {:count n :first-seen "YYYY-MM-DD" :example-ciks #{...}}} Options: :top - return only the n most frequent, as a seq of [concept info] pairs

Return the unmapped-concept registry accumulated this session:
{concept {:count n :first-seen "YYYY-MM-DD" :example-ciks #{...}}}
Options:
  :top - return only the n most frequent, as a seq of [concept info] pairs
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