code wiki / (root) / nx_debt_strategy.nx

nx_debt_strategy.nx

buildroot/runtime/nx_debt_strategy.nx

4664 B112 linesdepth 2pulls 2 transitivereach 3 importersview sourcekind librarytopic debt
docsdependenciesstructsconstsfunctions

about

nx_debt_strategy.nx -- FIRST module of the comprehensive money system: a debt-payoff strategist. Given a set of debts (balance, APR, minimum) and a monthly extra budget, it simulates AVALANCHE (attack highest APR -> minimises interest) vs SNOWBALL (attack lowest balance -> fastest wins, motivation) month-by-month with real compounding, and reports months-to-freedom + total interest for each. Integer-exact (cents / basis-points), deterministic, no look-ahead. Budget-covers-minimums assumed; if a person cannot even meet minimums the sim returns months=-1 (UNDERWATER -- an honest hardship signal that routes to the relief modules). license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_debt_strategy.nx nx_debt_strategy_gate.nx nx_money_situation.nx

imports: nx_syscalls.nx

imported by: nx_debt_strategy_gate.nxnx_money_situation.nx

structs

none

consts

8const DS_MAGIC_120000: i64 = 120000
10const DS_FIELDS: i64 = 3 // per debt: [balance_cents, apr_bps, min_payment_cents]
11const DS_AVALANCHE: i64 = 0
12const DS_SNOWBALL: i64 = 1
13const DS_MAX_MONTHS: i64 = 6000 // 500-year guard -> underwater sentinel

functions

16func ds_month_interest(balance: i64, apr_bps: i64) -> i64
called by 2: ds_simulatemain
22func ds_avalanche_target(bal: *i64, debts: *i64, n: i64) -> i64
called by 2: ds_simulatemain
35func ds_snowball_target(bal: *i64, n: i64) -> i64
called by 2: ds_simulatemain
48func ds_simulate(debts: *i64, n: i64, extra: i64, strategy: i64, out: *i64) -> i64
107func ds_can_meet_minimums(debts: *i64, n: i64, extra: i64) -> i64