perf: remove 0.2s sleep between Eastmoney HK requests (9 stocks < 1s, batch not supported by API)
This commit is contained in:
+1
-3
@@ -133,7 +133,7 @@ def fetch_hk_eastmoney(codes):
|
||||
|
||||
results = {}
|
||||
|
||||
# 主通道:东方财富实时行情(逐股查询,港股最多~10只,可接受)
|
||||
# 主通道:东方财富实时行情(逐股查询,港股仅~10只,<1秒完成。该API不支持批量)
|
||||
for code in hk_codes:
|
||||
try:
|
||||
url = (f"https://push2.eastmoney.com/api/qt/stock/get"
|
||||
@@ -155,8 +155,6 @@ def fetch_hk_eastmoney(codes):
|
||||
change_pct = str(item.get("f170", "0"))
|
||||
if price > 0:
|
||||
results[code] = (price, change, change_pct)
|
||||
# 东方财富有频率限制,每请求间隔 0.2s
|
||||
time.sleep(0.2)
|
||||
except Exception as e:
|
||||
print(f"⚠️ 东方财富 {code} 拉取失败: {e}", file=sys.stderr)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user