2026-11-12 12:20:39 +08:00
|
|
|
"""提议当前分析的业务表达与实质变化判断,不改变合议规则。"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def timing_view(timing):
|
|
|
|
|
t = timing or {}
|
|
|
|
|
stance = t.get('stance')
|
|
|
|
|
event = t.get('event') or t.get('intraday_event') or {}
|
|
|
|
|
if stance in ('看多', '看空', '中性'):
|
|
|
|
|
return {'label': stance, 'reason': event.get('reason') or {
|
|
|
|
|
'看多': '当前择时支持买入,仍需满足限价和资金条件',
|
|
|
|
|
'看空': '当前择时不支持买入', '中性': '暂无明确多空倾向'}[stance]}
|
|
|
|
|
signs = {g.get('direction') for g in (event.get('groups') or {}).values()
|
|
|
|
|
if g.get('state') == 'VALID'}
|
|
|
|
|
if 1 in signs and -1 in signs:
|
|
|
|
|
return {'label': '多空分歧', 'reason': '有效看多与看空证据并存,当前不支持买入'}
|
|
|
|
|
return {'label': '买入依据不足', 'reason': '有效择时证据尚不足以支持买入'}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def decision_basis(hard):
|
|
|
|
|
"""只比较影响建议的判断,不因证据刷新时间或事件标识变化反复打断确认。"""
|
|
|
|
|
h = hard or {}
|
|
|
|
|
con, tech, timing = h.get('consensus') or {}, h.get('tech') or {}, h.get('timing') or {}
|
|
|
|
|
votes = con.get('votes') or {}
|
|
|
|
|
return {'fund': (h.get('fund_stance') or {}).get('stance') or votes.get('fund'),
|
|
|
|
|
'tech': {k: tech.get(k) for k in ('stance', 'phase', 'data_date', 'sar_side')},
|
2026-11-12 12:22:41 +08:00
|
|
|
'intraday_confirmation': (tech.get('intraday') or {}).get('kind'),
|
2026-11-12 12:20:39 +08:00
|
|
|
'timing': timing.get('stance') or votes.get('timing'),
|
|
|
|
|
'timing_label': timing_view(timing)['label'],
|
2026-11-12 12:22:41 +08:00
|
|
|
'consensus': {k: con.get(k) for k in ('direction', 'strength', 'route')}}
|
2026-11-12 12:20:39 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def changed(old, current):
|
|
|
|
|
return decision_basis(old) != decision_basis(current)
|
2026-11-12 12:25:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def recheck_message(analysis):
|
|
|
|
|
"""条件已不满足时给出交易原因,而非要求用户理解后台更新状态。"""
|
|
|
|
|
con = (analysis or {}).get('consensus') or {}
|
|
|
|
|
reason = con.get('route_reason') or ''
|
|
|
|
|
if reason == '等待新的有效合成择时':
|
|
|
|
|
return '有效择时证据不足,暂不建仓'
|
|
|
|
|
if con.get('direction') == '看空':
|
|
|
|
|
return '综合分析看空,当前不建议建仓'
|
|
|
|
|
if con.get('route') in ('观察', '跳过'):
|
|
|
|
|
return '暂不建仓:' + (reason or '建仓条件尚未满足')
|
|
|
|
|
return '分析结论已更新,交易计划复核后可确认'
|