QVeris
Market Data API Guide市场数据 API 指南

Historical Stock Price API:
5 Best Options for 2026
历史股票价格 API:2026 年 5 个主流选择

Compare five historical stock price APIs by adjusted OHLCV, intraday depth, corporate actions, licensing, and backtesting integrity—then choose the right fit for your workload.

从复权 OHLCV、分钟历史深度、公司行动、授权和回测完整性出发,对比 5 个历史股票价格 API,并按实际任务选择合适的数据源。

Historical stock price API workflow showing symbol and date inputs, provider inspection, adjusted OHLCV data, validation, storage, and research output

TL;DR

Best for simple daily history

Start with Alpha Vantage or Tiingo when the core requirement is documented daily OHLCV plus corporate-action context.

Best for U.S. intraday pipelines

Massive is the stronger shortlist candidate when you need U.S. aggregates, trades, quotes, or bulk-oriented delivery.

Best for broad product coverage

Compare Twelve Data for global multi-asset workflows and FMP when historical prices must sit beside company fundamentals.

No universal winner

Benchmark the exact endpoint, history window, adjustment policy, quota, correction behavior, and license your application needs.

简单日线优先看

如果核心需求是日线 OHLCV 与公司行动,可先比较 Alpha Vantage 和 Tiingo 的公开数据契约。

美国盘中数据优先看

需要美国市场聚合 K 线、成交、报价或批量数据流程时,可把 Massive 放入首轮候选。

广覆盖任务优先看

全球多资产场景可比较 Twelve Data;需要把历史价格与公司基本面结合时,可比较 FMP。

没有通用第一名

必须用真实端点、历史区间、复权规则、配额、修订机制和授权条件测试,而不是只看品牌或免费额度。

Historical stock price API types and search intent历史股票价格 API 的类型与使用需求

“Historical stock price API” covers four different buying intents: end-of-day bars for charts, adjusted daily history for returns, intraday bars for strategy research, and trades or quotes for market microstructure. Write down the output contract and decision horizon first; only then compare providers.

“历史股票价格 API”背后至少有四类需求:图表用日线、收益计算用复权日线、策略研究用分钟 K 线,以及微观结构研究用逐笔成交或报价。先写清输出契约和决策周期,再比较供应商。

Data type数据类型Typical fields典型字段Best use适合用途Main risk主要风险
EOD / dailyOHLCV, date, adjusted closeCharts, portfolio returns, screening图表、组合收益、股票筛选Adjustment policy and delayed corrections复权方法与盘后修订
Intraday bars1m–4h OHLCV, session, VWAPBacktesting, alerts, execution research回测、预警、执行研究History limits, missing bars, session rules历史深度、缺失 K 线、交易时段
Trades and quotesPrice, size, exchange, conditions, timestampLiquidity and microstructure analysis流动性与市场微观结构分析Large volume and exchange licensing数据量巨大与交易所授权
Corporate actionsSplits, dividends, ex-date, factorsAdjusted history and total-return analysis复权历史与总回报分析Revisions and provider methodology differences数据修订与供应商方法差异

Daily data or intraday historical bars?应该选择日线还是历史分钟 K 线?

Choose daily bars when decisions are made over days, weeks, or months; they are cheaper to store and easier to reconcile against splits and dividends. Choose intraday bars only when entry timing, session boundaries, or execution assumptions materially change the result. Minute data adds missing-bar rules, pre/post-market policy, daylight-saving changes, and much heavier validation.

决策周期以天、周或月为单位时,优先选择日线:存储成本更低,也更容易核对拆股和分红。只有入场时点、交易时段边界或成交假设会实质改变结果时,才选择分钟 K 线。分钟数据会额外引入缺失 K 线、盘前盘后、夏令时和更重的数据验证工作。

Fields every historical stock data API should expose股票历史数据 API 应提供哪些字段

Treat the response as a data contract, not a bag of numbers. Every bar must identify the instrument, exchange calendar, currency, timezone, interval, adjustment state, and source. A close value without that context cannot be reproduced or safely compared across providers.

把响应视为数据契约,而不是一组数字。每根 K 线都应说明证券身份、交易所日历、币种、时区、粒度、复权状态和来源。缺少这些上下文的 close 无法复现,也不能安全地跨供应商比较。

Identity

Ticker plus a stable identifier, exchange, currency, asset type, and active/delisted status.

