Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 36 additions & 24 deletions src/quant_platform_kit/common/notification_localization.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"strategy_plugin_alert_strategy": "策略:{strategy}",
"strategy_plugin_alert_plugin": "插件:{plugin}",
"strategy_plugin_alert_situation": "当前情况:{situation}",
"strategy_plugin_alert_trigger": "触发原因:{reasons}",
"strategy_plugin_alert_recommendation": "建议处理:{recommendation}",
"strategy_plugin_alert_status": "插件状态:{route}",
"strategy_plugin_alert_action": "动作边界:{action}",
Expand Down Expand Up @@ -75,18 +76,23 @@
"strategy_plugin_action_blocked": "已阻断",
"strategy_plugin_action_monitor": "持续观察",
"strategy_plugin_action_unknown_action": "未知提醒",
"strategy_plugin_situation_watch_watch_only": "当前不是危机,也不是自动抄底信号;插件只提示市场进入观察状态。触发原因:{reasons}。",
"strategy_plugin_situation_market_regime_control_watch_watch_only": "当前不是危机,也不是自动抄底信号;市场状态控制只提示波动或宏观条件进入观察区。触发原因:{reasons}。",
"strategy_plugin_situation_market_regime_control_risk_reduced_delever": "市场压力升高,策略可能需要按已批准的可回测规则降杠杆。触发原因:{reasons}。",
"strategy_plugin_situation_market_regime_control_risk_off_defend": "市场状态进入防守区,机会类信号应先让位给风险控制。触发原因:{reasons}。",
"strategy_plugin_situation_market_regime_control_opportunity_watch_notify_manual_review": "出现可能的反弹或低吸窗口,但证据只够人工复核,不足以自动交易。触发原因:{reasons}。",
"strategy_plugin_situation_market_regime_control_blocked_blocked": "数据质量或新鲜度保护触发,当前插件信号不能直接使用。触发原因:{reasons}。",
"strategy_plugin_situation_taco_rebound_shadow_taco_rebound_notify_manual_review": "出现 TACO 反弹观察窗口;这属于人工复核机会,不是自动买入信号。触发原因:{reasons}。",
"strategy_plugin_situation_true_crisis_defend": "危机防守信号已触发,需要优先处理风险敞口。触发原因:{reasons}。",
"strategy_plugin_situation_delever_delever": "降杠杆信号已触发,需要按策略规则压低风险敞口。触发原因:{reasons}。",
"strategy_plugin_situation_notify_manual_review": "插件发现需要人工复核的市场状态。触发原因:{reasons}。",
"strategy_plugin_situation_default": "插件发现需要关注的市场状态。触发原因:{reasons}。",
"strategy_plugin_recommendation_watch_only": "先人工核对市场环境和现有仓位;策略仓位不因这条通知自动调整,具体买卖仍以策略运行结果或人工确认执行。",
"strategy_plugin_situation_watch_watch_only": "观察状态:插件检测到市场进入观察区。",
"strategy_plugin_situation_market_regime_control_watch_watch_only": "波动观察:市场状态控制检测到波动或宏观压力进入观察区。",
"strategy_plugin_situation_market_regime_control_risk_reduced_delever": "自动降杠杆候选:市场压力升高,策略可按已批准的可回测规则降低杠杆。",
"strategy_plugin_situation_market_regime_control_risk_off_defend": "防守状态:市场状态进入风险关闭区,机会类信号应先让位给风险控制。",
"strategy_plugin_situation_market_regime_control_opportunity_watch_notify_manual_review": "机会观察:出现可能的反弹或低吸窗口,当前证据只够人工复核。",
"strategy_plugin_situation_market_regime_control_blocked_blocked": "数据阻断:数据质量或新鲜度保护已触发,当前插件信号不能直接使用。",
"strategy_plugin_situation_taco_rebound_shadow_taco_rebound_notify_manual_review": "TACO 反弹观察:出现可能的反弹窗口,属于人工复核机会。",
"strategy_plugin_situation_true_crisis_defend": "危机防守:危机防守信号已触发,需要优先处理风险敞口。",
"strategy_plugin_situation_delever_delever": "降杠杆:降杠杆信号已触发,需要按策略规则压低风险敞口。",
"strategy_plugin_situation_notify_manual_review": "人工复核:插件发现需要人工判断的市场状态。",
"strategy_plugin_situation_default": "状态提醒:插件发现需要关注的市场状态。",
"strategy_plugin_recommendation_market_regime_control_watch_watch_only": "核对触发项、近几日波动和当前仓位杠杆;这类观察通知不自动改仓位,需要调仓时以策略运行结果或人工确认执行。",
"strategy_plugin_recommendation_market_regime_control_risk_reduced_delever": "核对策略运行结果、账户约束和降杠杆阈值;若策略侧已触发自动规则,由策略通知和仓位适配器执行。",
"strategy_plugin_recommendation_market_regime_control_risk_off_defend": "暂停机会类加仓判断,先确认防守仓位是否符合策略规则;恢复进攻前等待风险关闭状态解除。",
"strategy_plugin_recommendation_market_regime_control_opportunity_watch_notify_manual_review": "人工核对反弹质量、成交/趋势确认和失效条件;确认前只作为低吸候选,不直接转成自动买入。",
"strategy_plugin_recommendation_market_regime_control_blocked_blocked": "先修复数据源、产物新鲜度或校验失败项;阻断解除前不要基于这条信号调仓。",
"strategy_plugin_recommendation_watch_only": "核对触发项、市场环境和现有仓位;观察通知不自动改仓位,需要调仓时以策略运行结果或人工确认执行。",
"strategy_plugin_recommendation_notify_manual_review": "人工复核触发原因、新闻/宏观背景、现有仓位和失效条件;未确认前不要把这条通知当成下单指令。",
"strategy_plugin_recommendation_defend": "优先确认策略运行结果和账户约束;如果策略已触发自动防守,由策略通知和仓位适配器执行,插件通知本身不直接下单。",
"strategy_plugin_recommendation_delever": "优先确认策略运行结果和账户约束;如果策略已触发自动降杠杆,由策略通知和仓位适配器执行,插件通知本身不直接下单。",
Expand Down Expand Up @@ -117,6 +123,7 @@
"strategy_plugin_alert_strategy": "Strategy: {strategy}",
"strategy_plugin_alert_plugin": "Plugin: {plugin}",
"strategy_plugin_alert_situation": "Situation: {situation}",
"strategy_plugin_alert_trigger": "Trigger: {reasons}",
"strategy_plugin_alert_recommendation": "Suggested review: {recommendation}",
"strategy_plugin_alert_status": "Plugin status: {route}",
"strategy_plugin_alert_action": "Action boundary: {action}",
Expand Down Expand Up @@ -152,18 +159,23 @@
"strategy_plugin_action_blocked": "blocked",
"strategy_plugin_action_monitor": "watch",
"strategy_plugin_action_unknown_action": "unknown notice",
"strategy_plugin_situation_watch_watch_only": "This is not a crisis signal and not an automatic dip-buy signal; the plugin is only flagging a watch state. Trigger: {reasons}.",
"strategy_plugin_situation_market_regime_control_watch_watch_only": "This is not a crisis signal and not an automatic dip-buy signal; market-regime control is only flagging volatility or macro conditions for review. Trigger: {reasons}.",
"strategy_plugin_situation_market_regime_control_risk_reduced_delever": "Market stress has risen; the strategy may need to reduce leverage under approved backtestable rules. Trigger: {reasons}.",
"strategy_plugin_situation_market_regime_control_risk_off_defend": "The market regime is defensive; opportunity signals should give way to risk control. Trigger: {reasons}.",
"strategy_plugin_situation_market_regime_control_opportunity_watch_notify_manual_review": "A possible rebound or dip-buy window is present, but the evidence is only strong enough for manual review, not automatic trading. Trigger: {reasons}.",
"strategy_plugin_situation_market_regime_control_blocked_blocked": "Data-quality or freshness guards blocked the signal, so it should not be used directly. Trigger: {reasons}.",
"strategy_plugin_situation_taco_rebound_shadow_taco_rebound_notify_manual_review": "A TACO rebound watch window is present; this is a manual-review opportunity, not an automatic buy signal. Trigger: {reasons}.",
"strategy_plugin_situation_true_crisis_defend": "A crisis-defense signal is active and risk exposure needs priority review. Trigger: {reasons}.",
"strategy_plugin_situation_delever_delever": "A de-lever signal is active and risk exposure should be reduced under strategy rules. Trigger: {reasons}.",
"strategy_plugin_situation_notify_manual_review": "The plugin found a market state that needs manual review. Trigger: {reasons}.",
"strategy_plugin_situation_default": "The plugin found a market state that needs attention. Trigger: {reasons}.",
"strategy_plugin_recommendation_watch_only": "Review the market context and current holdings first; this notice does not automatically change strategy exposure, and any trade should come from the strategy run or an explicit manual decision.",
"strategy_plugin_situation_watch_watch_only": "Watch state: the plugin detected that the market has entered a watch zone.",
"strategy_plugin_situation_market_regime_control_watch_watch_only": "Volatility watch: market-regime control detected volatility or macro pressure in the watch zone.",
"strategy_plugin_situation_market_regime_control_risk_reduced_delever": "Automatic de-lever candidate: market stress has risen, and the strategy may reduce leverage under approved backtestable rules.",
"strategy_plugin_situation_market_regime_control_risk_off_defend": "Defensive state: the market regime is in the risk-off zone, so opportunity signals should give way to risk control.",
"strategy_plugin_situation_market_regime_control_opportunity_watch_notify_manual_review": "Opportunity watch: a possible rebound or dip-buy window is present, but the evidence is only strong enough for manual review.",
"strategy_plugin_situation_market_regime_control_blocked_blocked": "Data block: data-quality or freshness guards fired, so the current plugin signal cannot be used directly.",
"strategy_plugin_situation_taco_rebound_shadow_taco_rebound_notify_manual_review": "TACO rebound watch: a possible rebound window is present and needs manual review.",
"strategy_plugin_situation_true_crisis_defend": "Crisis defense: a crisis-defense signal is active and risk exposure needs priority review.",
"strategy_plugin_situation_delever_delever": "De-lever: a de-lever signal is active and risk exposure should be reduced under strategy rules.",
"strategy_plugin_situation_notify_manual_review": "Manual review: the plugin found a market state that needs human judgment.",
"strategy_plugin_situation_default": "State notice: the plugin found a market state that needs attention.",
"strategy_plugin_recommendation_market_regime_control_watch_watch_only": "Check the trigger, recent volatility, and current leverage; this watch notice does not change allocations automatically, and any position change should come from the strategy run or an explicit manual decision.",
"strategy_plugin_recommendation_market_regime_control_risk_reduced_delever": "Check the strategy run, account constraints, and de-lever thresholds; if the strategy-side automatic rule fired, execution belongs to the strategy notification and position adapter.",
"strategy_plugin_recommendation_market_regime_control_risk_off_defend": "Pause opportunity adds and confirm whether defensive exposure matches strategy rules; wait for the risk-off state to clear before resuming offensive signals.",
"strategy_plugin_recommendation_market_regime_control_opportunity_watch_notify_manual_review": "Manually review rebound quality, volume/trend confirmation, and the invalidation level; treat it as a dip-buy candidate only until confirmed.",
"strategy_plugin_recommendation_market_regime_control_blocked_blocked": "Fix source data, artifact freshness, or validation failures first; do not adjust exposure from this signal until the block clears.",
"strategy_plugin_recommendation_watch_only": "Review the trigger, market context, and current holdings; watch notices do not change allocations automatically, and any trade should come from the strategy run or an explicit manual decision.",
"strategy_plugin_recommendation_notify_manual_review": "Review the trigger, news or macro context, current exposure, and invalidation level before acting; do not treat this notice as an order instruction.",
"strategy_plugin_recommendation_defend": "Confirm the strategy run and account constraints first; if automatic defense is active, execution belongs to the strategy notification and position adapter, not to this plugin notice.",
"strategy_plugin_recommendation_delever": "Confirm the strategy run and account constraints first; if automatic de-levering is active, execution belongs to the strategy notification and position adapter, not to this plugin notice.",
Expand Down
9 changes: 8 additions & 1 deletion src/quant_platform_kit/common/strategy_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -1344,6 +1344,7 @@ def build_strategy_plugin_alert_messages(
fallback="Notification target" if target_type == "notification_target" else "Strategy",
)
guidance = build_strategy_plugin_alert_guidance(signal, translator=translator)
reason_summary = build_strategy_plugin_alert_reason_summary(signal, translator=translator)
situation = build_strategy_plugin_alert_situation(signal, translator=translator)
recommendation = build_strategy_plugin_alert_recommendation(signal, translator=translator)
scope_note = build_strategy_plugin_alert_scope_note(signal, translator=translator)
Expand Down Expand Up @@ -1398,6 +1399,12 @@ def build_strategy_plugin_alert_messages(
fallback="Situation: {situation}",
situation=situation,
),
_translate(
translator,
"strategy_plugin_alert_trigger",
fallback="Trigger: {reasons}",
reasons=reason_summary,
),
_translate(
translator,
"strategy_plugin_alert_recommendation",
Expand Down Expand Up @@ -1461,7 +1468,7 @@ def build_strategy_plugin_alert_messages(
"display_target": display_target_label,
"situation": situation,
"recommendation": recommendation,
"reason_summary": build_strategy_plugin_alert_reason_summary(signal, translator=translator),
"reason_summary": reason_summary,
"guidance": guidance,
"scope_note": scope_note,
"ai_audit": getattr(signal, "payload", {}).get("ai_audit")
Expand Down
8 changes: 5 additions & 3 deletions tests/test_strategy_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -846,9 +846,11 @@ def test_market_regime_notification_alert_explains_situation_and_next_step_in_zh
self.assertIn("[插件发布 / 统一市场状态通知]", alerts[0].subject)
self.assertNotIn("strategy-plugin-publish", alerts[0].subject)
self.assertIn("通知对象:统一市场状态通知", alerts[0].body)
self.assertIn("当前情况:当前不是危机,也不是自动抄底信号", alerts[0].body)
self.assertIn("宏观:实现波动偏高", alerts[0].body)
self.assertIn("建议处理:先人工核对市场环境和现有仓位", alerts[0].body)
self.assertIn("当前情况:波动观察:市场状态控制检测到波动或宏观压力进入观察区。", alerts[0].body)
self.assertIn("触发原因:宏观:实现波动偏高", alerts[0].body)
self.assertIn("建议处理:核对触发项、近几日波动和当前仓位杠杆", alerts[0].body)
self.assertNotIn("不是危机", alerts[0].body)
self.assertNotIn("不是自动抄底信号", alerts[0].body)
self.assertIn("动作边界:仅观察,不自动交易", alerts[0].body)
self.assertIn("自动化边界:这条通知只用于人工复核", alerts[0].body)
self.assertEqual(alerts[0].metadata["display_target"], "统一市场状态通知")
Expand Down