完全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。
This commit is contained in:
知微
2026-07-06 12:08:08 +08:00
parent e185b4e4dc
commit 3e2f0315eb
10 changed files with 55 additions and 85 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+8 -8
View File
@@ -5,9 +5,9 @@
"name": "腾讯",
"shares": 100,
"cost": 443.13,
"price": 447.0,
"price": 446.4,
"market_value": 39063.0,
"change_pct": 3.66,
"change_pct": 3.53,
"currency": "HKD",
"position_pct": null
},
@@ -16,9 +16,9 @@
"name": "中国神华",
"shares": 500,
"cost": 45.89,
"price": 40.68,
"price": 40.72,
"market_value": 17575.0,
"change_pct": 1.7,
"change_pct": 1.8,
"currency": "HKD",
"position_pct": 2.14
},
@@ -27,9 +27,9 @@
"name": "比亚迪股份",
"shares": 600,
"cost": 104.87,
"price": 84.2,
"price": 84.25,
"market_value": 44376.0,
"change_pct": 0.12,
"change_pct": 0.18,
"currency": "HKD",
"position_pct": 4.62
},
@@ -38,9 +38,9 @@
"name": "丘钛科技",
"shares": 11000,
"cost": 13.47,
"price": 6.77,
"price": 6.75,
"market_value": 64460.0,
"change_pct": -3.15,
"change_pct": -3.43,
"currency": "HKD",
"position_pct": 7.97
},