Time

Trading date, timezone, session, interval, and whether the timestamp marks bar open or close.

Price

Open, high, low, close, volume, and optionally VWAP, trade count, bid, and ask.

Adjustments

Adjusted close or adjusted OHLCV, split factor, dividend amount, and methodology.

Lineage

Source, update time, revision status, exchange conditions, and provider-specific quality flags.

Pagination

Next cursor, result limit, total count, sort direction, and deterministic date boundaries.

证券身份

股票代码、稳定标识符、交易所、币种、资产类型,以及上市或退市状态。

时间规则

交易日期、时区、交易时段、时间粒度,以及时间戳代表 K 线开始还是结束。

价格字段

开盘、最高、最低、收盘、成交量,以及可选的 VWAP、成交笔数、买价和卖价。

复权信息

复权收盘价或复权 OHLCV、拆股系数、分红金额,以及具体复权方法。

数据血缘

来源、更新时间、修订状态、交易条件,以及供应商提供的数据质量标记。

分页规则

下一页游标、返回数量、总数、排序方向和明确的日期边界。

Adjusted close vs raw close复权收盘价与原始收盘价有什么区别?

Raw close is the observed session close; adjusted close rewrites earlier values for corporate actions. The word “adjusted” is incomplete unless the provider states whether it covers splits, dividends, or both. Preserve raw bars and action events whenever possible. Tiingo, for example, documents raw and adjusted OHLCV beside dividend and split factors in its official end-of-day API documentation.

原始收盘价是当日实际观察到的收盘价格;复权收盘价会根据公司行动改写更早的数值。除非供应商明确说明处理拆股、分红还是两者都处理,否则“adjusted”并不是完整契约。尽量同时保存原始 K 线和公司行动事件。Tiingo 的官方日线 API 文档就把原始与复权 OHLCV、分红和拆股系数放在同一数据说明中。

5 best historical stock price API options5 个值得优先比较的历史股票价格 API

The five options below solve different jobs; this is a decision shortlist, not a permanent price ranking. Capabilities are based on current public documentation. Test the exact endpoint and verify plan entitlements, exchange coverage, adjustment logic, quotas, and data rights before committing.

下面 5 个候选解决的任务不同,这是一份选型清单,不是永久价格排名。能力说明依据当前公开文档;正式接入前仍要测试目标端点,并确认套餐权限、交易所覆盖、复权逻辑、配额和数据使用权。

APIDocumented strengths文档中的主要能力Best fit适合场景Verify before use接入前确认
Alpha VantageDocuments 20+ years of daily stock history, plus raw OHLCV, adjusted close, split and dividend events, JSON, and CSV.公开文档说明日线历史超过 20 年,并提供原始 OHLCV、复权收盘价、拆股、分红、JSON 和 CSV。Prototypes, notebooks, simple daily-history integrations原型、Notebook 与简单日线历史接入Adjusted endpoint entitlement, full output access, rate limits复权端点权限、完整输出权限与限流
MassiveCustom U.S. stock OHLC bars, adjustable intervals, split-adjusted output, trades, quotes, and pagination-oriented pipelines.美国股票自定义 OHLC K 线、灵活粒度、拆股复权输出,以及成交、报价和分页数据流程。U.S. intraday research and larger ingestion pipelines美国盘中研究与较大规模采集流程Plan history, empty intervals, session policy, data rights套餐历史深度、空区间、交易时段与数据权利
Twelve DataA time-series contract across equities and other asset classes, flexible intervals, metadata, REST, and SDK access.面向股票与其他资产的时间序列契约,提供灵活粒度、元数据、REST 和 SDK。Global or multi-asset dashboards and research tools全球或多资产仪表盘与研究工具Per-market coverage, credit consumption, exchange entitlement各市场覆盖、点数消耗与交易所权限
TiingoRaw and adjusted EOD OHLCV, cash dividends, split factors, metadata, and documented correction handling.原始与复权日线 OHLCV、现金分红、拆股系数、证券元数据和公开的数据修订说明。Adjusted daily history, return series, portfolio analytics复权日线、收益序列与组合分析Ticker universe, update timing, storage and redistribution rights证券覆盖、更新时间、存储与再分发权利
FMPFull and light EOD endpoints, unadjusted and dividend-adjusted variants, intraday intervals, VWAP, and adjacent fundamentals.完整与轻量日线端点、未复权与分红复权版本、分钟粒度、VWAP,并可结合基本面。Research products combining price and company data同时使用价格与公司数据的研究产品Endpoint differences, adjustment variant, plan availability端点差异、复权版本与套餐可用性

