code wiki / (root) / nx_edgar_lib.nx

nx_edgar_lib.nx

buildroot/runtime/nx_edgar_lib.nx

5487 B138 linesdepth 7pulls 12 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

nx_matter_lib.nx nx_edgar_lib.nx nx_edgar_balance.nx nx_edgar_gate.nx

imports: nx_matter_lib.nx

imported by: nx_edgar_balance.nxnx_edgar_gate.nx

structs

none

consts

20const EDGAR_NOVAL: i64 = 0 - 999999999 // no value found (matches nx_xbrl XB_NO_FACT / nx_piotroski PIO_NA)
21const EDGAR_Q: i64 = 34 // double-quote
22const EDGAR_COLON: i64 = 58

functions

24func edgar_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 2: mainmain calls 1: sys_read
40func edgar_mkkey(key: *u8, out: *u8) -> i64
54func edgar_find_last(hay: *u8, hl: i64, needle: *u8, nl: i64) -> i64
69func edgar_find_first(hay: *u8, hl: i64, needle: *u8, nl: i64) -> i64
called by 1: edgar_str_first
83func edgar_num_last(json: *u8, jl: i64, key: *u8) -> i64
106func edgar_str_at(json: *u8, jl: i64, p: i64, nl: i64, out: *u8) -> i64
123func edgar_str_last(json: *u8, jl: i64, key: *u8, out: *u8) -> i64
128func edgar_str_first(json: *u8, jl: i64, key: *u8, out: *u8) -> i64
135func edgar_latest_value(json: *u8, jl: i64) -> i64 { return edgar_num_last(json, jl, "val" as *u8) }
called by 1: main calls 1: edgar_num_last
136func edgar_entity(json: *u8, jl: i64, out: *u8) -> i64 { return edgar_str_first(json, jl, "entityName" as *u8, out) }
called by 1: main calls 1: edgar_str_first
137func edgar_latest_form(json: *u8, jl: i64, out: *u8) -> i64 { return edgar_str_last(json, jl, "form" as *u8, out) }
called by 1: main calls 1: edgar_str_last
138func edgar_latest_filed(json: *u8, jl: i64, out: *u8) -> i64 { return edgar_str_last(json, jl, "filed" as *u8, out) }
called by 1: main calls 1: edgar_str_last