Stock SDK
A zero-dependency JavaScript SDK for frontend and Node.js to fetch stock data for A-shares, HK, US, and funds, with CLI and MCP server included.
Evidence: SDK is a pure client library, no backend, minimal permissions (least_privilege=2). No user confirmation mechanism (user_confirmation=0). Data flow transparent: docs state data sources are public Tencent/Eastmoney APIs and note latency (data_flow_transparency=2). Sensitive data handling: no collection/transmission of sensitive data found, but no explicit statement (sensitive_data_handling=1). Dependency security: zero runtime dependencies, devDependencies no known vulnerabilities (dependency_security=2). External effects: only network requests for public data, no destructive actions (external_effects=2). Rollback: v1 migration guide provided, but no automatic rollback (rollback=1). Source attribution: author and repo clear, but publisher unverified (source_attribution=2).
Evidence: Code structure consistent, namespace API unified (self_consistency=2). Dependency availability: zero runtime deps, devDependencies pinned (dependency_availability=2). Failure messages: unified error system with SdkError and codes (failure_messages=2).
Evidence: Clear target audience (frontend engineers), scenarios cover dashboards, visualization, education (audience_and_scenarios=3). Capability boundaries clear: market support matrix details capabilities per market (capability_boundaries=3). Trigger precision: API design precise, symbol parsing tolerant (trigger_precision=2). Environment fit: supports browser and Node.js 18+, ESM/CJS (environment_fit=3).
Evidence: Clear information architecture, namespace grouping (information_architecture=3). Install notes detailed (install_notes=3). Naming stability: v2 breaking changes but migration guide provided (naming_stability=2). Examples and FAQ: README provides many examples, official docs (examples_and_faq=3). Known limitations: data latency and unsupported markets noted (known_limitations=2). License: ISC clear (license=3). Versioning/changelog: version number present, but no CHANGELOG file (versioning_changelog=2). Maintenance responsibility: author clear, but unverified (maintenance_responsibility=2).
Evidence: Output formats unified, supports JSON/CSV/table (output_usability=3). Marginal value: provides zero-dependency stock data solution for frontend, fills gap (marginal_value=3). Cost-benefit: zero-dependency, lightweight, free (cost_benefit=3).
Evidence: Claims in README supported by code and tests (claim_traceability=2). Cross-source corroboration: relies on single data source, no comparison with others (cross_source_corroboration=1). Fact/inference separation: docs distinguish data sources and local calculations (fact_inference_separation=2).
- Publisher identity unverified; assess risk before use.
- Data from third-party public APIs may have latency or instability; not suitable for high-frequency trading.
- No CHANGELOG file provided; version history incomplete.
- No explicit statement on user data collection; review code if concerned.
What does this agent do, and when should you use it?
Stock SDK is a zero-dependency JavaScript/TypeScript library for frontend and Node.js environments to retrieve real-time quotes and K-line data for A-shares, Hong Kong, US stocks, and public funds. It offers a namespaced API with tolerant symbol parsing, technical indicators, chip distribution, signal detection, screening, and backtesting. It provides a CLI (stock-sdk command) and a built-in MCP server for AI integration, supporting ESM, CommonJS, and subpath exports for tree-shaking. v2.0.0 is an architectural upgrade introducing namespaced APIs and a unified error system, but includes breaking changes. Data is sourced from public APIs like Tencent Finance and Eastmoney, with latency unsuitable for high-frequency trading.
Stock SDK fetches and parses stock market data from public APIs such as Tencent Finance and Eastmoney. It handles symbol normalization (e.g., sh600519, 600519.SH, 00700, AAPL), provides real-time quotes (sdk.quotes.cn()), K-line (sdk.kline.cn()), minute bars, intraday timelines, technical indicator calculations (MA, MACD, BOLL, etc.), chip distribution, fund flows, and dragon-tiger lists. Users can call these via namespaced async APIs in Node.js or browser, use the CLI (e.g., stock-sdk quote 600519), or start the built-in MCP server (npx stock-sdk mcp) to expose tools to AI clients like Cursor or Claude. Pure-computation subpath imports (stock-sdk/indicators) are also available for indicator and signal math.
- Frontend engineers building a stock dashboard or data visualization page who want to avoid maintaining a backend service or using Python.
- Developers needing to periodically fetch stock quotes in Node.js for quantitative strategy prototyping or analysis.
- Command-line users who want to quickly check a stock's price or K-line without writing a full application.
- Users of AI tools like Cursor or Claude who want the assistant to access stock data via the MCP server.
- Educators or students in finance courses who need a simple JavaScript library to demonstrate live market data.
What are this agent's strengths and limitations?
- Zero dependencies, works in both browser and Node.js, simplifying integration.
- Includes a CLI and built-in MCP server, enabling command-line use and AI integration.
- Full TypeScript types, rich namespaced API, and IDE autocompletion friendly.
- Subpath exports allow importing pure computation modules to keep bundles lean.
- Data comes from public APIs, not real-time matching, with latency unsuitable for high-frequency trading.
- v2 is a breaking change; migrating from v1 requires reading the guide, no compatibility aliases.
- Market coverage varies; futures and options have limited functionality, observe the support matrix.
- Relies on upstream API stability; provider changes may require SDK updates.
How do you install or deploy this agent?
Install via npm: npm install stock-sdk. For the v1 legacy version, use npm install stock-sdk@legacy. Requires Node.js 18+. No API keys or credentials are needed.
How do you use this agent?
After installation, import the SDK and create an instance: import { StockSDK } from 'stock-sdk'; const sdk = new StockSDK(); Then call namespaced APIs, e.g., fetch A-share quotes: await sdk.quotes.cnSimple(['sh000001', 'sz000858', 'sh600519']). For CLI, use npx stock-sdk quote 600519. For MCP integration, run npx stock-sdk mcp to start the server, and configure mcpServers in your client.