Add WeCom markdown alerts and keep target exits while strategy is paused.

Notify open/close/start/pause/fault with SIM vs LIVE venue labels; configure webhook in Settings.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-26 23:19:39 +08:00
parent 4d331da962
commit 56a4007130
12 changed files with 602 additions and 16 deletions
+20
View File
@@ -0,0 +1,20 @@
from __future__ import annotations
from app.notify.wecom import TAG_OPEN, build_markdown, venue_label
def test_build_markdown_has_tag_and_title(monkeypatch):
monkeypatch.setattr("app.notify.wecom.venue_label", lambda: "模拟盘")
md = build_markdown(tag=TAG_OPEN, title="开仓成功", lines=["组: G-1"])
assert "【模拟盘】开仓成功" in md
assert "`OPEN`" in md
assert "组: G-1" in md
def test_venue_label_sim(monkeypatch):
class S:
is_sim = True
exchange = "okx"
monkeypatch.setattr("app.notify.wecom.get_settings", lambda: S())
assert venue_label() == "模拟盘"