Comparison basis: public provider documentation reviewed August 3, 2026. This table does not guarantee QVeris availability for every provider and does not replace current plans, exchange terms, or licenses.

比较依据:2026 年 8 月 3 日查阅的供应商公开文档。本表不保证 QVeris 当前提供每个供应商,也不能替代最新套餐、交易所条款或授权协议。

What about a free historical stock price API?免费历史股票价格 API 是否够用?

Free access is useful for validating schemas, chart rendering, and small personal datasets. It is not a proxy for production suitability. Check whether the free plan includes the endpoint you need, how much history it returns, whether data is delayed, whether adjusted prices are included, and whether commercial storage or redistribution is permitted. Do not design a production database around a quota that you have not load-tested.

免费访问适合验证字段、图表渲染和小规模个人数据集,但不能代表适合生产。需要确认免费套餐是否包含目标端点、历史深度、延迟情况、是否提供复权价格,以及能否用于商业存储或再分发。没有经过负载测试的配额,不应直接成为生产数据库的基础。

How to get historical stock prices with an API in Python如何用 Python 调用历史股票价格 API

Put provider-specific request and parsing logic behind an adapter. The rest of the application should receive one normalized bar contract even when upstream field names, authentication, pagination, or adjustment flags differ. This example keeps the endpoint and key configurable and validates required fields before storage.

把供应商特有的请求和解析逻辑放在适配器后面。即使上游字段名、鉴权、分页或复权标志不同,应用其余部分仍只接收一种标准 K 线契约。下面的示例把端点和密钥配置化,并在入库前验证必填字段。

Python · request and validatePython · 请求与验证
import os
from datetime import date
import requests

API_URL = os.environ["HISTORICAL_STOCK_API_URL"]
API_KEY = os.environ["HISTORICAL_STOCK_API_KEY"]

response = requests.get(
    API_URL,
    params={
        "symbol": "AAPL",
        "start": "2025-01-01",
        "end": date.today().isoformat(),
        "interval": "1day",
        "adjusted": "true",
    },
    headers={"Authorization": f"Bearer {API_KEY}"},
    timeout=20,
)
response.raise_for_status()
payload = response.json()

# Implement this adapter from the inspected provider schema.
bars = extract_bars(payload)
required = {"timestamp", "open", "high", "low", "close", "volume"}

for bar in bars:
    missing = required.difference(bar)
    if missing:
        raise ValueError(f"Missing fields: {sorted(missing)}")

print(f"validated {len(bars)} historical bars")

Normalize before storing the response为什么入库前必须标准化?

Normalize symbol identifiers, timestamps, timezone, interval labels, numeric precision, null values, and adjustment flags before storage. Preserve the provider name and retrieval timestamp for lineage. Use a unique key such as instrument ID + interval + bar timestamp, and make ingestion idempotent so corrected bars can be safely upserted.

入库前应统一证券标识、时间戳、时区、粒度名称、数值精度、空值和复权标志,同时保存供应商名称与抓取时间用于追踪。可以用“证券 ID + 时间粒度 + K 线时间戳”作为唯一键,并让写入过程具备幂等性,以便安全更新供应商后续修订的数据。

Handle pagination, retries, and rate limits如何处理分页、重试和限流?

Request bounded date windows, persist the last successful cursor, retry only transient failures, and add jittered backoff for 429 and 5xx responses. Do not retry authentication, entitlement, or invalid-symbol errors indefinitely. Cache immutable historical windows, but schedule a short correction window for recent sessions because vendors may update late trades or corporate actions.

请求时应限制日期窗口,保存最后一次成功游标,只重试临时性错误,并针对 429 与 5xx 使用带随机抖动的退避。鉴权失败、权限不足和无效代码不能无限重试。较早历史区间可以长期缓存,但最近几个交易日应保留修订窗口,因为供应商可能补充迟到成交或更新公司行动。

Historical market data quality checklist历史市场数据质量检查清单

A 200 response proves transport, not research quality. Before accepting a provider, run a fixed validation set containing known splits, dividends, holidays, missing sessions, symbol changes, and delisted securities.

