Market Data Guide市场数据指南

How to Get Free Stock Data
Quotes, History & APIs
如何获取免费股票数据
行情、历史数据与 API

Find free stock quotes, historical prices, fundamentals, and export-ready market data—then verify coverage, delay, and licensing before you build.

查找免费的股票行情、历史价格、基本面及可直接导出的市场数据,
并在使用前核对覆盖范围、延迟与授权条款。

Whiteboard workflow showing how to search, inspect, and call free stock data sources for JSON or CSV output

Quick Summary快速摘要

What you can get

Free tiers commonly expose delayed quotes, daily OHLCV history, company profiles, and selected fundamentals.

What to verify

Check exchange coverage, timestamps, adjustment rules, request limits, redistribution rights, and commercial-use terms.

Best starting format

CSV is convenient for spreadsheets and research; JSON APIs are better for apps, agents, and repeatable pipelines.

Important boundary

Free does not always mean real-time or unrestricted. Never assume demo data is suitable for live trading decisions.

可获取的数据

免费套餐通常提供延迟行情、日线 OHLCV、公司资料以及部分基本面数据。

必须核对

确认交易所覆盖、时间戳、复权规则、调用限额、再分发权利和商业使用条款。

推荐格式

CSV 适合表格和研究;JSON API 更适合应用、Agent 和可重复的数据流程。

重要边界

免费不等于实时或无限制,演示数据不应直接用于真实交易决策。

Which free stock data do you actually need?你真正需要哪一种免费股票数据?

Start with the decision or product you are building. A watchlist needs current quotes; a backtest needs adjusted history; a screener needs fundamentals; an agent workflow needs stable schemas and source metadata.

先明确你的决策或产品目标。自选股需要当前行情,回测需要复权历史数据,选股器需要基本面,Agent 工作流则需要稳定字段与来源元数据。

The phrase free stock data covers several products that behave very differently. A quote endpoint may return only the latest traded price, while an end-of-day dataset can provide years of bars but no intraday updates. Fundamental feeds often follow company reporting cycles, and regulatory filings may arrive as documents rather than tidy rows. Define the market, asset class, frequency, history depth, and acceptable delay before comparing providers.

“免费股票数据”并不是单一产品。行情接口可能只返回最新成交价,日线数据集可以覆盖多年,却没有盘中更新;基本面数据通常跟随公司财报周期,监管申报则可能以文档而非整齐表格提供。因此在比较供应商之前,应先写清市场范围、资产类别、数据频率、历史深度以及可接受的延迟。

For research, price fields alone are rarely enough. You may also need trading calendars, symbol changes, delistings, currency, exchange identifiers, and corporate actions. These reference fields prevent survivorship bias and make it possible to join prices with fundamentals correctly. A smaller dataset with explicit lineage and consistent identifiers is often more useful than a larger feed whose origin and adjustment rules are unclear.

对于研究任务,只有价格字段通常不够。你还可能需要交易日历、代码变更、退市记录、币种、交易所标识和公司行动。这些参考字段能减少幸存者偏差,也能让价格与基本面正确关联。来源清楚、标识一致的小型数据集,往往比来源不明、复权规则模糊的大型数据源更有价值。

Quotes and snapshots

Last price, change, bid/ask, session status, and timestamp. Confirm whether values are real-time, delayed, indicative, or end-of-day.

Historical OHLCV

Open, high, low, close, and volume by interval. For return calculations, verify splits, dividends, and adjusted-close methodology.

Fundamentals

Income statements, balance sheets, cash flow, ratios, and company facts. Check reporting periods, currencies, and restatements.

Reference and source metadata

Ticker mappings, exchanges, time zones, data lineage, and provider identity make downstream results easier to explain and audit.

行情与快照

最新价、涨跌、买卖价、交易状态和时间戳。务必确认数据是实时行情、延迟行情、参考报价还是日终数据。

历史 OHLCV

