From 4880f1c1bfacb0f8ac4d984765cc60f45fd127af Mon Sep 17 00:00:00 2001 From: hmo Date: Fri, 31 Jul 2026 03:08:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=94=9F=E4=BA=A7=E7=AB=AF=E4=BF=A1?= =?UTF-8?q?=E5=BF=B5=E4=BB=93=E4=BD=8D=E5=AF=B9=E9=BD=90v=5Fnext3=E2=80=94?= =?UTF-8?q?=E2=80=94DNA=C3=972+=E8=A1=8C=E4=B8=9AADX>25=C3=972+flow=5Fdelt?= =?UTF-8?q?a>0=C3=972=E5=8F=A0=E4=B9=98=E5=B0=81=E9=A1=B6=C3=974(=E5=8F=96?= =?UTF-8?q?=E4=BB=A3=E6=97=A7=C3=972.5/=E8=A1=8C=E4=B8=9A=E7=89=9B?= =?UTF-8?q?=E6=9D=A0=E6=9D=86=E5=8D=87=E7=BA=A7=E6=A1=A3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/profile-scripts/strategy_lifecycle.py | 66 +++++++++++++------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/deploy/profile-scripts/strategy_lifecycle.py b/deploy/profile-scripts/strategy_lifecycle.py index 2db26829..9834177a 100644 --- a/deploy/profile-scripts/strategy_lifecycle.py +++ b/deploy/profile-scripts/strategy_lifecycle.py @@ -1040,26 +1040,21 @@ def reassess_strategy(code, name, price, cost, shares, current_action, print(f" 分类: {stock_category} | {time_horizon} | {position_advice}") - # ── v_next3行业牛杠杆: 行业确认牛(行业ADX>25)时升一档仓位(2026-07-30落地)── + # ── v_next3 信念模型因子:行业ADX>25 + flow_delta>0(DNA在v71_gate后判断)── + _vnext3_factors = {} + _vnext3_mult = 1.0 try: - _sec_adx = 0 - try: - from strategy_lab import sector_ctx, prepare_sector_context - from datetime import timedelta as _td - _end = datetime.now().strftime('%Y-%m-%d') - _start = (datetime.now() - _td(days=200)).strftime('%Y-%m-%d') - prepare_sector_context(_start, _end) - _sc = sector_ctx(code, _end) - _sec_adx = _sc.get('adx') or 0 - except Exception: - _sec_adx = 0 - if _sec_adx > 25: - _upgrade = {"小仓快进快出": "中等仓位", "中等仓位": "重仓", "正常配置": "重仓"} - if position_advice in _upgrade: - print(f" [行业牛杠杆] 行业ADX={_sec_adx:.0f}>25 → 仓位{position_advice}→{_upgrade[position_advice]}", flush=True) - position_advice = _upgrade[position_advice] - except Exception as _e: - print(f" [行业牛杠杆] 评估异常(跳过): {_e}", flush=True) + from strategy_lab import sector_ctx, prepare_sector_context, flow_ctx + from datetime import timedelta as _td + _end = datetime.now().strftime('%Y-%m-%d') + _start = (datetime.now() - _td(days=200)).strftime('%Y-%m-%d') + prepare_sector_context(_start, _end) + _sc = sector_ctx(code, _end) + _vnext3_factors['sector_adx'] = _sc.get('adx') or 0 + _fl = flow_ctx(code, _end, None, None) + _vnext3_factors['flow_delta'] = _fl.get('flow_delta') or 0 + except Exception: + pass # ----- 短炒+强趋势检测:短炒分类但多周期多头时用移动止损代替弱支撑止损 ----- is_short_term_strong_trend = False @@ -1505,13 +1500,38 @@ def reassess_strategy(code, name, price, cost, shares, current_action, timing_signal = "买入" _entry_source = 'momentum' action_note = (action_note + " | B动量突破: " + _bg["reason"]) if action_note else ("B动量突破: " + _bg["reason"]) - # 动量基因×2.5 信念仓位(2026-07-29 v_combo落地) - if position_advice in ("小仓快进快出", "中等仓位", "正常配置"): - position_advice = "重仓(动量基因×2.5)" - print(f" [B通道] 动量突破→买入+重仓×2.5: {_bg['reason']}", flush=True) + _vnext3_factors['dna'] = True + print(f" [B通道] 动量突破→买入: {_bg['reason']}", flush=True) except Exception as _e: print(f" [B通道] 评估异常(跳过): {_e}", flush=True) + # ── v_next3 信念模型叠乘封顶×4 ── + if is_new_entry and any(s in timing_signal for s in ("买入", "加仓", "可追")): + _mult = 1.0 + _notes = [] + # ① DNA(B通道标记或v71_gate的hh_structure) + if _vnext3_factors.get('dna') or ('_gate' in dir() and _gate and _gate.get('factors',{}).get('hh_structure')): + _mult *= 2 + _notes.append("DNA×2") + # ② 行业ADX>25 + if _vnext3_factors.get('sector_adx', 0) > 25: + _mult *= 2 + _notes.append(f"行业ADX={_vnext3_factors['sector_adx']:.0f}>25×2") + # ③ flow_delta>0 + if _vnext3_factors.get('flow_delta', 0) > 0: + _mult *= 2 + _notes.append(f"flow={_vnext3_factors['flow_delta']:.1f}>0×2") + # 封顶 + _mult = min(_mult, 4.0) + if _mult > 1.0: + up = {"小仓快进快出": "中等仓位", "中等仓位": "重仓", "正常配置": "重仓"} + if position_advice in up: + old_pos = position_advice + position_advice = up[position_advice] if _mult < 4.0 else "重仓" + print(f" [v_next3信念×{_mult:.0f}] {'·'.join(_notes)} → {old_pos}→{position_advice}", flush=True) + else: + print(f" [v_next3信念×1] 无信念因子触发", flush=True) + # ----- 【三维共振层】技术×资金×消息合成判断(2026-07-29 老爸批准,全程记录) ----- _res_decision = None if is_new_entry and any(s in timing_signal for s in ("买入", "加仓", "可追")):