ChanPivotMonitor: 实时中枢特征跟踪 + Telegram推送

- ChanPivotClassifier: 提取 calc_duration/contraction/shift 为 @staticmethod,新增 compute_features()
- ChanPivotMonitor: 实时追踪当前中枢,bi_count 增长时重新计算 shift/contraction/duration
- bsp_monitor/fetcher: 改用 data_provider HTTP API 替代直连 CCXT
- bsp_monitor/notify: 新增 send_telegram_message() 通用推送
- bsp_monitor/main: 集成 ChanPivotMonitor,有新笔或 BSP 时推送到 Telegram

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
jackyu66git
2026-05-26 11:35:09 +08:00
co-authored by Claude Opus 4.7
parent 5ad761fad4
commit b1cbdca707
5 changed files with 300 additions and 40 deletions
+33
View File
@@ -54,6 +54,39 @@ def _save_pushed():
_load_pushed()
def send_telegram_message(text: str) -> bool:
"""发送 Telegram 消息(不去重,每次调用都发)。
Args:
text: HTML 格式的消息文本
Returns:
True 如果发送成功
"""
if not BOT_TOKEN or not CHAT_ID:
logger.warning("Telegram 未配置,跳过推送")
return False
url = f"https://api.telegram.org/bot{BOT_TOKEN}/sendMessage"
try:
resp = requests.post(
url,
json={
"chat_id": CHAT_ID,
"text": text,
"parse_mode": "HTML",
"disable_web_page_preview": True,
},
timeout=10,
)
resp.raise_for_status()
logger.info(f"Telegram 推送成功")
return True
except Exception as e:
logger.error(f"Telegram 推送失败: {e}")
return False
def send_bsp_alert(text: str, bsp_key: str = "") -> bool:
"""通过 Telegram Bot API 推送买卖点消息(自动去重)。