From fa044756931df2a809d4caabb6fe87243af3e1d0 Mon Sep 17 00:00:00 2001 From: claude_dev Date: Sat, 15 Aug 2026 12:03:29 +0800 Subject: [PATCH] =?UTF-8?q?fix(portfolio):=20value=5Fselection=E9=80=89?= =?UTF-8?q?=E8=82=A1=E5=AE=9A=E5=BA=8F=E2=80=94=5Fget=5Fstock=5Flist=20lis?= =?UTF-8?q?t(set=E4=BA=A4=E9=9B=86)=E6=94=B9sorted():set=E8=BF=AD=E4=BB=A3?= =?UTF-8?q?=E5=BA=8F=E5=8F=97PYTHONHASHSEED=E6=AF=8F=E8=BF=9B=E7=A8=8B?= =?UTF-8?q?=E9=9A=8F=E6=9C=BA=E5=8C=96=E2=86=92=E8=B7=A8=E8=BF=9B=E7=A8=8B?= =?UTF-8?q?=E5=9B=9E=E6=B5=8Btrades/stocks=5Fselected=E4=B9=B1=E5=BA=8F(TE?= =?UTF-8?q?T=20Phase2=E8=80=81vs=E8=80=81=E5=AF=B9=E7=85=A736a3a843/afe189?= =?UTF-8?q?ea=E5=AE=9E=E9=94=A4,issue#19);sorted=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=E5=8F=AF=E5=A4=8D=E7=8E=B0=E6=80=A7,=E9=80=89=E8=82=A1?= =?UTF-8?q?=E9=9B=86=E5=90=88=E4=B8=8D=E5=8F=98;328=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E7=BB=BF=20[vps]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sanguo_portfolio/strategies/value_selection.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sanguo_portfolio/strategies/value_selection.py b/sanguo_portfolio/strategies/value_selection.py index 704977c..af71006 100644 --- a/sanguo_portfolio/strategies/value_selection.py +++ b/sanguo_portfolio/strategies/value_selection.py @@ -280,7 +280,10 @@ class ValueSelectionStrategy: cfg.earnings_growth_low, cfg.earnings_growth_high, ) - out = list(l1 & l2 & l3 & l4 & l5 & l6) + # sorted 定序:set 迭代顺序受 PYTHONHASHSEED 每进程随机化 → 跨进程 + # 回测 trades/stocks_selected 乱序(2026-08-15 TET Phase2 老vs老对照实锤); + # sorted 恢复可复现性,选股集合与顺序无关的下游语义不变 + out = sorted(l1 & l2 & l3 & l4 & l5 & l6) logger.info( "[%s] L1=%d L2=%d L3=%d L4=%d L5=%d L6=%d → final=%d", date_str, len(l1), len(l2), len(l3), len(l4), len(l5), len(l6),