perf: remove 0.2s sleep between Eastmoney HK requests (9 stocks < 1s, batch not supported by API)

This commit is contained in:
知微
2026-07-01 23:15:39 +08:00
parent 671fe4ecc2
commit 0faa58d211
+1 -3
View File
@@ -133,7 +133,7 @@ def fetch_hk_eastmoney(codes):
results = {} results = {}
# 主通道:东方财富实时行情(逐股查询,港股最多~10只,可接受 # 主通道:东方财富实时行情(逐股查询,港股~10只,<1秒完成。该API不支持批量
for code in hk_codes: for code in hk_codes:
try: try:
url = (f"https://push2.eastmoney.com/api/qt/stock/get" 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")) change_pct = str(item.get("f170", "0"))
if price > 0: if price > 0:
results[code] = (price, change, change_pct) results[code] = (price, change, change_pct)
# 东方财富有频率限制,每请求间隔 0.2s
time.sleep(0.2)
except Exception as e: except Exception as e:
print(f"⚠️ 东方财富 {code} 拉取失败: {e}", file=sys.stderr) print(f"⚠️ 东方财富 {code} 拉取失败: {e}", file=sys.stderr)
continue continue