How jiajiahuang/huobi-auto-python works
Main Components
• Config Module: Represent the configuration layer enabled by the config.ini file. This component loads critical settings (e.g., API keys, endpoints, trading parameters) which guide how trading strategies and API interactions are executed.
• Entry Points (Main Scripts): Include main.py, mainhuobi.py, and mains.py. These scripts likely act as the launching points for different modes or aspects of the trading program (e.g., initialization, live trading, simulation or different Huobi contract strategies).
• Utility Components: HuobiDMUtil.py and HuobiDMUtils.py are essential utility modules. They may include common helper functions for data parsing, error handling, logging, or other repeated operations needed in various parts of the application.
• External Services: Although not part of the file tree, it is crucial to include the Huobi Exchange API as an external dependency. This illustrates how the system interacts beyond its own boundaries.
Relationships and Interactions
• The Main Scripts read from the Config Module (config.ini) to retrieve the necessary runtime configurations.
• The Main Scripts interact with the Service Layer (HuobiDMService.py) to send requests and receive data from the Huobi API.
• The Service Layer uses the Utility Components to perform data formatting, error checking, and any auxiliary operations.
• Data flows from the Huobi API into the Service Layer, then returns to the Main Scripts, which may also log or store trade information using utility functions.
Architectural Patterns and Principles
• Layered Architecture: Emphasize the separation between configuration, application logic (entry points), service communication, and helper utilities.
• Modularity: Each Python file/module serves a distinct function; clearly represent these as separate modules for a clean separation of concerns.
Relevant Technologies and Frameworks
• Huobi API: Clearly mark this external entity, detailing it as the source of market data and trading execution.
• Any additional libraries used by utilities or services should be noted if known (for example, logging frameworks or HTTP request libraries like requests, though such details may need to be extracted from the code if not evident in the file names).
Final Composition
• Link the Service Layer to “External Huobi API” to show where the live data or trading operations are sourced.
• Incorporate “Utility Components (HuobiDMUtil.py & HuobiDMUtils.py)” as supporting modules that are referenced by both the Main Application Modules and Service Layer.
• An “Output/Logging” node if the application writes out trade information, as mentioned in the README.
This methodical breakdown should provide a complete snapshot of how the project functions and interacts with external systems which will be invaluable for understanding and evolving the system over time.