feat: granular Telegram notification filters via .env (#161) #162

Merged
jihoson merged 2 commits from feature/issue-161-telegram-notification-filters into main 2026-02-20 02:33:56 +09:00
Collaborator

요약

  • NotificationFilter dataclass 추가 — 알림 유형별 on/off 플래그
  • TelegramClient 생성자에 notification_filter 파라미터 추가
  • notify_* 메서드에 필터 가드 추가
  • circuit_breaker는 안전상 필터 무관 항상 전송
  • main.py 생성 시 settings에서 필터 값 주입
  • src/config.py에 7개 설정 추가

사용법 (.env)

# 시나리오 매칭 알림 끄기 (가장 빈번한 알림)
TELEGRAM_NOTIFY_SCENARIO_MATCH=false

# 장 시작/종료도 끄기
TELEGRAM_NOTIFY_MARKET_OPEN_CLOSE=false

# 나머지는 기본값 true

플랜 대비 구현 일치 여부

  • config.py 7개 설정 추가 — 플랜과 동일
  • NotificationFilter dataclass — 플랜과 동일
  • 각 notify_* 메서드 가드 — 플랜과 동일
  • circuit_breaker 항상 전송 — 플랜과 동일
  • main.py 생성 시 필터 전달 — 플랜과 동일
  • 테스트 10개 추가 (TestNotificationFilter 클래스)

테스트

10 passed (NotificationFilter tests)
658 passed total

Closes #161

## 요약 - `NotificationFilter` dataclass 추가 — 알림 유형별 on/off 플래그 - `TelegramClient` 생성자에 `notification_filter` 파라미터 추가 - 각 `notify_*` 메서드에 필터 가드 추가 - circuit_breaker는 안전상 필터 무관 항상 전송 - `main.py` 생성 시 settings에서 필터 값 주입 - `src/config.py`에 7개 설정 추가 ## 사용법 (.env) ```env # 시나리오 매칭 알림 끄기 (가장 빈번한 알림) TELEGRAM_NOTIFY_SCENARIO_MATCH=false # 장 시작/종료도 끄기 TELEGRAM_NOTIFY_MARKET_OPEN_CLOSE=false # 나머지는 기본값 true ``` ## 플랜 대비 구현 일치 여부 - [x] config.py 7개 설정 추가 — 플랜과 동일 - [x] NotificationFilter dataclass — 플랜과 동일 - [x] 각 notify_* 메서드 가드 — 플랜과 동일 - [x] circuit_breaker 항상 전송 — 플랜과 동일 - [x] main.py 생성 시 필터 전달 — 플랜과 동일 - [x] 테스트 10개 추가 (TestNotificationFilter 클래스) ## 테스트 ``` 10 passed (NotificationFilter tests) 658 passed total ``` Closes #161
agentson added 1 commit 2026-02-20 02:26:42 +09:00
feat: granular Telegram notification filters via .env (#161)
Some checks failed
CI / test (pull_request) Has been cancelled
8dd625bfd1
Add NotificationFilter dataclass to TelegramClient allowing per-type
on/off control via .env variables. circuit_breaker always sends regardless.

New .env options (all default true):
- TELEGRAM_NOTIFY_TRADES
- TELEGRAM_NOTIFY_MARKET_OPEN_CLOSE
- TELEGRAM_NOTIFY_FAT_FINGER
- TELEGRAM_NOTIFY_SYSTEM_EVENTS
- TELEGRAM_NOTIFY_PLAYBOOK
- TELEGRAM_NOTIFY_SCENARIO_MATCH  (most frequent — set false to reduce noise)
- TELEGRAM_NOTIFY_ERRORS

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
agentson added 1 commit 2026-02-20 02:33:08 +09:00
feat: /notify command for runtime notification filter control (#161)
Some checks failed
CI / test (pull_request) Has been cancelled
4a59d7e66d
Add /notify Telegram command for adjusting notification filters at runtime
without restarting the service:

  /notify                  → show current filter state
  /notify scenario off     → disable scenario match alerts
  /notify market off       → disable market open/close alerts
  /notify all off          → disable all (circuit_breaker always on)
  /notify trades on        → re-enable trade execution alerts

Changes:
- NotificationFilter: add KEYS class var, set_flag(), as_dict()
- TelegramClient: add set_notification(), filter_status()
- TelegramCommandHandler: add register_command_with_args() + args dispatch
- main.py: handle_notify() handler + register /notify command + /help update
- Tests: 12 new tests (set_flag, set_notification, register_command_with_args)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
jihoson merged commit ff5ff736d8 into main 2026-02-20 02:33:56 +09:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: jihoson/The-Ouroboros#162