RadarTopicsBuildersWeeklyReads
Open Source Radar
zhangxiangliang/

stock-api

GitHubWebsite

Stock-api is a TypeScript tool for querying stock quotes across A股, 港股, 美股, and funds via Node.js, browser, CLI, or MCP. It emphasizes zero-runtime dependency and multiple data sources.

1.8kstars
204forks
2issues
MITlicense
2020since
Star historydaily snapshots by VibeCrowd

Collecting history — the radar snapshots this repo daily. The trend line appears after 3 days of data (1 so far).

Alternatives & relatedmatched by topic overlap
Reviewgenerated from repository data · Aug 5, 2026

What it is

stock-api is a TypeScript stock data tool that supports A股, 港股, 美股行情查询 and can be accessed via Node.js, browser, CLI, or MCP. It defaults to a fallback data source chain and supports explicit sources like stocks.tencent, stocks.sina, and stocks.eastmoney.

How it works

The project exposes a stocks API with an auto data source that tries multiple providers. It supports getStock, getStocks, getKlines, and searchStocks methods for stock data retrieval. It can be used in Node.js, included in a browser bundle, via CLI (npx stock-api), or through MCP tooling. The data sources are built-in Tencent, Sina, and Eastmoney, with an automatic fallback sequence.

Getting started

Node.js installation:

npm install stock-api

Using in code:

import { stocks } from "stock-api";
const stock = await stocks.auto.getStock("SH510500");
const list = await stocks.auto.getStocks(["SH510500", "SZ000651"]);
const klines = await stocks.auto.getKlines("SH600519", { period: "day" });
const results = await stocks.auto.searchStocks("格力电器");

Browser usage:

<script src="https://cdn.jsdelivr.net/npm/stock-api/dist/browser/stock-api.iife.min.js"></script>
<script>
  StockApi.stocks.auto.getStock("SH510500").then(console.log);
  StockApi.stocks.auto.getStocks(["SH510500", "SZ000651"]).then(console.log);
  StockApi.stocks.auto.getKlines("SH600519", { period: "day" }).then(console.log);
  StockApi.stocks.auto.searchStocks("格力电器").then(console.log);
</script>

CLI usage:

npx stock-api get-stock SH510500
npx stock-api get-stocks SH510500 SZ000651
npx stock-api get-klines SH600519 --period day --count 120
npx stock-api search-stocks 格力电器

MCP usage:

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

Recent releases

Latest releases include v2.7.3 (2026-06-24) with bug fixes, and prior minor releases 2.7.2 (2026-05-27) and 2.7.1 (2026-05-26) with stability improvements and feature updates.

Traction

1798 stars on the repository; 204 forks; 2 open issues.

Behind the repo

This repo provides built-in data sources: Tencent, Sina, and Eastmoney, with a default automatic fallback sequence.

Caveats

License: MIT. Created 2020-07-21. Last push 2026-08-04. Language: TypeScript. Topics include browser, mcp, nodejs, stocks.

SharePost on XLinkedIn
All trending reposRevenue-verified startups →