Unify key support/resistance monitor type and fix form parity.
Merge 关键阻力位/关键支撑位 into 关键支撑阻力, share key_monitor_form.js across hub and new-tab views, and add hub shortcut to /key_monitor. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+21
-2
@@ -7,11 +7,30 @@ from datetime import datetime
|
||||
from typing import Any, Optional
|
||||
|
||||
KEY_MONITOR_AUTO_TYPES = frozenset({"箱体突破", "收敛突破"})
|
||||
KEY_MONITOR_RS_TYPES = frozenset({"关键阻力位", "关键支撑位"})
|
||||
KEY_MONITOR_ALERT_ONLY_TYPES = KEY_MONITOR_RS_TYPES
|
||||
KEY_MONITOR_RS_TYPE = "关键支撑阻力"
|
||||
KEY_MONITOR_RS_LEGACY_TYPES = frozenset({"关键阻力位", "关键支撑位"})
|
||||
KEY_MONITOR_RS_TYPES = frozenset({KEY_MONITOR_RS_TYPE}) | KEY_MONITOR_RS_LEGACY_TYPES
|
||||
KEY_MONITOR_ALERT_ONLY_TYPES = frozenset({KEY_MONITOR_RS_TYPE}) | KEY_MONITOR_RS_LEGACY_TYPES
|
||||
KEY_DIRECTION_WATCH = "watch"
|
||||
|
||||
|
||||
def is_rs_key_monitor_type(monitor_type: str) -> bool:
|
||||
return (monitor_type or "").strip() in KEY_MONITOR_RS_TYPES
|
||||
|
||||
|
||||
def rs_monitor_type_label(monitor_type: str) -> str:
|
||||
"""展示用:旧库里的阻力/支撑合并为「关键支撑阻力」。"""
|
||||
if is_rs_key_monitor_type(monitor_type):
|
||||
return KEY_MONITOR_RS_TYPE
|
||||
return (monitor_type or "").strip()
|
||||
|
||||
|
||||
def rs_monitor_type_for_storage(monitor_type: str) -> str:
|
||||
if is_rs_key_monitor_type(monitor_type):
|
||||
return KEY_MONITOR_RS_TYPE
|
||||
return (monitor_type or "").strip()
|
||||
|
||||
|
||||
def calc_breakout_breach_pct(direction: str, close: float, upper: float, lower: float) -> float:
|
||||
"""突破 K 收盘相对关键位的越过幅度(%)。未越过对应边界时返回 0。"""
|
||||
direction = (direction or "long").strip().lower()
|
||||
|
||||
Reference in New Issue
Block a user