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 with emoji

  • Bulk notifications support

  • Built-in error handling and logging

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

Send multiple messages concurrently to improve throughput.

Return type:

List[bool]

Parameters:

messagesList[str]

List of message texts to send.

parse_modeOptional[str], default None

Formatting mode for all messages: ‘HTML’ or ‘Markdown’.

disable_notificationbool, default False

If True, send all messages silently without notification sound.

Returns:

: List[bool]

List of booleans indicating success status for each message.

Examples:

>>> statuses = await bot.send_bulk_notifications(
...     ["Alert 1", "Alert 2"],
...     parse_mode="HTML"
... )
async send_message(text, parse_mode=None, disable_notification=False)

Send a text message to the configured Telegram chat asynchronously.

Return type:

bool

Parameters:

textstr

Content of the message to send.

parse_modeOptional[str], default None

Formatting mode: ‘HTML’ or ‘Markdown’. No formatting if None.

disable_notificationbool, default False

If True, send silently without notification sound.

Returns:

: bool

True if the message was sent successfully; False otherwise.

Examples:

>>> success = await bot.send_message(
...     "Bot is now live 🚀",
...     parse_mode="Markdown"
... )
async send_trade_alert(symbol, action, price, quantity, profit_loss=None, disable_notification=False)

Send a formatted trade alert with structured layout and emoji indicators.

Return type:

bool

Parameters:

symbolstr

Trading symbol (e.g., ‘BTCUSD’, ‘AAPL’).

actionstr

Trade action: ‘BUY’, ‘SELL’, or ‘CLOSE’.

pricefloat

Execution price of the trade.

quantityfloat

Quantity or size of the trade.

profit_lossOptional[float], default None

Profit or loss amount; if provided, shows 📈 for profit or 📉 for loss.

disable_notificationbool, default False

If True, send silently without notification sound.

Returns:

: bool

True if the alert was sent successfully; False otherwise.

Examples:

>>> await bot.send_trade_alert(
...     symbol="ETHUSD",
...     action="BUY",
...     price=1820.50,
...     quantity=1.2,
...     profit_loss=45.75
... )