fix: 买入区用live_prices+统一DB读取+报告前验价

This commit is contained in:
知微
2026-07-10 10:26:14 +08:00
parent dbff6b59f9
commit 73df767ac0
2 changed files with 17 additions and 5 deletions
+10 -3
View File
@@ -99,11 +99,18 @@ def main():
import sqlite3
_conn = sqlite3.connect(str(SCRIPTS_DIR.parent / "data" / "mofin.db"))
_actionable = _conn.execute(
"SELECT code FROM holding_strategies WHERE status='active' "
"AND timing_signal IN ('买入','可买入','可加仓','卖出','止盈')"
"SELECT hs.code, lp.price, hs.entry_low, hs.entry_high FROM holding_strategies hs "
"LEFT JOIN live_prices lp ON hs.code = lp.code "
"WHERE hs.status='active' "
"AND hs.timing_signal IN ('买入','可买入','可加仓','卖出','止盈')"
).fetchall()
_conn.close()
for (_code,) in _actionable:
for _code, _price, _el, _eh in _actionable:
# 价格必须在买入区内或附近(不高于上沿20%),否则不触发重评
if _price and _el and _eh and _price > 0 and _el > 0 and _eh > 0:
if _price > _eh * 1.20:
print(f" ⏭️ {_code}: 价{_price}超买入区上沿+{((_price/_eh)-1)*100:.0f}%,跳过重评")
continue
try:
subprocess.run(
["python3", str(SCRIPTS_DIR / "per_stock_reassess.py"), _code],