add Telegram alerts: qualified setups, S/R proximity, score drops, daily digest
Closes the action loop — instead of polling the dashboard, the platform pushes actionable signals to Telegram. New hourly 'alerts' job dispatches four toggleable triggers, deduped via a new alert_log table (cooldown-based for qualified/S-R/digest, watermark-based for score deterioration). Admin → Settings gains a Telegram panel (write-only bot token, chat ID, per-trigger toggles, Send Test). Credentials follow DB > env precedence (TELEGRAM_BOT_TOKEN / _CHAT_ID). Backend: alert_service + AlertLog model + migration 005, scheduler job, admin endpoints/schema. Frontend: AlertSettings panel, hooks, api, types. Deploy: run alembic upgrade (new alert_log table). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,8 @@ import apiClient from './client';
|
||||
import type {
|
||||
ActivationConfig,
|
||||
AdminUser,
|
||||
AlertConfig,
|
||||
AlertTestResult,
|
||||
PipelineReadiness,
|
||||
RecommendationConfig,
|
||||
SentimentProviderConfig,
|
||||
@@ -105,6 +107,32 @@ export function testSentimentSettings(ticker: string) {
|
||||
.then((r) => r.data);
|
||||
}
|
||||
|
||||
export function getAlertSettings() {
|
||||
return apiClient
|
||||
.get<AlertConfig>('admin/settings/alerts')
|
||||
.then((r) => r.data);
|
||||
}
|
||||
|
||||
export function updateAlertSettings(payload: {
|
||||
enabled?: boolean;
|
||||
bot_token?: string;
|
||||
telegram_chat_id?: string;
|
||||
qualified_enabled?: boolean;
|
||||
sr_proximity_enabled?: boolean;
|
||||
score_drop_enabled?: boolean;
|
||||
digest_enabled?: boolean;
|
||||
}) {
|
||||
return apiClient
|
||||
.put<AlertConfig>('admin/settings/alerts', payload)
|
||||
.then((r) => r.data);
|
||||
}
|
||||
|
||||
export function testAlertSettings() {
|
||||
return apiClient
|
||||
.post<AlertTestResult>('admin/settings/alerts/test')
|
||||
.then((r) => r.data);
|
||||
}
|
||||
|
||||
export function getTickerUniverseSetting() {
|
||||
return apiClient
|
||||
.get<TickerUniverseSetting>('admin/settings/ticker-universe')
|
||||
|
||||
Reference in New Issue
Block a user