stock-sdk

为前端设计的无需 Python、无需后端服务、零依赖的获取股票数据 JavaScript SDK。

What is stock-sdk?

为前端设计的无需 Python、无需后端服务、零依赖的获取股票数据 JavaScript SDK。

Overview of stock-sdk

What it is

stock-sdk is a JavaScript SDK designed for frontend and Node.js environments to retrieve stock market data without requiring Python, a backend service, or any external dependencies. It supports real-time quotes and K-line data for A-shares, Hong Kong stocks, US stocks, and public mutual funds directly in the browser or Node.js. The package also includes a command-line interface (CLI) and a built-in MCP server for AI tool integration. It is published under the ISC license and is open source. The repository is hosted at https://github.com/chengzuopeng/stock-sdk, with documentation available at https://stock-sdk.linkdiary.cn.

Key features

  • Zero dependencies, runs in both browser and Node.js 18+, with ESM and CommonJS support.
  • Namespace API: methods are grouped by domain, such as sdk.quotes.cn() and sdk.kline.cn(), with IDE autocompletion.
  • Unified symbol model: accepts various symbol formats like sh600519, 600519, 00700, AAPL, and 105.AAPL with fault-tolerant parsing.
  • Supports real-time quotes, historical K-lines (daily/weekly/monthly), minute K-lines (1/5/15/30/60), and intraday time-sharing for A-shares, Hong Kong stocks, US stocks, and public mutual funds.
  • Includes technical indicators (MA, MACD, BOLL, KDJ, RSI, WR, BIAS, CCI, ATR, OBV, ROC, DMI, SAR, KC), chip distribution (CYQ), signals/screening/backtesting, and extended data for futures, options, fund flows, and more.
  • Subpath exports: stock-sdk/{indicators,signals,symbols,screener,cache,errors} for tree-shaking, importing only computation functions without network layers.
  • CLI: stock-sdk quote 600519 fetches quotes from the terminal.
  • Built-in MCP server: stock-sdk mcp connects to AI tools like Cursor, Claude, and Codex with zero dependencies.

Use cases

  • Building stock market dashboards for web or admin interfaces.
  • Data visualization with libraries like ECharts or TradingView.
  • Creating demos for stock or finance courses.
  • Prototyping quantitative strategies in JavaScript or Node.js.
  • Scheduled data fetching in Node.js for market monitoring.
  • Quick quote lookups via command line or providing data sources for AI tools.

Getting started

bash npm install stock-sdk ts import { 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}%)`); });

License and pricing

The license is ISC. The package is open source with a pricing type of open_source.

Based on the project's public README and repository metadata.

Add this badge to your README

Featured on YunoDB Badge styles & help

Maintain this project? Show that it is featured on YunoDB.

Markdown[![Featured on YunoDB](https://yunodb.com/badge/chengzuopengstock-sdk.svg)](https://yunodb.com/tools/chengzuopengstock-sdk?utm_source=github&utm_medium=badge)
HTML<a href="https://yunodb.com/tools/chengzuopengstock-sdk?utm_source=github&utm_medium=badge"><img src="https://yunodb.com/badge/chengzuopengstock-sdk.svg" alt="Featured on YunoDB" height="20"></a>