Files
MoFin/scripts/check_key_levels.py
T
知微 66962ae190 fix: 全面系统修复 — delivery目标修正 + 脚本同步 + refresh_mtf_cache import修复 + clean_watchlist硬编码修复
修复清单:
- cron delivery修正:10个job从deliver=origin/all改为local,消除推送错误
- refresh_mtf_cache.py:替换strategy_lifecycle.PORTFOLIO_PATH导入为mofin_db直接读DB
- clean_watchlist.py:修复mo_data导入名错误和JSON硬编码路径
- MoFin/scripts/与profile scripts互相补全,双向sync到一致
- price_monitor.py:现金源从portfolio_summary表改为cash_log(Dad确认的现金权威)
- 更新watchlist.json加入000850华茂股份
2026-07-06 14:01:54 +08:00

70 lines
2.6 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
import json
import sys
# 读取实时数据
with open('data/temp_realtime.json', 'r') as f:
data = json.load(f)
prices = data['prices']
holdings = data['holdings']
print("=== 关键价位检查 ===")
# 检查每个持仓的关键价位
for holding in holdings:
code = holding['code']
name = holding['name']
current_price = holding['price']
analysis = holding.get('analysis', {})
stop_loss = analysis.get('stop_loss')
take_profit = analysis.get('take_profit')
if stop_loss and stop_loss != '':
try:
stop_loss_val = float(stop_loss)
distance_pct = (current_price - stop_loss_val) / stop_loss_val * 100
if distance_pct < 5: # 距离止损不到5%
print(f"⚠️ {name}({code}) 现价{current_price} 距止损{stop_loss_val}{abs(distance_pct):.1f}%")
except:
pass
if take_profit and take_profit != '':
try:
take_profit_val = float(take_profit)
distance_pct = (take_profit_val - current_price) / current_price * 100
if distance_pct < 5: # 距离止盈不到5%
print(f"🎯 {name}({code}) 现价{current_price} 距止盈{take_profit_val}{abs(distance_pct):.1f}%")
except:
pass
# 检查涨跌幅超过5%的股票
print("\n=== 异动股票检查(涨跌幅>5% ===")
for code, price_data in prices.items():
change_pct = price_data['change_pct']
if abs(change_pct) >= 5:
name = price_data['name']
price = price_data['price']
print(f"{'📈' if change_pct > 0 else '📉'} {name}({code}) 现价{price} {change_pct:+.2f}%")
# 检查决策库中的操作区间
print("\n=== 决策库操作区间检查 ===")
# 这里需要读取决策库,但数据太大,我们只检查几个关键股票
key_stocks = ['06160', '600110', '688411', '01478']
for code in key_stocks:
if code in prices:
price_data = prices[code]
name = price_data['name']
price = price_data['price']
# 根据历史回顾判断
if code == '06160':
print(f"🔵 {name}({code}) 现价{price} → 两批试仓已完成,止损160安全,目标175/185")
elif code == '600110':
print(f"🔵 {name}({code}) 现价{price} → 6月4日已按11.5~11.8加仓,现价仍在区间内")
elif code == '688411':
print(f"⚠️ {name}({code}) 现价{price} → 大涨10.87%,追踪止盈290接近,注意风险")
elif code == '01478':
print(f"⚠️ {name}({code}) 现价{price} → 反弹7.44%,深套股反弹至13~14可减仓")