How dr-lin-eng/stock-scanner works
Project Type and Purpose
• The project is a specialized stock analysis system for the A-share market, offering both single-stock analysis (via a GUI) and batch market scanning.
• The README clearly outlines three main functions/components:
– Single Stock Analysis GUI (with files like stock_analyzer.py and gui2.py)
– Batch Stock Scanner (triggered by 全部股票分析推荐1.py)
– Advanced Technical Indicator Analysis Engine (integrated in the analysis logic within stock_analyzer.py)
• Additionally, a minimal web interface exists (web_app.py and templates folder), likely to display results or summary reports.
Analysis of the File Structure
• Top-level configuration/utility files:
• .env: Contains API keys and environment configurations.
• requirements.txt: Lists system dependencies.
• Dockerfile and docker-compose.yml: Used for containerizing and deploying the application.
• Core Application Files:
• stock_analyzer.py: The key file for single stock analysis.
• gui.py & gui2.py: GUI implementations; note that gui2.py is the one used as per the README.
• 全部股票分析推荐1.py: Implements the batch scanning logic.
• web_app.py: Provides a web interface with HTML templates (in the templates directory).
• README.md: Contains project overview, setup instructions, and key functional details.
• The structure indicates a mix of standalone GUI-based functionality, batch processing scripts, and a simple web component.
a. Components:
• User Interfaces:
• GUI Application for Single Stock Analysis (via gui2.py and stock_analyzer.py).
• Web Application Interface (web_app.py and templates/index.html).
• Analysis Engines:
• Advanced Technical Indicator Analysis Engine (within stock_analyzer.py, performing calculations for indicators like MA, RSI, MACD, etc.).
• Batch Scanner (全部股票分析推荐1.py) for full-market scanning.
• Configuration & Infrastructure:
• Environment Variables (.env) – provide API keys and runtime configurations.
• Docker Environment (Dockerfile and docker-compose.yml) – for containerizing and running the system.
• Dependencies and External Libraries:
• Python and its libraries (PyQt6, Pandas, NumPy, AkShare, Markdown2 as per the requirements).
b. Relationships and Interactions:
• The GUI components interact with the underlying analysis engine by passing user input (stock selections and parameter configurations) and receiving analysis results.
• Both the single-stock analysis and batch scanning components likely share similar core analysis logic (technical indicator computations).
• The web interface (via web_app.py) may serve as an alternate way to view or trigger operations, pulling in HTML templates from the templates folder.
• Configuration (from .env) is loaded by the analysis scripts (especially in stock_analyzer.py) to connect with external APIs.
• Docker and docker-compose wrap the system infrastructure for consistent deployment, orchestrating service start-up and environment setups.
• Data flow is bidirectional: front-end interfaces (GUI/web) send requests to the backend analysis logic, which then returns computed analysis reports.
c. Architectural Patterns & Design Principles:
• Separation of Concerns: Distinct modules for user interface (both GUI and web), analysis computation (technical indicators), and orchestration (batch scanning vs. single analysis).
• Modularity: Scripts and components can be run independently (e.g., single stock analysis vs. full market scan).
• Containerization: Emphasizes deployment consistency via Docker, making the design more portable.
• Extensibility: The project is structured to potentially add more analysis or interface components, following a loosely coupled design.