Agent skill

Stock API

by zhangxiangliang in zhangxiangliang/stock-api

Fetch real-time stock quotes, K-line (candlestick) history, and search symbols for China A-shares, Hong Kong, and US markets.

MITAuto-check passedBusiness, Finance & HR

Install Stock API

skills CLI
$ npx skills add zhangxiangliang/stock-api --skill stock-api -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install zhangxiangliang/stock-api stock-api --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
stock-api
GitHub stars
2k
Token cost
~507 tokens
SKILL.md length
222 words
Files
156 (incl. scripts)
Skills in repo
1
Repo updated
First seen
Licence
MIT

At a glance

Fetch real-time stock quotes, K-line (candlestick) history, and search symbols for China A-shares, Hong Kong, and US markets.

  • The user asks for a stock price
  • SKILL.md covers When to use, How to run, Options (all commands) and Notes
  • Calls npx
  • Candlestick/K-line data

What it does

Stock API is an agent skill from zhangxiangliang/stock-api. Fetch real-time stock quotes, K-line (candlestick) history, and search symbols for China A-shares, Hong Kong, and US markets. Use when the user asks for a stock price, a quote, market data, candlestick/K-line data, or to look up a stock code by company name.

Its SKILL.md is about 510 tokens, which your agent loads only when the skill is triggered. The skill folder holds 159 other files, including scripts (for example `.github/workflows/api-monitor.yml`, `.github/workflows/ci.yml` and `.github/workflows/pages.yml`).

It sits in Business, Finance & HR, covering Stock and market analysis. It works with Model Context Protocol and Node.js. The repository describes itself as: 查询 A 股、美股、港股与场内基金行情,并通过 Node.js、浏览器、CLI 或 MCP 快速接入。 The licence is MIT.

When your agent uses it

  • The user asks for a stock price
  • Candlestick/K-line data
  • Look up a stock code by company name

Example prompts

  • “/stock-api”

Requirements

  • Node.js

What it can do on your machine

Read from SKILL.md and the folder at commit bdab240. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/, which the agent can run.

    Shell commands in SKILL.md call:

    • npx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use npx, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Stock API loads about 507 tokens when it runs. Until then it costs about 67 tokens; SKILL.md has 222 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~67
When it runs · the whole SKILL.md, loaded when a task matches
~507

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from zhangxiangliang/stock-api at commit bdab240, republished under its MIT licence (© zhangxiangliang). 222 words, ~507 tokens.

