
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
English | 中文
为 前端和 Node.js 设计的股票行情 JavaScript SDK。
无需 Python、无需后端服务,直接在 浏览器或 Node.js 中获取 A 股 / 港股 / 美股 / 公募基金 的实时行情与 K 线数据。
✨ 零依赖 | 🌐 Browser + Node.js | 📦 <20KB | 🧠 完整 TypeScript 类型
👉🏻 官方文档
🧭 Stock Dashboard:基于 stock-sdk 搭建的股票数据大盘演示站点,欢迎体验。
如果你是前端工程师,可能遇到过这些问题:
stock-sdk 的目标很简单:
让前端工程师,用最熟悉的 JavaScript / TypeScript,优雅地获取股票行情数据。
npm install stock-sdk
# 或
yarn add stock-sdk
# 或
pnpm add stock-sdk
import { StockSDK } from 'stock-sdk';
const sdk = new StockSDK();
const quotes = await sdk.getSimpleQuotes([
'sh000001',
'sz000858',
'sh600519',
]);
quotes.forEach(q => {
console.log(`${q.name}: ${q.price} (${q.changePercent}%)`);
});
前端直接一次性获取全市场 A 股行情(5000+股票),无需 Python 或后端服务。
const allQuotes = await sdk.getAllAShareQuotes({
batchSize: 300,
concurrency: 5,
onProgress: (completed, total) => {
console.log(`进度: ${completed}/${total}`);
},
});
console.log(`共获取 ${allQuotes.length} 只股票`);
💡 API 详细文档请查阅 https://stock-sdk.linkdiary.cn/
| 方法 | 说明 |
|---|---|
getFullQuotes | A 股/指数全量行情 |
getSimpleQuotes | A 股/指数简要行情 |
getHKQuotes | 港股行情 |
getUSQuotes | 美股行情 |
getFundQuotes | 公募基金行情 |
| 方法 | 说明 |
|---|---|
getHistoryKline | A 股历史 K 线(日/周/月) |
getHKHistoryKline | 港股历史 K 线(日/周/月) |
getUSHistoryKline | 美股历史 K 线(日/周/月) |
getMinuteKline | A 股分钟 K 线(1/5/15/30/60 分钟) |
getTodayTimeline | A 股当日分时走势 |
| 方法 | 说明 |
|---|---|
getKlineWithIndicators | 获取带技术指标的 K 线数据 |
calcMA | 计算均线(SMA/EMA/WMA) |
calcMACD | 计算 MACD |
calcBOLL | 计算布林带 |
calcKDJ | 计算 KDJ |
calcRSI | 计算 RSI |
calcWR | 计算威廉指标 |
calcBIAS | 计算乖离率 |
calcCCI | 计算商品通道指数 |
calcATR | 计算平均真实波幅 |
| 方法 | 说明 |
|---|---|
getIndustryList | 行业板块名称列表 |
getIndustrySpot | 行业板块实时行情 |
getIndustryConstituents | 行业板块成分股 |
getIndustryKline | 行业板块历史 K 线(日/周/月) |
getIndustryMinuteKline | 行业板块分时行情(1/5/15/30/60 分钟) |
| 方法 | 说明 |
|---|---|
getConceptList | 概念板块名称列表 |
getConceptSpot | 概念板块实时行情 |
getConceptConstituents | 概念板块成分股 |
getConceptKline | 概念板块历史 K 线(日/周/月) |
getConceptMinuteKline | 概念板块分时行情(1/5/15/30/60 分钟) |
| 方法 | 说明 |
|---|---|
getFuturesKline | 国内期货历史 K 线(日/周/月) |
getGlobalFuturesSpot | 全球期货实时行情 |
getGlobalFuturesKline | 全球期货历史 K 线(日/周/月) |
getFuturesInventorySymbols | 期货库存品种列表 |
getFuturesInventory | 期货库存数据 |
getComexInventory | COMEX 黄金/白银库存 |
| 方法 | 说明 |
|---|---|
getIndexOptionSpot | 中金所股指期权 T 型报价(看涨 + 看跌) |
getIndexOptionKline | 股指期权合约日 K 线 |
getCFFEXOptionQuotes | 中金所全部期权实时行情列表 |
getETFOptionMonths | 上交所 ETF 期权到期月份列表 |
getETFOptionExpireDay | ETF 期权到期日与剩余天数 |
getETFOptionMinute | ETF 期权当日分钟行情 |
getETFOptionDailyKline | ETF 期权历史日 K 线 |
getETFOption5DayMinute | ETF 期权 5 日分钟行情 |
getCommodityOptionSpot | 商品期权 T 型报价 |
getCommodityOptionKline | 商品期权合约日 K 线 |
getOptionLHB | 期权龙虎榜 |
| 方法 | 说明 |
|---|---|
getFundFlow | 资金流向 |
getPanelLargeOrder | 盘口大单占比 |
getTradingCalendar | A 股交易日历 |
| 方法 | 说明 |
|---|---|
getAShareCodeList | 获取全部 A 股代码 |
getUSCodeList | 获取全部美股代码 |
getHKCodeList | 获取全部港股代码 |
getAllAShareQuotes | 获取全市场 A 股行情 |
getAllHKShareQuotes | 获取全市场港股行情 |
getAllUSShareQuotes | 获取全市场美股行情 |
getAllQuotesByCodes | 批量获取指定股票行情 |
| 方法 | 说明 |
|---|---|
search | 搜索股票代码/名称/拼音 |
🌐 官网 | 📦 NPM | 📖 GitHub | 🎮 在线演示 | 🧭 Stock Dashboard | 🐛 Issues
如果这个项目对你有帮助,欢迎 Star ⭐ 或提出 Issue 反馈。
FAQs
Tencent qt.gtimg.cn stock quote SDK - supports both browser and Node.js
The npm package stock-sdk receives a total of 160 weekly downloads. As such, stock-sdk popularity was classified as not popular.
We found that stock-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.