Skip to content

feat(core): cross-sectional evaluation layer + honest README numbers#2

Merged
Electricitysheep merged 2 commits into
masterfrom
feat/cross-sectional-evaluation
Jul 6, 2026
Merged

feat(core): cross-sectional evaluation layer + honest README numbers#2
Electricitysheep merged 2 commits into
masterfrom
feat/cross-sectional-evaluation

Conversation

@Electricitysheep

Copy link
Copy Markdown
Owner

背景

框架此前只有单标的时序 IC(因子值与同一标的自身未来收益的相关),而 CPV、聪明钱等研报的命题是横截面选股:每天在全体股票间按因子排序、分组、构建多空。评估语义与原研报不同构,"研报复现"名不副实。README 头部的 "13+ 家券商、50+ 个经典策略" 也与代码(5 家有实现、3 个目录为空)矛盾。

实现

qrp/core/cross_section.py — CrossSectionAnalyzer(date × symbol 长表面板):

  • 前瞻收益严格按 symbol 分组计算(防全局 shift 跨标的泄漏)
  • 日度截面 Pearson IC + Spearman RankIC,含 ICIR、正值比例、t 统计量,按 min_symbols 过滤稀疏截面
  • 按日分位组合与顶底组多空收益

README 校准:头部数字对齐现实(5 家券商 15+ 篇研报),徽章更新为实际测试数(24/39),新特性入列。

测试

  • 完美单调因子 RankIC=1、反向=-1、随机≈0;跨标的泄漏防护;min_symbols 截面剔除;分位收益单调性(7 个新测试)
  • pytest 24/24、self_test 39/39、ruff 全过

🤖 Generated with Claude Code

Electricitysheep and others added 2 commits July 6, 2026 22:48
The framework only supported single-asset time-series IC, but the broker
research it reproduces (CPV, smart money, etc.) makes cross-sectional
stock-selection claims: rank the universe by factor each day, form
quantile portfolios, measure daily cross-sectional IC.

CrossSectionAnalyzer takes a date x symbol panel and provides:
- forward returns computed strictly within each symbol (no cross-symbol
  leakage from a global shift)
- daily cross-sectional Pearson IC and Spearman RankIC with ICIR,
  positive ratio and t-stat, filtered by min_symbols per date
- per-date quantile portfolios and top-minus-bottom long-short returns

Tests: perfect monotonic factor => RankIC = 1, reversed => -1, random
=> ~0; leakage guard; min_symbols exclusion; monotonic quantile spread.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- '13+ brokers, 50+ strategies' -> 5 brokers with implemented reports,
  24+ factors (dongfang/guangfa/guotai stay on the roadmap)
- test badges/stats refreshed to real counts (pytest 24, self-test 39)
- document the new cross-sectional evaluation layer

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Electricitysheep
Electricitysheep merged commit 0a659ba into master Jul 6, 2026
3 checks passed
@Electricitysheep
Electricitysheep deleted the feat/cross-sectional-evaluation branch July 6, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant