Skip to content

Commit 78af69a

Browse files
authored
Generalize strategy plugin alert copy (#96)
1 parent 80d3392 commit 78af69a

2 files changed

Lines changed: 23 additions & 7 deletions

File tree

notifications/telegram.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@
7777
"blend_gate_reason_bollinger_cap": "突破布林上轨",
7878
"blend_gate_reason_volatility_delever": "{symbol} {window} 日年化波动率 {volatility} 高于 {threshold},SOXL 转向 {redirect_symbol}",
7979
"strategy_plugin_line": "🧩 插件:{plugin} | 状态:{route} | 提醒:{action}",
80-
"strategy_plugin_alert_subject": "🚨 危机插件告警:{plugin} | {route}",
81-
"strategy_plugin_alert_title": "🚨 【危机插件告警】",
80+
"strategy_plugin_alert_subject": "🚨 策略插件告警:{plugin} | {route}",
81+
"strategy_plugin_alert_title": "🚨 【策略插件告警】",
8282
"strategy_plugin_alert_context": "运行环境:{context}",
8383
"strategy_plugin_alert_strategy": "策略:{strategy}",
8484
"strategy_plugin_alert_plugin": "插件:{plugin}",
@@ -87,12 +87,15 @@
8787
"strategy_plugin_alert_mode": "模式:{mode}",
8888
"strategy_plugin_alert_as_of": "信号时间:{as_of}",
8989
"strategy_plugin_name_crisis_response_shadow": "危机观察通知",
90+
"strategy_plugin_name_taco_rebound_shadow": "TACO 抄底观察通知",
9091
"strategy_plugin_mode_shadow": "影子观察",
91-
"strategy_plugin_route_no_action": "未触发危机",
92+
"strategy_plugin_route_no_action": "未触发",
9293
"strategy_plugin_route_true_crisis": "真危机",
94+
"strategy_plugin_route_taco_rebound": "TACO 反弹确认",
9395
"strategy_plugin_route_unknown_route": "未知状态",
9496
"strategy_plugin_action_no_action": "不操作",
9597
"strategy_plugin_action_watch_only": "仅通知",
98+
"strategy_plugin_action_notify_manual_review": "通知人工复核",
9699
"strategy_plugin_action_defend": "防守",
97100
"strategy_plugin_action_blocked": "已阻断",
98101
"strategy_plugin_action_monitor": "持续观察",
@@ -201,8 +204,8 @@
201204
"blend_gate_reason_bollinger_cap": "price above upper band",
202205
"blend_gate_reason_volatility_delever": "{symbol} {window}d annualized volatility {volatility} is above {threshold}; redirect SOXL to {redirect_symbol}",
203206
"strategy_plugin_line": "🧩 Plugin: {plugin} | status: {route} | notice: {action}",
204-
"strategy_plugin_alert_subject": "🚨 Crisis plugin alert: {plugin} | {route}",
205-
"strategy_plugin_alert_title": "🚨 【Crisis Plugin Alert】",
207+
"strategy_plugin_alert_subject": "🚨 Strategy plugin alert: {plugin} | {route}",
208+
"strategy_plugin_alert_title": "🚨 【Strategy Plugin Alert】",
206209
"strategy_plugin_alert_context": "Context: {context}",
207210
"strategy_plugin_alert_strategy": "Strategy: {strategy}",
208211
"strategy_plugin_alert_plugin": "Plugin: {plugin}",
@@ -211,12 +214,15 @@
211214
"strategy_plugin_alert_mode": "Mode: {mode}",
212215
"strategy_plugin_alert_as_of": "Signal as-of: {as_of}",
213216
"strategy_plugin_name_crisis_response_shadow": "Crisis Watch Notice",
217+
"strategy_plugin_name_taco_rebound_shadow": "TACO Rebound Watch Notice",
214218
"strategy_plugin_mode_shadow": "shadow",
215-
"strategy_plugin_route_no_action": "no crisis detected",
219+
"strategy_plugin_route_no_action": "no alert",
216220
"strategy_plugin_route_true_crisis": "true crisis",
221+
"strategy_plugin_route_taco_rebound": "TACO rebound confirmed",
217222
"strategy_plugin_route_unknown_route": "unknown status",
218223
"strategy_plugin_action_no_action": "no action",
219224
"strategy_plugin_action_watch_only": "notify only",
225+
"strategy_plugin_action_notify_manual_review": "notify manual review",
220226
"strategy_plugin_action_defend": "defend",
221227
"strategy_plugin_action_blocked": "blocked",
222228
"strategy_plugin_action_monitor": "watch",

tests/test_notifications.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,17 @@ def test_build_translator_supports_chinese():
4444
route=translate("strategy_plugin_route_no_action"),
4545
action=translate("strategy_plugin_action_watch_only"),
4646
)
47-
== "🧩 插件:危机观察通知 | 状态:未触发危机 | 提醒:仅通知"
47+
== "🧩 插件:危机观察通知 | 状态:未触发 | 提醒:仅通知"
48+
)
49+
assert (
50+
translate(
51+
"strategy_plugin_line",
52+
plugin=translate("strategy_plugin_name_taco_rebound_shadow"),
53+
mode=translate("strategy_plugin_mode_shadow"),
54+
route=translate("strategy_plugin_route_taco_rebound"),
55+
action=translate("strategy_plugin_action_notify_manual_review"),
56+
)
57+
== "🧩 插件:TACO 抄底观察通知 | 状态:TACO 反弹确认 | 提醒:通知人工复核"
4858
)
4959
assert translate("account_ids_detail", account_ids="U18308207") == "🆔 账户: U18308207"
5060
assert (

0 commit comments

Comments
 (0)