按周期提供开高低收和成交量。计算收益率前,要核对拆股、分红与复权收盘价的方法。

基本面

利润表、资产负债表、现金流、比率和公司资料。注意报告期、币种以及后续重述。

参考与来源元数据

代码映射、交易所、时区、数据血缘和供应商身份,让结果更容易解释与审计。

How free stock data sources compare免费股票数据来源如何比较

No single source is best for every workflow. Exchanges and regulators are closest to primary records, but their files may require more cleaning. Market-data APIs make common fields easier to query, although free plans usually trade convenience for lower request limits, delayed prices, shorter history, or narrower exchange coverage. Broker feeds can be useful for personal execution workflows, while downloadable files are efficient for reproducible analysis.

没有一种来源适合所有工作流。交易所和监管机构最接近一手记录,但文件往往需要更多清洗;市场数据 API 查询方便,不过免费套餐通常以较低调用限额、延迟行情、较短历史或较窄市场覆盖来换取便利。券商数据适合个人交易流程,而可下载文件更适合可重复的研究分析。

Source来源What it offers提供内容Best for适合场景Watch for注意事项
Exchange or regulator交易所或监管机构Authoritative listings, notices, and filings.权威的上市信息、公告与申报文件。Verification and primary-source research.核验与一手资料研究。May be fragmented or not API-friendly.可能分散,且不一定便于 API 调用。
Free market-data API免费市场数据 APINormalized quotes, history, and fundamentals.标准化的行情、历史与基本面。Apps, agents, prototypes, and repeatable research.应用、Agent、原型与可重复研究。Rate limits, delays, and license restrictions.有调用限额、延迟和授权限制。
Broker data券商数据Account-linked quotes and trading context.与账户关联的行情和交易上下文。Personal portfolio and execution workflows.个人投资组合与交易执行流程。Access may require an eligible account.可能要求符合条件的账户。
CSV or bulk datasetCSV 或批量数据集Portable files for analysis and archival.便于分析与归档的可移植文件。Spreadsheets, notebooks, and backtests.表格、Notebook 与回测。Often less current than a live API.通常不如实时 API 更新及时。

Compare sources with the same small test set rather than relying on feature lists. Request a liquid stock, a thinly traded security, a symbol that changed, and a date containing a split or dividend. Compare timestamps, missing records, precision, adjustment behavior, and error messages. This test quickly reveals whether two providers use different sessions or definitions even when their column names look identical.

不要只看功能清单,最好用同一组小样本横向测试:选择一只高流动性股票、一只成交稀疏的证券、一个曾更换代码的标的,以及包含拆股或分红的日期。对比时间戳、缺失记录、数值精度、复权方式和错误信息。即使字段名称相同,这种测试也能快速发现不同供应商对交易时段和指标定义的差异。

Match each source to its proper role让每个来源承担合适的角色

A convenient provider and a primary source solve different problems. Alpha Vantage offers a free API key and currently states that most free datasets allow up to 25 requests per day; it also states that U.S. real-time and 15-minute delayed market data are premium-only. Financial Modeling Prep requires an API key and documents normalized quote, history, company, statement, symbol-change, and corporate-action endpoints. Massive (formerly Polygon.io) documents U.S. stock data sourced from exchanges, securities information processors, FINRA facilities, and OTC markets, with actual feed access controlled by the user’s plan and entitlement. These services simplify application access, but free-tier scope and licensing must be checked at integration time.

便利的数据供应商与一手来源解决的是不同问题。Alpha Vantage 提供免费 API Key,并说明大多数免费数据集目前每天最多调用 25 次;同时,美国股票实时数据和 15 分钟延迟数据属于付费能力。Financial Modeling Prep 要求 API Key,其文档列出了标准化的行情、历史、公司资料、财报、代码变更和公司行动端点。Massive(原 Polygon.io)的文档说明,其美国股票数据来自交易所、证券信息处理机构、FINRA 设施及 OTC 市场,实际数据流权限由用户套餐和授权决定。这些服务降低了应用接入难度,但免费范围和许可仍需在正式接入时核验。

