{{ key_history_brief(h) }}
- 类型: {{ h.monitor_type }}
+ 类型: {{ key_monitor_type_label(h) }}
结案: {{ key_history_outcome_label(h) }}{% if h.close_reason %} ({{ h.close_reason }}){% endif %}
时间: {{ h.closed_at or '—' }}
@@ -318,3 +321,4 @@ document.querySelectorAll(".key-row-collapse").forEach((row)=>{
});
});
+
diff --git a/strategy_templates/key_monitor_rule_tips.html b/strategy_templates/key_monitor_rule_tips.html
index 74d2b38..f852f49 100644
--- a/strategy_templates/key_monitor_rule_tips.html
+++ b/strategy_templates/key_monitor_rule_tips.html
@@ -40,7 +40,7 @@
占当日开仓意图 全仓模式可用 |
-| 阻力 / 支撑 |
+关键支撑阻力 |
双向;填上/下沿 |
{{ r.tf }} 收盘破上沿或下沿 上沿优先 |
无(仅提醒) |
diff --git a/tests/test_key_monitor_rs_type.py b/tests/test_key_monitor_rs_type.py
new file mode 100644
index 0000000..29d486f
--- /dev/null
+++ b/tests/test_key_monitor_rs_type.py
@@ -0,0 +1,27 @@
+import unittest
+
+from key_monitor_lib import (
+ KEY_MONITOR_RS_TYPE,
+ is_rs_key_monitor_type,
+ rs_monitor_type_for_storage,
+ rs_monitor_type_label,
+)
+
+
+class KeyMonitorRsTypeTests(unittest.TestCase):
+ def test_legacy_types_still_recognized(self):
+ self.assertTrue(is_rs_key_monitor_type("关键阻力位"))
+ self.assertTrue(is_rs_key_monitor_type("关键支撑位"))
+
+ def test_storage_normalizes_to_unified_type(self):
+ self.assertEqual(rs_monitor_type_for_storage("关键阻力位"), KEY_MONITOR_RS_TYPE)
+ self.assertEqual(rs_monitor_type_for_storage("关键支撑位"), KEY_MONITOR_RS_TYPE)
+ self.assertEqual(rs_monitor_type_for_storage(KEY_MONITOR_RS_TYPE), KEY_MONITOR_RS_TYPE)
+
+ def test_label_merges_legacy_display(self):
+ self.assertEqual(rs_monitor_type_label("关键阻力位"), KEY_MONITOR_RS_TYPE)
+ self.assertEqual(rs_monitor_type_label("箱体突破"), "箱体突破")
+
+
+if __name__ == "__main__":
+ unittest.main()