How cleitonleonel/pyquotex works
Project Type and Purpose
• The project is a Python library (not a full-stack app or trading bot on its own) that provides developers with tools to automate communication with the Quotex platform.
• It abstracts away the details of the Quotex API (authentication, data retrieval, order management, etc.) via both HTTP and WebSocket channels.
• The design emphasizes real-time data (candlestick data, sentiment, etc.) and a collection of modular functions (e.g., connection, balance management, buying operations).
File Structure
• Top-level files and directories:
• app.py: Likely an example entry point for using the library.
• quotexapi: The main package containing core modules.
• examples: Sample scripts to demonstrate usage.
• docs: Documentation in multiple languages.
• .github: GitHub workflows and CI/CD pipelines.
• Within quotexapi, note the separation into submodules:
• API-related logic (quotexapi/api.py, stable_api.py): Core interfaces to interact with the Quotex server.
• HTTP communication (quotexapi/http): Modules handling login, logout, history, resource, settings, etc.
• WebSocket communication (quotexapi/ws): Contains channels (e.g., buy, candles, sell_option, ssid) and objects used for streaming real-time data.
• Utility functions (quotexapi/utils): For calculating indicators, installing dependencies (Playwright), processing data, and service routines.
• Other support files include configuration (quotexapi/config.py), expiration handling, and global variables.
a. Main Components:
• Client Application / Entry Point (app.py and examples): Where developers initiate the library.
• Core Quotex Library (quotexapi package):
• Initialization & Configuration (config.py, global_value.py)
• API Client Abstraction (api.py, stable_api.py)
• HTTP Module: Modules under quotexapi/http (login, logout, history, etc.)
• WebSocket Module: Modules under quotexapi/ws including separate channels and objects that manage real-time communications.
• Utility Module: Helper functions (quotexapi/utils) for data processing, indicator calculations, and Playwright-related tasks.
• External Dependencies & APIs:
• Quotex API itself (remote server endpoints).
• Third-party tools (e.g., Playwright for browser support, OpenSSL as per installation notes).
b. Relationships and Interactions:
• The entry point (app.py) calls functions implemented in the stable_api and related modules.
• HTTP Subsystem (for operations like login, data retrieval via HTTP endpoints).
• WebSocket Subsystem (for real-time data, option trading actions, streaming candles, etc.).
• Utility functions support the API Client by processing data (candles, indicators) and performing installations (Playwright_install).
• The examples show integration, so include a “Developer Integrations” block that uses the library.
c. Architectural Patterns & Design Principles:
• Modular design: Each module (HTTP, WS, utils) is separated by responsibility.
• Asynchronous programming: Significant use of async/await (visible in connection testing and data retrieval functions) ensures non-blocking I/O.
• Extensibility: The library is built to be easily integrated into third-party systems for trading operations.
• Separation of concerns: Clear demarcation between connection/authentication, data retrieval, order operations, and data processing.
• Decompose the API client into two major branches: HTTP communication and WebSocket communication.
• An extra section that shows integration points with utility modules and external services.