SG

simonlin1212/global-stock-data

开发工具
1830 stars 质量 73 趋势 57Apache-2.0

US stock market data for AI coding assistants — zero-auth, official sources. CBOE options with full Greeks + 0DTE flow, FINRA market-wide short volume, SEC EDGAR filing stream, and a free market-wide...

概览

美股港股全栈数据工具包 — 8 层架构 · 18 个端点 · 5 个数据源 · 全部零鉴权 · 仅依赖 requests 一个自包含的 Skill 文件,把分散在 5 个数据源里的美股/港股原始数据整合成 AI 编程助手直接能用的工具集。你不用再背东财 secid 前缀、Yahoo crumb 鉴权流程、SEC EDGAR 的 CIK 映射——全部封装好了。 5 个函数(个股行情/Yahoo K线/日级资金流/搜索/全市场列表)漏传 params=params,请求实际是裸 URL, → 一次性补齐;并修了 market_stock_list 在东财 diff 返回 dict 时 AttributeError 的连带 bug(归一化 dict→list)。强烈建议升级。致谢 @APTX4869-maker。 兼容 Claude Code · Codex · OpenClaw Skill 文件本质是结构化 Markdown + 内嵌 Python,任何支持上下文注入的 AI 编程助手都能用。 把 SKILL.md 的内容贴入你的系统 prompt 或项目上下文文件即可,内嵌的 Python 代码可直接执行。 全部 5 个数据源**。Yahoo crumb 由代码自动获取,SEC EDGAR 仅需标准 User-Agent。 全部直连 HTTP API,零第三方数据封装依赖。Yahoo crumb 由 helper 自动管理,SEC EDGAR 仅需标准 User-Agent。 姊妹项目。a-stock-data 覆盖 A 股(沪深北),global-stock-data 覆盖美股和港股。两个 Skill 可以同时安装,互不冲突。

README

简体中文 | English

global-stock-data

US Market Data for AI Coding Assistants Options Greeks · 0DTE Flow · VIX Term Structure · SEC Filings & Insider Trades · Short Data · Fundamentals · Screener · Global Rates & FX · Taiwan · Energy


Architecture · Compliance · Quick Start · Endpoints · Data Sources · FAQ

Full-stack market data for US equities — 16 layers · 50+ endpoints · 17 sources · zero-auth · only requests.

Official-source-first (V2.0): CBOE options with full Greeks + 0DTE flow, FINRA market-wide short volume, SEC EDGAR filing stream + a free market-wide screener, Treasury / CFTC / earnings calendar. Every source is labeled with its compliance tier, terms quoted verbatim — “official” does not mean “free to use”.

New in V2.1: a global rates & FX layer — policy rates for 38 central banks (BIS), ECB FX / key rates / euro-area yield curve, NY Fed SOFR / EFFR, Fed H.10 FX / H.6 money stock, and US Treasury auctions + federal debt, all tier S. Yahoo K-line now returns true full-history daily bars in exchange-local dates, builds weekly / monthly / quarterly bars from daily data, and works for Japan / Taiwan / Korea / India / Europe and more.

New in V2.2: CBOE volatility indices (VIX since 1990) and the VIX term structure, FINRA short interest (twice a month, with days to cover), SEC Form 4 insider trades line by line and 13F institutional holdings, the Taiwan Stock Exchange / TPEx official open APIs (latest Taiwan quotes, P/E, monthly revenue; commercial use OK), and US EIA weekly crude oil / natural gas inventories plus spot prices (spot prices are tier B, see Compliance tiers).

A single self-contained Skill file that turns raw US stock data — scattered across many sources — into a toolkit an AI coding assistant can call directly. You no longer memorize Eastmoney secid prefixes, Yahoo crumb auth flows, or SEC EDGAR CIK mappings. That’s all handled.

This project distributes code, not market data. Data is fetched by the user under each source’s own terms. For commercial use, rely only on tier-S sources.

Compatible with Claude Code · Codex · OpenClaw. The Skill file is structured Markdown + embedded Python — any AI coding assistant with context injection can use it.


Architecture

