Tushare TypeScript SDK 是 Tushare Pro 数据接口的 TypeScript 版本封装,提供完整的类型定义和文档,方便 TypeScript/JavaScript 开发者使用。
详细文档: packages/tushare-core/README.md
npm install @zhaots/tushare-core
# 或
yarn add @zhaots/tushare-core
# 或
pnpm add @zhaots/tushare-core- 注册Tushare账号
- 完成邮箱验证和个人认证
- 通过社区贡献、邀请用户等方式获取积分
- 详见:积分获取办法
# 设置环境变量
export TUSHARE_TOKEN=your_tushare_token
# 或在 .env 文件中
echo "TUSHARE_TOKEN=your_tushare_token" > .env然后就可以直接使用 API:
import { getStockBasicApi, getDailyApi } from '@zhaots/tushare-core';
// 获取股票列表
const stockList = await getStockBasicApi({
list_status: 'L'
});
// 获取日线行情
const dailyData = await getDailyApi({
ts_code: '000001.SZ',
start_date: '20240101',
end_date: '20240131'
});Prerequisites:
- Node.js v18.0.0+ and NPM (Install by official website)
- PNPM (Install globally by
npm install -g pnpm)
In the folder where you have cloned the repository, install the build dependencies using pnpm:
pnpm installThen, to build the source, using npm:
pnpm run build:allThis project is licensed under the MIT License - see the LICENSE file for details.
⭐ 如果这个项目对您有帮助,请给我们一个 Star!