npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@helloxiaohu/plugin-stock-market

v0.0.3

Published

Comprehensive stock market data plugin for A-shares, Hong Kong, and US markets.

Downloads

82

Readme

@xpert-ai/plugin-stock-market

Comprehensive stock market data plugin for A-shares, Hong Kong, and US markets.

Features

  • Real-time Quotes: Get current stock prices, volume, and market data
  • K-line Charts: Historical OHLCV data for technical analysis
  • Technical Indicators: MA, MACD, RSI, KDJ calculations
  • Stock Search: Search stocks by code or name
  • Multi-market Support: A-shares (SH/SZ), Hong Kong, and US markets

Installation

npm install @xpert-ai/plugin-stock-market

Configuration

{
  source: 'sina' | 'tencent',  // Data source (default: 'sina')
  timeout: 5000,                // Request timeout in ms
  cacheEnabled: true,           // Enable data caching
  cacheTTL: 300                 // Cache TTL in seconds
}

Tools

1. stock_market_get_quote

Get real-time stock quotes.

Parameters:

  • code (string, required): Stock code (e.g., "600519", "00700", "AAPL")
  • market (enum, optional): Market type - "auto", "sh", "sz", "hk", "us" (default: "auto")

Example:

// Get quote for 茅台
{ code: "600519" }

// Get quote for Tencent (HK)
{ code: "00700", market: "hk" }

2. stock_market_get_kline

Get K-line (candlestick) data.

Parameters:

  • code (string, required): Stock code
  • period (enum): "1d", "1w", "1m", "3m", "6m", "1y", "ytd"
  • market (enum, optional): Market type

Example:

{ code: "600519", period: "1m" }

3. stock_market_get_technical

Get technical indicators.

Parameters:

  • code (string, required): Stock code
  • indicators (array): List of indicators - "ma", "macd", "rsi", "kdj"
  • period (enum, optional): Time period for calculation

Example:

{ 
  code: "600519", 
  indicators: ["ma", "macd", "rsi"] 
}

4. stock_market_search

Search for stocks.

Parameters:

  • keyword (string, required): Search keyword
  • market (enum, optional): Filter by market

Example:

{ keyword: "茅台" }
{ keyword: "Apple" }

Data Sources

  • Primary: Sina Finance (free, stable)
  • Backup: Tencent Finance
  • HK/US: Snowball / Yahoo Finance

Error Handling

The plugin uses unified error codes:

| Code | Description | |------|-------------| | 1001 | Invalid stock code format | | 2001 | Stock not found | | 2002 | No data available | | 3001 | API error | | 3003 | Rate limit exceeded |

Output Format

Text Format (default)

【贵州茅台(600519)】
  当前价: 1690.00 元
  涨跌额: +12.00 元
  涨跌幅: +0.72%
  ...

JSON Format

{
  "success": true,
  "data": {
    "code": "600519",
    "name": "贵州茅台",
    "price": 1690.00,
    ...
  }
}

License

MIT