nx_fin_marketdata.nx
buildroot/runtime/nx_fin_marketdata.nx
about
nx_fin_marketdata.nx -- R1 of the trading stack: the PRICE + LIQUIDITY sensor's CORE. Pure, deterministic
OHLCV parsing + the ADV / capacity math that answers the SCALING WALL ("can a small stake grow to $1M in
this name?"). Source-agnostic: parses a standard OHLCV CSV (Date,Open,High,Low,Close,Volume by column) into
flat i64 bars [date,o,h,l,c,vol]; prices in CENTS, volume in SHARES, dollar-volume in CENTS (i64 fixed-point,
NO floats -- money is exact by construction). The LIVE fetch is a separate adapter (nx_https_fetch_follow);
some hosts still need TLS-robustness work (stooq/cornell/FRED fail the 1.3 handshake = err -3), so the PARSER
is proven here on KNOWN bytes, independent of any one source -- and R2's backtester consumes these same bars.
license_tier: ORIGINAL
dependencies 1 imports · 12 importers
diagram shows first 10 each side; +0 more imports, +2 more importers in the complete lists below.
imports: nx_syscalls.nx
imported by: nx_fin_backtest.nxnx_fin_backtest_gate.nxnx_fin_marketdata_fetch.nxnx_fin_marketdata_gate.nxnx_fin_microcap.nxnx_fin_microcap_gate.nxnx_fin_paper.nxnx_fin_paper_gate.nxnx_fin_risk_engine.nxnx_fin_risk_engine_gate.nxnx_fin_strategy.nxnx_fin_strategy_gate.nx
structs
| none |
consts
| 11 | const MD_FIELDS: i64 = 6 // per bar: [date(YYYYMMDD), open, high, low, close, volume] |
functions
| 14 | func md_atoi(s: *u8, off: i64, len: i64) -> i64 |
| 26 | func md_price_cents(s: *u8, off: i64, len: i64) -> i64 |
| 52 | func md_date_key(s: *u8, off: i64, len: i64) -> i64 |
| 59 | func md_find(s: *u8, from: i64, end: i64, ch: i64) -> i64 { var i: i64 = from; while i < end { if (s[i] as i64) == ch { return i } i = i + 1 } return end } called by 1: md_parse_csv |
| 63 | func md_parse_csv(buf: *u8, n: i64, out: *i64, max_bars: i64) -> i64 |
| 97 | func md_dollar_vol(bars: *i64, idx: i64) -> i64 { return bars[idx*MD_FIELDS+4] * bars[idx*MD_FIELDS+5] } called by 1: main |
| 100 | func md_adv(bars: *i64, count: i64, ndays: i64) -> i64 called by 1: main |
| 110 | func md_capacity(adv_cents: i64, participation_bps: i64) -> i64 { return (adv_cents * participation_bps) / 10000 } |