code wiki / (root) / nx_fin_liquidity.nx

nx_fin_liquidity.nx

buildroot/runtime/nx_fin_liquidity.nx

1797 B30 linesdepth 3pulls 3 transitivereach 1 importersview sourcekind librarytopic fin
docsdependenciesstructsconstsfunctions

about

nx_fin_liquidity.nx -- the market-IMPACT model: finer than R1's flat ADV cap. Uses the square-root impact law (Almgren): impact grows with sqrt(order/ADV), so doubling size ~1.4x's the cost, not 2x. impact_bps = k_bps * sqrt(participation), participation = order/ADV. Composes me_isqrt (nx_fin_metrics). Gives the $ cost of trading AND the inverse -- the largest order that keeps impact within a bound = the honest, per-name answer to the SCALING WALL ("how much can a growing stake actually deploy here"). k_bps is DATA (per-name/regime). Pure, i64. license_tier: ORIGINAL

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_fin_metrics.nx nx_fin_liquidity.nx nx_fin_liquidity_gate.nx

imports: nx_syscalls.nxnx_fin_metrics.nx

imported by: nx_fin_liquidity_gate.nx

structs

none

consts

9const K_MAGIC_1000000: i64 = 1000000
10const K_MAGIC_10000: i64 = 10000

functions

14func lq_impact_bps(order_cents: i64, adv_cents: i64, k_bps: i64) -> i64
called by 1: main calls 1: me_isqrt
21func lq_slippage_cost_cents(order_cents: i64, impact_bps: i64) -> i64 { return order_cents * impact_bps / K_MAGIC_10000 }
called by 1: main
25func lq_max_order_for_impact(adv_cents: i64, max_impact_bps: i64, k_bps: i64) -> i64
called by 1: main