Notification upgrades: lifecycle, configurable levels, summaries
- NOTIFY_LEVELS chooses which event levels are sent (default trade,error). - NOTIFY_LIFECYCLE sends explicit start/stop messages; the kill switch always notifies at error level. - SUMMARY_INTERVAL_MINUTES sends a periodic portfolio summary (equity, per strategy P&L, allocation, halted state) via a background task started with the run and stopped on stop/kill/shutdown. - Wires the new vars plus the go-live vars through both compose files and the deploy workflow. Adds tests.
This commit is contained in:
1 parent
ef3e6f346c
commit
2ca5032e7e
8 files changed
+203
-5
No files matched your search
@@ -60,6 +60,13 @@ class Settings(BaseSettings):
|
||||
telegram_bot_token: str = ""
|
||||
telegram_chat_id: str = ""
|
||||
notify_webhook_url: str = ""
|
||||
# Event levels to notify on. Defaults to trades and errors; add "info" to
|
||||
# include start/stop messages, or "warning" for blocked entries.
|
||||
notify_levels: str = "trade,error"
|
||||
# Explicit start/stop lifecycle messages (separate from event levels).
|
||||
notify_lifecycle: bool = True
|
||||
# Periodic portfolio summary, in minutes (0 disables).
|
||||
summary_interval_minutes: int = 0
|
||||
|
||||
# Optional bearer token required on /api requests (defense-in-depth behind
|
||||
# the Traefik Basic auth). Empty disables the check.
|
||||
@@ -80,6 +87,10 @@ class Settings(BaseSettings):
|
||||
def cors_origin_list(self) -> list[str]:
|
||||
return [origin.strip() for origin in self.cors_origins.split(",") if origin.strip()]
|
||||
|
||||
@property
|
||||
def notify_level_set(self) -> set[str]:
|
||||
return {level.strip().lower() for level in self.notify_levels.split(",") if level.strip()}
|
||||
|
||||
@property
|
||||
def is_live(self) -> bool:
|
||||
return self.mode == "live"
|
||||
|
||||
Reference in new issue
Block a user