A股行情数据API接口
1. 历史日线
# Restful API:上交所
https://tsanghi.com/api/fin/stock/XSHG/daily?token={token}&ticker={ticker}
# Restful API:深交所
https://tsanghi.com/api/fin/stock/XSHE/daily?token={token}&ticker={ticker}
默认返回全部历史数据,也可以使用参数start_date和end_date选择特定时间段。
更新时间:收盘后3~4小时。
更新周期:每天。
请求方式:GET。
# 测试:返回不超过10条数据(2年历史)
https://tsanghi.com/api/fin/stock/XSHG/daily?token=demo&ticker=
600519&order=2
Python示例
import requests
url = f"https://tsanghi.com/api/fin/stock/XSHG/daily?token=demo&ticker=600519"
data = requests.get(url).json()
print(data)
Response示例
2. 增量日线
# Restful API:上交所
https://tsanghi.com/api/fin/stock/XSHG/daily/latest?token={token}
# Restful API:深交所
https://tsanghi.com/api/fin/stock/XSHE/daily/latest?token={token}
不指定日期时,默认返回最新行情。此接口可方便地获取每日增量行情。
更新时间:收盘后3~4小时。
更新周期:每天。
请求方式:GET。
# 测试:返回不超过10条数据(2年历史)https://tsanghi.com/api/fin/stock/XSHG/daily/latest?token=demo
Python示例
import requests
url = f"https://tsanghi.com/api/fin/stock/XSHG/daily/latest?token=demo"
data = requests.get(url).json()
print(data)
Response示例
# 更多详情
https://tsanghi.com