code wiki / _hdl_build / nx_market_cmp.nx
nx_market_cmp.nx
buildroot/runtime/_hdl_build/nx_market_cmp.nx
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
imports: nx_ledger_data.nxnx_syscalls.nx
imported by: nx_analyst_html.nxnx_analyst_markets.nx
structs
| none |
consts
| 19 | const MC_MAGIC_1024: i64 = 1024 |
| 21 | const MC_MAX_SRC: i64 = 32 |
| 22 | const MC_MAX_MKT: i64 = 16 |
| 23 | const MC_MAX_EDGE: i64 = 64 |
| 26 | const MC_REL: i64 = 0 |
| 27 | const MC_CRED: i64 = 1 |
| 28 | const MC_PARTY: i64 = 2 |
| 29 | const MC_METHOD: i64 = 3 |
| 30 | const MC_CLASS: i64 = 4 |
| 31 | const MC_PRICE: i64 = 5 |
| 32 | const MC_TON: i64 = 6 |
| 33 | const MC_EQUIP: i64 = 7 |
| 34 | const MC_BMKT: i64 = 8 |
| 35 | const MC_BSRC: i64 = 9 |
| 36 | const MC_NS: i64 = 10 |
| 37 | const MC_NM: i64 = 11 |
| 38 | const MC_NB: i64 = 12 |
| 39 | const MC_REF: i64 = 13 |
| 40 | const MC_NT: i64 = 14 |
functions
| 42 | func mc_alloc(st: *i64) -> i64 |
| 57 | func mc_line(b: *u8, i: i64, e: i64, st: *i64) -> i64 |
| 109 | func mc_parse(b: *u8, n: i64, st: *i64) -> i64 |
| 123 | func mc_parse_file(path: *u8, st: *i64) -> i64 |
| 131 | func mc_distinct_classes(st: *i64, m: i64) -> i64 |
| 156 | func mc_per_ton(price: i64, ton_x10: i64) -> i64 { return (price * 10) / ton_x10 } |
| 157 | func mc_equip_share_permil(price: i64, equip: i64) -> i64 { return (equip * 1000) / price } |
| 158 | func mc_structure(price: i64, equip: i64) -> i64 { return price - equip } |
| 159 | func mc_ratio_q10(a: i64, b: i64) -> i64 { if b <= 0 { return 0 } return (a * MC_MAGIC_1024) / b } |
| 162 | func mc_spread_q10(vals: *i64, n: i64) -> i64 called by 1: mc_eval |
| 177 | func mc_eval(st: *i64, out: *i64) -> i64 called by 2: ah_generatemain calls 6: sys_mmapmc_per_tonmc_structuremc_spread_q10mc_distinct_classesmc_ratio_q10 |