Commit Graph
23 Commits
Author SHA1 Message Date
hmo c1b38d3d7b feat(盯盘): 推荐操作精选层——72h新鲜度+RR降序+现金预算贪心装入(上限5只)
老爸: 太多推荐=没有推荐。机制:
- 候选: tag非空 且 reassessed_at 72h内(陈旧信号不算推荐)
- 排序: rr_ratio 降序
- 预算: 从 portfolio_summary 读现金/总资产, 每只建议仓位
  (position_advice解析%或默认8%) 贪心累加, 耗尽即止, 最多5只
- 落选者降回持仓/自选自然组
- /api/watch 返回 cash/budget_pct/rec_used_pct, 前端显示预算条
- 推荐行仓位列显示'建议X%'
2026-07-22 00:16:35 +08:00
hmo 5b44086c8a fix: reports匹配链修正(标题匹配不再是死代码) + strategy_history空历史时降级当前行 2026-07-20 23:58:45 +08:00
hmo de9927a627 重评核心重构:ds-v4-pro + 原策略全文 + strategy_history + 前端三改造
后端(重评管线):
- 新增 llm_client.py 共享客户端: REASSESS_MODEL=deepseek-v4-pro 单点,
  gateway预检(fail-fast), 150s超时+1次重试, 永不抛异常
- batch_reassess/per_stock_reassess: curl/urllib -> call_llm,
  prompt传入原策略全文+当前参数+最近3条变更, 输出 维持/修改判断+
  修改点理由+最终新策略, max_tokens 4096
- mofin_db: 新增 strategy_history 表 + snapshot_strategy_history(),
  write_holding_strategy 覆写前自动快照(保留20条/code)
- mofin_db: holding_strategies 补 tag 列迁移 + 写入保留
  (tag缺席=保留旧值, 显式传''=允许清除), 修复推荐标签被静默丢弃
- mo_data.read_decisions: SELECT 补 tag
- stale_detector/promote_candidates: 子进程超时 240/60 -> 480s

前端:
- 移除 报告Tab -> mofin_health 全部流程/Cron 表加 最后十次 列
  (modal列表->详情), /api/reports 支持 cron+script 多路匹配
  (jobs.json name->id 解析 + 文件名/标题子串兜底)
- 移除 决策库Tab
- 盯盘Tab 重构: 全部持仓+自选, sort_group 分组(推荐/持仓/自选),
  推荐行琥珀高亮+🔥badge+行内策略, 新增 操作策略 列查看
  最近3次完整策略(/api/strategy_history/<code>, 表缺失时降级当前行)
- 提示词Tab: registry.py 数据路径改回 /home/hmo/MoFin/data/prompts
  (红线: 数据只在规范数据根), 空态提示初始化命令
2026-07-20 23:51:24 +08:00
知微 0190c02064 chore: capture live morning state before session merge 2026-07-20 08:50:29 +08:00
知微 e366a6359a fix(bot): 防递归重连 guard - 防止 on_disconnect → reconnect → disconnect 无限递归导致栈溢出 2026-07-19 20:59:18 +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
知微 016258bc09 feat: 批量LLM九维分析+仓位建议列+Dashboard显示 2026-07-09 23:16:47 +08:00
知微 14690a64e5 fix: 自选按信号优先级排序+策略显示tech_snapshot/sector_context 2026-07-09 20:24:43 +08:00
知微 ffef8cdd29 fix: 自选Tab显示策略数据(买入区间/信号/策略)+live_prices涨跌 2026-07-09 19:49:07 +08:00
知微 a83c0ea11e fix: watchlist API改用holding_strategies+市场Tabtrend变量 2026-07-09 19:24:45 +08:00
知微 057e87f0ab feat: Dashboard市场Tab候选管道+S4资金流(外盘/内盘)+全链路测试通过 2026-07-09 19:07:08 +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
知微 b3bedc8024 migrate: remove JSON, DB-only — mo_data, server, scripts, prompts (27 files) 2026-07-03 12:12:05 +08:00
知微 8ed755bff9 feat: strategy_lifecycle + stale_detector + server — DB-first price reads, Tencent API as fallback only 2026-07-01 22:48:48 +08:00
hmo 6abc2e45b0 refactor: phase 0-2 MoFin architecture reform — single source of truth
Phase 0 (止血):
- mo_models.py: unified calc_total_assets(), is_hk_stock(), get_hk_rate() — single source of truth
- Fixed 3 files missing frozen_cash: holdings_reconciliation, server, import_holding_xls
- Fixed stale_push_wlin: unified is_hk_stock detection, removed hardcoded 0.866
- Fixed price_monitor: consolidated 2 duplicate total_assets blocks into mo_models calls
- Fixed stock_scorer: replaced broken len()<=5 is_hk_stock heuristic
- Fixed strategy_lifecycle: replaced non-existent currency_utils import with mo_models

