Commit Graph
131 Commits
Author SHA1 Message Date
xxm 70ce86099a docs: 止损+RR定稿——固定-12%止损 + RR2.5止盈(+30%)
21组合扫描(7止损×3RR): 固定-12%+RR2.5最优(avg+5.13%/wr57.5%/去2018+6.34%)
跌破前低止损验证: 距前低<5%→止损距离仅4-8%, 深超跌高波动频繁被扫(wr42-53%)
RR验证: 止盈/止损=30/12=2.5>=2 
入场: 甜区+bias60+RSI+急跌+距前低<5%+每月≤8+等权6槽
2026-08-03 20:43:10 +08:00
xxm 3805e2233c docs: 入场修正——只买下方有支撑的票(距前低<5%)
老莫洞察: 支撑太远的票不该买
验证: 距20日低点<5% avg+10.93%/wr70% vs >10% avg+4%以下
修正后: 292笔/avg+5.13%/wr57.5%/去2018+6.34%/正年10/11/6槽ret310%/dd19.4%
止损结论: 深超跌无可靠技术支撑, 固定-12%最优; 入场用距前低<5%确保有承接
2026-08-03 20:15:12 +08:00
xxm 346e45dbae docs: 回撤优化——每月≤8信号(27.6%→19.4%)
根因: 2023-2024阴跌市312笔wr36.2%, 2024-01微盘危机22笔全灭
测试证伪: 大盘RSI/斜率择时无效, 收紧止损无效, 高槽位无效
最优: 同月≤8自然序+等权6槽 → 回撤19.4% 年化16.7% 收益回撤15.9
v_weak更新: 301笔/6槽+308%/dd19.4%/去2018+6.00%/正年10/11
2026-08-03 15:53:20 +08:00
xxm 52abaf80a5 docs: 仓位研究结论——等权6槽自然序最优(§15)
科学仓位研究: 强度分单调性验证(十等分D1+1.24%→D10+18.17%)
6方案×3-8槽全扫描: 等权6槽最优(年化9.6%/回撤27.6%/收益回撤4.7)
反直觉: 分级加权和score排序都损害收益(等权115% vs 高分优先17%)
v_weak sizing_slots: 5→6, 组合ret130.6%/dd27.6%
2026-08-03 12:39:38 +08:00
xxm 55488c2c98 feat: v_weak弱市策略定稿落地(六步方法论+12维框架完整产出)
- 策略: 弱市(MA20下)+大盘ADX∈[25,30]甜区 + bias60∈[-35,-20] + RSI≤25 + 5日急跌; tp30/sl12/40
- 回测: 2649笔/avg+10.66%/wr68.4%/去2018+5.60%/正年9/11/组合5槽年化7.9%
- 后端: members优先读v_weak(替代不合格v_mr_sel)
- 前端: v_mr卡片改推荐+完整策略说明
- 文档: §14完整六步推导链
2026-08-03 12:00:03 +08:00
xxm 9080790ed2 feat: v_mr扫描器加大盘ADX甜区门控(12维框架发现)
12维分析(大盘技术面×个股技术面): 弱市深超跌edge前提=大盘ADX∈[25,30]
全市场10年验证: ADX25-30 avg+4.89% vs ADX>=40 -0.10% vs ADX<20 +1.63%
叠加bias60<-20+RSI<30: avg+5.04%/去2018+5.67%/正年10/11
落地: 非甜区默认跳过(--force可强制); 文档§13记录完整推导
2026-08-03 08:58:35 +08:00
xxm 53fc09ec6b docs: v_mr全系不合格结论固化(§12) + 弱市选股无alpha教训
六步方法论全面重审: v_mr靠2018熊市撑起(去2018 avg+2.14%/wr49.8%掷硬币)
v_mr_sel 144笔中2018-10占54%覆盖仅14月——一次行情产物
穷尽验证(超跌/强势/突破/低PE防御)弱市均无可实盘alpha
结论: 弱市最好策略是仓位管理(降仓/空仓), 已确认实盘6.5节生效
方法论教训: 评估必须做去极端年稳健性检查, 防2018型假象
2026-08-03 01:38:09 +08:00
xxm 7ba5391344 docs: v_mr精选出场调优固化(tp25/sl10/h30)
网格扫描tp×sl×hold: avg12.73%→15.51%, wr88.9%→90.3%
去2018仍+12.18%/81.1%稳健; 组合3槽年化11.0%/回撤10.0%
2026-08-03 00:07:07 +08:00
xxm cd9d6a8a38 docs: v_mr六步方法论精选调优结果固化(§11)
21690笔回测→正面因子(4)+负面因子(4)合并:
144笔/avg+12.73%/wr88.9%/pf2.67, 去2018仍+10.76%/83.8%非过拟合
年均14笔=每月1笔适合手工; 待落地: 扫描器规则替换+出场调优
2026-08-03 00:04:20 +08:00
xxm 09f40aadd7 docs: 记录策略研究六步方法论为通用铁律(learned.md)
v_mr扫描器违规教训: 拍脑袋发明bias60最超跌排序, 实测证伪(最深档最差)
方法论: 涨幅显著票→共同因子→全市场筛→负面因子→合并再筛→调参
2026-08-02 23:51:14 +08:00
hmo b676d85c41 feat: v_mr 均值回复策略 v2——10y全市场验证通过(21690笔/53.6%WR/avg+3.34%)
- 独立均值回复引擎: MA60下>10%+RSI≤42+60日跌>15%+小盘≤1500万+RSI止跌≥2
- 出场: 止盈+18%/止损-8%/25天, 移除MA20反弹截断(v1毒药)
- backtest_framework: prepare_bars 补 amount 字段(千元)
- 大盘上下文: sh000001 2016-2020 数据从 sector_index_daily 回填 stock_daily
- 验证: sideways(ADX)过滤有害(206.6%→147.9%), mkt_mode=any 最优
- docs/v_mr_strategy.md 完整策略文档
2026-08-02 15:02:10 +08:00
hmo 3ea7c52112 feat(L2): 卫生审计自动收尸——scripts/影子副本+零引用孤儿(mtime>7天)自动git mv归档并提交; dev-spec新增文件居住宪法(红线#9) 2026-07-22 08:41:06 +08:00
hmo 93f0b24007 docs: 纪律文档加严——git写权限撤销(pre-commit白名单,kanban唯一路径) 2026-07-21 23:49:29 +08:00
知微 34337fc5b7 clean: 移除早上健康检查/系统审计中的小果残留引用(二次提交—deploy guard恢复旧版后重新应用) 2026-07-21 12:05:43 +08:00
hmo e6e79ced0d docs: 红线#12 告警信噪比纪律(alert_helper两级通道) 2026-07-21 02:44:56 +08:00
hmo a69b246c57 feat(guard): 部署一致性守卫 deploy_guard.py + 知微运维纪律 + 健康JSON移出跟踪
- deploy_guard.py (15min cron): 代码漂移自动回滚(仅未提交改动)+
  session-work可快进时自动merge部署+幂等重链+cron引用完整性,
  状态落盘JSON, 有动作即XMPP报备
- docs/zhiwei-ops-discipline.md: 知微纪律——禁止直接编辑被跟踪代码/
  禁stale提交/禁直调gateway批量LLM; 自愈白名单(rerun/restart/
  sync/switch_key)本不改代码, 与纪律不矛盾; 紧急热修走git流程,
  提交到session-work后guard 15min自动部署
- dev-spec 红线#6 补充部署守卫机制
- static/mofin_health.json 移出git跟踪(运行时产物, 常驻dirty
  会废掉漂移检测)
2026-07-21 01:17:01 +08:00
hmo 574151aee9 docs: 红线#11 批量LLM调用禁走hermes gateway agent通道(603288事件) 2026-07-21 01:05:08 +08:00
hmo 60dbb64f92 docs(dev-spec): v2.1 — fix section numbering + outdated refs
Zhiwei flagged: '十条红线' but she counted 14. Real issues found:
- duplicate section numbers: two '三、' (验证闭环 + 自检体系矩阵),
  two '四、' (开发流程 + 部署环境) -> renumbered 一~七 sequentially
- doc index said '含五条红线' (stale from v1) -> '含十条红线'
- F 小节 still used old Tier1/Tier2 framing -> aligned to L0/L1-L2
  with pointer to the L0-L4 matrix section
- version bump v2.0 -> v2.1
Minimal edit: no content changes beyond numbering/consistency.
2026-07-20 21:21:21 +08:00
hmo 94883539de docs: reply to zhiwei on cron error status accuracy 2026-07-20 20:57:20 +08:00
hmo c42769f293 docs: zhiwei briefing on 2026-07-20 system changes 2026-07-20 20:36:50 +08:00
hmo 9a359f49bd feat(deploy): automatic hardlink repair built into deployment pipeline
User insight: hardlink breakage only happens at deploy time (scp file
replacement / git checkout-merge), so detection must be welded INTO the
deploy pipeline, not left to daily audit.

Three automatic layers, no reliance on discipline:
1. systemd path watcher (profile-scripts-sync.path): watches
   deploy/profile-scripts/ directory, auto-fires sync_profile_scripts.sh
   on any change. Verified: fires within 4s of file replacement, logs to
   gateway/logs/link_sync.log (runs as hmo user)
2. git hooks (.git/hooks/post-merge + post-checkout on 246 repo):
   auto re-link after git operations
3. Manual fallback: sync_profile_scripts.sh (now self-logging)

dev-spec red line #6 updated: SSOT rule now documents the three layers
and states breakage only happens at deploy time.
2026-07-20 20:27:11 +08:00
hmo 08eef1e181 feat(self-check): L0-L4 layered self-check architecture with LLM auto-repair
User directive: daily not weekly; clear responsibilities per layer with no
overlap; functional criteria (does the function WORK) not process liveness;
problems get FIXED via LLM with file-and-report discipline (act first,
report after); plus a meta-layer watching the watchers; deeply integrated
into F健康.

Architecture (responsibility matrix in dev-spec.md):
- L0 agents_health_check (5min): port/HTTP/DB liveness + auto_heal executor
- L1 functional_health_check (15min trading): per-module FUNCTIONAL
  criteria — output freshness/validity per REGISTRY (live_prices/market_
  snapshots/mtf_cache/macro_context/bot/LLM/cron engine), not process alive
- L2 system_hygiene_audit (daily 08:20, was weekly): divergence/hardlink/
  zombie/orphan/dead-cron/db-freshness
- L3 self_repair (30min): reads L1/L2 failures -> LLM diagnoses -> executes
  WHITELISTED repair actions directly (rerun_script/restart_service/
  sync_links/switch_llm_key/none) -> repair_log.jsonl + XMPP report.
  Max 2 repairs/module/day anti-loop. LLM unavailable -> rule fallback.
- L4 meta_watchdog (hourly): checks L0-L3 output freshness + L3 cron
  registration + XMPP bridge; direct XMPP alert as last resort

Retired (overlap): Cron监护-高频 (cron_watchdog -> L3), 全局cron健康监控
(cron_health_monitor -> L1).

Dashboard: mofin_health.py now emits self_check section (functional/meta/
hygiene/recent_repairs); mofin_health.html new '🩺 自检体系' tab rendering
L4 layers, L1 module checks, L2 issues, L3 repair history.

E2E verified: stopped xmpp bot -> L1 flagged fail -> systemd recovered ->
L3 LLM correctly diagnosed 'none needed' and logged; rerun_script whitelist
path executes real scripts successfully; meta_watchdog all-green after fix.
2026-07-20 19:39:58 +08:00
hmo 4f83ee8a01 feat(hygiene): anti-redundancy enforcement — spec rules + weekly audit
Root cause analysis of the 2026-07-20 redundancy incident:
1. No single-source-of-truth rule -> same file legitimately lived in 4+
   locations, diverging silently
2. Relative path resolution (Path(__file__).parent/'data') -> each
   hardlinked copy of mofin_db.py pointed to a DIFFERENT database
3. 'Backup habit' left .bak/legacy files in production dirs, which
   monitoring then scanned and reported as false alarms
4. Half-done migrations: DB tables created but old JSON writers/readers
   stayed (price_events), old files stayed
5. Dead modules never got buried: xiaoguo 'dead' but bot ran 8 days
   as root eating 2.5GB
6. Monitoring checked 'does it exist' not 'is it alive' -> stale file
   mtime reported as 'pipeline stalled 14 days' (false alarm)
7. No 'system hygiene' as a check category at all

Prevention implemented:
- dev-spec.md v2.0: 五条红线 -> 十条红线
  #6 single source of truth (hardlink only, no independent copies)
  #7 absolute data paths only (no __file__-relative data resolution)
  #8 no backups/legacy in production data dirs (archive immediately)
  #9 dead module burial checklist (6 mandatory steps)
  #10 monitor liveness (DB table freshness) not existence
- File Location Constitution: canonical location per content type
- NEW system_hygiene_audit.py: weekly Monday 07:30 cron checking
  diverged copies / broken hardlinks / zombie processes / orphan data
  files / dead cron scripts / DB freshness -> hygiene_report.json + XMPP
- specs/hygiene.json: module spec per red line #1
- Verified: audit found 5 real issues on first run, all fixed, re-run clean
2026-07-20 19:04:05 +08:00
hmo b41bed7959 feat: XMPP observability — logger, monitor endpoints, clean dead xiaoguo refs 2026-07-19 12:47:15 +08:00
hmo 49ccd7467d docs: update module list — 10 specs completed 2026-07-19 11:18:22 +08:00
hmo b08bfa5d03 refactor: integrate dashboard into server.py :8899, remove standalone dashboard 2026-07-19 11:06:50 +08:00
hmo 782a914a3c fix: dashboard port 5804→5807 (avoid conflicts with wechat_webhook and zhiwei bot) 2026-07-19 10:56:42 +08:00
hmo 747fdfe467 feat: introduce spec system + dashboard + health pipeline (AgentsMeeting template) 2026-07-19 10:50:34 +08:00
知微 90966c63ca chore: 同步运行版本与git一致
- strategy_lifecycle.py: GATE_9D_ANALYSIS → GATE_12D_ANALYSIS(12维交叉验证)
- system_audit.py: 审计策略评估改用holding_strategies.updated_at
- CHANGELOG.md + analyst-knowledge-log.md 日常更新
2026-07-17 23:08:11 +08:00
知微 136f3f9fb8 sync scripts/mofin_db.py with root + knowledge log 2026-07-14 11:01:59 +08:00
知微 59e94d135c fix: 盘中脚本统一使用get_conn()替代raw sqlite3.connect防DB死锁
- mofin_health.py, cron_health_monitor.py, intraday_health_check.py,
  self_todo_executor.py: 替换raw sqlite3.connect() → get_conn()
  统一使用WAL模式+busy_timeout=30s连接
- mofin_db.py: get_conn()每次新建连接时WAL checkpoint
  防止被kill进程残留WAL导致后续全部卡死
- 并发测试验证: 3x price_monitor + 3x mofin_health同时运行
  6/6通过,WAL仅32bytes

关联问题: 2026-07-14 SQLite写锁死锁根因诊断
2026-07-14 10:56:38 +08:00
知微 02d1c93923 fix(price_monitor): DB写锁死锁根治 - 统一BEGIN IMMEDIATE + 5次重试指数退避 + emergency WAL checkpoint
- 统一一个BEGIN IMMEDIATE事务包裹所有写操作,替代独立写函数调用
- 5次重试 + 指数退避 (1s,2s,4s,8s,16s),原3次+固定2s
- 重试耗尽后自动 emergency WAL checkpoint(TRUNCATE)释放死锁
- try/except确保连接始终释放,修复conn泄漏
- 三副本同步:profile/scripts + MoFin/scripts + MoFin/root
2026-07-14 10:30:15 +08:00
知微 9239ab40c0 docs: 更新CHANGELOG + 开发日志记录07/13全部变更
- XMPP Bot非阻塞/本地XMPP/MUC修复
- price_monitor推送冷却持久化
- 深套股规则重构+换股规划swap-plan
- 周月线技术分析增强
- 健康Tab写无读清零
- stale_push_wlin/per_stock_reassess/promote_candidates更新
- static/index.html + mofin_health.json + server.py同步
2026-07-13 12:09:25 +08:00
知微 c4de7d6516 docs: 补充今日全量变更文档(扫描/过滤/九维/仓位/冷却/清理) 2026-07-10 01:30:11 +08:00
知微 52e70bde26 fix: 14个LLM cron prompt添加数据真实性铁律(置顶)+注册到提示词系统 2026-07-09 13:38:36 +08:00
知微 d2fe7e771f fix: intraday_health_check + system_audit信号堆积监控盲区 — 增加全量未处理查询(非仅xiaoguo) 2026-07-09 10:50:50 +08:00
知微 2762ddf3ae fix: DB路径大面积修复——mofin_db/server/technical_analysis/strategy_tree等脚本的Path(__file__).parent/data错误指向scripts/data而非data/ 导致读写分离
- 量价分析: full_analysis输出volume_deep+成交量存储在price_history.json
- FK约束移除: holding_strategies外键->holdings阻止自选股写入
- #000850 重评已写入(止损3.74/止盈4.06/RR1.67)含量价信号
2026-07-08 12:34:39 +08:00
知微 3e2f0315eb 完全DB版: 移除JSON写入/回退,所有操作直走SQLite
- price_monitor: 完全DB版,不再读写 portfolio.json/watchlist.json
  - holdings代码从DB读取(SELECT code FROM holdings WHERE is_active=1)
  - 价格写入DB holdings表 + portfolio_summary + live_prices
  - 3次重试+指数退避防锁
- server.py: 移除API的JSON回退,DB失败直接返回500
- mofin_db.py: execute_with_retry/commit_with_retry + 15s timeout + busy_timeout
- mo_data.py: 已是纯DB模式(无JSON fallback)

这是推进的完全DB化。下一步可删除 data/portfolio.json data/decisions.json data/watchlist.json 等遗留JSON。
2026-07-06 12:08:08 +08:00
知微 e185b4e4dc feat: DB-first architecture with lock-safe writes
- price_monitor: writes live prices to both JSON and mofin.db (holdings + live_prices + portfolio_summary)
- mofin_db: added execute_with_retry/commit_with_retry with exponential backoff on 'database is locked'
- mofin_db: increased timeout 5s->15s, added PRAGMA busy_timeout=15000
- price_monitor retry loop: fixed break-before-if-ok bug (was not retrying on write failure)
- DB connection: WAL mode + retry decorator for all write operations
- cash sync: preserves DB authoritative cash (JSON cash not pushed to DB)

This is the DB-first version. JSON writes remain for dashboard compatibility.
Next step: remove JSON writes entirely for full DB-only architecture.
2026-07-06 12:02:11 +08:00
知微 574f1be3ec docs: reorganize — README index, archive old docs, add status headers 2026-07-04 10:22:51 +08:00
知微 7f84471aca docs: development standards + test plan 2026-07-04 09:57:18 +08:00
知微 4e080d4fc5 docs: comprehensive test plan (10 categories, 70+ test cases) 2026-07-04 09:36:48 +08:00
知微 b6959f73bc docs: update CHANGELOG + data model + mark decisions migration complete 2026-07-03 23:34:52 +08:00
知微 7c0e85af28 硬性策略质量门禁 validate_strategy()
新增 STRATEGY_QUALITY_GATES 检查清单(9条红线):
CRITICAL: 止损/止盈存在+>0, 买入区下沿<上沿
HIGH: 止损≤买入区, 买入推荐含RR≥1.5, 港股标currency=HKD
MEDIUM: signal短词, tech_snapshot含技术位

enforce_strategy_quality() 插在写入链的两处:
1. reassess_with_context() return前 → 单只重评必过
2. regenerate_all() for d in decisions: 写DB前 → 批量重评必过

不过的:status=review_needed, signal降级→信号不充分
不会写进DB/JSON,除非修复了CRITICAL问题
2026-07-02 13:46:53 +08:00
知微 6305204c7a feat: mo_data.py unified read layer (DB-first, JSON fallback) + cash_log table + batch JSON→DB migration (16 files) 2026-07-01 23:45:30 +08:00
知微 82024a6d7f 给笑笑的接手说明 — refactor-for-xiaoxiao.md 2026-07-01 22:05:01 +08:00
知微 e1057bc747 docs: 数据管道诊断报告(交笑笑重构参考)
涵盖:系统数据架构总图、港股币种不统一问题、
总资产计算路径问题、现金管理缺失问题、
建议重构方向(单一日志数据源、统一价格写入路径、
现金 changelog 系统、币种感知比较)、
当前文件清单和 TODO
2026-06-30 09:34:59 +08:00
知微 12025d58a0 docs: 更新交接文档(含笑笑架构改革) 2026-06-30 03:04:26 +08:00
知微 04c98c23e1 docs: session交接文档 2026-06-30 03:02:29 +08:00
知微 fa45d8aa5f fix: 小果地址统一node122(兼容LAN+EasyTier)
- health_checklist.json: 192.168.1.122→node122
- ocr_client.py: docstring IP→node122
- docs/market-data-requirements.md: IP→node122
- 所有API调用通过ProxyHandler({})绕过系统代理
  Privoxy对node122:18003返回500,直连正常
2026-06-30 02:56:35 +08:00