diff --git a/README.md b/README.md index 7837c04..48ea0e8 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ An LLM-powered intelligent analysis platform for the A-share (Chinese stock) mar | 🌊 事件总线 | Redis Streams 事件驱动微 OODA(行情 / 新闻 / 情绪 / 信号) | Event Bus | Redis-Streams event-driven micro-OODA (market / news / sentiment / signal) | | 🛡️ 风险引擎 | 熔断器 + Kelly 仓位 + VaR + A股约束(T+1 / 涨跌停 / 100 股) | Risk Engine | circuit breaker + Kelly sizing + VaR + A-share constraints (T+1 / price limits / 100-share lots) | | 🌐 全球情报 + 新闻 | 全球指数 / 大宗 / 汇率关联 + AI 新闻聚合 | Global Intel + News | global indices / commodities / FX correlation + AI news aggregation | -| 📈 量化回测 | backtrader 策略回测,可选 Qlib Alpha158 | Backtesting | backtrader strategy backtesting, optional Qlib Alpha158 | +| 📈 量化回测 | backtrader 策略回测,可选 Qlib 自定义 alpha 因子 | Backtesting | backtrader strategy backtesting, optional Qlib custom alpha factors | | 📱 Discord | 交易信号 / 情报自动推送到 Discord | Discord | auto-push trade signals / intel to Discord | | 🖥️ Web UI | FastAPI + React 19:ControlTower / Portfolio / Recommendations / Review | Web UI | FastAPI + React 19: ControlTower / Portfolio / Recommendations / Review | | ⚙️ 自动化调度 | Celery 45+ 定时任务 + 常驻 agent 守护进程 | Automation | Celery beat (45+ tasks) + always-on agent daemon | @@ -88,7 +88,7 @@ src/web/ FastAPI · frontend/ React SPA · src/discord_bot/ · openclaw/ C | 数据 / Data | AKShare, adata, EastMoney push2 (curl_cffi), QMT/XtQuant (optional), pandas, numpy, pyarrow, yfinance | | 分析 / Analysis | ta (technical indicators), plotly, matplotlib | | AI 预测 / AI | Anthropic Claude, Google Gemini, OpenAI, DeepSeek, Claude Code bridge (fallback) | -| 量化 & Agent / Quant | hmmlearn (HMM 市场状态), networkx (知识图谱), scikit-learn, Qlib Alpha158 (optional) | +| 量化 & Agent / Quant | hmmlearn (HMM 市场状态), networkx (知识图谱), scikit-learn, Qlib custom alpha factors (optional) | | 策略回测 / Backtest | backtrader, Qlib (optional) | | 后端 / Backend | FastAPI, uvicorn, Redis (cache + Streams 事件总线), Celery + Beat | | 前端 / Frontend | React 19, TypeScript, Vite, shadcn/ui, Tailwind CSS 4, React Query | diff --git a/docs/guides/development-guide.md b/docs/guides/development-guide.md index 7fb47a2..56507e0 100644 --- a/docs/guides/development-guide.md +++ b/docs/guides/development-guide.md @@ -42,7 +42,7 @@ See @requirements.txt for Python dependencies and @frontend/package.json for fro |-------|-----------------| | Data | AKShare, adata, EastMoney push2 (curl_cffi), XtQuant (QMT), pandas, numpy, pyarrow, Qlib (optional) | | Intelligence | NetworkX (knowledge graph), feedparser, ddgs/searxng | -| Quant / Agent | hmmlearn (HMM regime), scikit-learn, Qlib Alpha158 (optional) | +| Quant / Agent | hmmlearn (HMM regime), scikit-learn, Qlib custom alpha factors (optional) | | Prediction / LLM | Anthropic Claude, Google Gemini, OpenAI, DeepSeek, Claude Code bridge | | Strategy | backtrader | | Web Backend | FastAPI, uvicorn, Redis (cache + Streams event bus) | diff --git a/scripts/qlib_worker.py b/scripts/qlib_worker.py index c0a5620..9732661 100644 --- a/scripts/qlib_worker.py +++ b/scripts/qlib_worker.py @@ -160,7 +160,9 @@ def cmd_predict(symbols: list[str], horizon: int) -> dict[str, dict[str, Any]]: # Use mean recent return as raw score, sigmoid to [0,1] raw = float(returns.mean()) * 100 # scale up score = round(1.0 / (1.0 + math.exp(-raw)), 4) - # IC: autocorrelation of returns as proxy + # NOTE: serial autocorrelation of returns, used as a rough + # proxy only — this is NOT a true cross-sectional Information + # Coefficient (rank-corr of factor vs forward returns). if len(returns) >= 10: ic = round(float(returns.autocorr()), 4) @@ -278,6 +280,9 @@ def cmd_ic(symbol: str) -> dict[str, Any]: if data is None or data.empty or len(data) < 10: return {"symbol": symbol, "ic": None, "reason": "insufficient data"} + # Serial return autocorrelation used as a rough proxy — NOT a true + # cross-sectional Information Coefficient. The "ic" key is kept for + # config/back-compat; treat it as an autocorrelation signal. ic_val = float(data.iloc[:, 0].dropna().autocorr()) threshold = _ACTUARY_CFG.get("ic_threshold", 0.03) return { diff --git a/src/intelligence/impact_chain.py b/src/intelligence/impact_chain.py index 6280cb4..8eec457 100644 --- a/src/intelligence/impact_chain.py +++ b/src/intelligence/impact_chain.py @@ -1,7 +1,9 @@ """Impact Chain Engine — builds event-to-asset transmission chains. -Per PRD v34.0 FR-GI002: Automatic construction of causal chains from -macro events to affected sectors and stocks. +Per PRD v34.0 FR-GI002: maps macro events to affected sectors and stocks using +hand-authored, keyword-matched transmission **templates** (a curated rule base). +These are domain-knowledge templates, NOT statistically inferred causality — the +edge confidences are fixed constants, not estimated from data. Example chain: 中东战争 → 原油↑ → 航运成本↑ → 航运股↓ diff --git a/src/quant/qlib_alpha.py b/src/quant/qlib_alpha.py index 0397e07..05e2b88 100644 --- a/src/quant/qlib_alpha.py +++ b/src/quant/qlib_alpha.py @@ -1,7 +1,9 @@ -"""Qlib Alpha factor computation — enhanced factor library for stock screening. +"""Qlib alpha factor computation — custom factor library for stock screening. -FR-QL001: Wraps Qlib-style Alpha158 factor categories into a computation -engine that works via the QlibAdapter (remote/subprocess/in-process). +FR-QL001: a hand-written set of ~20 alpha factors expressed in the Qlib DSL, +computed via the QlibAdapter (remote/subprocess/in-process). This is *inspired +by* Qlib's Alpha158 factor categories but is NOT Qlib's Alpha158 dataset handler +— it does not instantiate or reproduce the full 158-factor set. Factor categories: - Momentum: 5d, 10d, 20d, 60d price momentum