emrpy.telegrambot

Telegram Trading Bot Module

A lightweight, async-first Telegram bot client optimized for trading notifications. Built on top of python-telegram-bot library for reliability and ease of use.

Classes

TelegramTradingBot(bot_token, chat_id[, ...])

Lightweight Telegram bot for trading notifications.

class emrpy.telegrambot.TelegramTradingBot(bot_token, chat_id, chat_name=None)

Bases: object

Lightweight Telegram bot for trading notifications.

Features:

  • Async-first design for minimal latency impact

  • Simple message sending

  • Formatted trade alerts

  • Bulk notifications support

  • Built-in error handling and logging

async send_bulk_notifications(messages, parse_mode=None, disable_notification=False)

Send multiple messages concurrently for better performance.

Parameters:
  • messages (List[str]) – List of message texts to send

  • parse_mode (Optional[str]) – ‘HTML’ or ‘Markdown’ for formatting (optional)

  • disable_notification (bool) – Send silently without notification sound

Returns:

List of success status for each message

Return type:

List[bool]

async send_message(text, parse_mode=None, disable_notification=False)

Send a text message to the configured chat.

Parameters:
  • text (str) – Message text to send

  • parse_mode (Optional[str]) – ‘HTML’ or ‘Markdown’ for formatting (optional)

  • disable_notification (bool) – Send silently without notification sound

Returns:

True if message sent successfully, False otherwise

Return type:

bool

async send_trade_alert(symbol, action, price, quantity, profit_loss=None, disable_notification=False)

Send a formatted trade alert with emoji and structured layout.

Parameters:
  • symbol (str) – Trading symbol (e.g., ‘BTCUSD’, ‘AAPL’)

  • action (str) – Trade action (‘BUY’, ‘SELL’, ‘CLOSE’)

  • price (float) – Execution price

  • quantity (float) – Trade quantity/size

  • profit_loss (Optional[float]) – P/L amount (optional, will show emoji based on sign)

  • disable_notification (bool) – Send silently without notification sound

Returns:

True if alert sent successfully, False otherwise

Return type:

bool