Fix chart pattern alert Markdown
This commit is contained in:
+4
-1
@@ -341,7 +341,10 @@ def format_signal_message(report: SignalReport) -> str:
|
|||||||
f"📊 Regime: {regime_str} · Vol: {vol_str}",
|
f"📊 Regime: {regime_str} · Vol: {vol_str}",
|
||||||
]
|
]
|
||||||
if report.action_recommendation:
|
if report.action_recommendation:
|
||||||
lines.append(f"_{_escape_md(report.action_recommendation)}_")
|
# Pattern identifiers use underscores, which legacy Telegram Markdown
|
||||||
|
# can misparse even when escaped inside this italicized action line.
|
||||||
|
action = report.action_recommendation.replace("_", " ")
|
||||||
|
lines.append(f"_{_escape_md(action)}_")
|
||||||
|
|
||||||
if report.trade_setup and sig not in (SignalStrength.NEUTRAL,):
|
if report.trade_setup and sig not in (SignalStrength.NEUTRAL,):
|
||||||
ts = report.trade_setup
|
ts = report.trade_setup
|
||||||
|
|||||||
@@ -1685,6 +1685,15 @@ def _():
|
|||||||
assert "Not financial advice" in msg
|
assert "Not financial advice" in msg
|
||||||
|
|
||||||
|
|
||||||
|
@test("format_signal_message makes chart pattern actions Markdown-safe")
|
||||||
|
def _():
|
||||||
|
report = SignalReport(symbol="XAU/USD", display_name="XAU/USD", timestamp="now")
|
||||||
|
report.action_recommendation = "BUY — double_bottom pattern completion"
|
||||||
|
msg = format_signal_message(report)
|
||||||
|
assert "_BUY — double bottom pattern completion_" in msg
|
||||||
|
assert "double_bottom" not in msg
|
||||||
|
|
||||||
|
|
||||||
@test("format_signal_message renders stamped per-TF trail plan")
|
@test("format_signal_message renders stamped per-TF trail plan")
|
||||||
def _():
|
def _():
|
||||||
def _setup(**extra):
|
def _setup(**extra):
|
||||||
|
|||||||
Reference in New Issue
Block a user