From e92e4473c82edebafa4ff41dc48f780aa3a7ad70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=A5=E5=BE=AE?= Date: Fri, 10 Jul 2026 21:07:59 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=91=A8=E7=BA=BF+=E6=9C=88=E7=BA=BF?= =?UTF-8?q?=E8=B6=8B=E5=8A=BF/MA/=E6=94=AF=E6=92=91=E9=98=BB=E5=8A=9B?= =?UTF-8?q?=E6=B3=A8=E5=85=A5mtf=5Fcontext?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/strategy_lifecycle.py | 24 ++++++++++++++++++++++++ scripts/technical_analysis.py | 23 ++++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/scripts/strategy_lifecycle.py b/scripts/strategy_lifecycle.py index c5891e55..2deec1e3 100644 --- a/scripts/strategy_lifecycle.py +++ b/scripts/strategy_lifecycle.py @@ -1458,6 +1458,30 @@ def reassess_strategy(code, name, price, cost, shares, current_action, parts.append(f"长撑:{stop_ref.get('source','?')}={stop_ref['level']}") if take_ref: parts.append(f"长压:{take_ref.get('source','?')}={take_ref['level']}") + + # 周线趋势 + weekly = mtf_analysis.get("weekly", {}) + wt = weekly.get("trend", {}) + wm = weekly.get("mas", {}) + ws = weekly.get("support_resistance", {}) + if wt.get("direction"): + parts.append(f"周线{wt['direction']}") + if wm.get("ma5"): + parts.append(f"周MA5={wm['ma5']}") + if ws.get("weak_support"): + parts.append(f"周撑={ws['weak_support']}") + if ws.get("weak_resist"): + parts.append(f"周压={ws['weak_resist']}") + + # 月线趋势 + monthly = mtf_analysis.get("monthly", {}) + mt = monthly.get("trend", {}) + ms = monthly.get("mas", {}) + if mt.get("direction"): + parts.append(f"月线{mt['direction']}") + if ms.get("ma5"): + parts.append(f"月MA5={ms['ma5']}") + mtf_context = " | ".join(parts) now_str = datetime.now().strftime('%Y-%m-%d %H:%M') diff --git a/scripts/technical_analysis.py b/scripts/technical_analysis.py index 3216f4bc..b363efe1 100644 --- a/scripts/technical_analysis.py +++ b/scripts/technical_analysis.py @@ -587,9 +587,30 @@ def full_analysis(code): if 'weekly' in mtf_raw: w = mtf_raw['weekly'] ws = w.get('support_resistance', {}) - mtf['weekly_sr'] = { + wt = w.get('trend', {}) + wm = w.get('mas', {}) + mtf['weekly'] = { 'weak_resist': ws.get('weak_resist'), 'weak_support': ws.get('weak_support'), + 'strong_resist': ws.get('strong_resist'), + 'strong_support': ws.get('strong_support'), + 'trend': wt.get('direction', ''), + 'ma5': wm.get('ma5'), + 'ma10': wm.get('ma10'), + } + # 月线作为长期参考 + if 'monthly' in mtf_raw: + m = mtf_raw['monthly'] + ms = m.get('support_resistance', {}) + mt = m.get('trend', {}) + mm = m.get('mas', {}) + mtf['monthly'] = { + 'weak_resist': ms.get('weak_resist'), + 'weak_support': ms.get('weak_support'), + 'strong_resist': ms.get('strong_resist'), + 'strong_support': ms.get('strong_support'), + 'trend': mt.get('direction', ''), + 'ma5': mm.get('ma5'), } except Exception: pass # non-critical, graceful degradation