HTTP 200 只能证明传输成功,不能证明数据适合研究。接入供应商前,应使用包含已知拆股、分红、节假日、缺失交易日、代码变更和退市证券的固定样本做验证。

Trading calendar and timezone

Confirm that bars align with the listing exchange, holidays, half-days, daylight-saving changes, and pre/post-market policy.

Corporate-action reconciliation

Test known split and dividend dates. Compare raw and adjusted values and verify whether volume is adjusted consistently.

Missing and duplicate bars

Detect gaps against the expected calendar, duplicate timestamps, zero-volume anomalies, impossible OHLC relationships, and outlier returns.

Point-in-time integrity

Backtests need the data that would have been knowable on each date, not today's cleaned universe projected backward.

Delisted securities and symbol history

Exclude them and survivorship bias appears. Store stable identifiers and symbol-effective dates instead of treating tickers as permanent IDs.

Licensing and retention

Confirm whether your plan permits internal storage, customer display, derived analytics, redistribution, or model training.

交易日历与时区

确认 K 线与上市交易所、节假日、半日市、夏令时变化,以及盘前盘后数据规则一致。

公司行动核对

使用已知拆股和分红日期测试原始值与复权值,并检查成交量是否采用一致的复权方式。

缺失与重复 K 线

根据预期交易日历发现缺口、重复时间戳、零成交量异常、不可能的 OHLC 关系和极端收益。

时点数据完整性

回测需要使用当时能够获得的数据,而不是把今天清洗后的股票池直接投射到历史。

退市证券与代码历史

忽略退市证券会引入幸存者偏差。应保存稳定标识符和代码生效日期,而不是把 ticker 当作永久 ID。

授权与数据保留

确认套餐是否允许内部存储、面向客户展示、衍生分析、再分发或模型训练。

Avoid look-ahead and survivorship bias如何避免前视偏差与幸存者偏差?

Do not build a 2018 backtest from the companies that survive in an index today. Use point-in-time constituents, include delisted securities, and separate event date from the date your system could have received the event. Corporate-action corrections can also rewrite historical bars, so keep ingestion timestamps and dataset versions for reproducibility.

不能用今天仍在指数中的公司构建 2018 年的回测股票池。应使用历史时点成分股、包含退市证券,并区分事件发生日期与系统真正能够接收到事件的日期。公司行动修订也可能改变历史 K 线,因此需要保存抓取时间和数据集版本,保证结果可复现。

Use QVeris to discover and call historical stock data capabilities使用 QVeris 发现并调用股票历史数据能力

QVeris does not replace market-data due diligence. It gives an agent a consistent workflow for discovering candidate capabilities, inspecting the current input/output contract and cost signals, and calling the selected tool without baking discovery logic into the application.

QVeris 不能替代行情数据尽调。它为 Agent 提供一致的能力流程:发现候选数据能力、检查当前输入输出契约与成本信号,再调用选定工具,避免把能力发现逻辑硬编码到应用中。

Important: QVeris is not presented here as the original exchange data source. Available providers, schemas, fields, prices, and entitlements are dynamic. Use Discover to find candidates, Inspect to verify the current contract, and Call only after the capability fits your task.

重要说明:QVeris 并不是这里所述交易所行情的原始数据源。可用供应商、字段结构、价格和权限会动态变化。应先 Discover 查找候选能力,再 Inspect 确认当前调用契约,最后在满足任务要求后执行 Call。

1. Discover

Describe the outcome: “daily adjusted OHLCV for U.S. equities with split and dividend context,” rather than searching only by provider name.

2. Inspect

Review required parameters, output schema, adjustment fields, date limits, cost signals, and examples before writing production logic.

3. Call and validate

Submit structured parameters, validate the returned dates and fields, and record the selected capability and execution identifier in your lineage log.

1. Discover

描述实际结果,例如“包含拆股和分红信息的美国股票日线复权 OHLCV”,而不是只按供应商名称搜索。

2. Inspect

在编写生产逻辑前检查必填参数、输出结构、复权字段、日期限制、成本信号和示例。

3. Call 与验证

提交结构化参数,验证返回日期与字段,并在数据血缘日志中记录选定能力和执行标识。

Start with the QVeris REST API reference, review the Python SDK, or browse related guidance on free stock APIs and real-time stock price APIs.

