$ show DR-lin-eng/stock-scanner
This repository provides a comprehensive stock analysis tool that combines technical, fundamental, and sentiment analysis with AI-powered insights. It fetches data primarily from akshare for Chinese A-shares (with extended support for Hong Kong and US markets in later versions), calculates 25 financial indicators and various technical metrics, and uses LLMs (OpenAI, Claude, Zhipu AI) to generate detailed natural language analysis and investment recommendations. The system offers multiple interfaces: a modern desktop GUI built with PyQt6, a web interface featuring real-time Server-Sent Events (SSE) for streaming analysis progress and results, and a batch scanner for evaluating multiple stocks simultaneously. Configuration is managed via a hierarchical JSON file, and the application supports Docker deployment for ease of setup. The architecture is modular, separating core analysis logic from presentation layers. The analyzer classes (e.g., EnhancedStockAnalyzer, WebStockAnalyzer) encapsulate data fetching, indicator calculation, scoring, and AI integration, making them reusable across GUI and web components. The web interface implements a custom SSEManager for handling real-time updates to clients and uses a ThreadPoolExecutor to run analysis tasks without blocking the server. Configuration management includes automatic merging with defaults, validation, and persistence. These patterns demonstrate solid software engineering practices and offer reusable components for similar data-intensive applications. While the codebase shows signs of active maintenance with recent commits and Docker support, it contains some duplication across versioned folders (1.0, 2.0, 2.5, etc.) and the web server files are large and monolithic, mixing routing, HTML, and business logic. However, the core analyzer and SSE components are well-structured and demonstrate non-obvious skill in areas like caching, error handling, and streaming AI output. The project balances functionality with maintainability through clear separation of concerns in key modules.
The LLM identified 3 files worth highlighting for reuse:
Encapsulates stock data fetching (price, fundamental, news), technical and fundamental indicator calculation, sentiment analysis, scoring, and AI integration. Designed to be used by both GUI and web interfaces, demonstrating low coupling to the presentation layer and reusable core analysis logic.
Implements a thread-safe SSEManager for handling multiple client connections and a StreamingAnalyzer that sends progress, logs, scores, and AI-generated content over SSE. Uses a ThreadPoolExecutor to run analysis tasks without blocking the web server, enabling real-time updates in the browser with clean separation of concerns.
Hierarchical JSON configuration system that loads user config, merges with defaults, validates, and saves back. Supports nested sections and automatic updates when new config options are added, providing a flexible and reusable configuration solution applicable to any Python application.