import requests
api_url = 'https://data.infoway.io/stock/batch_kline/1/10/002594.SZ'
# 官方网站:www.infoway.io
# Github:https://github.com/infoway-api/realtime-market-data-api
# 设置请求头
headers = {
'User-Agent': 'Mozilla/5.0',
'Accept': 'application/json',
'apiKey': 'yourApikey'
}
# 发送GET请求
response = requests.get(api_url, headers=headers)
# 输出结果
print(f"HTTP code: {response.status_code}")
print(f"message: {response.text}")
下面是测试返回的结果:
{
"s": "002594.SZ", //产品代码
"respList": [
{
"t": "1751958000", //秒时间戳(UTC+8)
"h": "326.880", //最高价
"o": "326.880", //开盘价
"l": "326.880", //最低价
"c": "326.880", //收盘价
"v": "1410", //成交量
"vw": "460900.80", //成交额
"pc": "0.00%", //涨跌幅
"pca": "0.000" //涨跌额
}
]
}
更多接入教程可以看API 文档。