fix: 生产端信念仓位对齐v_next3——DNA×2+行业ADX>25×2+flow_delta>0×2叠乘封顶×4(取代旧×2.5/行业牛杠杆升级档)

This commit is contained in:
hmo
2026-07-31 03:08:41 +08:00
parent 49a9fc980f
commit 4880f1c1bf
+43 -23
View File
@@ -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>0DNA在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 = []
# ① DNAB通道标记或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 ("买入", "加仓", "可追")):