OpenGithubs / OpenGithubs/weekly
【开源自荐】stock-sdk:浏览器前端和 Node.js 都能直接调用的股票行情 SDK,零依赖、TypeScript 全类型、单测覆盖
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 1.7k
- Forks
- 71
- PR merge metrics
- No merged PRs in 30d
Description
项目地址:https://github.com/chengzuopeng/stock-sdk
官方文档:https://stock-sdk.linkdiary.cn/
在线 Playground:https://stock-sdk.linkdiary.cn/playground/
NPM:https://www.npmjs.com/package/stock-sdk
看板 Demo:https://chengzuopeng.github.io/stock-dashboard/
一句话:给前端工程师的股票行情 SDK —— 不写 Python、不搭后端、不开代理,浏览器里就能直接拉 A 股 / 港股 / 美股 / 基金 / 期货 / 期权 的实时行情和 K 线。
背景
股票行情工具几乎都活在 Python 生态里(AkShare、tushare、baostock 一统天下)。前端做个看板、写个 Demo、跑个量化原型,要么得搭一层 Python 后端,要么得自己去戳腾讯/东方财富/雪球的接口、踩 GBK 编码、CORS、JSONP、并发限流的所有坑。
stock-sdk 把这些活全干完了:浏览器端用 Script Tag Injection(JSONP)跨域,Node.js 端走标准 fetch,同一份 API 两端跑。
亮点
- 🌐 浏览器 + Node.js 双端:同一份代码,浏览器里靠 JSONP 直连数据源,没有 CORS,不用配代理
- 📦 零依赖、轻量:发布包 gzip 后 ~27 KB,ESM + CJS 双格式
- 🧠 完整 TypeScript 类型:所有接口、字段、错误码都有类型,IDE 自动补全
- 📈 覆盖面广:A 股、港股、美股、公募基金的实时行情;日/周/月 K 线和 1/5/15/30/60 分钟 K 线;当日分时
- 🔢 14 个内置技术指标:MA / MACD / BOLL / KDJ / RSI / WR / BIAS / CCI / ATR / OBV / ROC / DMI / SAR / KC
- 🏛️ 专业数据:龙虎榜、北向资金、资金流向、盘口大单、涨停池、大宗交易、融资融券、期货库存
- 🛡️ 请求治理:内置重试、限流、熔断、批量并发控制,可按 provider 维度覆盖
- 🤖 AI / MCP 就绪:配套 stock-sdk-mcp,一行 npx 即可接入 Cursor / Claude Desktop / Gemini / Codex / OpenClaw,内置技术分析、智能选股、市场概览、实时监控 4 个 Skills
使用示例
ts
import { StockSDK } from 'stock-sdk';
const sdk = new StockSDK();
// 浏览器也可直接调用
await sdk.getSimpleQuotes(['sh600519']); // A 股
await sdk.getHKQuotes(['hk00700']); // 港股
await sdk.getUSQuotes(['usAAPL.O']); // 美股
await sdk.getKLine('sh600519', 'day'); // K 线
await sdk.getNorthboundFlow(); // 北向资金
await sdk.getDragonTigerList(); // 龙虎榜
await sdk.getAllAShareQuotes(); // 全市场 5000+ 只一次拉
14 个技术指标(MA / MACD / BOLL / KDJ / RSI / ATR / DMI / SAR / KC …)和期货、期权、融资融券都有。完整 TypeScript 类型,发布包 gzip 27 KB。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
This is a project self-recommendation rather than a code-change request, and it names no file, test, or entry point in the weekly repository. Review the linked project page, documentation, Playground, and npm package first; completion criteria for a repository change are not specified in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- content
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100