我想要获取个股K线数据,用的是券商终端,内置 python 环境,<br />然后,打开极简模式,import xtquant。<br />3月份开通的模拟账号,到9月11日之后请求K线数据,返回的数据日期最大也就是9月11日,<br />问了券商客服好多次,不知道原因。<br /><br /><br />请问各位大佬,有没有建议?代码如下<br /><br /><br />
from xtquant import xtdata
def test_history_data():
try:
print(xtdata.download_history_data("600519.SH", "1d", start_time=""))
print(xtdata.subscribe_quote("600519.SH", period="1d"))
data1 = xtdata.get_market_data(
field_list=["close"],
stock_list=["600519.SH"],
period="1d",
start_time="",
end_time="",
count=10,
dividend_type="front"
)
print(f"Result 1:\n{data1}")
print(xtdata.download_history_data2(["600519.SH"], "1d"))
data2 = xtdata.get_market_data(
field_list=["close"],
stock_list=["600519.SH"],
period="1d",
dividend_type="front" # 前复权
)
print(f"result 2:{data2}")
except Exception as e:
print(f"Error: {e}")
# 主函数
if __name__ == '__main__':
test_history_data()
"""
以上代码输出如下,注意K线日期截至9月11日,非常奇怪!
None
1
Result 1:
{'close': Empty DataFrame
Columns: []
Index: [600519.SH]}
None
result 2:{'close': 20240530 20240531 20240603 20240604 20240605 ... 20250905 20250908 20250909
20250910 20250911
600519.SH 1566.569 1566.019 1556.959 1570.769 1561.569 ... 1483.0 1501.23 1505.0 1522.01 1523.5
[1 rows x 315 columns]}
"""
|