tinyshare 使用说明

安装

Python 3.8+,通过 pip 从文档站安装。

pip install tinyshare --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 到期时间(有效期截止)