# 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
```
