安装
Python 3.8+,通过 pip 从文档站安装。授权码可添加微信 Aimuen2 获取(下方与左侧有醒目入口,可一键复制)。
联系微信 · 获取授权码
Aimuen2
添加微信咨询购买与技术支持,授权码也可通过微信获取。
tinyshare(源码包)
与 tushare 类似的包名,便于迁移与调试。
pip install tinyshare --extra-index-url https://tinydoc.pages.dev/simple/ -U
ttshare(字节码包)
多 Python 版本字节码分发,安装后使用 import ttshare,API 与 tinyshare 一致。
pip install ttshare --extra-index-url https://tinydoc.pages.dev/simple/ -U
daily 调用示例
获取 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)
MCP 配置
在 Cursor 等支持 MCP 的客户端中接入 tinyshare,将 YOUR_CODE 替换为你的授权码。
配置路径:Cursor 设置 → MCP → 编辑 mcp.json,或项目根目录 .cursor/mcp.json。
{
"mcpServers": {
"tinyshare": {
"url": "http://mintree.site:8080/mcp?auth_code=YOUR_CODE",
"transport": "streamable-http"
}
}
}
有效期查询
查询当前授权码的开通时间与到期时间,无需额外参数。调用 user() 接口即可。
在线查询
使用左侧栏填入的授权码,点击下方按钮即可查询,无需运行 Python。
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 | 到期时间(有效期截止) |