refactor: 统一价格入口 mo_data.get_price() - 22个脚本移除自拉腾讯API
所有价格获取统一走 mo_data.get_price() / get_prices_batch():
- 优先读 live_prices(DB) → 无/过期才调 stock_quote(API) → 自动写回DB
- 22个脚本全部替换:branch_scanner chip_factors divergence_detector
market_screener mo_provider mofin_collect monitor_300308 300308_monitor
multi_timeframe refresh_macro_context stale_detector stale_push_wlin
stock_profile strategy_evaluator strategy_lifecycle strategy_review
strategy-staleness-check technical_analysis xiaoguo_signal_consumer
collect_evaluation_data
This commit is contained in:
@@ -11,8 +11,9 @@
|
||||
发一次信号后就停,不再重复。
|
||||
"""
|
||||
|
||||
import json, os, subprocess, sys, urllib.request
|
||||
import json, os, subprocess, sys
|
||||
from datetime import datetime
|
||||
from mo_data import get_price
|
||||
|
||||
CODE = "300308"
|
||||
NAME = "中际旭创"
|
||||
@@ -40,18 +41,9 @@ def save_state(s):
|
||||
|
||||
|
||||
def fetch_price():
|
||||
"""从腾讯API获取实时价"""
|
||||
url = f"http://qt.gtimg.cn/q=sz{CODE}"
|
||||
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
|
||||
try:
|
||||
resp = urllib.request.urlopen(req, timeout=10)
|
||||
text = resp.read().decode("gbk")
|
||||
fields = text.split("~")
|
||||
price = float(fields[3]) if fields[3] else 0
|
||||
change_pct = fields[32] if len(fields) > 32 else "0"
|
||||
return price, change_pct
|
||||
except Exception as e:
|
||||
return 0, "0"
|
||||
"""从统一入口获取实时价"""
|
||||
price, chg = get_price(CODE)
|
||||
return price or 0, chg or 0
|
||||
|
||||
|
||||
def send_alert(price, change_pct):
|
||||
|
||||
Reference in New Issue
Block a user