Initial commit: cc-cursor 全链路量化研究平台
7 Sprints 全部完成: Sprint 0: 基础设施 (DataManager + MariaDB) Sprint 1: 因子引擎 (34因子/12分类) Sprint 2: VectorBT 回测 (5策略+截面) Sprint 3: Optuna 优化 (+Walk-Forward) Sprint 4: ML 模型 (LightGBM+CatBoost) Sprint 5: Qwen 情绪因子 (三源新闻+日期对齐) Sprint 6: Agent 系统 (4Agent+日报.md/.html) 生产加固 (15项): Tushare双源fallback, SSH自动恢复, pool_pre_ping, save_daily先删后插, load_dotenv绝对路径, 日报5d/20d修复, RiskAgent改上证指数, 昨日对比+数据截止, mac_report utf8mb4, CLAUDE-*.md 9条已知Bug, demo全参数化, djapi数据源归一化, indexDatas API修正 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# CLAUDE-reference.md — 因子 + 表结构速查
|
||||
|
||||
## 因子速查(34 个,12 分类)
|
||||
|
||||
| 注册名 | 类 | 参数 | 文件 |
|
||||
|--------|-----|------|------|
|
||||
| `momentum_5/10/20/60` | MomentumFactor | `period=N` | `factors/technical/momentum.py` |
|
||||
| `rsi_7/14` | RSIFactor | `period=N` | `factors/technical/rsi.py` |
|
||||
| `macd` | MACDFactor | `fast=12,slow=26,signal=9` | `factors/technical/macd.py` |
|
||||
| `macd_5_35_5` | MACDFactor | `fast=5,slow=35,signal=5` | `factors/technical/macd.py` |
|
||||
| `vol_ratio_5/20` | VolumeRatioFactor | `period=N` | `factors/technical/volume.py` |
|
||||
| `vol_chg_5` | VolumeChangeFactor | `period=5` | `factors/technical/volume.py` |
|
||||
| `boll` | BollingerPositionFactor | `period=20` | `factors/technical/bollinger.py` |
|
||||
| `boll_width` | BollingerWidthFactor | `period=20` | `factors/technical/bollinger.py` |
|
||||
| `atr_14` | ATRFactor | `period=14` | `factors/technical/atr.py` |
|
||||
| `atr_ratio_14` | ATRRatioFactor | `period=14` | `factors/technical/atr.py` |
|
||||
| `ma_cross_5_20` | MACrossFactor | `fast=5,slow=20` | `factors/technical/ma_cross.py` |
|
||||
| `ma_cross_10_60` | MACrossFactor | `fast=10,slow=60` | `factors/technical/ma_cross.py` |
|
||||
| `ma_dev_20/60` | MADevFactor | `period=N` | `factors/technical/ma_cross.py` |
|
||||
| `volatility_20/60` | VolatilityFactor | `period=N` | `factors/technical/volatility.py` |
|
||||
| `down_vol_20` | DownsideVolatilityFactor | `period=20` | `factors/technical/volatility.py` |
|
||||
| `turnover_5` | TurnoverFactor | `period=5` | `factors/technical/turnover.py` |
|
||||
| `turnover_chg_5` | TurnoverChangeFactor | `period=5` | `factors/technical/turnover.py` |
|
||||
| `amplitude_5/20` | AmplitudeFactor | `period=N` | `factors/technical/amplitude.py` |
|
||||
| `roe` | ROEFactor | — | `factors/fundamental/roe.py` |
|
||||
| `pe` | PEFactor | — | `factors/fundamental/pe_pb.py` |
|
||||
| `pb` | PBFactor | — | `factors/fundamental/pe_pb.py` |
|
||||
| `ep` | EPFactor | — | `factors/fundamental/pe_pb.py` |
|
||||
| `news_sent_5/20` | NewsSentimentFactor | `window=N,decay=0.3` | `factors/sentiment/sentiment_factor.py` |
|
||||
| `news_conf_5` | SentimentConfidenceFactor | `window=5` | `factors/sentiment/sentiment_factor.py` |
|
||||
| `sent_delta_5` | SentimentMomentumFactor | `period=5` | `factors/sentiment/sentiment_factor.py` |
|
||||
|
||||
## DB 表速查
|
||||
|
||||
| 表 (mac_) | 主键 | 关键列 | 用途 |
|
||||
|-----------|------|--------|------|
|
||||
| `stock_basic` | ts_code | ts_code, name, area, industry | 股票列表 (5524行) |
|
||||
| `stock_daily` | (ts_code, trade_date) | open, high, low, close, vol, amount, turnover_rate | 日线行情 |
|
||||
| `stock_financial` | (ts_code, end_date) | eps, bvps, roe, net_profit_margin, debt_to_assets | 财务指标 |
|
||||
| `report` | id | report_date, title, subject_type, subject_code, content, is_active | 报告持久化 |
|
||||
|
||||
## 数据源接口速查
|
||||
|
||||
| 接口 | AkShareSource | TushareSource |
|
||||
|------|--------------|---------------|
|
||||
| 股票列表 | `ak.stock_info_a_code_name()` | `pro.stock_basic()` |
|
||||
| 每日行情 | `ak.stock_zh_a_hist(symbol, period='daily')` | `pro.daily(ts_code,...)` |
|
||||
| 指数行情 | `ak.index_zh_a_hist(symbol, period='daily')` | `pro.index_daily(ts_code,...)` |
|
||||
| 财务指标 | `ak.stock_financial_abstract_ths(symbol)` | `pro.fina_indicator(ts_code,...)` |
|
||||
| 复权因子 | — | `pro.adj_factor(ts_code,...)` |
|
||||
|
||||
## 常用快捷入口
|
||||
|
||||
```python
|
||||
from factors.registry import get_factor, list_factors, list_categories
|
||||
from database.dao import get_latest_trade_date, query_daily, save_daily
|
||||
from database.connection import get_engine, test_connection
|
||||
from reports.storage import save_report, query_reports
|
||||
```
|
||||
Reference in New Issue
Block a user