nx_money_situation.nx
buildroot/runtime/nx_money_situation.nx
about
nx_money_situation.nx -- the FOUNDATION of the comprehensive money system: a person's whole financial SITUATION
(income, expenses, debts, assets, goals) + the derived metrics every module reads so advice is "optimal for THEIR
situation", not generic. Integer-exact (cents / basis-points). Composes nx_debt_strategy (debts layout + underwater
check). The keystone is sit_priority(): given the WHOLE picture it routes to the right focus -- relief, emergency
fund, debt, or invest -- the decision the operator asked for. license_tier: ORIGINAL
dependencies 2 imports · 1 importers
imports: nx_syscalls.nxnx_debt_strategy.nx
imported by: nx_money_situation_gate.nx
structs
| none |
consts
| 8 | const SIT_MAGIC_10000: i64 = 10000 |
| 11 | const SIT_INCOME_GROSS: i64 = 0 // monthly gross income cents |
| 12 | const SIT_INCOME_NET: i64 = 1 // monthly after-tax income cents |
| 13 | const SIT_EXPENSES_ESSENTIAL: i64 = 2 // monthly essentials cents (housing/food/utilities/transport/insurance) |
| 14 | const SIT_SPEND_DISCRETIONARY: i64 = 3 // monthly discretionary spend cents |
| 15 | const SIT_CASH: i64 = 4 // liquid cash/savings cents |
| 16 | const SIT_RETIREMENT: i64 = 5 // retirement assets cents |
| 17 | const SIT_OTHER_ASSETS: i64 = 6 // other assets cents |
| 18 | const SIT_DEPENDENTS: i64 = 7 // number of dependents |
| 19 | const SIT_EMPLOYED: i64 = 8 // 1 = employed, 0 = not |
| 20 | const SIT_EFUND_TARGET_MONTHS: i64 = 9 // desired emergency fund, in months of essentials |
| 21 | const SIT_FIELDS: i64 = 16 |
| 24 | const DTI_HEALTHY_BPS: i64 = 3600 // back-end DTI < 36% = healthy (conventional-mortgage guideline) |
| 25 | const DTI_STRESSED_BPS: i64 = 4300 // 36-43% stretched; > 43% exceeds the CFPB ability-to-repay QM limit |
| 26 | const EFUND_MIN_MONTHS: i64 = 3 // 3-6 months of essentials = standard emergency fund floor |
functions
| 29 | func sit_total_debt(debts: *i64, ndebts: i64) -> i64 { var s: i64 = 0; var i: i64 = 0; while i < ndebts { s = s + debts[i*DS_FIELDS+0]; i = i + 1 } return s } |
| 30 | func sit_total_min(debts: *i64, ndebts: i64) -> i64 { var s: i64 = 0; var i: i64 = 0; while i < ndebts { s = s + debts[i*DS_FIELDS+2]; i = i + 1 } return s } |
| 31 | func sit_total_assets(sit: *i64) -> i64 { return sit[SIT_CASH] + sit[SIT_RETIREMENT] + sit[SIT_OTHER_ASSETS] } called by 1: sit_net_worth |
| 32 | func sit_net_worth(sit: *i64, debts: *i64, ndebts: i64) -> i64 { return sit_total_assets(sit) - sit_total_debt(debts, ndebts) } |
| 36 | func sit_monthly_surplus(sit: *i64, debts: *i64, ndebts: i64) -> i64 |
| 40 | func sit_max_debt_paydown(sit: *i64, debts: *i64, ndebts: i64) -> i64 |
| 47 | func sit_dti_bps(sit: *i64, debts: *i64, ndebts: i64) -> i64 |
| 51 | func sit_savings_rate_bps(sit: *i64, debts: *i64, ndebts: i64) -> i64 calls 1: sit_monthly_surplus |
| 57 | func sit_efund_months_x100(sit: *i64) -> i64 { // months of essentials covered by cash, x100 |
| 61 | func sit_efund_target_cents(sit: *i64) -> i64 { return sit[SIT_EFUND_TARGET_MONTHS] * sit[SIT_EXPENSES_ESSENTIAL] } called by 1: sit_efund_gap_cents |
| 62 | func sit_efund_gap_cents(sit: *i64) -> i64 { let g: i64 = sit_efund_target_cents(sit) - sit[SIT_CASH]; if g < 0 { return 0 } return g } calls 1: sit_efund_target_cents |
| 65 | func sit_dti_status(sit: *i64, debts: *i64, ndebts: i64) -> i64 |
| 77 | func sit_priority(sit: *i64, debts: *i64, ndebts: i64) -> i64 |