SEC EDGAR is a primary source for U.S. company filings and structured XBRL facts, not a stock-price feed. Its public data APIs require no authentication key, update throughout the day, and include nightly bulk archives. Combining a market-data source for prices with EDGAR for filings is often more defensible than treating one aggregator as the authority for both. For a critical value, retain the provider, endpoint, retrieval time, and any upstream source attribution so a reviewer can trace it.

SEC EDGAR 是美国公司申报和结构化 XBRL 事实的一手来源,而不是股票价格流。其公共数据 API 无需认证密钥,会在日内更新,并提供夜间批量归档。用市场数据来源获取价格、用 EDGAR 获取申报,通常比把同一家聚合商同时视为两类数据的权威来源更可靠。对于关键数值,应保留供应商、端点、获取时间和上游来源署名,使审阅者能够追溯。

Understand stock data fields before comparing values比较数值前先理解股票数据字段

“Stock price” may mean the last eligible trade, the midpoint of the best bid and ask, an official auction close, a delayed consolidated value, or a vendor-calculated snapshot. Those values can all be valid and still disagree. Store the event type, venue or consolidated-feed indicator, market session, currency, timestamp, and delay status together with the number. A bare price without this context is unsafe for alerts, charts, valuation inputs, or execution decisions.

“股票价格”可能指最后一笔符合条件的成交价、最优买卖价中点、官方收盘竞价价、延迟综合行情,或者供应商计算的快照。这些数值都可能有效,却彼此不同。应把事件类型、交易场所或综合数据流标识、交易时段、币种、时间戳和延迟状态与价格一起保存。缺少这些上下文的单个价格,不适合直接用于提醒、图表、估值输入或交易执行。

Record记录类型Meaning含义Required context必要上下文Common mistake常见错误
Trade成交An executed transaction with price and size.包含价格和数量的实际成交。Venue, conditions, event time, sequence, and correction status.场所、成交条件、事件时间、序列号与更正状态。Treating one odd-lot or late report as the current market.把零股或延迟报告的单笔成交当成当前市场价。
Quote报价Displayed bid and ask prices and sizes.公开显示的买卖价格与数量。Bid/ask venue, size, timestamp, and whether it is consolidated.买卖场所、数量、时间戳及是否为综合报价。Calling the midpoint an executable trade price.把买卖中点称为可实际成交的价格。
OHLCV barOHLCV K 线Aggregated open, high, low, close, and volume for an interval.某一周期聚合的开高低收与成交量。Interval, session, time-zone rule, eligible events, and adjustments.周期、时段、时区规则、纳入事件和复权方式。Combining bars built from different sessions or trade conditions.合并基于不同时段或成交条件生成的 K 线。
Snapshot快照A provider’s packaged view of current or latest fields.供应商打包的当前或最近字段视图。Field-level timestamps, delay, source, and session state.字段级时间戳、延迟、来源和交易状态。Assuming all fields in the response share one timestamp.假设响应中的所有字段都对应同一时间。

Use durable identifiers alongside tickers在股票代码之外保留稳定标识

Tickers can change, be reused, vary by exchange, and represent different share classes. A reliable security master stores the provider symbol, exchange or MIC, currency, instrument type, company identity, and effective date range. Where available, retain CIK, FIGI, ISIN, or another stable identifier. For historical joins, resolve the identifier that was valid on the observation date; joining every old row to today’s ticker table creates survivorship and identity errors.

股票代码可能变更、被重复使用、因交易所而不同,也可能代表不同股份类别。可靠的证券主数据应保存供应商代码、交易所或 MIC、币种、工具类型、公司身份和生效日期范围;若来源提供 CIK、FIGI、ISIN 或其他稳定标识,也应一并保存。历史关联必须解析观测日期当时有效的标识,把所有旧记录直接连接到今天的代码表会制造幸存者偏差和身份错误。

A practical API and CSV workflow实用的 API 与 CSV 工作流

A reliable workflow separates discovery from production use. First inspect the provider documentation and a sample response. Then make a small request, save the raw payload, and transform it into your own stable schema. Add validation before the data enters a chart, model, spreadsheet, or agent. This makes it easier to replace a source later without rewriting the rest of the product.

可靠的工作流会把“发现数据源”和“正式使用”分开。先查看供应商文档与示例响应,再发起小规模请求,保存原始返回,并转换为自己的稳定字段结构。数据进入图表、模型、表格或 Agent 之前应先经过验证。这样未来更换数据源时,无需重写整个产品。

1. Search by intent

Start with a ticker and the required dataset: quote, history, fundamentals, corporate actions, or filings. Avoid choosing a provider before you define the need.

2. Inspect before calling

Review schema, exchange coverage, delay, sample response, request cost, limits, source lineage, and commercial-use rules.

3. Call with explicit parameters

Send the symbol, interval, start and end dates, adjustment mode, and output format. Store the provider timestamp with every result.

4. Validate the output

Check missing sessions, duplicates, time zones, split adjustments, null values, and unexpected schema changes before analysis.

1. 按需求搜索

先确定股票代码和数据类型:行情、历史、基本面、公司行动或公告,不要在需求明确前锁定供应商。

2. 调用前检查

检查字段结构、交易所覆盖、延迟、示例响应、调用成本、限额、数据血缘与商业使用规则。

3. 明确传入参数

传入代码、周期、起止日期、复权模式和输出格式,并保存每条结果对应的供应商时间戳。

4. 验证输出

分析前检查缺失交易日、重复记录、时区、拆股复权、空值和意外的字段变化。

For API access, cache responses that do not need second-by-second freshness, apply exponential backoff to temporary failures, and log the request time, parameters, status code, and provider timestamp. For CSV, preserve the original file separately from the cleaned table and record its download date, delimiter, encoding, and time zone. Both approaches need a repeatable update policy so old and new observations are not silently mixed.

使用 API 时,应缓存不要求秒级更新的结果,对临时失败采用指数退避,并记录请求时间、参数、状态码和供应商时间戳。使用 CSV 时,应把原始文件与清洗后的表格分开保存,同时记录下载日期、分隔符、编码和时区。两种方式都需要可重复的更新策略,避免新旧数据在无提示的情况下混合。

Request and validate a daily time series请求并验证日线时间序列

The example below requests daily IBM data from Alpha Vantage with a user-supplied key. It validates the response before trusting the time-series object because quota messages and API errors may also arrive as JSON. The example is for research ingestion, not a claim that the free response is real-time.

下面的示例使用用户提供的 Key 从 Alpha Vantage 请求 IBM 日线数据。代码会在使用时间序列对象前检查响应,因为限额提示和 API 错误同样可能以 JSON 返回。该示例用于研究数据接入,并不表示免费响应属于实时行情。

import os
import requests

params = {
    "function": "TIME_SERIES_DAILY",
    "symbol": "IBM",
    "outputsize": "compact",
    "apikey": os.environ["ALPHA_VANTAGE_API_KEY"],
}
response = requests.get(
    "https://www.alphavantage.co/query",
    params=params,
    timeout=20,
)
response.raise_for_status()
payload = response.json()

series = payload.get("Time Series (Daily)")
if not isinstance(series, dict):
    raise RuntimeError(payload.get("Note") or payload.get("Error Message") or payload)

rows = [
    {"date": date, **values, "provider": "Alpha Vantage"}
    for date, values in series.items()
]

Before loading the rows, convert numeric strings deliberately, preserve the provider’s raw field names in the archive, sort by date, and test for duplicates and gaps against the relevant trading calendar. Do not interpret a missing calendar date as missing data until holidays and market closures are considered. If you later switch to adjusted data, keep raw and adjusted series separate and record the adjustment method.

