nx_debt_strategy.nx
buildroot/runtime/nx_debt_strategy.nx
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
imports: nx_syscalls.nx
imported by: nx_debt_strategy_gate.nxnx_money_situation.nx
structs
| none |
consts
| 8 | const DS_MAGIC_120000: i64 = 120000 |
| 10 | const DS_FIELDS: i64 = 3 // per debt: [balance_cents, apr_bps, min_payment_cents] |
| 11 | const DS_AVALANCHE: i64 = 0 |
| 12 | const DS_SNOWBALL: i64 = 1 |
| 13 | const DS_MAX_MONTHS: i64 = 6000 // 500-year guard -> underwater sentinel |
functions
| 16 | func ds_month_interest(balance: i64, apr_bps: i64) -> i64 |
| 22 | func ds_avalanche_target(bal: *i64, debts: *i64, n: i64) -> i64 |
| 35 | func ds_snowball_target(bal: *i64, n: i64) -> i64 |
| 48 | func ds_simulate(debts: *i64, n: i64, extra: i64, strategy: i64, out: *i64) -> i64 called by 2: ds_can_meet_minimumsmain calls 4: sys_mmapds_month_interestds_snowball_targetds_avalanche_target |
| 107 | func ds_can_meet_minimums(debts: *i64, n: i64, extra: i64) -> i64 |