硬性策略质量门禁 validate_strategy()

新增 STRATEGY_QUALITY_GATES 检查清单(9条红线):
CRITICAL: 止损/止盈存在+>0, 买入区下沿<上沿
HIGH: 止损≤买入区, 买入推荐含RR≥1.5, 港股标currency=HKD
MEDIUM: signal短词, tech_snapshot含技术位

enforce_strategy_quality() 插在写入链的两处:
1. reassess_with_context() return前 → 单只重评必过
2. regenerate_all() for d in decisions: 写DB前 → 批量重评必过

不过的:status=review_needed, signal降级→信号不充分
不会写进DB/JSON,除非修复了CRITICAL问题
This commit is contained in:
知微
2026-07-02 13:46:53 +08:00
parent 04b8a6d4bc
commit 7c0e85af28
32 changed files with 12496 additions and 75159 deletions
+4 -4
View File
@@ -211,14 +211,14 @@ def refresh_data_prices():
# 收集所有需要拉取的代码
try:
pf = mo_data.read_portfolio()
pf = read_portfolio()
for s in pf.get('holdings', []):
all_codes.add(s['code'])
except:
pf = {"holdings": []}
try:
wl = mo_data.read_watchlist()
wl = read_watchlist()
for s in wl.get('stocks', []):
all_codes.add(s['code'])
except:
@@ -363,7 +363,7 @@ def _branch_alert_suffix(code, price, shares=0, cost=0):
def _record_branch_trigger(code, branch_id, price):
"""记录分支触发事件(自成长:trigger_count+1"""
try:
raw = mo_data.read_decisions()
raw = read_decisions()
for d in raw.get('decisions', []):
if d.get('code') == code and d.get('strategy_tree',{}).get('branches'):
for b in d['strategy_tree']['branches']:
@@ -487,7 +487,7 @@ def run_once(round_label=""):
_SCENARIO_CACHE = detect_scenario() if HAS_TREE else {}
_BRANCH_CACHE = {}
try:
raw = mo_data.read_decisions()
raw = read_decisions()
for d in raw.get('decisions', []):
tree = d.get('strategy_tree', {})
if tree and tree.get('branches'):