Skip to Content
Telegram → MT5Architecture

Architecture

The package lives under src/telegram_metatrader/. Console scripts from pyproject.toml:

ScriptEntry
telegram-metatradertelegram_metatrader.main:run
telegram-metatrader-logintelegram_metatrader.cli.login:run
telegram-metatrader-verify-chattelegram_metatrader.cli.verify_chat:run

Modules

ModuleResponsibility
main.pyProcess entry / run loop
service.pyOrchestrates poll → parse → execute / dry-run
config.pyEnvironment-based settings
models.pySignal and related models
parser.pyFixed-lot market signal parsing
telegram_client.pyTelethon MTProto client for the configured chat
mt5_executor.pyLocal MT5 init, symbol select, order_check / order_send (when live)
state.pyCursor and handled-message persistence
jsonl.pyJSONL log writers
health.pyGET /health and GET /status HTTP surface
cli/login.pyInteractive session creation
cli/verify_chat.pyChat ID / access verification

Runtime flow

Telegram chat (MTProto user session) poll messages ──▶ parse signal ──▶ map symbol (SYMBOL_MAP_JSON) │ │ │ ▼ │ dry-run log or MT5 order_check → order_send cursor + handled keys + JSONL logs (raw / signals / executions / errors)

Dependencies: Telethon, MetaTrader5, python-dotenv. The official MetaTrader5 package targets Windows beside a running terminal.

Last updated on