$ show ZhuLinsen/daily_stock_analysis
This repository is a production-grade, AI-powered stock analysis platform for CN, HK, US, JP, KR, and TW markets. In production it runs a scheduled analysis pipeline that fetches market data from multiple providers (akshare, yfinance, tushare, efinance, futu, etc.) with priority-based fallback, feeds the data to LLM backends via LiteLLM, generates structured decision reports, and pushes them through 15+ notification channels (WeChat, Feishu, DingTalk, Telegram, email, Discord, Slack, etc.). It also exposes a FastAPI REST API, a React/TypeScript web dashboard, an Electron desktop client, and bot integrations for Feishu/DingTalk/Discord. The system includes agent-based chat with tool use, screening, backtesting, alerts, portfolio management, decision-signal tracking, and market review capabilities.
The LLM identified 5 files worth highlighting for reuse:
Defines BaseFetcher with a _fetch_raw_data/_normalize_data template method and DataFetcherManager that orchestrates priority-based fallback across many market data providers. This is an isolated, reusable abstraction for any multi-source data ingestion system needing graceful degradation and provider ranking.
Provides redact_sensitive_mapping and to_safe_dict helpers that strip secrets and sensitive markers from prompts, logs, and API payloads. Self-contained and directly applicable to any Python service that must keep API keys and PII out of observability and LLM context.
Implements RiskOverridePlan to RiskOverrideApplication with transition validation (veto->buy->hold) and signal downgrade logic. Encapsulates a non-obvious financial decision guardrail pattern that can be extracted for any rule-based risk control or policy enforcement system.
Thread-safe in-memory cache with inflight request coalescing and wait-timeout fallback for Reddit/X/Polymarket sentiment data. Demonstrates a reusable pattern for aggregating rate-limited external APIs without stampede or stale-data races.
Reads and writes .env files atomically while preserving comments and escaping webhook templates. A robust configuration persistence layer reusable in any Python application that needs user-editable environment configuration with safe concurrent updates.