跳转至

2026-04-01 Memory

投委会全自动化完成

Cron 配置(统一节奏)

步骤 HK US
数据更新 09:00 CST 21:00 CST
投委会 09:10 CST 21:10 CST

两边都是:整点数据 + 10 分钟后投委会

投委会模式

  • --lean: 跳过 reflection / OHLCV 缓存更新 / 行业研究
  • --autovote: LLM 自动投票(5 委员)
  • --apply: 应用投票结果到 plan
  • --auto-execute: Futu SIM 自动下单
  • --reuse-context: 当日 context 已存在则复用

多模型路由

llm_client.py 新增 _PROVIDER_ROUTES: - gpt-* → OpenAI API - MiniMax-* → MiniMax API

委员模型分配: - Peter/Munger: gpt-5.4(强推理) - Annie/Grace/Dalio: MiniMax-M2.7

Bug 修复

  1. ليات 标签 strip(MiniMax reasoning output 导致 JSON parse 失败)
  2. ACC_ID_US_SIM 改为 lazy 读取(不在模块顶层 crash)
  3. MiniMax model name 去掉 minimax/ 前缀
  4. LLM autovote _call_member 加重试 + stub fallback

代码重构

execution_engine.py

目标: 拆分 execute_plan() 740 行

提取的函数: 1. l2_gate_check() — L2 门控检查 2. get_counter_price() — 订单簿对手价 3. safe_reprice() — 改价安全检查 4. _execute_sell_stage() — SELL 阶段(下单+轮询+改价+取消) 5. _execute_buy_stage() — BUY 阶段(downsize+retries+下单+轮询+改价+取消)

结果: execute_plan() 740 行 → 190 行(-75%

ml_cross_sectional.py

目标: 拆分 rolling_ml_scores() 372 行

提取的函数: 1. _try_load_precomputed_ml_scores() — 快速加载预计算分数 2. _prepare_ml_features() — 特征选择 + 剪枝 + NaN 处理 3. _compute_ml_sample_weights() — 样本权重(衰减 + regime 匹配) 4. _update_adaptive_ml_weight() — OOS IC 追踪 + 自适应权重

结果: rolling_ml_scores() 372 行 → 245 行(-34%

其他

  • secrets/config 加载统一(3 个文件改用 config_loader.load_secrets()

Commits

  • 1388281: unify secrets loading via config_loader
  • 18f943c: extract nested helpers to module level (execution_engine)
  • 9fdf4fe: extract _execute_sell_stage function
  • f0139b9: extract _execute_buy_stage function
  • 5f7bd86: extract helpers from rolling_ml_scores
  • 1ae7bcf: extract _prepare_ml_features helper

Claude Code 建议评审

值得修的

  • 上帝函数 execute_plan() / rolling_ml_scores() → ✅ 已完成
  • 40+ 个 bare except Exception → 待修
  • lot size / snapshot price 硬编码 → 实际上职责不同,保留合理

Claude 说得不对的

  • _InteractingModel 包装类 → 实际上是 feature interaction 标准做法
  • macro 模块合并 → macro_data.pymacro_refresh.py 职责不同
  • legacy/ 直接删 → 太激进,应先归档

Claude 完全没提的

  • 没有测试覆盖
  • 没有 type hints
  • logging vs print 混用
  • 配置验证缺失

性价比最高

  1. ✅ secrets/config 加载统一(15 分钟)
  2. ✅ 上帝函数拆分(2-3 小时)
  3. bare except → logging(2-3 小时,可分批)

2026-04-01 — v1.12.0 发布

执行引擎三个关键 bug 修复

  1. futu_connector._trd_market() 返回 method 而不是值 → place_order 全部失败
  2. SIMULATE 环境没有 unlock_trade → "environment param is wrong"
  3. SELL stage 没有 lot size 对齐 → odd lot 拒绝

投委会优化

  • Context 压缩:21K→8K chars(去掉 plan_raw,sector_research 只保留摘要)
  • 成功率:40%→100%,耗时:15min→3min
  • 回测两阶段并行:29x 加速
  • VIX 实时获取:FMP API

OHLCV cache 修复

  • API 调用加 60s 超时(SIGALRM)
  • 脚本退出时 close_all() 防僵尸进程

FMP API 修复

  • /api/v3/quote 被废弃(403),fmp_quote() fallback 到 Futu

选股会自动推送 Discord

版本统一

  • VERSION 为单一来源,pyproject.toml 动态读取,src/version.py 运行时访问

当日执行

  • 港股投委会:14/14 成交,HK$404,220,仓位降至~50%
  • 美股投委会:完成审核,19笔 BUY 计划($510K),等确认执行

提交

  • 751a115: fix execution engine + committee optimization
  • 8cfc0c8: bump v1.12.0
  • 259aa46: unify version to single file
  • ed0a377: ohlcv_cache_build timeout
  • 31b2313: close Futu contexts on exit
  • cb45a96: auto-announce selection to Discord
  • f4bcf79: fmp_quote fallback to Futu