diff --git a/tushare/src/fetcher.py b/tushare/src/fetcher.py index b226e99..b5c50d4 100644 --- a/tushare/src/fetcher.py +++ b/tushare/src/fetcher.py @@ -34,6 +34,10 @@ def fetch_contract( ] df = df[[c for c in cols if c in df.columns]].copy() + # 确保 ts_code 列与查询时传入的完整代码一致(Tushare 返回的可能不带交易所后缀) + if "ts_code" in df.columns: + df["ts_code"] = ts_code + numeric = ["open", "high", "low", "close", "vol", "amount", "oi", "oi_chg", "pre_close"] for c in numeric: if c in df.columns: