知微
|
8cef092c74
|
更新pipeline文档:JSON→SQLite
|
2026-06-20 20:55:05 +08:00 |
|
hmo
|
c80f814632
|
fix: K线迁移 + 清理重复文件
migrate_all.py:
- 新增 migrate_klines(): multi_tf_cache.json → stock_daily/weekly/monthly + stock_fundamentals
- 迁移量: daily=5520, weekly=1104, monthly=552 (46只股票)
- 验证表新增 stock_daily/weekly/monthly/fundamentals
清理:
- 删除 web/static/ (与根目录 static/ 重复,server.py 使用 static/)
|
2026-06-20 20:46:25 +08:00 |
|
知微
|
5936db828f
|
gitignore 排除 data/ 运行时文件和 pycache
|
2026-06-20 20:36:49 +08:00 |
|
知微
|
7a6ade52f1
|
cron prompt 全切SQLite + script同步
- 4个LLM cron prompt 从JSON改走 mofin.db SQLite
- ~/.hermes/scripts/ 同步xxm的最新版本
- mofin_query.py 已验证可用
- 迁移验证通过
|
2026-06-20 20:36:34 +08:00 |
|
hmo
|
d820ff2ad8
|
docs: 更新协作文档 — 记录数据层重构完成状态
|
2026-06-20 20:08:09 +08:00 |
|
hmo
|
6182ff081d
|
docs: 统一数据库架构实施文档
覆盖: 表结构设计(13张表)、数据流架构、核心模块说明、
部署指南、架构决策记录(ADR)、已知限制
|
2026-06-20 17:54:10 +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 |
|
hmo
|
1610f184a0
|
feat: 补全 SQLite 表结构 + 查询函数 + 迁移覆盖
mofin_db.py 新增:
- 4 张表: portfolio_summary, advice_timeline, accuracy_stats, strategy_feedback
- 18 个查询函数: query_holdings, query_watchlist, query_strategies,
query_advice_timeline, query_candidates, query_candidate_scores,
query_price_events, query_price_events_by_date, query_stock_sectors,
query_sector_stocks, query_accuracy_stats, query_strategy_feedback,
query_strategy_evaluations, query_latest_market, query_holding_by_code,
query_portfolio_summary
migrate_all.py 新增:
- 4 个迁移函数: migrate_portfolio_summary, migrate_advice_timeline,
migrate_accuracy_stats, migrate_strategy_feedback
- 迁移量: portfolio_summary(1), advice_timeline(2547),
accuracy_stats(1), strategy_feedback(37)
现在 13 张表全部覆盖,JSON→SQLite 数据完整迁移
|
2026-06-20 16:59:24 +08:00 |
|
hmo
|
0650673038
|
feat: migrate_all.py — 完整数据迁移脚本 (JSON → SQLite)
一次性迁移全部生产数据到 mofin.db:
- stock_profiles.json → stocks (55只)
- portfolio.json → holdings (21只) + holding_strategies (21条)
- watchlist.json → watchlist_stocks (1只) + holding_strategies (1条)
- decisions.json → holding_strategies (316条, 含changelog历史)
- candidate_pool.json → candidates (10只) + candidate_score_history (21条)
- price_events.json → price_events (193条)
- evaluation.json → strategy_evaluations (36条)
- stock_sector_map.json → stock_sectors (62条)
特性:
- 自动从所有JSON源收集股票代码 (collect_all_stocks)
- 代码格式归一化 (_normalize_code: 整数→补零字符串)
- 迁移期间关闭外键约束 (兼容旧数据格式不一致)
- 幂等可重跑 (INSERT OR REPLACE/IGNORE)
- JSON文件不修改,可安全重复执行
替换旧的 migrate_sectors.py (功能已合并)
|
2026-06-20 16:40:39 +08:00 |
|
hmo
|
0924cf3124
|
refactor: 数据层重构 — 统一 SQLite 访问层 + 多脚本双写
新建 mofin_db.py 共享数据库模块:
- get_conn() 统一连接管理 (WAL + Row factory + 外键)
- init_all_tables() 幂等建表 (12张表: market/sector/stock/kline/fundamentals/sectors/holdings/strategies/watchlist/candidates/score_history/events/evaluations)
- write_market_snapshot() 市场快照双写
- write_klines() K线数据双写 (stocks + daily/weekly/monthly + fundamentals)
- write_price_event() 价格事件双写
- migrate_stock_sectors() 一次性迁移 stock_sector_map.json
- query_*() 通用查询函数 (sector_trend/top_inflow/consecutive_inflow/market_mood/db_stats)
重构现有脚本:
- market_watch.py: 删除内联 DB 代码,改用 mofin_db
- multi_timeframe.py: _save_local_history() 加 SQLite 双写
- price_monitor.py: record_event() 加 SQLite 双写
- mofin_query.py: 改用 mofin_db 查询函数
新增:
- migrate_sectors.py: 一次性迁移脚本
清理:
- get_realtime_prices.py: 死代码 (只读 portfolio.json,不调API)
|
2026-06-20 16:26:17 +08:00 |
|
知微
|
8926b11090
|
自选新增 中钨高新(000657) 并制定策略
|
2026-06-20 15:50:50 +08:00 |
|
hmo
|
a293119a31
|
feat: 阶段1 — market_watch 双写 SQLite + 查询工具
- market_watch.py: 新增 init_db() 建表 + write_snapshot() 双写 SQLite
- market_snapshots: 每次采集的元信息(时间、来源、涨跌比、情绪)
- sector_snapshots: 每个板块的涨跌幅、资金流向、领涨股等
- JSON 写入保留不变,SQLite 写入失败不影响 JSON 管道
- mofin_query.py: 通用查询工具
- 板块趋势查询:「半导体最近5次采集的涨跌幅」
- 资金流向排行:「净流入最多的5个板块」
- 连续净流入检测:「最近3天连续净流入的板块」
- 市场情绪趋势 + 数据库概览
- 支持直接 SQL 查询
|
2026-06-20 12:51:02 +08:00 |
|
知微
|
9e63899794
|
清理重复文件(2)
|
2026-06-20 12:44:09 +08:00 |
|
知微
|
664a25b7a2
|
清理重复文件
|
2026-06-20 12:43:50 +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 |
|