auto-sync: 2026-05-02 18:54:48
This commit is contained in:
@@ -84,12 +84,10 @@ def fetch_incremental(code: str, start_date: str, end_date: str):
|
|||||||
prefix = 'sh' if code.startswith(('6', '5', '1')) else 'sz'
|
prefix = 'sh' if code.startswith(('6', '5', '1')) else 'sz'
|
||||||
tq = f"{prefix}{code}"
|
tq = f"{prefix}{code}"
|
||||||
days = (pd.Timestamp(end_date) - pd.Timestamp(start_date)).days + 10
|
days = (pd.Timestamp(end_date) - pd.Timestamp(start_date)).days + 10
|
||||||
url = f"https://web.ifzq.gtimg.cn/appstock/app/fqkline/get?_var=kline_dayqfq¶m={tq},day,,{days},qfqa"
|
url = f"https://web.ifzq.gtimg.cn/appstock/app/fqkline/get?param={tq},day,,{days},"
|
||||||
import urllib.request, json
|
import urllib.request, json
|
||||||
with urllib.request.urlopen(url, timeout=10) as r:
|
with urllib.request.urlopen(url, timeout=10) as r:
|
||||||
raw = r.read().decode('gbk')
|
data = json.loads(r.read())
|
||||||
json_str = raw.split('=', 1)[1]
|
|
||||||
data = json.loads(json_str)
|
|
||||||
klines = data.get("data", {}).get(tq, {}).get("day", [])
|
klines = data.get("data", {}).get(tq, {}).get("day", [])
|
||||||
if not klines:
|
if not klines:
|
||||||
return None
|
return None
|
||||||
|
|||||||
Reference in New Issue
Block a user