Stock SDK
A zero-dependency JavaScript SDK for frontend and Node.js to fetch stock data for A-shares, HK, US, and funds, with CLI and MCP server included.
- Source repo
- chengzuopeng/stock-sdk
- Stars
- ★ 2k
- Last updated
- 5d ago v2.5.0
- FARS reviewed
- Nov 07, 2026 +2 new
- License
- ISC
- Primary language
- TypeScript
- FA score
- 61/100 · Some gaps
At a glance
- How it runs
- Works with
- Universal · cross-platformChatGPT · Codex · Claude Code
- Cost
- Free, no paid service needed
- Setup effort
- Low · running in minutes
- You'll need
- Typical use
- Frontend engineers building a stock dashboard or data visualization page who want to avoid maintaining a backend service or using Python.
- Not a fit if
- Teams needing high-frequency trading or real-time matching quotes
- Projects built on Python or requiring a backend service
- Users needing full minute-level futures and options data
- Website
- stock-sdk.linkdiary.cn ↗ set on GitHub
- Maintenance
- Commits in the last 30 dayslast commit 2026-11-28latest release v2.5.0 (2026-11-28)+1.1 ★/day over 7 days
- Source review
- 61/100 · Some gaps
What does this agent do, and when should you use it?
Stock SDK is a zero-dependency JavaScript/TypeScript library for frontend and Node.js environments to retrieve real-time quotes and K-line data for A-shares, Hong Kong, US stocks, and public funds. It offers a namespaced API with tolerant symbol parsing, technical indicators, chip distribution, signal detection, screening, and backtesting. It provides a CLI (stock-sdk command) and a built-in MCP server for AI integration, supporting ESM, CommonJS, and subpath exports for tree-shaking. v2.0.0 is an architectural upgrade introducing namespaced APIs and a unified error system, but includes breaking changes. Data is sourced from public APIs like Tencent Finance and Eastmoney, with latency unsuitable for high-frequency trading.
Stock SDK fetches and parses stock market data from public APIs such as Tencent Finance and Eastmoney. It handles symbol normalization (e.g., sh600519, 600519.SH, 00700, AAPL), provides real-time quotes (sdk.quotes.cn()), K-line (sdk.kline.cn()), minute bars, intraday timelines, technical indicator calculations (MA, MACD, BOLL, etc.), chip distribution, fund flows, and dragon-tiger lists. Users can call these via namespaced async APIs in Node.js or browser, use the CLI (e.g., stock-sdk quote 600519), or start the built-in MCP server (npx stock-sdk mcp) to expose tools to AI clients like Cursor or Claude. Pure-computation subpath imports (stock-sdk/indicators) are also available for indicator and signal math.
- Frontend engineers building a stock dashboard or data visualization page who want to avoid maintaining a backend service or using Python.
- Developers needing to periodically fetch stock quotes in Node.js for quantitative strategy prototyping or analysis.
- Command-line users who want to quickly check a stock's price or K-line without writing a full application.
- Users of AI tools like Cursor or Claude who want the assistant to access stock data via the MCP server.
- Educators or students in finance courses who need a simple JavaScript library to demonstrate live market data.
Key setup facts
Pulled from the install and usage notes below. The project README has the current values.
- Install / run
npm install stock-sdk. For the v1 legacy version, use npm install stock-sdk@legacy. Requires Node.js 18+. No API keys or credentials are needed
- Runtime
- Node.js 18+
How do you install or deploy this agent?
Install via npm: npm install stock-sdk. For the v1 legacy version, use npm install stock-sdk@legacy. Requires Node.js 18+. No API keys or credentials are needed.
How do you use this agent?
After installation, import the SDK and create an instance: import { StockSDK } from 'stock-sdk'; const sdk = new StockSDK(); Then call namespaced APIs, e.g., fetch A-share quotes: await sdk.quotes.cnSimple(['sh000001', 'sz000858', 'sh600519']). For CLI, use npx stock-sdk quote 600519. For MCP integration, run npx stock-sdk mcp to start the server, and configure mcpServers in your client.
Safety boundaries, hardening & integrations
Operational blast radius, source-verified safety controls, and first-run hardening steps before connecting this agent to real workspaces.
Declared capability surface (blast radius)
Can run terminal commands; pair with approval gates or container/OS sandboxing.
Makes outbound requests; verify telemetry settings and model data routing on private repos.
FARS trust-control audit
- dependency security
What are this agent's strengths and limitations?
- Zero dependencies, works in both browser and Node.js, simplifying integration.
- Includes a CLI and built-in MCP server, enabling command-line use and AI integration.
- Full TypeScript types, rich namespaced API, and IDE autocompletion friendly.
- Subpath exports allow importing pure computation modules to keep bundles lean.
- Data comes from public APIs, not real-time matching, with latency unsuitable for high-frequency trading.
- v2 is a breaking change; migrating from v1 requires reading the guide, no compatibility aliases.
- Market coverage varies; futures and options have limited functionality, observe the support matrix.
- Relies on upstream API stability; provider changes may require SDK updates.
How does this agent compare with similar options?
Key facts side by side with the most closely related agents.
| Agent | Source review | Form / cost | Stars | Updated | Language | Full support on |
|---|---|---|---|---|---|---|
| Stock SDK This agent | 61 · Some gaps | Library / SDKFree | ★ 2k | 5d ago | TypeScript | ChatGPT · Codex · Claude Code |
| Unbrowse Website API Client | 52 · Major gaps | Hosted serviceFreemium | ★ 957 | 6d ago | Rust | ChatGPT · Codex · Claude Code |
| Superset | 66 · Some gaps | Desktop appFreemium | ★ 17k | today | TypeScript | Codex · Claude Code |
| Context7 Docs | 59 · Major gaps | CLIFreemium | ★ 66k | 1d ago | TypeScript | — |
How does FollowAgents rate this agent?
Why each dimension lost points
The repository describes zero runtime dependencies, and package.json lists only development dependencies; the SDK reads market data by default, with configurable caching, timeouts, retries, and rate limits. This supports moderate least privilege and data-flow transparency. Deductions: default network access and CLI/MCP external interactions are not shown with per-action confirmation; sensitive-data handling is not documented; rollback is only implied by migration guidance; providers such as Tencent and Eastmoney are named, but specific endpoints and data-use terms are not detailed in the packet.
The README describes unified errors, retries, rate limiting, circuit breaking, and K-line fallback sources; CLI code shows error mapping, and CI declares typechecking, build, unit tests, and documentation checks. Deductions: README and src/index.ts are in tension—for example, the README says indicators moved to subpaths while the root entry still exports them; integration test files exist, but their execution is unknown, and static evidence cannot ensure upstream data-source availability.
The project targets frontend and Node.js developers and lists dashboard, visualization, teaching, prototyping, scheduled-fetching, and AI integration scenarios, with a market matrix and latency warning. Deductions: the matrix and warning describe some boundaries, but many details depend on external documentation; local automatic triggers and MCP tool trigger semantics are only lightly evidenced.
The README, package exports, source layout, and CI show clear information architecture, install commands, examples, an ISC license, and version 2.4.6. Deductions: v2 is a breaking migration, so naming stability is not fully established; the README sends full API and limitation details to an external site; this packet has version and migration guidance but no changelog; maintenance responsibility is only partly indicated by the author field and Issues link, while publisher identity remains unknown.
The SDK offers quotes, klines, indicators, screening, backtesting, CLI, and MCP, with common usage examples and JSON/table/CSV output options. Deductions: broad functionality and the zero-dependency positioning offer practical value, but latency, upstream-source dependence, and uneven market coverage limit usefulness by scenario; static evidence cannot establish end-to-end result quality.
Some README claims can be cross-checked against package.json, src/index.ts, CLI source, and CI configuration, while test files show expected fields and behavior. Deductions: test source is not evidence of execution or independent validation; claims such as live endpoint availability and complete feature coverage lack in-packet live evidence.
- Quotes come from public third-party interfaces; the README says they may be delayed by tens of seconds to minutes and are unsuitable for high-frequency trading decisions.
- Check actual coverage for the target market and endpoint; the README notes market differences and points to external documentation for details.
- The README claims zero dependencies and describes the v2 API, while the supplied root entry still exports indicators; verify import paths against the installed version.
Recent releases
Latest entries from the project's GitHub Releases. Notes are quoted from upstream as written, not rewritten or tested by FollowAgents.
-
v2.5.0 v2.5.0 Shared Core & Reliability
Release notes excerpt
Stock SDK 2.5.0 是基础包的兼容升级。基础包现在由 Monorepo 的共享核心构建,继续支持浏览器和 Node.js,运行时零依赖。Node 增强包独立发布。 新增 - 分红明细提供每股税前派息、计量单位和币种字段。 - 请求层支持 POST 和单次请求的自定义 headers、method、body。 修复 - 修复港股盘中实时行情的时间戳解析。 - 修复请求取消、东财 K 线备用源切换及腾讯 A 股前复权的一致性。 升级 ```sh npm install [email protected] ``` What's Changed * fix: 修复请求取消及东财 K 线异常降级 by @chengzuopeng in https://github.com/chengzuopeng/stock-sdk/pull/85 * feat: Monorepo 与 stock-node-sdk 首个公开 Beta by @chengzuopeng in https://github.com/chengzuopeng/stock-sdk/pull/86 Full Changelog: https://github.com/chengzuopeng/stock-sdk/compare/v2.4.7...v2.5.0View on GitHub ↗ -
v2.4.7 v2.4.7 MCP, Skills & CLI
Release notes excerpt
Stock SDK 2.4.7 改进了 MCP 结果、Skills 编排和 CLI 参数校验。依赖 MCP 截断结果或 CLI 退出码的脚本请留意下列行为变化。 新增 - MCP 基金净值和同类排名支持日期筛选,并报告实际覆盖区间。 修复 - MCP 超限时保留最新 K 线和信号及榜首数据,并校验消息和嵌套参数。 - Skills 按工具依赖展示,更新取数范围和安装示例。 - CLI 对无效参数返回退出码 2,补齐分页和 MCP 启动帮助。 升级 ```sh npm install [email protected] ``` What's Changed * fix: 改进 MCP、Skills 和 CLI(v2.4.7) by @chengzuopeng in https://github.com/chengzuopeng/stock-sdk/pull/84 Full Changelog: https://github.com/chengzuopeng/stock-sdk/compare/v2.4.6...v2.4.7View on GitHub ↗ -
v2.4.6 v2.4.6 K-line Fallback Switch
Release notes excerpt
v2.4.6 是一次 请求可控 + 数据正确性 版本:A 股 K 线的备用源切换可以关闭了,批量拉取时不必再连带触发备用源的频控;同时修掉 chips.cn 在备用源下静默返回空统计的问题。无破坏性变更,升级无需改代码。 新增 - A 股 K 线备用源开关 klineFallback(#80,感谢 @zhrenyue 提出需求):2.4.4 起,A 股 K 线在东方财富失败时会按腾讯、新浪顺序切换,但没法关掉。批量拉取时东财一旦频控,每只股票都会转去请求腾讯(长历史要分页请求多次)和新浪,备用源随之也被频控。现在可以关闭: ```ts const sdk = new StockSDK({ klineFallback: false, providerPolicies: { eastmoney: { rateLimit: { requestsPerSecond: 2 }, // 控制节奏,减少软限流 retry: { maxRetries: 2 }, // 只覆盖断连、超时和可重试的 HTTP 状态码 }, }, }) ``` | klineFallback | 东方财富请求 | 东方财富失败时 | …View on GitHub ↗
FAQ
Is the data real-time?
Do I need an API key?
Which markets are supported?
How can I use it with AI tools?
Thanks — we use this to improve the page.
Subscribe to the FollowAgents RSS feed, or save this agent to your browser shortlist to compare on your next visit.