nx_finance_svc.nx
buildroot/runtime/nx_finance_svc.nx
about
nx_finance_svc.nx -- FINANCE SERVICE FACADE. One agentic MCP tool over the sovereign finance stack.
This is the MCP / API / AGENTIC / WORKFLOW-READY / SCALABLE layer the gate-proven libraries did not yet
have. It composes the integer-exact finance modules (nx_dcf, nx_bond, nx_taxlot, nx_amort) behind a verb-
dispatched JSON contract inherited from nx_service, adding NO new domain logic -- every number comes from a
gated module, so the facade cannot drift from the math it exposes (Rule 15 DRY, Rule 6 OOP, Rule 22 compose).
MCP-ready: a single fork-exec organ, stable name + argv verb contract, registerable in the allowlist.
API-ready: pure stdout JSON, versioned envelope, CORS-safe structured errors (400/404/422).
agentic-ready: the `describe` verb emits this facade's verb catalog with arg shapes (tools/list analog).
workflow-ready: every verb is a PURE function of its args returning a self-contained JSON object.
scalable: stateless; a call is a fork-exec; concurrency is free.
*THE FAIL-CLOSED PROPERTY SURVIVES THE FACADE: a domain refusal sentinel (the DCF growth>=rate trap, an
unreachable bond yield, a bad tax-lot or amortization input) is mapped to a structured 422 REFUSED / 400
BAD_ARGS error, never a bogus number in the data. An agent sees the refusal as a first-class outcome.
USAGE: nx_finance_svc <verb> [args...]
genealogy_id: finance_spine + service_infrastructure
dependencies 7 imports · 0 importers
imports: nx_syscalls.nxnx_service.nxnx_grounding.nxnx_dcf_lib.nxnx_bond_lib.nxnx_taxlot_lib.nxnx_amort_lib.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 28 | const FIN_MAGIC_8192: i64 = 8192 |
| 30 | const FIN_SVC: *u8 = "finance" as *u8 |
functions
| 33 | func fin_describe(j: *NxJson) -> i64 |
| 56 | func fin_dcf_verdict(j: *NxJson, intrinsic: i64, price: i64) -> i64 called by 1: main calls 9: dcf_margin_of_safety_bpnsvc_errordcf_verdictnsvc_ok_opennj_kv_intnj_comma+3 |
| 76 | func fin_dcf_terminal(j: *NxJson, final_cf: i64, growth_bp: i64, rate_bp: i64) -> i64 |
| 89 | func fin_bond_price(j: *NxJson, coupon_bp: i64, face: i64, periods: i64, ytm_bp: i64) -> i64 |
| 104 | func fin_bond_ytm(j: *NxJson, price: i64, coupon_bp: i64, face: i64, periods: i64) -> i64 |
| 121 | func fin_bond_duration(j: *NxJson, coupon_bp: i64, face: i64, periods: i64, ytm_bp: i64) -> i64 called by 1: main calls 7: bond_macaulay_durationnsvc_errorbond_modified_durationnsvc_ok_opennj_kv_intnj_comma+1 |
| 137 | func fin_taxlot_wash(j: *NxJson, loss: i64, sale_day: i64, repl_day: i64, repl_shares: i64, sold_shares: i64) -> i64 called by 1: main calls 7: tl_wash_disallowednsvc_errortl_allowed_lossnsvc_ok_opennj_kv_intnj_comma+1 |
| 153 | func fin_amort_schedule(j: *NxJson, principal: i64, annual_bp: i64, term: i64) -> i64 called by 1: main calls 8: amort_level_paymentnsvc_erroramort_final_paymentamort_total_interestnsvc_ok_opennj_kv_int+2 |
| 172 | func main(argc: i64, argv: *i64) -> i64 |