setup_telegram_logging#
API documentation for tradeexecutor.cli.log.setup_telegram_logging Python function.
- setup_telegram_logging(telegram_api_key, telegram_chat_id)[source]#
- Setup Telegram logger. - Set up a Python logging handler based on telegram_bot_logger to send trade output to a Telegram group chat. - Note - This handler spawns a background thread. You need to call handler.close or your application won’t exit. - Manual testing instructions. - Invite the bot to a group chat. Then send a message /start @botname to the bot in the group chat to activate it. - Then get chat id with: - curl https://api.telegram.org/bot$TELEGRAM_API_KEY/getUpdates | jq - Test with: - pytest --log-cli-level=info -k test_telegram_logging