npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

fund-api

v1.2.1

Published

Fund market data API for Node.js and TypeScript

Readme

fund-api 是一个零运行时依赖的基金行情工具,支持 Node.js、浏览器、CLI 和 MCP。默认使用 funds.auto,自动从可用数据源获取基金数据。

支持使用方式

特性

  • Node.js / Browser bundler API + TypeScript 类型
  • CLI 查询基金净值、历史净值和搜索基金
  • MCP tools 给 AI 客户端直接调用基金接口
  • 默认自动数据源:funds.auto
  • 指定数据源:funds.tencent
  • 支持基金代码格式,例如 110022
  • 零运行时依赖

Node.js

安装

Node.js 环境要求 >=18

npm install fund-api

使用

import { funds } from "fund-api";

const fund = await funds.auto.getFund("110022");
const list = await funds.auto.getFunds(["110022", "000001"]);
const history = await funds.auto.getNavHistory("110022");
const results = await funds.auto.searchFunds("易方达消费");

浏览器

引用

<script src="https://cdn.jsdelivr.net/npm/fund-api/dist/browser/fund-api.iife.min.js"></script>

使用

<script>
  FundApi.funds.auto.getFund("110022").then(console.log);
  FundApi.funds.auto.getFunds(["110022", "000001"]).then(console.log);
  FundApi.funds.auto.getNavHistory("110022").then(console.log);
  FundApi.funds.auto.searchFunds("易方达消费").then(console.log);
</script>

浏览器示例:GitHub Pages

CLI

npx fund-api get-fund 110022
npx fund-api get-funds 110022 000001
npx fund-api get-nav-history 110022
npx fund-api search-funds 易方达消费

MCP

fund-api 接到支持 MCP 的 AI 客户端:

{
  "mcpServers": {
    "fund-api": {
      "command": "npx",
      "args": ["-y", "fund-api", "mcp"]
    }
  }
}

内置工具:get_fundget_fundsget_nav_historysearch_funds

数据源

内置腾讯基金数据源,默认由 funds.auto 自动处理。

| 数据源 | 用法 | 能力 | | --- | --- | --- | | 自动 | funds.auto | 单只基金、批量基金、历史净值、搜索 | | 腾讯 | funds.tencent | 单只基金、批量基金、历史净值、搜索 |

文档

| 文档 | 内容 | | --- | --- | | API 使用 | TypeScript API、数据结构、浏览器使用 | | CLI 使用 | 命令、参数、输出 | | MCP 使用 | MCP 客户端配置和工具列表 | | 项目架构 | 目录结构、provider 工厂、解析和错误模型 | | 开发指南 | 本地开发、测试、发布前检查、新增数据源 | | API 监控 | 定时检查第三方数据源并更新状态徽章 |

免责声明

fund-api 使用第三方公开基金接口作为数据来源,不保证数据的准确性、完整性、实时性或持续可用性。本项目不提供投资建议,任何交易或投资决策都应由你自行判断。商业、高频或生产使用前,请自行确认第三方数据源的服务条款、授权范围和合规要求。

License

MIT