How khiemdoan/market-today works
Project Overview & Type
• This is a lightweight, automation-focused notifier written in Python. Its purpose is to fetch or process cryptocurrency-related data (from sources like Bybit and others) and automatically send notifications to a Telegram channel.
• GitHub Actions are central to its functioning, serving as the automation runner to trigger update scripts.
Main Components
a. GitHub Actions Workflows:
• .github/workflows directory which contains several YAML files (e.g., update_fgi.yml, update_launchpool.yml, update_p2p.yml, update_tops.yml, update_vnindex.yml). Each workflow is responsible for triggering a specific update process.
b. Update Script Modules:
• Update script in the src/ directory (update_fgi.py, update_launchpool.py, update_p2p.py, update_tops.py, update_vnindex.py) that are executed by the workflows.
c. Client & DTO Layers:
• A module layer labeled “Clients” (e.g., src/clients/bybit.py) that likely handles external API interactions with crypto exchanges/services.
• “DTOs” (Data Transfer Objects) from src/dtos (files like base.py, bybit.py, fgi.py, tops.py) responsible for formatting and normalizing the data.
d. Templates:
• “Templates” module (files with .j2 extension found in src/templates, such as launchpool.j2, p2p.j2, top.j2) which formats data into messages.
e. Telegram Integration:
• Telegram notification component (contained in src/telegram.py) that sends the formatted notifications.
f. Additional Utilities:
• Supplementary components like src/trading_view.py and src/utils.py, which could represent additional functionalities or data sources.
g. Data Persistence:
• Data directory (data/p2p.csv) that might be used to store intermediate or fetched data.
Relationships and Data Flow
• Each update script uses:
• The corresponding DTO to process data.
• A Client module to fetch or interact with external crypto APIs.
• The Template module to structure the message.
• Final output: The data flows to the Telegram module which sends notifications to a Telegram chat.
• Optionally, indicate any logging or data persistence (via the data folder).
Architectural Patterns & Design Principles
• Separation of Concerns: Different modules (Clients, DTOs, Templates, Update Scripts) clearly separate responsibilities.
• Automation via GitHub Actions: Highlight how CI/CD (or scheduled jobs) trigger the update processes.
• Modular and Extensible Design: New update scripts or templates can easily be added for new data sources or notifications.
Relevant Technologies & Frameworks
• Python as the primary language with well-defined modules.
• GitHub Actions for orchestration/automation.
• Telegram’s API (accessed via src/telegram.py) to deliver notifications.
• Jinja2-like templating system (judging by the .j2 extensions in the templates folder).