fix: 弱信号不可执行+rr_low/rr_high防DELETE+INSERT冲零

- /api/watch: 信号不充分/关注/弱势持有/观望/持有 的推荐永远排队不徽章可执行
  (tag是LLM行动信号时遗留,技术路径降级信号后无权摘tag,徽章层自卡信号)
- write_holding_strategy: INSERT补rr_low/rr_high列,调用方不提供时保留旧值
  (盘中per_stock技术路径每次DELETE+INSERT把两个计算列冲成0,昨晚回填全灭)
This commit is contained in:
hmo
2026-07-23 14:11:22 +08:00
parent d5a62f48ef
commit 12f7f87a2e
2 changed files with 18 additions and 5 deletions
+7 -1
View File
@@ -240,11 +240,17 @@ def get_watch():
# 买入:RR≥1.5 才有可执行资格(prompt 自己的纪律:RR<1.5→不推荐);
# 达标者贪心装入现金预算,预算外/不达标标记"排队"(不再降级隐藏)
_cum = 0.0
# 弱信号不可执行(2026-07-23 老爸:信号不充分+盈利持有为何可执行?——
# tag是LLM行动信号时的遗留,技术路径降级信号后无权摘tag,徽章层必须自己卡信号)
_WEAK_SIGNALS = ('信号不充分', '关注', '弱势持有', '观望', '持有', '')
for d in _buys:
pct = _sugg_pct(d)
d['suggested_position_pct'] = pct
rr = d.get('rr_ratio') or 0
if rr >= 1.5 and _cum + pct <= _budget_pct + 1e-9:
sig_now = d.get('timing_signal') or ''
if sig_now in _WEAK_SIGNALS:
d['rec_exec'] = False # 弱信号永远排队
elif rr >= 1.5 and _cum + pct <= _budget_pct + 1e-9:
d['rec_exec'] = True # 可执行
_cum += pct
else: