Build a Stock Dashboard from Three Keyless Public Data Feeds

Build a Stock Dashboard from Three Keyless Public Data Feeds

使用三个无需密钥的公共数据源构建股票仪表盘

Every time I start a finance side project I hit the same wall. The data I want is public, but it lives behind finance sites that fight scrapers or data plans that bundle fifty things I will never touch. Over the past week I packaged three slices of that data as plain JSON, no key and no browser. Together they cover most of what a small stock dashboard needs: price history, company fundamentals, and the forward earnings calendar. Here is how each one works and why keyless HTTP keeps the whole thing cheap.

每当我开始一个金融相关的副业项目时,总会遇到同样的障碍。我想要的数据虽然是公开的,但要么被那些抵制爬虫的金融网站挡在门外,要么被捆绑在包含五十种我根本用不到的功能的数据套餐中。过去一周,我将这三类数据打包成了纯 JSON 格式,无需密钥,也无需浏览器。它们共同涵盖了一个小型股票仪表盘所需的大部分功能:价格历史、公司基本面以及未来财报日历。以下是每个数据源的工作原理,以及为什么使用无需密钥的 HTTP 请求能让整个项目保持低成本。

1. Price history (OHLCV)

1. 价格历史 (OHLCV)

Nasdaq exposes keyless JSON behind its quote pages. Send a normal User-Agent and you get daily open, high, low, close and volume back as rows. GET https://api.nasdaq.com/api/quote/AAPL/historical?assetclass=stocks&fromdate=2025-01-01&todate=2026-06-30 One row per trading day, ready to drop into a chart or a backtest. No login, no proxy. The dates come back in a US format, so normalize them once at the edge or every downstream join will hurt.

纳斯达克在其行情页面背后提供了无需密钥的 JSON 数据。只需发送一个正常的 User-Agent,你就能获取到每日的开盘价、最高价、最低价、收盘价和成交量数据。 GET https://api.nasdaq.com/api/quote/AAPL/historical?assetclass=stocks&fromdate=2025-01-01&todate=2026-06-30 每个交易日一行数据,可直接用于图表展示或回测。无需登录,无需代理。返回的日期格式为美式格式,因此建议在数据入口处进行一次标准化处理,否则后续的关联操作会很麻烦。

2. Company fundamentals (SEC XBRL)

2. 公司基本面 (SEC XBRL)

The SEC publishes every public company’s reported financials as structured XBRL, free and keyless. You resolve a ticker to its CIK, then pull the company facts. GET https://www.sec.gov/files/company_tickers.json # ticker to CIK GET https://data.sec.gov/api/xbrl/companyfacts/CIK0000320193.json That second call returns revenue, net income, assets, EPS and dozens more line items, each with the filing it came from. The one rule the SEC asks for is a descriptive User-Agent with a contact, so set that and you are a good citizen.

美国证券交易委员会 (SEC) 将每家上市公司的财务报告以结构化的 XBRL 格式发布,完全免费且无需密钥。你只需将股票代码解析为 CIK(中央索引键),然后即可提取公司事实数据。 GET https://www.sec.gov/files/company_tickers.json # 将股票代码转换为 CIK GET https://data.sec.gov/api/xbrl/companyfacts/CIK0000320193.json 第二个调用会返回营收、净利润、资产、每股收益 (EPS) 以及数十个其他财务指标,并附带其来源的申报文件。SEC 唯一的要求是设置一个包含联系方式的描述性 User-Agent,只要照做,你就是一个合格的数据使用者。

3. Earnings calendar

3. 财报日历

Nasdaq again, this time the calendar endpoints. Earnings and dividends are per day, splits are one list, IPOs are per month. GET https://api.nasdaq.com/api/calendar/earnings?date=2026-06-30 Each earnings row carries the symbol, report date, whether it reports pre market or after hours, the EPS estimate and last year’s number for context. Filter it down to a watchlist and you have the feed a Discord bot needs to ping before a big report.

还是纳斯达克,这次使用的是日历接口。财报和股息按天提供,拆股信息是一个列表,IPO 信息则按月提供。 GET https://api.nasdaq.com/api/calendar/earnings?date=2026-06-30 每一行财报数据都包含股票代码、报告日期、盘前还是盘后发布、EPS 预期以及去年的同期数据作为参考。将其过滤为你的关注列表,你就拥有了 Discord 机器人推送重大财报提醒所需的数据源。

Why keyless matters

为什么无需密钥很重要

The moment a scraper needs a headless browser plus a residential proxy, the per run cost balloons and a thin data feed goes underwater. All three feeds above are pure HTTP over JSON, so a run costs almost nothing and the margin works. The tradeoff is that an endpoint can quietly return zero rows on a bad day, so always sanity check the row count against a date or ticker you know is busy before you trust the output.

一旦爬虫需要无头浏览器和住宅代理,单次运行成本就会激增,导致轻量级数据源变得入不敷出。上述三个数据源均为纯 HTTP JSON 请求,因此运行成本几乎为零,利润空间也得以保障。其代价是,接口在某些情况下可能会静默返回空数据,因此在信任输出结果之前,务必根据你已知的活跃日期或股票代码对行数进行完整性检查。

If you would rather not run it yourself I packaged each feed as a small pay per use scraper on Apify:

  • Stock Market Price History Scraper
  • Stock Market Fundamentals Scraper
  • Stock Earnings Calendar Scraper

如果你不想自己运行,我已经将每个数据源打包成了 Apify 上的小型按需付费爬虫:

  • 股票价格历史爬虫
  • 股票基本面爬虫
  • 股票财报日历爬虫

First rows of every run are free, so you can check the shape before you pay. They are part of a growing set of keyless public data tools I keep shipping, and counting. Either way the takeaway is the same. This data is public. With the right endpoint it is also clean data.

每次运行的前几行数据都是免费的,因此你可以在付费前检查数据格式。这些工具是我不断发布的一系列无需密钥的公共数据工具的一部分。无论如何,结论是一样的:这些数据是公开的,只要找到正确的接口,它们也是干净的数据。