US Full-Stack Data · 16-layer architecture · V2.2
│
├── Market Data      Sina + Tencent + Eastmoney push2        Real-time quotes, 25-78 fields
├── K-line           Sina(back to 1984) + Yahoo chart        Daily / weekly / monthly / minute; JP/TW/KR/IN/EU via suffix
├── Technical Ind.   MA/EMA + MACD + RSI + KDJ + Bollinger   Pure Python, zero extra deps
├── Fundamentals     Eastmoney + Yahoo + SEC XBRL            Statements + key metrics + holdings
├── Fund Flow        Eastmoney push2his                      Daily main/large/medium/small flow
├── Options          Yahoo crumb                             Options chain (US only)
├── SEC Filing       EDGAR submissions + XBRL                10-K/10-Q/8-K + 503 GAAP metrics (US)
└── Tools            Eastmoney + Yahoo + SEC CIK             Search + market list + news + ticker↔CIK

━━━ New in V2.0 (official-source-first) ━━━
├── Options·CBOE     cdn.cboe.com official feed   ⭐ full chain + IV + delta/gamma/vega/theta/rho + 0DTE + flow
├── Short Volume     FINRA Reg SHO                ⭐ market-wide daily short volume (12,112 symbols) + series
├── Filing Stream    EDGAR daily index + FTS      ⭐ Form 4 / 8-K / 13F same-day + full-text since 2001
├── Market Screener  EDGAR frames                 ⭐ any XBRL tag across the whole market (1,842~5,309 co.) — free
└── Macro / Calendar Treasury + CFTC + Nasdaq     ⭐ yield curve (1M~30Y) + COT + earnings calendar

━━━ New in V2.1 ━━━
└── Global Rates/FX  BIS + ECB + NY Fed + Fed + Treasury ⭐ 38 central-bank policy rates + EUR/USD FX + SOFR/EFFR + euro curve + auctions

━━━ New in V2.2 ━━━
├── Volatility       CBOE index files             ⭐ VIX since 1990 + VIX9D/3M/6M/1Y term structure + VVIX/SKEW/OVX/GVZ
├── Short Interest   FINRA, twice a month         ⭐ all US open short positions (22,595 symbols) + days to cover + rankings
├── Insiders / 13F   SEC Form 4 + 13F             ⭐ insider trades (price/shares/10b5-1 box on the filing) + quarterly institutional holdings
├── Taiwan           TWSE + TPEx OpenAPI          ⭐ latest quotes + P/E + monthly revenue + margin for all listed/OTC stocks (commercial OK)
└── Energy           US EIA                       ⭐ weekly crude/gas inventories + WTI (since 1986)/Brent/Henry Hub daily spot prices (tier B)

Layer count: the original 8 layers + 5 in V2.0 (the CBOE options chain counts as its own layer) + 1 in V2.1 + 2 in V2.2 (Taiwan, energy). The V2.2 volatility indices, short interest and Form 4 / 13F parsers are new sections inside existing layers and are not counted as layers.


Compliance tiers

Source terms differ a lot. “Official” does not mean “free to use”. These tiers come from reading each source’s actual terms of service (2026-07-24; Yahoo / Nasdaq re-checked and 4 new official sources read on 2026-10-11; TWSE / TPEx and EIA read on 2026-10-12). Quotes are verbatim.

A working HKEX shareholding layer was built, then removed. Shipping code that violates a source’s terms would defeat the point of grading sources in the first place. This project distributes code, not data. For commercial use, rely only on tier S.

So why keep tier-D Yahoo and Nasdaq? Honestly, their terms are the same kind as HKEX’s. The difference is that they have no substitute: Yahoo is the only source for HK K-lines and for markets beyond the US and HK, and Nasdaq is the only key-free earnings calendar, while the HKEX shareholding layer was a nice-to-have. So the code stays and the terms are quoted in full (see “数据源合规分级” in SKILL.md). Whether to use them is your call under those terms.


Quick start

3 steps, 2 minutes.

# 1. Create the skill directory
mkdir -p ~/.claude/skills/global-stock-data

# 2. Download SKILL.md
curl -o ~/.claude/skills/global-stock-data/SKILL.md \
  https://raw.githubusercontent.com/simonlin1212/global-stock-data/main/SKILL.md

# 3. Install the dependency
pip install requests
# Windows only: also install tzdata so Yahoo K-line dates use the exchange's time zone
pip install tzdata

⚠️ Before using the SEC layers, set SEC_CONTACT in SKILL.md to your real name and email. SEC requires a declared User-Agent; requests without one are rejected as an Undeclared Automated Tool. The code raises a clear error if you forget.

Launch Claude Code and say “check AAPL’s financials” — the skill activates on its own. Codex / OpenClaw users: paste SKILL.md into your system prompt or project context file; the embedded Python runs as-is.


Endpoints

Price — Sina / Tencent / Eastmoney quotes (25-78 fields) · Sina & Yahoo K-line (US back to 1984, daily→minute; Japan / Taiwan / Korea / India / Europe and more via ticker suffix) · MA/EMA/MACD/RSI/KDJ/Bollinger computed locally.

Value — Eastmoney three statements + GMAININDICATOR (US 49 / HK 75 fields) · Yahoo quoteSummary (23 modules: financials, analysts, institutional holdings) · SEC EDGAR XBRL (503 GAAP metrics).

Flow & positioning ⭐ — CBOE options with full Greeks + IV + 0DTE + unusual-flow detection · FINRA market-wide daily short volume (12,112 symbols) · Eastmoney daily fund flow · V2.2: CBOE VIX history since 1990 + term structure (contango or backwardation) + VVIX / SKEW · FINRA short interest (twice a month, 22,595 symbols, with days to cover and rankings).

Filings & events ⭐ — EDGAR daily index (same-day Form 4 insider / 8-K / 13F, one day: 547 / 370 / 261) · full-text search since 2001 · 10-K/10-Q/8-K list · V2.2: Form 4 insider trades line by line (price, shares, holdings after, whether the filing ticks the 10b5-1 box) · 13F quarterly institutional holdings (sorted by value, with weights).

Screener & macro ⭐ — EDGAR frames (any XBRL tag across the whole market, free — net income CY2025Q1 = 5,309 companies) · Treasury yield curve (1M~30Y) · CFTC COT · Nasdaq earnings calendar.

Global rates & FX ⭐ (V2.1) — policy rates for 38 central banks in one call (BIS) · ECB FX / three key rates / euro-area yield curve · NY Fed SOFR / EFFR · Fed H.10 USD vs 23 currencies / H.6 M1·M2 · Treasury auction results and schedule / federal debt / average interest rates.

Taiwan ⭐ (V2.2) — TWSE + TPEx official open APIs: the latest trading day’s quotes, P/E / dividend yield / P/B, monthly revenue, company profiles, margin trading, ex-dividend notices and dividends for every listed and OTC stock (latest day only; for Taiwan K-line history use Yahoo .TW / .TWO).

Energy ⭐ (V2.2) — EIA weekly crude (commercial + SPR), gasoline, distillate and natural gas inventories · WTI (since 1986) / Brent / Henry Hub daily spot prices (tier B: third-party data republished by EIA).

Tools — stock search (CN+EN) · full-market list (US 5925+ / HK 18000+) · news by ticker · ticker↔CIK.


Usage examples

Just tell your AI assistant:

Scenario Prompt
0DTE options flow ⭐ “Show NVDA’s 0DTE options flow — unusual activity”
Short volume ⭐ “TSLA’s short volume ratio trend this week”
Short interest ⭐ “GME’s short interest and days to cover over the last few periods”
VIX term structure ⭐ “Is the VIX term structure inverted right now?”
Insider filings ⭐ “Any Form 4 insider filings today for my watchlist”
Insider trades ⭐ “How many shares did NVDA insiders sell in the past six months?”
13F holdings ⭐ “Berkshire’s top 10 holdings in its latest 13F”
Full-text filings ⭐ “Which companies first mentioned ‘HBM4’ in an 8-K”
Market screener ⭐ “Rank all filers by R&D expense for CY2025Q1”
Macro ⭐ “What’s the 10Y-2Y Treasury spread right now”
Central banks ⭐ “Current policy rates of the major central banks” · “SOFR and EFFR over the past week”
FX / Treasuries ⭐ “EUR/JPY this month” · “Next week’s Treasury auction schedule”
Taiwan ⭐ “TSMC’s latest close and P/E” · “This month’s revenue for OTC-listed stocks”
Oil / gas ⭐ “This week’s EIA crude inventories” · “WTI over the past year”
Other markets “Toyota 7203.T daily K-line for the past year” · “TSMC 2330.TW full history”
US / HK quote “AAPL’s price and PE” · “How’s Tencent 00700 today”
K-line “Pull TSLA’s daily K-line for the past 6 months”
Statements / valuation “Apple’s latest income statement” · “BABA’s PE/PB/ROE + target”
Institutional holdings “Which institutions hold NVDA, and what %”
Technical analysis “AAPL’s MACD and RSI — any golden cross?”
Batch compare “Compare valuations of AAPL MSFT GOOGL”

Data sources

Source Tier Auth Coverage
SEC EDGAR S real UA US filings / XBRL / filing stream / full-text search / market screener / Form 4 insider trades / 13F holdings
US Treasury S none Yield curve (1M~30Y) · FiscalData auctions / federal debt / average rates
CFTC S none COT reports
Federal Reserve Board S none H.10 FX / H.6 money stock (attribution)
NY Fed S none SOFR / EFFR / OBFR / TGCR / BGCR (notice required when shown to others)
BIS S none Central-bank policy rates (attribution)
ECB S none EUR FX / ECB key rates / euro-area yield curve (attribution, no modification)
US EIA S / B none Weekly crude oil / natural gas inventories (S, attribution recommended) · WTI / Brent / Henry Hub spot prices (B: Refinitiv data republished by EIA, verify before commercial use)
Taiwan Stock Exchange S none Listed stocks’ latest quotes / P/E / monthly revenue / margin / ex-dividend / dividends (attribution)
TPEx S none OTC stocks’ latest quotes / P/E / monthly revenue / margin / ex-dividend (attribution; S is this tool’s judgment)
FINRA B none US market-wide daily short volume · short interest (verify before commercial use)
CBOE C none US options + Greeks + IV + 0DTE · VIX and other volatility indices (needs Cboe’s prior approval)
Eastmoney (push2 / push2his / datacenter / search) C none US+HK quotes / fund flow / statements / search
Sina C none US+HK quotes, US K-line
Tencent C none US+HK quotes
Yahoo Finance D cookie+crumb (auto) US+HK+other markets, all categories (terms prohibit automated access)
Nasdaq D none US earnings calendar (terms prohibit automated access)

Tiers: S = government and central-bank data (including exchange data registered as Taiwan government open data), commercial + redistribution OK (some require attribution) · B = published data, verify before commercial use · C = needs prior approval or terms unverified, personal research only · D = terms prohibit automated access without permission; personal study and research only, at your own risk, no commercial use or redistribution. See Compliance tiers for the quoted basis. All requests go through direct HTTP with a built-in thread-safe rate limiter (SEC capped at 8 req/s against the official 10).


FAQ

Q: How does this relate to a-stock-data? Sister project. a-stock-data covers China A-shares; global-stock-data covers US and HK. Install both — they don’t conflict.

Q: Does Yahoo Finance need an API key? No. The code fetches cookie + crumb automatically and refreshes on expiry.

Q: Any limits on SEC EDGAR? Yes — a declared User-Agent and 10 req/s. Set SEC_CONTACT to your real email; the built-in throttle stays under the limit.

Q: HK options data? No. HK options aren’t in Yahoo’s coverage and need HKEX’s paid feed. The options layer is US only.

Q: Can I look up stocks outside the US and HK? K-lines and Yahoo fundamentals, yes: Japan .T, Taiwan .TW, Korea .KS, India .NS, London .L, Germany .DE and more — see “Yahoo Finance 代码格式” in SKILL.md. Note that Yahoo is a tier-D source. Taiwan also has the official TWSE / TPEx APIs (tier S, latest trading day only): tw_stock("2330"). For China A-shares, use the sister project a-stock-data.

Q: How fresh are the global rates and FX? ECB and NY Fed update every business day; Fed H.10 is published each Monday for the prior week; BIS lags by a few days to about three weeks depending on the country. Every row carries its date — check the central bank itself when you need today’s exact value.

Q: How often is short interest updated? FINRA publishes it twice a month, for settlement dates on the 15th and at month-end (moved earlier for holidays), about 8 business days after settlement. The daily dataset is a different one — daily short volume (9.1), which counts that day’s short-sale trades, not open short positions.

Q: Running from a server in mainland China — can it reach Yahoo / SEC? They’re overseas and may be flaky on a direct connection. Use a proxy, or lean on the Eastmoney / Sina / Tencent sources.

Q: Can I use it without Claude Code? Yes. SKILL.md is Markdown + embedded Python — Codex, OpenClaw, or any AI coding assistant can read it, and you can copy the Python into your own scripts.


Changelog

See CHANGELOG.md.

Disclaimer

This project provides data-access tools only. It is not investment advice. Investing involves risk.

License

Apache License 2.0 — Author: Simon Lin · X @linsizhen · Email: [email protected]

在 GitHub 查看完整 README

推荐工具

换一个关键词,或者移除筛选条件。

安装

npx skillfish add simonlin1212/global-stock-data
新手?先看 mcpskill.org 教程 →