code wiki / _hdl_build / nx_market_cmp.nx

nx_market_cmp.nx

buildroot/runtime/_hdl_build/nx_market_cmp.nx

7826 B202 linesdepth 4pulls 5 transitivereach 2 importersview sourcekind librarytopic market
docsdependenciesstructsconstsfunctions

about

nx_market_cmp.nx -- CROSS-MARKET COMPARISON library (arc=ANALYST rung AN10): the operator's "wholesale feedback, overseas feedback -- ALL the information so it is irrefutable". The irrefutability move: the v2 explanation ("the price is the delivery STRUCTURE, not the machine") makes a TESTABLE cross-border prediction -- equipment is globally traded so its per-ton price should be roughly comparable across markets, while the structure layer (labor/licensing/margin) is local and should vary wildly. This organ MEASURES both spreads from a .cmp data file and issues a deterministic verdict: STRUCTURE-DOMINANT iff the structure-per-ton spread exceeds the equipment-per-ton spread. Same independence rule as .led: a market backed by <2 distinct incentive classes is PROVISIONAL (named, never silently trusted). Grammar (integers only; '#'/blank = comment): T <ref_market> (exactly one; ratios are vs this market) S <rel> <cred> <party> <method> <class> (source; idx = order) M <price_cents> <ton_x10> <equip_cents> (market; idx = order) B <market> <src> (backing edge) Composes nx_ledger_data (int/line parsing helpers) + nx_source_grade (grades, independence). LAWS: struct-free, integer-only, flat ifs, <=6 args. license_tier: ORIGINAL

dependencies 2 imports · 2 importers

nx_ledger_data.nx nx_syscalls.nx nx_market_cmp.nx nx_analyst_html.nx nx_analyst_markets.nx

imports: nx_ledger_data.nxnx_syscalls.nx

imported by: nx_analyst_html.nxnx_analyst_markets.nx

structs

none

consts

19const MC_MAGIC_1024: i64 = 1024
21const MC_MAX_SRC: i64 = 32
22const MC_MAX_MKT: i64 = 16
23const MC_MAX_EDGE: i64 = 64
26const MC_REL: i64 = 0
27const MC_CRED: i64 = 1
28const MC_PARTY: i64 = 2
29const MC_METHOD: i64 = 3
30const MC_CLASS: i64 = 4
31const MC_PRICE: i64 = 5
32const MC_TON: i64 = 6
33const MC_EQUIP: i64 = 7
34const MC_BMKT: i64 = 8
35const MC_BSRC: i64 = 9
36const MC_NS: i64 = 10
37const MC_NM: i64 = 11
38const MC_NB: i64 = 12
39const MC_REF: i64 = 13
40const MC_NT: i64 = 14

functions

42func mc_alloc(st: *i64) -> i64
called by 1: mc_parse calls 1: sys_mmap
57func mc_line(b: *u8, i: i64, e: i64, st: *i64) -> i64
109func mc_parse(b: *u8, n: i64, st: *i64) -> i64
123func mc_parse_file(path: *u8, st: *i64) -> i64
131func mc_distinct_classes(st: *i64, m: i64) -> i64
called by 2: mainmc_eval calls 1: sys_mmap
156func mc_per_ton(price: i64, ton_x10: i64) -> i64 { return (price * 10) / ton_x10 }
157func mc_equip_share_permil(price: i64, equip: i64) -> i64 { return (equip * 1000) / price }
called by 2: ah_generatemain
158func mc_structure(price: i64, equip: i64) -> i64 { return price - equip }
159func mc_ratio_q10(a: i64, b: i64) -> i64 { if b <= 0 { return 0 } return (a * MC_MAGIC_1024) / b }
called by 2: mainmc_eval
162func mc_spread_q10(vals: *i64, n: i64) -> i64
called by 1: mc_eval
177func mc_eval(st: *i64, out: *i64) -> i64