完全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:
+2
-3
@@ -72,9 +72,8 @@ def detect_scenario():
|
||||
|
||||
try:
|
||||
# 优先 DB
|
||||
import sqlite3
|
||||
from pathlib import Path
|
||||
db = sqlite3.connect(str(Path(__file__).parent / "data" / "mofin.db"))
|
||||
from mofin_db import get_conn
|
||||
db = get_conn()
|
||||
mrow = db.execute(
|
||||
"SELECT indices, structure, sector_mood FROM macro_context_log "
|
||||
"WHERE has_valid_data=1 ORDER BY created_at DESC LIMIT 1"
|
||||
|
||||
Reference in New Issue
Block a user