How myhhub/stock works
Main Components
• Data Acquisition & Crawling: Represent the set of “crawling” modules under instock/core/crawling (which fetch stock details, ETF data, historical trade dates, etc.) to show how the system ingests raw market data.
• Data Processing & Analysis: Include components for indicator calculations (in instock/core/indicator), K-line and pattern recognition (instock/core/kline and instock/core/pattern), and backtest modules (instock/core/backtest). Also illustrate the “strategy” submodule that encapsulates various stock selection logics.
• Web Presentation: Represent the front-end web module (instock/web) that includes static resources, templates, and the web service handler. This component exposes dashboards and data views to the user.
• Database & Storage: Include a database/data persistence layer that is accessed via modules in instock/lib/database and configured under instock/config. This component stores historical data, indicators, and logs.
• External Dependencies & Deployment:
• Docker and Containerization: Outline the “docker” folder and related Dockerfiles plus GitHub workflows, indicating that the system is deployed in Docker containers (with links for development and deployment).
• TA-Lib and Third-Party Libraries: Represent external libraries such as TA-Lib, pandas, and the various Python dependencies.
• Broker/Trading Client Integration: Show the integration point for the trading broker (configured with trade_client.json and corresponding trade services).
• Logging & Supervisor: Mention that there are separate log files for data jobs (stock_execute_job.log), web services (stock_web.log), and trade services (stock_trade.log). Also, supervisor configurations are present to manage daemon processes.
Relationships and Interactions
• That the Job Scheduler (cron jobs and job scripts) triggers the Data Acquisition and Data Processing components periodically.
• That the Web Presentation layer retrieves data from the Database for visualization.
• Integration lines from the entire system to the external Docker/Deployment environment, emphasizing that the system is containerized and uses CI/CD workflows (.github/workflows).
• Optionally, include a feedback loop from logging and monitoring components back to the system infrastructure for error handling and debugging.
Architectural Patterns and Design Principles
• Separation of concerns: Different folders and modules clearly separate data acquisition, processing, trading, and user interface.
• Modular design: Each functionality (e.g., crawling, indicators, strategies) is encapsulated in its own submodule – an important pattern making the system scalable.
• Batch processing: The job scheduling and cron script implementation are a key pattern for periodic processing.
• Multi-threading and singleton design: Note in the README that the system employs multi-thread and singleton patterns for efficiency; these can be noted near the processing modules.
• Containerization and deployment automation using Docker and GitHub workflows.