September 25, 2026

stock-sdk
A zero-dependency stock market JavaScript SDK for frontend and Node.js, supporting A-shares, HK stocks, US stocks, and mutual fund data.
npm install stock-sdkimport { StockSDK } from 'stock-sdk';
const sdk = new StockSDK();
const quotes = await sdk.quotes.cnSimple(['sh000001', 'sz000858', 'sh600519']);
quotes.forEach((q) => {
console.log(`${q.name}: ${q.price} (${q.changePercent}%)`);
});Product facts
- Type
- API, SDK & Library
- Category
- Business & Finance › Fundraising and Investing
- Pricing
- Open source
- License
- Custom License
- Launched
- Sep 25, 2026
- Listed
- Sep 25, 2026
- Website
- github.com
Overview
stock-sdk is a TypeScript stock market SDK built for frontend engineers and Node.js developers. It solves common pain points of traditional stock tools—such as heavy reliance on the Python ecosystem, the need to maintain backend services, and inconsistent financial API formats—allowing developers to fetch stock data directly in the browser or Node.js.
The SDK supports real-time quotes and historical K-line data (daily, weekly, monthly, and minute-level) for A-shares, HK stocks, US stocks, and mutual funds. It includes 14 built-in technical indicator calculations such as MA, MACD, BOLL, and KDJ. Additional features include chip distribution (CYQ), signal recognition, chainable stock screening, and local backtesting. Extended data covers futures, options, capital flow, Dragon-Tiger lists, northbound capital, and margin trading.
Architecturally, stock-sdk uses a namespaced API with a unified symbol model that fault-tolerantly parses ticker formats across different markets. Version v2.0.0 introduced a unified error system that only throws SdkError instances with standard codes. Request governance supports provider-level retries, rate limiting, and circuit breaking, and allows injecting a custom fetchImpl and lifecycle hooks.
Beyond being a library, stock-sdk ships with a CLI tool and an MCP server. The CLI lets you query quotes, K-lines, and indicators directly from the terminal; the MCP server connects stock data sources to AI tools like Cursor and Claude with a single command. The SDK supports subpath exports, so pure computation modules can be imported independently without pulling in network-layer code, making it tree-shake friendly. Both ESM and CommonJS formats are provided.
Key features
- Zero-dependency dual-runtime: runs directly in browsers and Node.js 18+ without Python or backend services. Ships in both ESM and CommonJS formats.
- Multi-market quotes & K-lines: real-time quotes for A-shares, HK stocks, US stocks, and mutual funds, plus daily, weekly, monthly, and minute-level historical K-line data.
- Namespaced API: domain-grouped design like sdk.quotes.cn() and sdk.kline.cn() for easy IDE autocompletion.
- Unified symbol model: fault-tolerant parsing of various ticker formats (e.g., sh600519, 600519.SH, AAPL).
- Technical indicators: pure-function calculation for 14 built-in indicators including MA, MACD, BOLL, KDJ, and RSI.
- Chip distribution (CYQ): locally compute profit ratio, average cost, cost range, concentration, and chip peak histograms.
- Signal screening & backtesting: event detection like golden/death crosses, chainable stock screener, and local strategy backtesting.
- Extended financial data: covers futures, options, capital flow, Dragon-Tiger lists, northbound capital, block trades, and margin trading.
- CLI tool: query quotes, K-lines, indicators, or search stocks directly from your terminal after installation.
- Built-in MCP Server: zero-dependency implementation, starts with one command, and connects data sources to AI tools like Cursor and Claude.
- Subpath exports: import pure computation modules like indicators, signals, and screeners independently without pulling in the network layer, ideal for tree-shaking.
- Request governance & error system: supports retries, rate limiting, and circuit breaking, uniformly throwing SdkError with standard codes.
Releases
Notify meQ&A
- What runtime environment does stock-sdk require?AI-generated
- stock-sdk has zero dependencies and runs in browsers and Node.js 18+. No Python environment or additional backend services are required.
- How do I upgrade from v1 to v2?AI-generated
- v2 is an architectural leap with breaking changes and no compatibility aliases. Read the official v1 → v2 migration guide before upgrading. The legacy version can be installed via npm install stock-sdk@legacy.
- Which markets' stock data are supported?AI-generated
- It supports A-shares, HK stocks, US stocks, and mutual funds. It also covers global futures and some options (ETF, CFFEX, commodities).
- How do I connect stock-sdk to AI tools?AI-generated
- v2 includes a zero-dependency MCP server. Start it with npx stock-sdk mcp and add the command to the mcpServers config in clients like Cursor or Claude Desktop to connect.
- If I only need technical indicator calculations, will network request code be included?AI-generated
- No. stock-sdk supports subpath exports. For example, importing via import { calcMACD } from 'stock-sdk/indicators' keeps RequestClient and network-layer code out of your bundle.
- How are failed API requests handled?AI-generated
- The SDK provides request governance, including provider-level retries, rate limiting, and circuit breaking. For error handling, v2 uniformly throws SdkError with standard codes; import the relevant types from stock-sdk/errors to catch them.
This product has no owner yet
It was listed by the platform or its author left. If it is your work, prove your relationship to become the owner.
Claim this productThe product content on this page was translated by AI from the author's original.