feat: integrate TelegramClient into main trading loop (issue #34) #39

Merged
jihoson merged 1 commits from feature/issue-34-main-integration into main 2026-02-04 23:44:49 +09:00
Collaborator

Summary

Integrate Telegram notifications throughout the main trading loop to provide real-time alerts for critical events and trading activities.

Changes

  • System lifecycle notifications

    • System startup notification with enabled markets
    • Market open/close notifications tracking market state
  • Trading notifications

    • Trade execution notifications for BUY/SELL orders
    • Fat finger rejection notifications when orders are blocked
    • Circuit breaker notifications when loss threshold is exceeded
  • Implementation details

    • Initialize TelegramClient in run() function
    • Pass telegram client to trading_cycle() function
    • All notifications wrapped in try/except (non-blocking)
    • Market state tracking to detect open/close transitions
  • Testing

    • Add comprehensive test suite in tests/test_main.py
    • Test all notification scenarios with mocks
    • Verify notifications don't crash trading on failure
    • 6 new tests, all passing

Test Results

pytest tests/test_main.py -v
# 6 passed

pytest --cov=src
# 273 passed, overall coverage 79%

Closes #34


🤖 Generated with Claude Code

## Summary Integrate Telegram notifications throughout the main trading loop to provide real-time alerts for critical events and trading activities. ## Changes - **System lifecycle notifications** - System startup notification with enabled markets - Market open/close notifications tracking market state - **Trading notifications** - Trade execution notifications for BUY/SELL orders - Fat finger rejection notifications when orders are blocked - Circuit breaker notifications when loss threshold is exceeded - **Implementation details** - Initialize TelegramClient in `run()` function - Pass telegram client to `trading_cycle()` function - All notifications wrapped in try/except (non-blocking) - Market state tracking to detect open/close transitions - **Testing** - Add comprehensive test suite in `tests/test_main.py` - Test all notification scenarios with mocks - Verify notifications don't crash trading on failure - 6 new tests, all passing ## Test Results ```bash pytest tests/test_main.py -v # 6 passed pytest --cov=src # 273 passed, overall coverage 79% ``` ## Related Issues Closes #34 --- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
agentson added 1 commit 2026-02-04 23:43:10 +09:00
feat: integrate TelegramClient into main trading loop (issue #34)
Some checks failed
CI / test (pull_request) Has been cancelled
972e71a2f1
Integrate Telegram notifications throughout the main trading loop to provide
real-time alerts for critical events and trading activities.

Changes:
- Add TelegramClient initialization in run() function
- Send system startup notification on agent start
- Send market open/close notifications when markets change state
- Send trade execution notifications for BUY/SELL orders
- Send fat finger rejection notifications when orders are blocked
- Send circuit breaker notifications when loss threshold is exceeded
- Pass telegram client to trading_cycle() function
- Add tests for all notification scenarios in test_main.py

All notifications wrapped in try/except to ensure trading continues even
if Telegram API fails. Notifications are non-blocking and do not affect
core trading logic.

Test coverage: 273 tests passed, overall coverage 79%

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
jihoson merged commit 5f7d61748b into main 2026-02-04 23:44:49 +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#39