auto-sync: 2026-04-06 23:15:02
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
测试单个股票下载,看看具体问题
|
||||
"""
|
||||
import akshare as ak
|
||||
import pandas as pd
|
||||
import time
|
||||
|
||||
print("测试单个股票日线下载测试...")
|
||||
|
||||
# 测试一只正常股票
|
||||
test_codes = ["000001", "600000"]
|
||||
|
||||
for code in test_codes:
|
||||
print(f"\n{'='*60}")
|
||||
print(f"测试股票代码: {code}")
|
||||
print(f"{'='*60}")
|
||||
|
||||
for attempt in range(3):
|
||||
try:
|
||||
print(f"尝试 {attempt+1}/3...")
|
||||
df = ak.stock_zh_a_hist(
|
||||
symbol=code,
|
||||
period="daily",
|
||||
start_date="20240101",
|
||||
end_date="20250101",
|
||||
adjust="hfq"
|
||||
)
|
||||
|
||||
if df is not None and not df.empty:
|
||||
print(f"✅ 成功!获取到 {len(df)} 条记录")
|
||||
print(f"列名: {list(df.columns)}")
|
||||
print(f"\n前5行:\n{df.head()}")
|
||||
break
|
||||
else:
|
||||
print("❌ 返回空数据")
|
||||
time.sleep(2)
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ 异常: {e}")
|
||||
time.sleep(2)
|
||||
|
||||
print("\n{'='*60}")
|
||||
print("测试完成")
|
||||
Reference in New Issue
Block a user