Python 3.8+,通过 pip 从文档站安装。
pip install tinyshare --extra-index-url https://tinydoc.pages.dev/simple/ -U
获取 A 股日线行情。
import tinyshare as ts
ts.set_token('授权码')
pro = ts.pro_api()
df = pro.daily(
ts_code='600519.SH',
start_date='20260204',
end_date='20260211',
)
print(df)
查询当前授权码的开通时间与到期时间,无需额外参数。调用 user() 接口即可。
填入授权码后点击查询,无需运行 Python。
import tinyshare as ts
ts.set_token('授权码')
pro = ts.pro_api()
df = pro.user()
print(df)
| 字段 | 类型 | 说明 |
|---|---|---|
| code | string | 授权码(脱敏显示) |
| week | int | 授权周期(周) |
| addDate | string | 开通时间 |
| limitDate | string | 到期时间(有效期截止) |