Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By quantskillsGPL-3.0In 1 marketplace
Computes a futures top-20-seat position-change factor and signal from net-position data.
Claude loads one when your task matches it, or you run it by name.
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
简体中文 | English
期货前 20 席位持仓突变 Alpha 因子:从 PandaAI 期货持仓数据计算多空突变信号,输出可验证的因子表、回测指标与 HTML 可视化报告。
skill-alpha-f1-position-change 是一个期货持仓突变因子 Skill,用于计算前 20 席位多空持仓突变因子值,并完成验证、回测与离线复现。
这个 Skill 适合用于:
本 Skill 通过 panda_data SDK 拉取真实持仓与价格数据,输出因子表、回测指标(IC/ICIR/分层收益/Calmar)、HTML 可视化报告以及离线 fixture,便于 CI 集成。
| 文件 | 说明 |
|---|---|
SKILL.md | Skill 契约文档(Agent 内部使用) |
scripts/factor.py | 因子计算入口(持仓 → 因子表) |
scripts/validate.py | 因子验证(契约检查 + IC 稳定性 + 离线模式) |
scripts/backtest.py | 回测评估(真实价格收益 IC/ICIR) |
scripts/backtest_report_data.py | 回测时序数据包装层(HTML 报告数据源) |
scripts/report.py | HTML 报告生成入口(matplotlib 静态图) |
scripts/save_fixture.py | 一次性生成离线测试 fixture |
scripts/fixtures/ | 离线测试数据(Parquet 格式) |
requirements.txt | Python 依赖清单 |
references/data_guide.md | PandaAI 数据接口参考 |
LICENSE | GPLv3 协议 |
README.md / README.en.md | 中英文 README |
skill-alpha-f1-position-change/
├── SKILL.md
├── README.md
├── README.en.md
├── LICENSE
├── requirements.txt
├── references/
│ └── data_guide.md
├── scripts/
│ ├── factor.py # 因子计算(含 load_position_data / load_price_data)
│ ├── validate.py # 验证(含 check_factor_contract 11 条契约)
│ ├── backtest.py # 回测(严格口径 forward_return)
│ ├── backtest_report_data.py # 回测时序数据包装层(保留 curve / daily_ic / drawdown)
│ ├── report.py # HTML 报告生成入口(matplotlib + base64)
│ ├── save_fixture.py # 离线 fixture 生成
│ └── fixtures/ # 离线测试数据(首次运行后生成)
│ ├── sample_positions.parquet
│ └── sample_prices.parquet
└── reports/ # 报告产物(.gitignored)
├── backtest_result.json # 中间数据(含全部时序)
└── report.html # 最终 HTML 报告(self-contained)
调用 panda_data.get_future_netposi_rank 与 get_future_daily 的输入契约:
| 字段 | 类型 | 说明 |
|---|---|---|
underlying_symbol | str | 品种代码(如 "AP"),不含合约月份、不含交易所后缀 |
date | str | 交易日期 YYYYMMDD 格式 |
broker_name | str | 期货公司名称 |
net_position | int | 净持仓量 |
position_type | str | 持仓类型:long 或 short |
输入契约细则:
"AP"、"AU"),不是合约代码("AP801")combined_df.empty 抛 ValueErrorunderlying_symbol 字段;如返回 symbol / code / instrument_id,validate_input 会自动别名映射并打印 [INFO] 警告export PANDA_DATA_USERNAME=your_username
export PANDA_DATA_PASSWORD=your_password
# 可选:控制数据区间
export PANDA_DATA_START_DATE=2026-01-01
export PANDA_DATA_END_DATE=2026-03-31
cd scripts/
# 1. 因子计算
python factor.py
# 输出:因子表(trade_date, symbol, factor_value, score, signal, confidence, ...)
# 2. 因子验证
python validate.py
# 输出:契约检查(11 条断言)+ IC 稳定性 + score 分布
# 3. 回测评估
python backtest.py
# 输出:IC, ICIR, Rank IC, Rank ICIR, 分层收益, Calmar, MDD, 换手率
# 4. HTML 报告生成
python report.py
# 输出:reports/report.html(self-contained,含 4 张图 base64 内嵌)
# 1. 一次性生成 fixture(需联网 + 凭证)
python save_fixture.py
# 生成 scripts/fixtures/sample_positions.parquet + sample_prices.parquet
# 2. 后续验证无需联网
export PANDA_DATA_OFFLINE=1
python validate.py
# 3. 离线生成 HTML 报告(无需凭证,自动用浏览器打开)
python report.py --offline --open
check_factor_contract(11 条契约断言)始终离线可跑,不依赖任何 fixture。
离线模式下若本地未装 panda_data SDK,report.py 会自动注入 stub 模块绕过 factor.py 顶层 import;pyarrow 19 与旧版 parquet 不兼容时自动 fallback 到 fastparquet。
| 环境变量 | 必填 | 默认值 | 说明 |
|---|---|---|---|
PANDA_DATA_USERNAME | ✓ | — | PandaAI 账号 |
PANDA_DATA_PASSWORD | ✓ | — | PandaAI 密码 |
PANDA_DATA_START_DATE | — | 当前日期往前 90 天 | 起始日期(YYYY-MM-DD) |
PANDA_DATA_END_DATE | — | 当前日期 | 结束日期(YYYY-MM-DD) |
PANDA_DATA_OFFLINE | — | 0 | 1 时启用离线模式,从 fixture 加载 |
PANDA_DATA_DEBUG | — | 0 | 1 时首次 API 调用打印 schema 探针 |
因子值公式:
factor_value = long_change_rate - short_change_rate
其中:
long_change_rate = (今日多头总和 - 昨日多头总和) / |昨日多头总和|
short_change_rate = (今日空头总和 - 昨日空头总和) / |昨日空头总和|
信号阈值 CHANGE_THRESHOLD = 0.02(2%):
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
alpha-f1-position-change@quantskills is listed by quantskills/registry — review the source before installing
npx claudepluginhub quantskills/registry --plugin alpha-f1-position-changePlugins from other owners that cover similar ground