chengzuopeng/stock-sdk

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

What it solves

Stock SDK provides a lightweight, zero-dependency JavaScript/TypeScript library for frontend and Node.js developers to access stock market data without needing a Python backend or complex server-side infrastructure. It simplifies the process of retrieving real-time quotes, K-line charts, and technical indicators for A-shares, Hong Kong stocks, US stocks, and public funds.

How it works

The library acts as a wrapper around public financial data providers (such as Tencent Finance and Eastmoney), offering a unified, type-safe API. It features a "symbol model" that handles various ticker formats automatically. The SDK includes built-in tools for calculating technical indicators (MA, MACD, RSI, etc.), identifying trading signals, and performing local backtesting and stock screening based on the retrieved data.

Who it’s for

  • Frontend Engineers: Those building financial dashboards, data visualizations (e.g., using ECharts or TradingView), or admin panels.
  • Quant Developers: Users performing prototype validation for quantitative strategies using JS/Node.
  • AI Integrators: Developers wanting to provide real-time financial data sources to AI agents via the Model Context Protocol (MCP).
  • Students/Educators: Those creating financial course demos.

Highlights

  • AI-Ready: Built-in MCP server allowing one-command integration with AI tools like Cursor, Claude, and Gemini.
  • Broad Market Coverage: Supports A-shares, HK stocks, US stocks, public funds, futures, and options.
  • Technical Analysis Suite: Local calculation of 14+ technical indicators and chip distribution (CYQ).
  • Developer Friendly: Zero dependencies, full TypeScript support, and subpath exports for tree-shaking.
  • Integrated Tooling: Includes a CLI for terminal-based queries and a local backtesting engine.

Related

  • Project
  • Project
  • Project
  • Project
  • Project