fix: DB路径大面积修复——mofin_db/server/technical_analysis/strategy_tree等脚本的Path(__file__).parent/data错误指向scripts/data而非data/ 导致读写分离
- 量价分析: full_analysis输出volume_deep+成交量存储在price_history.json - FK约束移除: holding_strategies外键->holdings阻止自选股写入 - #000850 重评已写入(止损3.74/止盈4.06/RR1.67)含量价信号
This commit is contained in:
+8
-6
@@ -11,6 +11,8 @@ import time
|
||||
import sqlite3
|
||||
from datetime import datetime
|
||||
|
||||
# ⚠️ 以下常量已废弃:数据在 mofin.db 的 holding_strategies / holdings / watchlist_stocks 表
|
||||
# 保留仅防止 import 报错,新代码勿用
|
||||
DECISIONS_PATH = "/home/hmo/web-dashboard/data/decisions.json"
|
||||
PORTFOLIO_PATH = "/home/hmo/web-dashboard/data/portfolio.json"
|
||||
WATCHLIST_PATH = "/home/hmo/web-dashboard/data/watchlist.json"
|
||||
@@ -23,6 +25,7 @@ sys.path.insert(0, "/home/hmo/MoFin")
|
||||
try:
|
||||
from mofin_db import get_conn, write_holdings_batch, write_portfolio_summary, write_live_prices
|
||||
from mo_models import calc_total_mv, calc_total_assets
|
||||
from mo_data import read_decisions
|
||||
HAS_DB = True
|
||||
except ImportError:
|
||||
HAS_DB = False
|
||||
@@ -307,12 +310,11 @@ def run_once(round_label=""):
|
||||
# === 第一步:一次性刷新所有价格 ===
|
||||
refreshed = refresh_data_prices()
|
||||
|
||||
# === 第二步:检查触发条件 ===
|
||||
# === 第二步:检查触发条件(纯DB,不读JSON) ===
|
||||
try:
|
||||
with open(DECISIONS_PATH) as f:
|
||||
dec = json.load(f)
|
||||
except:
|
||||
print(f"❌{label} 无法读取decisions.json", file=sys.stderr)
|
||||
dec = read_decisions()
|
||||
except Exception as e:
|
||||
print(f"❌{label} 无法从DB读取决策数据: {e}", file=sys.stderr)
|
||||
return
|
||||
|
||||
active = [d for d in dec.get("decisions", []) if d.get("status") == "active"]
|
||||
@@ -393,7 +395,7 @@ def run_once(round_label=""):
|
||||
if price == 0:
|
||||
continue
|
||||
|
||||
# 从 decisions.json 中读取 analysis 的买入区
|
||||
# 从 DB holding_strategies 读取买入区
|
||||
entry_low = d.get("entry_low", 0)
|
||||
entry_high = d.get("entry_high", 0)
|
||||
if not entry_low or not entry_high:
|
||||
|
||||
Reference in New Issue
Block a user