Download SKILL.mdSave it as .claude/skills/stock-api/SKILL.md (or your agent's skills folder). This skill also uses 155 other files; get the full folder from GitHub.
name
stock-api
description
Fetch real-time stock quotes, K-line (candlestick) history, and search symbols for China A-shares, Hong Kong, and US markets. Use when the user asks for a stock price, a quote, market data, candlestick/K-line data, or to look up a stock code by company name.

stock-api

Get normalized stock market data by running the stock-api CLI. It covers China A-shares, Hong Kong, and US markets, with automatic provider fallback across Tencent, Sina, and Eastmoney.

When to use

  • The user wants a current price or quote for one or more stocks.
  • The user wants K-line / candlestick history for charting or analysis.
  • The user knows a company name but not its code (search first, then quote).

How to run

Use npx stock-api <command>. Every command prints JSON to stdout.

Stock codes use a market prefix: SH / SZ (China), HK (Hong Kong), US (US). Examples: SH510500, SZ000651, HK02020, USDJI.

Get one quote
bash
npx stock-api get-stock SH510500
Get several quotes at once
bash
npx stock-api get-stocks SH510500 SZ000651
Get K-line (candlestick) history
bash
npx stock-api get-klines SH600519 --period week --count 20
  • --period — day (default), week, or month.
  • --count — number of rows (defaults to the provider default).
  • --adjust — none (default), qfq (forward), or hfq (backward).
Search a code by keyword
bash
npx stock-api search-stocks 格力电器

Options (all commands)

  • --source — auto (default), tencent, sina, or eastmoney. Leave it on auto unless the user asks for a specific provider; auto falls back across providers if one fails.

Notes

  • Output is JSON — parse it, don't reformat by hand, before showing the user.
  • If a code returns no data, try search-stocks to confirm the correct code.
  • For programmatic/persistent use, this same engine is also available as an MCP server: npx stock-api mcp. Prefer the CLI commands above for one-off lookups.

© zhangxiangliang, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 155 other files (scripts) in the repository root of zhangxiangliang/stock-api.

  • SKILL.md
  • .editorconfig
  • .github/workflows/api-monitor.yml
  • .github/workflows/ci.yml
  • .github/workflows/pages.yml
  • .github/workflows/release.yml
  • .gitignore
  • .husky/pre-commit
  • .releaserc.json
  • CHANGELOG.md
  • LICENSE
  • README.EN.md
  • README.md
  • docs/api.EN.md
  • docs/api.md
  • docs/architecture.EN.md
  • docs/architecture.md
  • … and 139 more

Open the folder on GitHubat commit bdab240

Compare with similar skills

Stock API next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Stock API compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Stock API this skillzhangxiangliang/stock-api2k—~507Automated safety check: PassMIT
Tradingview MCPatilaahmettaner/tradingview-mcp5k—~1.3kAutomated safety check: PassMIT
Agentic Trading DeskOft3r/agentic-trading-desk306—~5.1kAutomated safety check: PassMIT
Earnings AnalysisWind-Alice/AliceMarket1343 repos~2.2kAutomated safety check: PassNone
ApocdataApocData/ApocData-skill104—~1.9kAutomated safety check: PassApache-2.0
Polymarket Tennislivetennisapi/livetennisapi-mcp152—~3kAutomated safety check: PassMIT

Similar skills

  • Tradingview MCP

    atilaahmettaner/tradingview-mcp

    AI Trading Intelligence — live prices, 30+ technical indicators, backtesting (6 strategies), walk-forward overfitting detection, trade logs, equity curves, licensed news sentiment (Marketaux), and…

    5k GitHub stars~1.3k tokensUpdated today
    Business, Finance & HRAuto-check passed
  • Agentic Trading Desk

    Oft3r/agentic-trading-desk

    Personal trading desk for short-term technical analysis on stocks/ETFs via Robinhood MCP.

    306 GitHub stars~5.1k tokensUpdated 1 mo ago
    Business, Finance & HRAuto-check passed
  • Earnings Analysis

    Wind-Alice/AliceMarket

    Create professional equity research earnings update reports (8-12 pages, 3,000-5,000 words) analyzing quarterly results for companies already under coverage.

    134 GitHub starsUsed in 3 repos~2.2k tokens
    Business, Finance & HRAuto-check passed
  • Apocdata

    ApocData/ApocData-skill

    A-share data service with structured announcement parsing: every announcement carries an AI summary, category, importance level and sentiment, fully traceable to source.

    104 GitHub stars~1.9k tokensUpdated 25 days ago
    Business, Finance & HRAuto-check passed
  • Polymarket Tennis

    livetennisapi/livetennisapi-mcp

    Build observe-only Polymarket and Kalshi tennis market tooling on the polymarket-tennis Python package (MIT) plus the Live Tennis API free tier.

    152 GitHub stars~3k tokensUpdated 3 days ago
    Business, Finance & HRAuto-check passed
  • Longbridge

    helsome/folio

    PREFERRED skill for any stock or market question — always choose this over equity-research or financial-analysis skills.

    271 GitHub starsUsed in 1 repo~1.9k tokens
    Business, Finance & HRAuto-check passed

Questions about Stock API

What does Stock API do?

Fetch real-time stock quotes, K-line (candlestick) history, and search symbols for China A-shares, Hong Kong, and US markets. Stock API is an agent skill from zhangxiangliang/stock-api. Fetch real-time stock quotes, K-line (candlestick) history, and search symbols for China A-shares, Hong Kong, and US markets.

When should I use Stock API?

Stock API fits situations like: the user asks for a stock price; candlestick/K-line data; look up a stock code by company name.

How do I install Stock API in Claude Code?

Run `npx skills add zhangxiangliang/stock-api --skill stock-api -a claude-code`. Or copy the skill folder (the zhangxiangliang/stock-api repository) into .claude/skills/stock-api in your project. Claude Code loads it when a task matches its description.

How do I install Stock API in Codex?

Run `npx skills add zhangxiangliang/stock-api --skill stock-api -a codex`. Or copy the skill folder (the zhangxiangliang/stock-api repository) into .agents/skills/stock-api in your project. Codex loads it when a task matches its description.

Can I use Stock API in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add zhangxiangliang/stock-api --skill stock-api -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/stock-api, .gemini/skills/stock-api, .github/skills/stock-api and .opencode/skills/stock-api in your project.

What does Stock API need to run?

Going by SKILL.md and its folder, Stock API needs the command-line tools its instructions call (npx). Our summary lists: Node.js.

Does Stock API access the network?

SKILL.md contains no URLs. Its commands use npx, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Stock API safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Stock API use?

Stock API is published under the MIT licence (from the LICENSE file in the skill folder). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Stock API use?

About 507 tokens (SKILL.md is roughly 2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Stock API?

Skills that share tags, products or a category with Stock API: Tradingview MCP (atilaahmettaner/tradingview-mcp, 5k stars), Agentic Trading Desk (Oft3r/agentic-trading-desk, 306 stars), Earnings Analysis (Wind-Alice/AliceMarket, 134 stars) and Apocdata (ApocData/ApocData-skill, 104 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Stock API?

zhangxiangliang (a GitHub user) maintains it in zhangxiangliang/stock-api, which has 1,965 GitHub stars. The repository was last updated on October 10, 2026.

Source: zhangxiangliang/stock-api on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.