refactor(siamchart): momentum is a first-class factor INSIDE the score formula (owner rule)

Owner: momentum must enter the formula (a factor), not be bolted on outside it.
- Single declarative source _SIAMCHART_WEIGHTS = {eps_growth:1.5, dividend_yield:2.0, momentum:0.5}.
- New siamchart_raw_score(g,d,m) = single source of the formula; momentum is an
  explicit term inside it. All 3 call sites (build_siamchart_score + both
  symbol_breakdown spots) now share it — no duplicated arithmetic.
- Pure refactor: outputs unchanged (weights identical). Tests added for the
  momentum-inside-formula rule + momentum raising the score. Full suite 376 green.
This commit is contained in:
Kunthawat Greethong committed 2026-08-31 18:50:32 +07:00
1 parent 2b7a065ae5
commit 5b8a10c730
3 files changed
+72 -11

No files matched your search

@@ -143,3 +143,16 @@ New definition implemented:
PIT backtest path (which doesn't provide them) still allocates.
- Regression tests: load_price_snapshot picks most-recently-retrieved; negative
momentum excluded from profit buckets. Full suite 374 green.
## Refactor: momentum is a factor INSIDE the Siamchart formula (owner rule — 2026-08-31)
The owner insisted momentum must be entered INTO the score formula (a first-class
factor), not bolted on outside it. Refactored `themes.py` from 3 loose weight
constants + inline formula repeated in 3 places to a single declarative source:
- `_SIAMCHART_WEIGHTS = {eps_growth:1.5, dividend_yield:2.0, momentum:0.5}` (config).
- `siamchart_raw_score(g,d,m)` = single source of the formula; momentum is a term
INSIDE it. All three call sites (build_siamchart_score, symbol_breakdown raw,
symbol_breakdown population) now use it — no more duplicated arithmetic.
- Purely a refactor: outputs unchanged (0.6/0.4 weighting intact), momentum
already weighted 0.5 inside the formula.
- Added tests: raw score formula incl. momentum term; momentum raises siamchart
score given identical fundamentals. Full suite 376 green.