fix(suggestion): load full 50-symbol price snapshot + exclude falling-price names from profit buckets

- load_price_snapshot picked the last snapshot by filename (lexicographic),
  selecting a stale 9-symbol collection over the full 50-symbol universe. Now
  picks the snapshot with the latest source.retrieved_at.
- allocate_capital profit buckets now also require momentum > 0 (a falling-price
  name is not 'ทำกำไร'), while momentum/theme_signal stay Optional so the PIT
  backtest path (which doesn't provide them) still allocates.
- Suggestion now allocates across all 50 SET50 names (B1: BGRIM,TTB; B2: BANPU;
  B3: ADVANC,SCB,LH).
- Regression tests for both. Full suite 374 green.
This commit is contained in:
Kunthawat Greethong
2026-08-31 10:56:22 +07:00
parent 576d9e31ec
commit 4c32e2b737
3 changed files with 89 additions and 14 deletions

View File

@@ -129,3 +129,17 @@ New definition implemented:
- Verified: suggestion now picks CRC+BEM (dividend, rising price) in bucket 1;
PTT/MINT (falling price, theme positive) slide to bucket 3 by yield, not
bucket 1. Full suite 372 green (3 new momentum/gate tests).
## Price-snapshot load fix + momentum gate (owner "เพื่อทดสอบ logic" — 2026-08-31)
- `load_price_snapshot` was picking the LAST snapshot by FILENAME (lexicographic),
which selected a stale 9-symbol collection over the full 50-symbol universe
(`2024-01-01..` sorts after `2023-08-28..`). Now it picks the snapshot with the
latest `source.retrieved_at`, so the full 50-symbol SET50 universe loads.
- Suggestion now allocates across all 50 names; verified it picks rising-price,
theme-positive dividend names in B1 (BGRIM, TTB), non-dividend rising in B2
(BANPU), and yield-top names in B3 (ADVANC, SCB, LH).
- Added momentum>0 gate to the profit buckets (a falling-price name must NOT be
picked as "ทำกำไร"), while keeping momentum/theme_signal as Optional so the
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.