Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion notifications/telegram.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,22 @@ def _localize_timing_contract(contract: Any, *, translator: Callable[..., str])
return value


def _infer_quote_overlay_used(source: str, overlay):
if overlay is not None:
return overlay
normalized_source = str(source or "").strip().lower()
if "with_live_quote_overlay" in normalized_source:
return True
if normalized_source in {
"longbridge_candlesticks",
"historical_close",
"snapshot_close",
"market_quote",
}:
Comment on lines +562 to +567

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Classify mixed market quote sources as no-overlay

When latest_price_source is mixed_market_quote_snapshot_close or mixed_market_quote_historical_close (both recognized source names in this module's localization table), this inference still returns None because those names are not in the no-overlay set and do not contain with_live_quote_overlay. Since build_signal_snapshot() leaves absent quote_overlay_used as None, notifications for those known non-overlay sources will continue to render quote overlay unknown, defeating the new inference for those snapshot source names.

Useful? React with 👍 / 👎.

return False
return None


def _format_timing_lines(execution: Mapping[str, Any], *, translator: Callable[..., str]) -> list[str]:
signal_date = str(execution.get("signal_date") or "").strip()
effective_date = str(execution.get("effective_date") or "").strip()
Expand All @@ -573,7 +589,7 @@ def _format_signal_snapshot_line(snapshot: Any, *, lang: str) -> str:
return ""
market_date = str(snapshot.get("market_date") or snapshot.get("signal_as_of") or "").strip()
source = str(snapshot.get("latest_price_source") or "").strip()
overlay = snapshot.get("quote_overlay_used")
overlay = _infer_quote_overlay_used(source, snapshot.get("quote_overlay_used"))
warning = snapshot.get("data_freshness_warning")
if not market_date and not source and overlay is None and warning in (None, "", False):
return ""
Expand Down