Files
MoFin/deploy/profile-scripts/premarket_full_review.py
T

41 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""premarket_full_review.py — 盘前全量重评
执行顺序:
1. regenerate_all() 全量技术分析重评(持仓+自选)
2. watchlist_auto_exit() 自选退出检查
3. 输出摘要
调度:交易日 08:10A股09:30开盘)
"""
import sys, os, json
sys.path.insert(0, '/home/hmo/MoFin')
# Step 1: 全量重评
print("=" * 50)
print("📊 盘前全量重评开始")
print("=" * 50)
from strategy_lifecycle import regenerate_all
result = regenerate_all(stdout=True)
print(f"\n重评完成: {result.get('ok',0)}/{result.get('total',0)}成功")
# Step 2: 自选退出
print("\n" + "=" * 50)
print("🔍 自选退出检查")
print("=" * 50)
from scripts.watchlist_auto_exit import main as auto_exit
exited = auto_exit(dry_run=False)
# Step 3: 写入摘要供开盘简报引用
summary = {
"premarket_at": __import__('datetime').datetime.now().isoformat(),
"reassess": result,
"auto_exit": [{"code": c, "name": n, "reason": r} for c, n, s, r in exited],
"total_kept": result.get('total', 0) - len(exited),
}
os.makedirs("/tmp/mofin_premarket", exist_ok=True)
with open("/tmp/mofin_premarket/summary.json", "w") as f:
json.dump(summary, f, ensure_ascii=False, indent=2)
print(f"\n✅ 盘前重评完毕")