Validation harness — quantify how close edgarjure's statement output is to a benchmark (Compustat/Capital IQ extract, hand-collected figures, academic reconciliation datasets).
Usage: (require '[edgar.validation :as validation]) (validation/compare-to-benchmark "AAPL" [{:line-item "Revenue" :end "2023-09-30" :val 383285000000} {:line-item "Net Income" :end "2023-09-30" :val 96995000000}]) ;=> {:match-rate 1.0 :matched [...] :mismatched [] :missing []}
Track :match-rate over time as concept files and identities improve.
Validation harness — quantify how close edgarjure's statement output is to
a benchmark (Compustat/Capital IQ extract, hand-collected figures, academic
reconciliation datasets).
Usage:
(require '[edgar.validation :as validation])
(validation/compare-to-benchmark "AAPL"
[{:line-item "Revenue" :end "2023-09-30" :val 383285000000}
{:line-item "Net Income" :end "2023-09-30" :val 96995000000}])
;=> {:match-rate 1.0 :matched [...] :mismatched [] :missing []}
Track :match-rate over time as concept files and identities improve.(compare-to-benchmark ticker-or-cik
benchmark
&
{:keys [statement form view industry as-of tolerance
value-key date-tolerance-days]
:or {statement :income
form "10-K"
view :standardized
tolerance 0.01
value-key :val
date-tolerance-days 0}})Compare a company's statement line items against benchmark values.
benchmark — a dataset or seq of maps with keys :line-item :end :val (:end as an ISO date string matching the fiscal period end)
Options: :statement - :income (default) | :balance | :cash-flow :form - "10-K" (default) or "10-Q" :view - statement view to validate (default :standardized) :industry, :as-of - passed through to the statement function :tolerance - relative tolerance for a match (default 0.01 = 1%) :value-key - which statement column to compare (default :val). Use :val-q to validate single-quarter values from 10-Q data against quarterly benchmarks (e.g. Compustat SALEQ/NIQ). :date-tolerance-days - allow the benchmark :end and the statement :end to differ by up to this many days (default 0 = exact match). Commercial databases normalise fiscal period ends to calendar month-end while XBRL carries the exact 52/53-week date (e.g. Compustat 2015-09-30 vs Apple's 2015-09-26) — pass ~10 when validating against such sources. Exact date matches always win; otherwise the closest date within tolerance is used.
Returns: {:match-rate matched / total benchmark rows (nil when benchmark empty) :matched [{:line-item :end :expected :actual} ...] :mismatched [{:line-item :end :expected :actual :rel-diff} ...] :missing [{:line-item :end :expected} ...]} ; no edgarjure value
Compare a company's statement line items against benchmark values.
benchmark — a dataset or seq of maps with keys :line-item :end :val
(:end as an ISO date string matching the fiscal period end)
Options:
:statement - :income (default) | :balance | :cash-flow
:form - "10-K" (default) or "10-Q"
:view - statement view to validate (default :standardized)
:industry, :as-of - passed through to the statement function
:tolerance - relative tolerance for a match (default 0.01 = 1%)
:value-key - which statement column to compare (default :val).
Use :val-q to validate single-quarter values from 10-Q data
against quarterly benchmarks (e.g. Compustat SALEQ/NIQ).
:date-tolerance-days - allow the benchmark :end and the statement :end to
differ by up to this many days (default 0 = exact match).
Commercial databases normalise fiscal period ends to
calendar month-end while XBRL carries the exact 52/53-week
date (e.g. Compustat 2015-09-30 vs Apple's 2015-09-26) —
pass ~10 when validating against such sources. Exact date
matches always win; otherwise the closest date within
tolerance is used.
Returns:
{:match-rate matched / total benchmark rows (nil when benchmark empty)
:matched [{:line-item :end :expected :actual} ...]
:mismatched [{:line-item :end :expected :actual :rel-diff} ...]
:missing [{:line-item :end :expected} ...]} ; no edgarjure valuecljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |