Build
Connect & operate
Design & teams
Start hereScope a build in one callBring a spec, a wireframe, or a paragraph. You leave with an architecture, a timeline, and a number.Book a scoping call
AI software
LLM & data systems
Vibe coding
Ready to ship?Put AI where the work isAgents, RAG, and private LLMs wired into the systems your team already uses — not a chatbot bolted to a homepage.Discuss an AI project
Domain firstWe learn your workflow before we model itRegulated, operational, or high-volume — the constraints belong in the schema, not in a training doc.Talk about your domain
Plan smarterEstimate before you commitCost ranges, scope templates, and the questions we ask in discovery — free, no form.Open the cost calculator
Real conversationsTalk with a technical leadNo SDR, no discovery gauntlet. The person on the call is the one who scopes the build.Book a call
MCP Servers · zhangxiangliang

stock-api

stock-api is a TypeScript library for querying real-time stock market data across Chinese A-shares, US stocks, and Hong Kong stocks. It runs in Node.js, browsers, CLI, and as an MCP tool with zero production dependencies and automatic fallback between multiple data sources.

Source: GitHub — github.com/zhangxiangliang/stock-api
1.7k
GitHub stars
194
Forks
TypeScript
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryzhangxiangliang/stock-api
Ownerzhangxiangliang
Primary languageTypeScript
LicenseMIT — OSI-approved
Stars1.7k
Forks194
Open issues1
Latest releasev2.7.3 (2026-06-24)
Last updated2026-07-08
Sourcehttps://github.com/zhangxiangliang/stock-api

What stock-api is

Built in TypeScript with zero runtime dependencies, stock-api abstracts multiple third-party stock data providers (Tencent, Sina, Eastmoney) behind a unified API. It supports single/batch stock queries, K-line charting, search, and exposes capabilities via Node.js modules, browser bundles (IIFE), CLI commands, and MCP protocol integration.

Quickstart

Get the stock-api source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/zhangxiangliang/stock-api.gitcd stock-api# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Real-time stock dashboards and portfolio trackers

Embed live A-share, US, or Hong Kong stock data into web applications or Electron desktop tools using the browser bundle or Node.js API with automatic data-source fallback for reliability.

AI agent integration for financial assistants

Connect to Claude, ChatGPT, or local LLMs via MCP protocol to enable AI agents to autonomously query stock data, K-lines, and perform searches within multi-turn conversations.

CLI-based stock monitoring and automation

Use npx commands or shell scripts for scheduled market data collection, alerts, or integration into trading workflows without deploying a full service.

Implementation considerations

  • Verify third-party data source terms of service and rate limits before production deployment; project does not guarantee continued API access.
  • Handle fallback logic: auto mode tries tencent → sina → eastmoney in sequence; plan for partial/failed responses when sources are unavailable.
  • Stock code format strictly requires SH/SZ/HK/US prefixes; validate user input before querying to avoid silent failures.
  • Node.js ≥18 required; ensure browser target compatibility when using the CDN bundle (check minified size and CORS headers on jsdelivr).
  • No built-in caching, rate-limiting, or request batching; implement client-side caching and request deduplication for high-frequency UIs.

When to avoid it — and what to weigh

  • Requires guaranteed data accuracy or regulatory compliance — Project explicitly disclaims data accuracy, completeness, and real-time guarantees. Third-party sources may change terms or availability. Financial institutions and trading firms must validate independently and confirm compliance with financial regulations.
  • Need high-frequency or low-latency trading — Designed for periodic queries and dashboards, not sub-millisecond market data feeds. Depends on external third-party APIs which may introduce latency and rate limiting constraints.
  • Require SLA guarantees and dedicated support — Open-source MIT project maintained by individuals; no commercial SLA, uptime guarantees, or vendor support. Third-party data sources (Tencent, Sina, Eastmoney) can break without notice.
  • Cannot accept third-party data source dependencies — No internal data infrastructure; relies entirely on reverse-engineered or public APIs from external Chinese and international financial services. Service continuity depends on those providers.

License & commercial use

MIT License (permissive OSI-approved). Allows commercial use, modification, and distribution with attribution and no warranty. No patent or trademark restrictions stated.

MIT permits commercial use. However, project disclaims data accuracy and continuity; third-party data sources have their own terms. Before commercial deployment (trading, advisory, fintech), independently verify compliance with financial regulations, data provider ToS, and liability assumptions. No commercial support or indemnification from project maintainer.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

No encryption, authentication, or authorization primitives in the library. Data flows over HTTPS to third-party providers (not verified in provided data). Browser bundle is minified but sourced from CDN; verify integrity hash. No mention of input sanitization for stock codes or search queries; supply malformed codes to untrusted endpoints at your own risk. Depends on third-party API security posture (not audited or documented).

Alternatives to consider

TradingView (proprietary / freemium SaaS)

Offers real-time charting, multiple data sources, and API; includes compliance/SLA but higher cost and less transparent data attribution than stock-api's open-source modular design.

yfinance (Python, Yahoo Finance wrapper)

Python equivalent for historical and real-time US/international data; larger ecosystem and documentation but US-centric; lacks A-share and MCP integration.

Akshare (Python, multi-source Chinese financial data)

Chinese fintech data library with A-share, futures, bonds coverage; more mature ecosystem but Python-only; no browser or MCP support, heavier dependencies.

Software development agency

Build on stock-api with DEV.co software developers

Evaluate stock-api for your dashboard, trading tool, or AI agent. Review third-party data provider terms and compliance requirements before production use. Devco can help you architect data pipelines, validate integrations, and plan fallback strategies.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

stock-api FAQ

Is stock-api suitable for production trading or investment advice?
No. Project explicitly disclaims data accuracy and continuity. Use only for informational dashboards or research. Verify data independently and consult compliance/legal before commercial financial use.
What happens if a data source API breaks or gets rate-limited?
Auto mode will try the next fallback source (tencent → sina → eastmoney). If all fail, you get an error response. Implement client-side retry/cache logic and monitor the project's status endpoints.
Can I use stock-api in my proprietary app under MIT license?
Yes. MIT permits commercial use, modification, and distribution. Include license attribution. However, ensure your use of the underlying third-party data sources complies with their ToS.
Does stock-api include historical backtesting or advanced charting?
No. It fetches current stock quotes, K-line data, and search results only. For advanced analytics, backtesting, or custom indicators, integrate with charting libraries (e.g., TradingView Lightweight Charts) or quant platforms (e.g., backtrader).

From evaluation to production software

Bringing stock-api into production usually means new services, new interfaces, and new failure modes. DEV.co is a software development agency that builds all three and stays on for the mcp servers maintenance.

Ready to integrate live stock data?

Evaluate stock-api for your dashboard, trading tool, or AI agent. Review third-party data provider terms and compliance requirements before production use. Devco can help you architect data pipelines, validate integrations, and plan fallback strategies.