From e5ed91d755b65d69143f337f6304d919bd7e27cf Mon Sep 17 00:00:00 2001 From: claude_dev Date: Tue, 8 Sep 2026 00:54:08 +0800 Subject: [PATCH] =?UTF-8?q?feat(factor):=20run=5Feval=20CLI=E6=9A=B4?= =?UTF-8?q?=E9=9C=B2--fund-data-dir=E2=80=94=E2=80=94=E5=AE=B9=E5=99=A8?= =?UTF-8?q?=E8=B4=A2=E5=8A=A1=E6=89=B9=E5=8F=AF=E4=BC=A0=E9=9D=99=E6=80=81?= =?UTF-8?q?=E5=9F=9F(WP1-3=E6=94=B6=E5=B0=BE=E8=A1=A5=E5=B7=A5)=20[nas]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - --fund-data-dir default=None 透传 batch_eval;默认语义已有三层fallback: 参数 → cfg.data_paths['static_dir'] → /volume1/stock/sanguo_vnpy_v2/data/static (None≠不join,CLI不传参容器内外同路径可跑财务批;量价批不含fundamental因子零开销) - docstring补财务批用法示例(--categories fundamental) - 验证: pytest tests/factor/ -x -q 145绿; --list-factors fundamental 列出32个 [nas] Co-Authored-By: Claude Code --- scripts/factor_research/run_eval.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/factor_research/run_eval.py b/scripts/factor_research/run_eval.py index 9ee08fd..4135d88 100644 --- a/scripts/factor_research/run_eval.py +++ b/scripts/factor_research/run_eval.py @@ -8,6 +8,9 @@ --factors alpha2,alpha6,alpha12,alpha18,kmid,klen,roc_5,ma_20,std_20,wvma_20 全量(Alpha101+158 × 全A × 8.5年): venv310/bin/python scripts/factor_research/run_eval.py --label batch1-full + 财务批(32因子;静态域默认 /volume1/stock/sanguo_vnpy_v2/data/static 容器内外同路径): + venv310/bin/python scripts/factor_research/run_eval.py \ + --start 2024-01-01 --end 2026-06-30 --categories fundamental --label fund-p0 """ import argparse import os @@ -28,6 +31,10 @@ def main() -> int: ap.add_argument("--label", default="batch1") ap.add_argument("--db", default=None, help="factor_eval.db 路径;默认 default_eval_db_path()") ap.add_argument("--run-id", default=None, help="断点续跑:复用既有 run_id,跳过已落库因子") + ap.add_argument("--fund-data-dir", default=None, + help="财务静态域根目录;默认 cfg.data_paths['static_dir'] → " + "/volume1/stock/sanguo_vnpy_v2/data/static(容器内外同路径)," + "仅含 fundamental 因子时才读取") ap.add_argument("--list-factors", default="", metavar="CATEGORY", help="列出类目因子后退出") args = ap.parse_args() @@ -58,7 +65,8 @@ def main() -> int: print(f"[eval] {done}/{total} {current}", flush=True) out = run_batch_eval(factor_names, args.start, args.end, db_path, label=args.label, - symbols=symbols, limit=args.limit, cfg=None, progress_cb=_cb, run_id=args.run_id) + symbols=symbols, limit=args.limit, cfg=None, progress_cb=_cb, + run_id=args.run_id, fund_data_dir=args.fund_data_dir) print(f"[eval] run_id={out['run_id']} done={out['factors_done']} " f"errors={len(out['errors'])} elapsed={out['elapsed_sec']}s symbols={out['symbols_count']}")