nx_edgar_lib.nx
buildroot/runtime/nx_edgar_lib.nx
about
nx_edgar_lib.nx -- F986: SEC EDGAR real-data extraction. GROUNDED, NOT MADE UP.
The sovereign fetcher reaches data.sec.gov over our own TLS (proven live: Apple StockholdersEquity
pulled 200 OK, current through the latest 10-Q). This parses the SEC companyconcept JSON so the
valuation engines run on REAL filings instead of hand-entered figures -- the operator's standing rule
for the whole finance arc. Every extracted fact carries its PROVENANCE: the form (10-K/10-Q) and the
filing date, so a number is always traceable to a specific SEC filing, never a floating assertion.
★FAIL-CLOSED + COMPOSES the pipeline: the no-value sentinel EDGAR_NOVAL is the SAME value nx_xbrl and
nx_piotroski use for a missing fact (-999999999). So an unparseable or empty response flows through as
"missing" -- the F-score reads INCOMPLETE, the identity check refuses -- rather than silently becoming a
zero that would corrupt a valuation. Fetch failure never turns into a fabricated financial fact.
SCOPE (declared): extracts the LATEST fact value + its provenance and the entity name from the
companyconcept JSON. Full submissions parsing, all periods, and unit handling beyond USD are follow-ons.
Strings/keys are built at runtime (NishiLang literals cannot hold a double-quote). license_tier: ORIGINAL LIB.
dependencies 1 imports · 2 importers
imports: nx_matter_lib.nx
imported by: nx_edgar_balance.nxnx_edgar_gate.nx
structs
| none |
consts
| 20 | const EDGAR_NOVAL: i64 = 0 - 999999999 // no value found (matches nx_xbrl XB_NO_FACT / nx_piotroski PIO_NA) |
| 21 | const EDGAR_Q: i64 = 34 // double-quote |
| 22 | const EDGAR_COLON: i64 = 58 |
functions
| 24 | func edgar_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 40 | func edgar_mkkey(key: *u8, out: *u8) -> i64 |
| 54 | func edgar_find_last(hay: *u8, hl: i64, needle: *u8, nl: i64) -> i64 |
| 69 | func edgar_find_first(hay: *u8, hl: i64, needle: *u8, nl: i64) -> i64 called by 1: edgar_str_first |
| 83 | func edgar_num_last(json: *u8, jl: i64, key: *u8) -> i64 |
| 106 | func edgar_str_at(json: *u8, jl: i64, p: i64, nl: i64, out: *u8) -> i64 |
| 123 | func edgar_str_last(json: *u8, jl: i64, key: *u8, out: *u8) -> i64 |
| 128 | func edgar_str_first(json: *u8, jl: i64, key: *u8, out: *u8) -> i64 |
| 135 | func edgar_latest_value(json: *u8, jl: i64) -> i64 { return edgar_num_last(json, jl, "val" as *u8) } |
| 136 | func edgar_entity(json: *u8, jl: i64, out: *u8) -> i64 { return edgar_str_first(json, jl, "entityName" as *u8, out) } |
| 137 | func edgar_latest_form(json: *u8, jl: i64, out: *u8) -> i64 { return edgar_str_last(json, jl, "form" as *u8, out) } |
| 138 | func edgar_latest_filed(json: *u8, jl: i64, out: *u8) -> i64 { return edgar_str_last(json, jl, "filed" as *u8, out) } |