知微
d75694c9e5
fix: 磁盘IO优化——state.db auto_vacuum+cache增大+每周压缩
2026-07-08 10:13:49 +08:00
知微
7cebcba13a
Implement proposal #19 : Score-and-Retry + JSON format validation for 知微 pipeline
...
- Create json_validator.py utility module:
- validate_json_syntax(): JSON syntax scoring (0-100) with auto-fix
- validate_with_schema(): Multi-layer validation (syntax + schema)
- score_and_retry(): Generic retry wrapper with error feedback
- safe_parse_structured(): Safe <structured_data> extraction
- FormatErrorLibrary: Persistent error tracking + stats + auto recommendations
- CLI entry point for standalone use
- Integrate into strategy_lifecycle.py:
- safe_json_load() now uses json_validator for auto-fix + error logging
- Falls back to legacy repair on ImportError
- Integrate into update_data.py:
- parse_report() uses safe_parse_structured() instead of bare json.loads()
- Errors logged to FormatErrorLibrary silently
- Convert strategy_lifecycle.py to Unix line endings
2026-07-08 01:18:48 +08:00
知微
073cc1a2de
fix: 注入市场状态(A股交易中/已收盘 港股交易中/已收盘)防交易时段幻觉
2026-07-07 15:47:14 +08:00
知微
bdd0611275
fix: 去掉ping骚扰+注入datetime防日期幻觉
...
1. cron_health_monitor/verify_reassess_pipeline: bridge检测从发ping改为TCP端口检测
2. xmpp_agent_core: call_hermes注入当前时间防止LLM日期幻觉
[当前时间: 2026-07-07 15:32 Tuesday]
3. 修复import datetime缺失
2026-07-07 15:33:14 +08:00
知微
ad74ede2b8
fix: 自选股强制重评+潜力股管道解冻+健康监控阈值修正
...
1. mofin_collect.py: 加入自选股(watchlist_stocks)强制重评, 输出持仓+自选两段
2. cron_health_monitor: 只监控7个实时管道, 排除日/周任务
3. 解冻: 知微洞察生成(a1f06826) + 市场精选推荐(759064f5)
2026-07-07 13:37:07 +08:00
知微
8f34681e8d
fix: 宏观风险扫描是日任务改到正确job名 宏观风险信号消费
2026-07-07 12:49:47 +08:00
知微
6237a01f61
fix: cron健康监控只监控实时管道, 排除日/周任务
2026-07-07 12:29:34 +08:00
知微
583db09090
fix: cron健康监控v2——空闲超时检测+自检+去重冷却+price_monitor直查DB
2026-07-07 12:28:31 +08:00
知微
9f44715b61
feat: add watchlist auto-reassessment to per_stock_reassess
...
- Add scan_watchlist_stocks() function that scans watchlist_stocks table
- Deviation formula: max(|price-entry_low|,|price-entry_high|)/entry_low*100 > 20%
- Calls technical_analysis.full_analysis() to get latest support/resistance
- Updates entry_low/entry_high/stop_loss/price/analysis_json in DB
- Records changelog in analysis_json with old/new values
- Limits to 3 stocks per run, logs remaining=N for overflow
- Scans watchlist AFTER decisions scan in main() (no changes to decisions logic)
2026-07-07 11:48:45 +08:00
知微
43bd84a7c0
feat: 全局cron job健康监控, failed时主动推XMPP
2026-07-07 11:29:56 +08:00
知微
5ffc487659
fix: 审计度量修正——reassess写strategy_evaluations非holding_strategies
2026-07-07 11:27:56 +08:00
知微
ae35631208
自选股自动重评机制+000850华茂股份9维分析
...
fix: per_stock_reassess 现在支持自选股(不在decisions.json)触发的重评
- 不在decisions_map的code→查watchlist_stocks表构建entry
- 重评完成后同步回watchlist_stocks表
- is_watchlist=True传给reassess_strategy确保正确分类
fix: stale_detector的[AUTO_REASSESS]路径现在能真正触发自选股重评
- 价格偏离买入区中心>15%→触发per_stock_reassess
- 结果写回DB watchlist_stocks表+decisions.json
feat: 000850华茂股份完整9维分析
- 横: 大盘偏弱但个股独立/纺织板块/金融资产折价
- 纵: PE72.79虚高(被金融收益摊薄)/PB0.80破净(安全垫)
- 消息面: 7/16临时股东会催化
- 技术面: MA5>MA10>MA20多头初成/缩量回踩健康
- 资金流: 量比1.21放量上攻后缩量回踩(正常)
- 买入区3.70~3.90现价3.81在区内→策略有效维持
- 止损3.50/止盈4.30/RR=1.6
2026-07-07 11:27:46 +08:00
知微
4689849c9d
fix: 管道审计+全局cron失败监控, 异常时主动推XMPP
2026-07-07 11:27:09 +08:00
知微
5320509893
fix: stale_detector per_stock_reassess参数修正(--code→位置参数)
2026-07-07 11:20:28 +08:00
知微
7b4826777a
自选股自动重评机制+000850华茂股份全面重评
...
1. stale_detector新增自选股买入区偏离自动重评:
- 每轮扫描watchlist_stocks, price偏离买入区中心>15%自动触发per_stock_reassess
- 之前只标记[STRATEGY_STALE]不输出,改为标记+触发重评两步完成
- 策略完毕直接输出结果,不再等下次cron通知
2. 000850华茂股份全面重评:
- 核心价值:纺织是壳,金融股权投资才是核心(国泰海通/广发/徽商银行)
- PB=0.78破净, 7月3日分红3675万占年净利17.85%
- 7/16临时股东会催化剂
- 结论:3.70~3.90区间可建仓1~2%,止损3.50,止盈4.30
- 修复:之前说'观望不建仓'是错的,低估了破净安全垫
3. watchlist_stocks DB加000850记录
2026-07-07 11:20:04 +08:00
知微
096fbbf5f6
fix: sqlite3.Row没有.get()方法, r.get('cost',0)静默失败→改为r['cost'] if r['cost'] else 0
2026-07-07 11:05:21 +08:00
知微
7c255d5234
fix: 统一DB路径+管道审计脚本
...
mo_data.py DB_PATH: /home/hmo/web-dashboard/data/mofin.db → /home/hmo/MoFin/data/mofin.db
新增 verify_reassess_pipeline.py:管道审计,静默时无声、异常时报警
2026-07-07 10:37:05 +08:00
知微
26e2794cca
fix: 代码级约束 —— 推荐前必须同步重评, 不输出无操作信号的信息
...
1. price_monitor: 区间突破后同步调reassess_with_context(), 明确信号推XMPP
2. stale_detector: 只输出有[PUSH]/[STRATEGY_STALE]标记的行, 静默无操作信号的买入区
3. mofin_collect: stale/无策略持仓同步重评, 不靠TODO异步
2026-07-07 10:31:50 +08:00
知微
2138ae2bfd
fix: 代码级强制约束——LLM看到数据前必须同步重评(stale/无策略), 不等TODO异步
...
mofin_collect.py步骤0改造:
stale(>4h未更新) → 立即调reassess_with_context()强制重评, 不靠TODO异步
无策略(holding_strategies无记录) → 立即调reassess_with_context()创建策略
只有重评成功后才允许LLM给出建议
2026-07-07 10:14:21 +08:00
知微
bbd90a005e
feat: 代码级策略新鲜度强制检查 — mofin_collect.py步骤0, 推荐前先检策略是否最新, 过期自动创TODO
2026-07-07 10:10:01 +08:00
知微
fbbb96020f
fix: system_health_check不再误报market.json/decisions.json缺失(DB-only已迁移)
2026-07-07 09:20:49 +08:00
知微
6e03b62f69
chore: .gitignore排除运行时数据文件和db
2026-07-06 14:03:55 +08:00
知微
de6e5f6624
docs: 更新CHANGELOG — 2026-07-06全面系统修复记录
2026-07-06 14:03:27 +08:00
知微
e055485f53
chore: 加 .gitignore(取自code_only分支)
2026-07-06 14:02:24 +08:00
知微
66962ae190
fix: 全面系统修复 — delivery目标修正 + 脚本同步 + refresh_mtf_cache import修复 + clean_watchlist硬编码修复
...
修复清单:
- cron delivery修正:10个job从deliver=origin/all改为local,消除推送错误
- refresh_mtf_cache.py:替换strategy_lifecycle.PORTFOLIO_PATH导入为mofin_db直接读DB
- clean_watchlist.py:修复mo_data导入名错误和JSON硬编码路径
- MoFin/scripts/与profile scripts互相补全,双向sync到一致
- price_monitor.py:现金源从portfolio_summary表改为cash_log(Dad确认的现金权威)
- 更新watchlist.json加入000850华茂股份
2026-07-06 14:01:54 +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
知微
687155487d
feat: strategy-staleness-check auto-creates TODOs for STRATEGY_STALE stocks
2026-07-05 01:41:10 +08:00
知微
320353348d
feat: add todos table to mofin_db + DB_PATH fix for self_todo_executor
2026-07-05 01:37:40 +08:00
知微
574f1be3ec
docs: reorganize — README index, archive old docs, add status headers
2026-07-04 10:22:51 +08:00
知微
58786d170b
00700 腾讯成本修复: 443.13 HKD
...
holdings/holding_strategies 表中 00700 的 cost 字段 =0,
从旧备份 data 追溯确认成本为 443.13 HKD,已修正。
portfolio.json 同步刷新。
验证: 00700 431.2 HKD 浮亏-2.7%(非-17.7%的币种错配数据)
2026-07-04 09:59:52 +08:00
知微
7f84471aca
docs: development standards + test plan
2026-07-04 09:57:18 +08:00
知微
5b9f22a643
test: 33/33 pass + fix last 4 json.load in strategy_lifecycle + analytics dead code
2026-07-04 09:45:27 +08:00
知微
4e080d4fc5
docs: comprehensive test plan (10 categories, 70+ test cases)
2026-07-04 09:36:48 +08:00
知微
8b114d6e9e
refactor: remove duplicate scripts + JSON constants + update docs
2026-07-04 09:30:50 +08:00
知微
7d6b08953c
cash_log正式接入——所有现金变更写表审计
...
接入流程:
1. Dad确认/截图发送现金变更 → write_cash_log()记录before/after/frozen/source/note
2. portfolio_state + portfolio.json同时更新
3. cash_log表可审计查询,不再遗失任何现金变更
4. 清理重复cash_log条目(#4 #5 )
当前已验证:cash=132,121.93 frozen=0.0
2026-07-03 23:53:04 +08:00
知微
a05b82cd6b
fix: market_screener market.json→DB, remove all JSON refs
2026-07-03 23:48:29 +08:00
知微
b6959f73bc
docs: update CHANGELOG + data model + mark decisions migration complete
2026-07-03 23:34:52 +08:00
知微
9337130ca2
fix: HK stocks store HKD, calc_total_assets converts to CNY at aggregation
2026-07-03 23:29:37 +08:00
知微
8e487f400f
fix: system_audit/stale_push_wlin/refresh_mtf → DB, remove final JSON refs
2026-07-03 23:19:32 +08:00
知微
9bc0cca174
fix: HK currency→CNY + portfolio_summary + LLM prompt evaluation.json→DB
2026-07-03 23:15:18 +08:00
知微
239590c0d4
现金132121.93/frozen=0写入DB portfolio_summary+portfolio.json
...
所有HK持仓currency=HKD,价格腾讯实时HKD原值
calc_total_mv正确汇兑处理
总资产953,295
2026-07-03 17:29:52 +08:00
知微
b15960ba38
全数据路径审计修复完成:所有脚本从DB读数据
...
最终修复:
1. price_monitor: HK股存HKD原值, currency=HKD (移除x0.87转换)
2. strategy_lifecycle: 质量门禁currency=CNY→HKD/CNY均可
3. strategy_lifecycle: 新建策略currency动态判断
4. stale_push_wlin: 所有read_decisions()+read_portfolio()替代json.load
5. stale_detector: read_portfolio()替代json.load(PORTFOLIO_PATH)
6. per_stock_reassess: json.dump(decisions.json)→mo_data写入
7. DB holdings/holding_strategies: 8只HK股currency=HKD,价格修正
8. 建滔84.45 HKD浮亏-4.3%(之前报-24%)
9. 现金132,121.93总资产953,295
10. LLM cron prompts已改为全部从mo_data读
2026-07-03 17:14:56 +08:00
知微
908dc6a897
全数据路径审计修复:price_monitor HK股价不再转CNY
...
审计发现(2026-07-03 15:00 systematic audit):
1. price_monitor 港股仍转 CNY (line 255, 306) → 改为存 HKD 原值, currency=HKD
2. strategy_lifecycle 质量门禁检查 currency=CNY (line 88-91) → 改为接受 HKD/CNY
3. strategy_lifecycle 新建策略写 currency='CNY' (line 2299) → 改为按代码判断 HKD/CNY
4. stale_push_wlin 两处直接 json.load(open(decisions.json)) → 改为 read_decisions()
5. stale_push_wlin 直接 json.load(open(portfolio.json)) → 改为 read_portfolio()
6. DB holdings/holding_strategies: 8只HK股currency从CNY改为HKD
7. calc_total_mv 增加港股HKD→CNY汇兑计算
验证:
- 建滔 84.45 HKD 浮亏-4.3%(不是-24%)
- 现金 132,121.93 总资产 953,295
- 所有8只HK股DB正确标记HKD
- price_monitor已重启,下个tick用新逻辑写HKD原值
- stale_push_wlin已换用mo_data读DB
2026-07-03 17:13:19 +08:00
知微
0bfb819110
DB港股价格+成本修复回HKD原值
...
笑笑重构把HK股的价格和成本都转CNY写入DB。
price_monitor同时改了新逻辑要写HKD,但DB已经是CNY,
两个方向打架导致建滔(-2.5%实际浮亏)被算成-15.5%。
修复:
DB holdings表8只HK股的price和cost从CNY转回HKD
currency改回HKD
现金修正为132,121.93(Dad 7/3截图确认)
总资产=957,656.13 仓位=86.2%
2026-07-03 14:42:30 +08:00
知微
5bd8af20ac
migrate: live_prices+mtf+capital_flow DB read/write, cleanup remaining JSON refs
2026-07-03 13:46:12 +08:00
知微
bb9b3922c9
migrate: last 4 JSON files — live_prices, market, mtf_cache, capital_flow → DB
2026-07-03 13:44:10 +08:00
知微
7cc0ea0ef3
fix: Eastmoney 1-fail→Tencent + 2s interval + HKD→CNY + None-safe
2026-07-03 13:34:31 +08:00
知微
c1c4ba4a81
fix: price_monitor HKD→CNY + Eastmoney 2s timeout + None-safe + summary fix
2026-07-03 13:24:10 +08:00
知微
9124a7ad56
migrate: remove final JSON cold backup lines, prune/branch→DB
2026-07-03 12:41:20 +08:00