可以从 QVeris REST API 参考开始,查看 Python SDK,也可以继续阅读免费股票 API 对比实时股票价格 API

Historical stock price API selection checklist历史股票价格 API 选型清单

  • Coverage: exchanges, countries, asset types, delisted securities, ETFs, and identifier history.
  • Depth: earliest date, daily vs intraday retention, and whether complete history requires another plan.
  • Adjustments: split-only or split-and-dividend, adjusted close or adjusted OHLCV, and revision policy.
  • Delivery: REST, SDK, CSV, bulk files, pagination, compression, and multi-symbol requests.
  • Operations: quotas, timeout behavior, status visibility, support, corrections, and versioning.
  • Rights: internal use, commercial display, storage, redistribution, derived data, and model training.
  • Migration: stable internal schema, provider adapter, cached raw payloads, and a tested fallback plan.
  • 覆盖范围:交易所、国家、资产类型、退市证券、ETF 与证券标识历史。
  • 历史深度:最早日期、日线与分钟数据保留期,以及完整历史是否需要更高套餐。
  • 复权方式:只处理拆股还是包含分红,提供复权收盘价还是完整复权 OHLCV,以及修订规则。
  • 交付方式:REST、SDK、CSV、批量文件、分页、压缩和多证券请求。
  • 运行保障:配额、超时、状态可见性、支持、数据修订和版本管理。
  • 使用权利:内部使用、商业展示、存储、再分发、衍生数据和模型训练。
  • 迁移能力:稳定内部结构、供应商适配器、原始响应缓存和经过测试的替代方案。

Historical stock price API FAQ历史股票价格 API 常见问题

What is a historical stock price API?

It returns time-series market data for a security, usually timestamps and OHLCV. Depending on the provider, it may also include adjusted prices, dividends, splits, trades, quotes, or metadata.

What fields should the API return?

Require symbol, stable identifier, exchange, currency, timestamp, interval, open, high, low, close, volume, and adjustment status. Backtests usually need corporate actions and delisted securities too.

What is adjusted close?

It is a historical close restated for corporate actions. Providers differ on whether they adjust for splits only or also dividends, so verify the methodology.

Can I use a free API?

Yes for many prototypes and small research tasks. Before production use, check limits, history depth, delayed data, commercial rights, corrections, and support.

How do I get prices in Python?

Call a dated REST endpoint, validate the status and schema, normalize the returned bars, and store them with provider and retrieval metadata. Keep keys in environment variables.

Is price history enough for backtesting?

No. You also need point-in-time universes, corporate actions, delisted names, market calendars, trading costs, and controls for look-ahead and survivorship bias.

Daily data or minute bars?

Use daily bars for longer-horizon analysis and reporting. Use intraday bars only when the strategy depends on within-session timing and you can model execution realistically.

How does QVeris help?

QVeris helps agents discover candidate capabilities, inspect their current schemas and cost signals, and call a selected capability through one protocol.

什么是历史股票价格 API?

它返回证券的时间序列行情,通常包括时间戳与 OHLCV。不同供应商还可能提供复权价格、分红、拆股、成交、报价和证券元数据。

API 应该返回哪些字段?

至少需要代码、稳定标识、交易所、币种、时间戳、粒度、开高低收、成交量和复权状态。回测还需要公司行动与退市证券。

什么是复权收盘价?

它是根据公司行动重新表述后的历史收盘价。供应商可能只处理拆股,也可能包含分红,因此必须确认具体方法。

可以使用免费 API 吗?

许多原型和小型研究可以使用。生产接入前,需要确认限额、历史深度、延迟、商业权利、数据修订和支持。

如何用 Python 获取历史股价?

调用带日期范围的 REST 端点,验证状态和字段,标准化 K 线,再连同供应商与抓取时间一起保存。密钥应放在环境变量中。

历史价格足够用于回测吗?

不够。还需要时点股票池、公司行动、退市证券、交易日历、交易成本,以及避免前视和幸存者偏差的控制。

选择日线还是分钟 K 线?

中长期分析和报告优先使用日线。只有策略依赖盘中时点,并且能够真实建模成交时,才使用分钟数据。

QVeris 如何提供帮助?

QVeris 帮助 Agent 发现候选能力、检查当前字段结构和成本信号,并通过统一协议调用选定能力。

Official documentation and related guides官方文档与相关指南