入库前应明确转换数字字符串,在归档中保留供应商原始字段名,按日期排序,并结合对应交易日历检查重复和缺口。只有排除节假日与休市后,才能把缺失日历日期认定为数据缺失。如果之后切换到复权数据,应把原始序列与复权序列分开保存,并记录复权方法。

Build historical stock datasets without silent bias构建不含隐性偏差的历史股票数据集

A clean chart is easier to build than a defensible backtest. Historical research needs the securities that existed at each date, not only companies that survive today. It also needs delistings, symbol changes, listing dates, trading calendars, corporate actions, and point-in-time fundamentals. Otherwise the dataset can exclude failed companies, use revised information too early, or join prices to the wrong issuer.

制作一张干净图表比构建可信回测容易得多。历史研究需要每个日期当时存在的证券,而不仅是今天仍然存续的公司;还需要退市记录、代码变更、上市日期、交易日历、公司行动,以及各历史时点当时可得的基本面数据。否则数据集可能排除失败公司、过早使用后来修订的信息,或把价格连接到错误发行人。

Keep raw and adjusted prices

Raw OHLC reflects observed session prices; adjusted series may restate history for splits and dividends. Store both, plus factors, events, method, and retrieval date.

Create a point-in-time universe

Track listing, delisting, exchange, symbol, share class, and index-membership effective dates so historical screens only use eligible securities.

Separate event, publication, and ingestion time

Market events, company disclosures, provider delivery, and your own database load occur at different times. Preserve each timestamp to prevent look-ahead.

Version every transformation

Record calendar filters, currency conversion, adjustment logic, deduplication, outlier rules, code commit, and upstream dataset version.

同时保留原始与复权价格

原始 OHLC 反映交易时段实际价格,复权序列可能根据拆股和分红回写历史。应同时保存两者,以及因子、事件、方法和获取日期。

建立时点证券池

跟踪上市、退市、交易所、代码、股份类别和指数成分的生效日期,使历史筛选只使用当时符合条件的证券。

区分事件、发布和入库时间

市场事件、公司披露、供应商交付和数据库入库发生在不同时间。分别保留时间戳,才能避免前视偏差。

为每次转换建立版本

记录交易日历筛选、汇率转换、复权逻辑、去重、异常值规则、代码提交和上游数据集版本。

In a QVeris workflow, start with the required dataset and decision: a delayed quote for a watchlist, adjusted history for research, company facts for valuation, or corporate actions for reconciliation. Discover a matching capability, inspect its provider, schema, delay, limits, and provenance, then call it with explicit identifiers and dates. Store the raw response beside the normalized table. QVeris can assist with capability discovery and routing, but it does not grant market-data entitlements or replace validation of accuracy, timeliness, and license terms.

在 QVeris 工作流中,应从数据和决策需求出发:自选列表需要延迟行情,研究需要复权历史,估值需要公司事实,对账需要公司行动。先查找匹配的数据能力,检查供应商、字段结构、延迟、限额和来源,再传入明确的标识与日期进行调用,并将原始响应与标准化表并存。QVeris 可以协助查找和调用这些能力,但不会授予市场数据权限,也不能代替对准确性、时效和许可条款的验证。

Free stock data quality checklist免费股票数据质量检查清单

A useful source makes coverage, freshness, provider identity, request limits, pricing, and licensing visible before you depend on it.

可靠的数据源会在你正式依赖它之前,清楚展示覆盖范围、更新时间、供应商身份、请求限额、定价信息与授权条款。

Data quality is not only about whether a number looks plausible. Confirm that every observation refers to the intended venue, session, currency, and time zone. Check whether timestamps represent trade time, bar close, or provider delivery time. When building indicators or backtests, document how missing sessions, zero volume, duplicate rows, outliers, splits, dividends, and restated fundamentals are handled.

