fix: 日线/复权/每日指标接口改回普通版(daily_vip/adj_factor_vip 接口名不存在,daily_basic_vip 无权限;普通版5120积分可用)
This commit is contained in:
@@ -427,7 +427,7 @@ def import_daily_for_stock(ts_code: str, start_date: str, end_date: str, conn) -
|
|||||||
pro = get_ts_pro()
|
pro = get_ts_pro()
|
||||||
|
|
||||||
def fetch():
|
def fetch():
|
||||||
return pro.daily_vip(
|
return pro.daily(
|
||||||
ts_code=ts_code,
|
ts_code=ts_code,
|
||||||
start_date=start_date.replace("-", ""),
|
start_date=start_date.replace("-", ""),
|
||||||
end_date=end_date.replace("-", ""),
|
end_date=end_date.replace("-", ""),
|
||||||
@@ -485,7 +485,7 @@ def import_daily_by_date(
|
|||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
按交易日批量导入日线行情 (高效模式)
|
按交易日批量导入日线行情 (高效模式)
|
||||||
使用 pro.daily_vip(trade_date='YYYYMMDD') 一次性拉取全市场当日数据
|
使用 pro.daily(trade_date='YYYYMMDD') 一次性拉取全市场当日数据
|
||||||
大幅减少 API 调用次数: 约250交易日/年 × 16年 ≈ 4000次 (原来需要 5000股票 × 16年 = 80000次)
|
大幅减少 API 调用次数: 约250交易日/年 × 16年 ≈ 4000次 (原来需要 5000股票 × 16年 = 80000次)
|
||||||
|
|
||||||
参数:
|
参数:
|
||||||
@@ -576,7 +576,7 @@ def import_daily_by_date(
|
|||||||
td_str = td.strftime("%Y%m%d") if hasattr(td, "strftime") else str(td).replace("-", "")
|
td_str = td.strftime("%Y%m%d") if hasattr(td, "strftime") else str(td).replace("-", "")
|
||||||
|
|
||||||
def fetch():
|
def fetch():
|
||||||
return pro.daily_vip(trade_date=td_str)
|
return pro.daily(trade_date=td_str)
|
||||||
|
|
||||||
df = fetch_with_retry(fetch, max_retries=3)
|
df = fetch_with_retry(fetch, max_retries=3)
|
||||||
if df is None or df.empty:
|
if df is None or df.empty:
|
||||||
@@ -679,7 +679,7 @@ def import_daily_basic(
|
|||||||
kwargs["trade_date"] = trade_date.replace("-", "")
|
kwargs["trade_date"] = trade_date.replace("-", "")
|
||||||
|
|
||||||
def fetch():
|
def fetch():
|
||||||
return pro.daily_basic_vip(**kwargs)
|
return pro.daily_basic(**kwargs)
|
||||||
|
|
||||||
df = fetch_with_retry(fetch, max_retries=2)
|
df = fetch_with_retry(fetch, max_retries=2)
|
||||||
if df is None or df.empty:
|
if df is None or df.empty:
|
||||||
@@ -745,7 +745,7 @@ def import_daily_basic_by_date(
|
|||||||
pro = get_ts_pro()
|
pro = get_ts_pro()
|
||||||
|
|
||||||
def fetch_daily_basic():
|
def fetch_daily_basic():
|
||||||
return pro.daily_basic_vip(trade_date=td)
|
return pro.daily_basic(trade_date=td)
|
||||||
|
|
||||||
df = fetch_with_retry(fetch_daily_basic, max_retries=3)
|
df = fetch_with_retry(fetch_daily_basic, max_retries=3)
|
||||||
if df is not None and not df.empty:
|
if df is not None and not df.empty:
|
||||||
@@ -799,7 +799,7 @@ def import_adj_factor(
|
|||||||
kwargs["ts_code"] = ts_code
|
kwargs["ts_code"] = ts_code
|
||||||
|
|
||||||
def fetch():
|
def fetch():
|
||||||
return pro.adj_factor_vip(**kwargs)
|
return pro.adj_factor(**kwargs)
|
||||||
|
|
||||||
df = fetch_with_retry(fetch, max_retries=2)
|
df = fetch_with_retry(fetch, max_retries=2)
|
||||||
if df is None or df.empty:
|
if df is None or df.empty:
|
||||||
@@ -1635,7 +1635,7 @@ def resume_daily_by_date(
|
|||||||
td_compact = td_str.replace("-", "")
|
td_compact = td_str.replace("-", "")
|
||||||
|
|
||||||
def fetch():
|
def fetch():
|
||||||
return pro.daily_vip(trade_date=td_compact)
|
return pro.daily(trade_date=td_compact)
|
||||||
|
|
||||||
df = fetch_with_retry(fetch, max_retries=3)
|
df = fetch_with_retry(fetch, max_retries=3)
|
||||||
if df is None or df.empty:
|
if df is None or df.empty:
|
||||||
|
|||||||
Reference in New Issue
Block a user