How lucasaraujoo/iqoption-telegram-bot works
Main System Components
• Telegram Integration: The bot listens for commands and sends/receives messages to/from Telegram. This is indicated by the instructions to create and configure a Telegram bot via BotFather and the use of “TELEGRAM_TOKEN” and “TELEGRAM_ID” environment variables in config.txt.
• Core Bot Logic & Signal Processing: Represented by the main scripts (AutoBot_24h.py and Inclusor_Sinais.py), which are responsible for loading configurations, handling real-time signals, and managing internal state. This module also handles threading to improve optimization and precision.
• IQ Option API Integration:
– HTTP Module: Inside the iqoptionapi/http folder are multiple files (login.py, auth.py, profile.py, etc.) that handle RESTful interactions such as authentication, registration, billing, and other operations.
– WebSocket (WS) Module: Located in iqoptionapi/ws and further divided into “channels” and “objects” directories. This module manages real-time data such as market data, orders, and trading updates.
– Stable API Wrapper: Wrappers such as stable_api.py and api.py serve as a higher-level abstraction for interacting with the underlying HTTP and WS components.
• Configuration & Logging: The config.txt file, signals file (sinais.txt), and logs directory collectively represent the configuration settings and runtime logs for monitoring operations.
Relationships and Interactions
• The Telegram integration component serves as the user interface. It sends user commands to the core bot logic.
• The core bot logic, upon receiving a Telegram command or signal, uses threads to perform operations concurrently. It then communicates with the IQ Option API modules to execute trades.
• The IQ Option API integration has two main communication paths: one using HTTP for tasks like login, registration, and profile queries, and another using WebSockets for receiving real-time market feed, order updates, and executing trades.
• Configuration settings from config.txt drive the runtime behavior while log files record significant events.
Architectural Patterns and Design Principles
• Separation of Concerns: Different modules/components are clearly separated (Telegram interface, core logic, HTTP and WS API integrations).
• Modular Design: The iqoptionapi package is organized into submodules (http and ws) which encapsulate API-specific functionality.
• Concurrency: Use of threads in the main scripts to manage simultaneous tasks and ensure trade execution precision.
• Extensibility: The “channels” in the ws submodule are organized per functionality, making it easier to add or modify trading commands and features.
Final Touches for Detail
• Integration points by noting which environment variables (from config.txt) affect behavior.