nx_fin_optimizer.nx
buildroot/runtime/nx_fin_optimizer.nx
about
nx_fin_optimizer.nx -- portfolio OPTIMIZATION, analytic (no matrix inverse needed): the closed-form
mean-variance solutions. (1) inverse-variance weighting (risk-parity's simple cousin): w_i ~ 1/var_i;
(2) diagonal max-Sharpe / tangency for uncorrelated assets: w_i ~ max(0,mu_i)/var_i (long-only); (3) 2-asset
min-variance WITH correlation, closed form; (4) portfolio variance of ANY weight vector given the full
covariance (the objective to evaluate/compare allocations). Weights in bps (sum ~10000). i64 fixed-point.
The full N-asset correlated convex QP (cvxpy/PyPortfolioOpt) is the refinement still ahead. license_tier: ORIGINAL
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_fin_optimizer_gate.nx
structs
| none |
consts
| 8 | const K_MAGIC_1000000000: i64 = 1000000000 |
| 9 | const K_MAGIC_10000: i64 = 10000 |
| 10 | const K_MAGIC_1000000: i64 = 1000000 |
| 11 | const K_MAGIC_5000: i64 = 5000 |
| 12 | const K_MAGIC_100000000: i64 = 100000000 |
functions
| 15 | func op_inv_var_weight(varr: *i64, n: i64, wout: *i64) -> i64 |
| 25 | func op_max_sharpe_diag(mu: *i64, varr: *i64, n: i64, wout: *i64) -> i64 |
| 41 | func op_minvar_2asset(v1: i64, v2: i64, cov: i64) -> i64 called by 1: main |
| 52 | func op_port_variance(w: *i64, cov: *i64, n: i64) -> i64 called by 1: main |