Phase 1 (DSA adapter):
- mo_provider.py: wraps DSA DataFetcherManager (16 fetchers, auto-fallback)
  - TDX relay as primary, DSA as backup for realtime/kline/news/fundamentals

Phase 2 (Integration):
- mo_bridge.py: injects DSA market review + news context into MoFin analysis prompts
- Graceful degradation if DSA not installed

Infrastructure:
- mo_config.py: centralized Config singleton replacing scattered hardcoded paths
- All 11 changed files pass python compile check

Impact: total_assets now computed in ONE place (mo_models).
        is_hk_stock now ONE implementation (no more false negatives).
        HK rate now ONE source (hk_rate API → cache → 0.87 fallback).
        No more hardcoded 0.866/0.8664/0.8700 divergence.
2026-06-29 23:25:54 +08:00
知微 0ecdfbc861 上传OCR切换:小果GLM-OCR-8bit优先,Tesseract降级
MoFin/server.py 的 _ocr_image 改为:
1. 优先调小果 gateway (192.168.1.122:18003) 的 GLM-OCR-8bit
2. 失败/无响应则自动降级到本地 Tesseract(预处理+chi_sim+eng)
3. fallback逻辑保留原预处理管道(放大/锐化/二值化)

ocr_client.py 模块独立可调用,兼作CLI工具
2026-06-24 13:48:40 +08:00
知微 ce687a4216 fix: xiaoguo_scanner 榜单更新+看空榜持仓预警
- 修bug:stock_rank_cxd_ths 实为'创新低',改为 stock_rank_lxsz_ths '连续上涨'
- 新增6个看多榜(险资举牌)+ 5个看空榜(创新低/持续缩量/量价齐跌/连续下跌/向下突破)
- 看空榜自动比对持仓,命中写入 xiaoguo_risk 信号
- 东财热榜静默降级(502不可修)
- 看空榜不跳过已扫描,每轮全检
2026-06-22 19:13:55 +08:00
知微 a8c3ec5db9 三修:建议去重+闭环跟踪+模糊用词禁令
server.py:
- /api/advice/record 加去重(同天+同方向+同摘要前40字=跳过)
- /api/advice/confirm 支持 executed 动作+自动打 evaluated 标记

cron prompts:
- MoFin盘前中监控 + 午后监控 加入 advice/record 调用指令
- 模糊用词禁令嵌入 cron prompt
2026-06-21 23:00:53 +08:00
知微 70514bf542 Dashboard: 信号tab + API(signals + xiaoguo-scan),前端展示 2026-06-21 02:44:05 +08:00
hmo 25f8c6ec67 refactor: 消费者切 SQLite 优先读取
切换策略: SQLite 优先 → 失败回退 JSON

price_events (100%覆盖):
- strategy_feedback.py: run() 优先 query_price_events()
- system_health_check.py: 优先 query_price_events() + query_price_events_by_date()

stock_sector_map (100%覆盖):
- strategy_lifecycle.py: load_stock_sector_map() 优先 stock_sectors 表

market.json (85%覆盖):
- strategy_lifecycle.py: load_market_context() 优先 query_latest_market()
- market_insight.py: generate() 优先 query_latest_market()

portfolio.json + watchlist.json (70%覆盖):
- strategy_lifecycle.py: regenerate_all() 优先 query_holdings() + query_watchlist()
- server.py: /api/portfolio, /api/watchlist, /api/overview, /api/market 优先 SQLite

所有改动保留 JSON 回退路径,SQLite 不可用时自动降级
2026-06-20 17:50:15 +08:00
知微 66a8f24e17 加回 .gitignore 2026-06-20 12:43:24 +08:00
知微 (MoFin) 33df400c01 目录重组:web/ scripts/ config/ tests/ 标准化 2026-06-20 12:11:33 +08:00
知微 (MoFin) aa0f740381 MoFin 初始提交
完整数据采集+分析管道:
- market_watch.py:90行业板块采集(同花顺/东方财富)
- 市场精选推荐 cron:全市场分析+候选池+星级推荐
- price_monitor.py:持仓/自选高频价格监控
- refresh_mtf_cache.py:多周期K线缓存
- 策略评估/知识萃取管道

文档:docs/ 含完整需求+架构设计
注意:尚未配置 git remote,笑笑接手后自行配置
2026-06-20 12:04:21 +08:00