code wiki / (root) / nx_piotroski_lib.nx

nx_piotroski_lib.nx

buildroot/runtime/nx_piotroski_lib.nx

3438 B64 linesdepth 7pulls 12 transitivereach 3 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_piotroski_lib.nx -- F-SCORE: Piotroski 9-point fundamental-strength score, integer-exact. Pairs with the Altman-Z distress engine (nx_fin_zscore): Altman asks "is this firm in trouble?", the Piotroski F-score asks "is this firm's fundamental picture STRENGTHENING?" -- nine binary year-over-year tests across profitability, leverage/liquidity, and operating efficiency, each worth one point, summed 0..9. High (8-9) = strong improving fundamentals; low (0-2) = deteriorating. Every test is an integer comparison -- no float, so the score is reproducible to the point. Inputs are scaled integers (ratios in basis points, money in minor units); a real pipeline gets them from nx_xbrl-parsed filings. ★FAIL-CLOSED + COMPOSES nx_xbrl: the missing-input sentinel PIO_NA is the SAME value nx_xbrl returns for an absent fact (XB_NO_FACT = -999999999). So if any required metric could not be parsed from the filing, pio_fscore returns PIO_INCOMPLETE rather than scoring an unverifiable firm -- a partial F-score read as a real one is exactly the kind of false signal that gets money committed on bad data. DRY: composes nx_matter_lib helpers. license_tier: ORIGINAL No hw writes (Rule 26). LIB.

dependencies 1 imports · 2 importers

nx_matter_lib.nx nx_piotroski_lib.nx nx_finhealth_lib.nx nx_piotroski_gate.nx

imports: nx_matter_lib.nx

imported by: nx_finhealth_lib.nxnx_piotroski_gate.nx

structs

none

consts

21const PIO_NA: i64 = 0 - 999999999 // missing input (matches nx_xbrl XB_NO_FACT) -> incomplete
22const PIO_INCOMPLETE: i64 = 0 - 1 // a required metric was absent; score not computable
23const PIO_N: i64 = 14 // number of input metrics

functions

32func pio_fscore(m: *i64) -> i64
called by 2: mainmain
52func pio_grade(score: i64) -> *u8
called by 1: main
60func pio_complete(m: *i64) -> i64
called by 1: main