数据质量不只是判断一个数字“看起来是否合理”。每条记录都应对应正确的交易场所、交易时段、币种和时区,还要确认时间戳表示成交时间、K 线结束时间,还是数据从供应商送达的时间。构建指标或回测时,应记录如何处理缺失交易日、零成交量、重复行、异常值、拆股、分红以及重述后的财务数据。

  • Confirm the market, exchange, asset class, interval, and historical depth.
  • Record whether prices are raw or adjusted and how corporate actions are handled.
  • Preserve source, timestamp, currency, time zone, and request parameters with every result.
  • 确认市场、交易所、资产类别、周期和历史深度。
  • 记录价格是否复权,以及拆股和分红等公司行动的处理方式。
  • 为每条结果保留来源、时间戳、币种、时区和请求参数。

Finally, read the license as carefully as the schema. Free access may permit personal analysis but restrict public display, redistribution, automated extraction, model training, or commercial products. Keep a link or copy of the applicable terms with the project and review them when the provider changes plans. If the data supports trading, compliance, or customer-facing decisions, validate critical values against an authoritative source.

最后,许可证应当和字段说明一样认真阅读。免费访问可能允许个人分析,却限制公开展示、再分发、自动抓取、模型训练或商业产品。建议在项目中保存适用条款的链接或副本,并在供应商调整套餐时重新检查。如果数据用于交易、合规或面向客户的决策,关键数值还应与权威来源交叉核验。

FAQ常见问题

Where can I get free stock data?

Start with exchanges and regulators for primary records, then compare free API or broker tiers for normalized quotes, history, and fundamentals.

Is free stock data real-time?

Sometimes, but often it is delayed or limited to specific venues. Always read the timestamp, entitlement, and exchange-coverage notes.

Can I download historical stock data as CSV?

Many providers support CSV export. Verify the interval, time zone, missing sessions, and whether close prices are adjusted.

Can I use free data commercially?

It depends on the license. API access does not automatically grant display, redistribution, derived-data, or commercial rights.

Which format is better: JSON or CSV?

JSON is usually easier for applications that request data repeatedly and need structured metadata. CSV is simpler for spreadsheets, bulk downloads, notebooks, and portable archives. Choose based on the workflow, then normalize field names, date formats, numeric types, and null-value rules before combining files or providers.

How do I know whether free stock data is accurate?

Test several symbols and dates against an exchange, regulator, issuer filing, or another independent source. Check timestamps, decimal precision, corporate actions, missing sessions, and update frequency. Accuracy should be monitored continuously because provider coverage and schemas can change.

哪里可以获取免费股票数据?

先从交易所和监管机构核对一手记录,再比较免费 API 或券商套餐提供的标准化行情、历史和基本面。

免费股票数据是实时的吗?

有时是,但很多数据存在延迟或仅覆盖部分市场。务必检查时间戳、授权与交易所覆盖说明。

能以 CSV 下载历史股票数据吗?

许多供应商支持 CSV。下载后要核对周期、时区、缺失交易日以及收盘价是否复权。

免费数据可以商用吗?

取决于许可证。能够调用 API 不代表自动拥有展示、再分发、衍生数据或商业使用权。

JSON 和 CSV 哪种格式更合适?

JSON 更适合需要重复请求并保留结构化元数据的应用;CSV 更适合电子表格、批量下载、Notebook 和便携归档。无论选择哪种格式,在合并多个文件或供应商之前,都应统一字段名称、日期格式、数值类型和空值规则。

如何判断免费股票数据是否准确?

选择多个股票代码和历史日期,与交易所、监管机构、上市公司申报文件或另一独立来源进行对照。重点检查时间戳、小数精度、公司行动、缺失交易日与更新频率。供应商的覆盖范围和字段结构可能变化,因此准确性检查应持续进行,而不是只在首次接入时完成。

External references外部参考链接