Free Historical
Stock Price API免费股票历史价格 API
选择与验证指南
Choose a free API by coverage, adjustment quality, frequency, and limits—then validate the data before you build.
根据市场覆盖、复权质量、时间粒度和使用限制筛选免费 API,
并在正式开发前验证数据。
TL;DR核心摘要
A good free historical stock price API covers your exchanges, date range, intervals, and symbol count without hiding essential data behind a paid tier.
At minimum, request timestamp, open, high, low, close, and volume. For return analysis, verify splits, dividends, and adjusted close.
Free plans commonly restrict calls per minute, rows per response, history depth, intraday retention, or commercial use.
Test several symbols and corporate-action dates before committing your database schema or research pipeline.
合适的免费股票历史价格 API 应覆盖所需交易所、日期范围、K 线周期和证券代码数量,并且无需升级到付费套餐即可获取关键数据。
至少应包含时间戳、开盘价、最高价、最低价、收盘价和成交量。用于收益分析时,还需核对拆股、分红和复权收盘价。
免费套餐通常会限制每分钟请求次数、单次响应返回的记录数、可查询的历史跨度和盘中数据保留期限,也可能限制商业用途。
在确定数据库结构或研究流程前,应测试多个股票代码,并重点核验拆股、分红等公司行为发生日前后的价格数据。
For long-horizon returns and portfolio research, daily adjusted OHLCV is usually the right free starting point. For charting an entry inside a session, require intraday bars with explicit interval boundaries and retention. For event studies, preserve both raw and adjusted prices plus the corporate-action events that connect them. The right API is therefore the one whose price semantics match the calculation—not simply the source with the longest advertised history.
用于长期收益和投资组合研究时,免费日线复权 OHLCV 通常是合适起点;用于还原盘中入场位置时,需要边界定义清楚且历史保留期足够的盘中 K 线;用于事件研究时,则应同时保留原始价格、复权价格,以及连接两者的公司行为记录。因此,真正合适的 API 是价格口径与计算目的相匹配的服务,而不只是宣传历史跨度最长的服务。
What historical stock price data should include股票历史价格数据应包含哪些内容
“Historical price” can mean an unadjusted daily close, a full OHLCV bar, or years of intraday candles. Define the dataset precisely before comparing providers.
“历史价格”既可能仅指未复权的每日收盘价,也可能指完整的 OHLCV K 线,或跨度长达数年的盘中 K 线数据。比较数据供应商前,应先准确界定所需数据集。
Confirm timestamp timezone, trading calendar, interval definitions, and whether zero-volume or missing sessions are omitted.
Splits and dividends change historical comparability. Check whether the API returns raw values, adjusted values, or both, and document the adjustment method.
Identify the primary listing, trading currency, regular or extended session, venue calendar, and whether a daily close means auction close, official close, last trade, or provider-selected value.
Prefer separate split and cash-distribution factors or events alongside adjusted OHLCV. Confirm whether volume is inversely adjusted, whether dividends affect every price field, and when a correction changes historical factors.
Keep stable security and listing IDs, ticker effective dates, IPO date, delisting date, exchange transfers, share-class changes, and trading halts. Today’s ticker list is not a valid historical universe.
For minute or hourly data, document event time versus receipt time, interval start or end labels, session breaks, auction prints, late trades, corrections, and whether empty intervals are omitted or emitted.
Retain provider, endpoint, request parameters, retrieval time, source timestamps, schema version, and raw response. Historical prices can be restated after corrections or later corporate-action processing.
核对时间戳所用时区、交易日历和 K 线周期定义,并确认 API 是否会省略零成交量 K 线或数据缺失的交易时段。
拆股和分红会影响不同时期价格的可比性。应确认 API 返回未复权价格、复权价格还是两者,并记录所采用的具体复权方法。
明确主要上市地、交易币种、常规或盘前盘后时段、交易场所日历,并确认日线收盘价究竟指收盘集合竞价价、官方收盘价、最后成交价,还是服务商自行选择的数值。
最好在复权 OHLCV 之外单独提供拆股与现金分配因子或事件,并确认成交量是否反向调整、现金分红是否作用于全部价格字段,以及数据更正何时会改变历史复权因子。
保存稳定的证券和上市地 ID、股票代码有效期、IPO 日期、退市日期、转板记录、股份类别变化和停牌信息。今天的股票代码名单不能直接作为历史研究样本。
分钟或小时数据应说明事件时间与接收时间、K 线以区间开始还是结束时间标记、交易时段中断、集合竞价成交、延迟成交、更正记录,以及空区间是省略还是返回空 K 线。
保留服务商、接口、请求参数、获取时间、来源时间戳、数据结构版本和原始响应。历史价格可能因成交更正或公司行为的后续处理而被重新计算。
Free historical stock price data sources to evaluate值得评估的免费股票历史价格数据来源
A provider name alone is not a recommendation. The same provider may expose daily, adjusted daily, intraday, or bulk-download products with different coverage and plan boundaries. Start with the route that matches your workload, then confirm current access, licensing, retention, and adjustment semantics in the official documentation.
仅列出供应商名称并不能构成有效推荐。同一家供应商可能分别提供日线、复权日线、盘中数据和批量下载产品,其覆盖范围与套餐边界并不相同。应先按工作负载选择路线,再到官方文档核对当前权限、许可、历史保留期和复权口径。
| Route路线 | Useful for适合用途 | Verify before choosing选择前核对 |
|---|---|---|
| Alpha Vantage | JSON or CSV time-series workflows, especially prototypes that combine prices with other documented market-data functions.需要 JSON 或 CSV 时间序列,并希望把价格与同一文档体系中的其他行情能力结合起来的原型。 | Whether the required raw or adjusted endpoint is available on the current plan, output-size limits, call frequency, and the precise adjustment fields returned.所需原始或复权接口在当前套餐中是否开放、输出规模、调用频率,以及实际返回的复权字段。 |
| Massive | US stock aggregate bars where interval construction, timestamps, and market-data context need to be explicit.需要明确 K 线周期构建、时间戳和市场数据上下文的美国股票聚合 K 线场景。 | Current free access, history window, adjusted parameter behavior, pagination, venue coverage, and commercial terms.当前免费权限、历史窗口、复权参数含义、分页、交易场所覆盖与商业条款。 |
| Stooq CSV downloadStooq CSV 下载 | Manual exploration, spreadsheets, and lightweight research that can ingest downloadable daily files.能够读取可下载日线文件的人工探索、电子表格与轻量研究。 | Symbol conventions, exchange suffixes, update schedule, adjustment basis, automation suitability, and redistribution terms.证券代码规则、交易所后缀、更新频率、复权口径、自动化适用性与再分发条款。 |
| Exchange or issuer records交易所或发行人记录 | A truth set for corporate actions, ticker history, official calendars, and disputed price dates.为公司行动、代码历史、官方交易日历和存在争议的价格日期建立真值集。 | This is usually a validation source rather than a convenient normalized API; document how each record maps to the provider series.这通常是验证来源,而不是方便的标准化 API;必须记录每条记录如何映射到供应商价格序列。 |
Do not freeze plan claims into application logic. Free quotas and endpoint access can change. Store the provider, endpoint, parameters, documentation date, and observed response contract so a later change can be diagnosed rather than mistaken for missing market data.
不要把套餐描述写死在应用逻辑中。免费额度与接口权限可能变化。应保存供应商、接口、参数、文档核对日期和实际响应契约,后续发生变化时才能定位原因,而不是误判为市场数据缺失。
Worked example: a 2-for-1 split is not a 50% loss实例:2 比 1 拆股并不代表股价亏损 50%
Assume a stock closes at $100 on Monday and begins trading at $50 on Tuesday after a 2-for-1 split. A raw close series shows 100 then 50, which looks like a −50% return. A split-adjusted series restates Monday's comparable close to $50 and usually adjusts historical volume in the opposite direction, so the economic return across the split is approximately 0% before ordinary price movement. If an API adjusts only the close but your strategy uses open, high, or low, signals can still be distorted.
假设某股票周一收盘价为 100 美元,随后进行 2 比 1 拆股,周二以 50 美元附近开始交易。未复权序列显示 100 变为 50,看上去像亏损 50%;拆股复权序列会把周一可比收盘价重述为 50 美元,并通常反向调整历史成交量,因此在不考虑普通价格波动时,拆股前后的经济收益约为 0%。如果接口只复权收盘价,而策略还使用开盘、最高或最低价,信号仍可能失真。
Cash dividends require a different decision现金分红需要单独确定口径
Suppose a stock closes at $50 before a $1 cash dividend and opens near $49 after going ex-dividend. A raw price-return series records a decline, while a total-return series treats the distribution as value received by the shareholder. Neither series is universally “correct”: charting the traded price calls for raw bars, estimating shareholder wealth calls for a documented total-return adjustment, and an event study may need both plus the dividend record. Keep the method in metadata instead of naming every transformed field simply adjusted_close.
假设某股票在派发 1 美元现金股息前收于 50 美元,除息后在 49 美元附近开盘。原始价格收益序列会记录下跌,总收益序列则把现金分配视为股东已经取得的价值。两种序列都不是所有场景下的唯一正确答案:展示实际成交价格应使用原始 K 线,估算股东财富应使用定义清楚的总收益复权,事件研究往往需要同时保留两者和股息记录。复权方法应写入元数据,不能把所有转换结果笼统命名为 adjusted_close。
How to compare free historical stock APIs如何比较免费股票历史数据 API
| Option方案 | Strength优势 | Check first优先核对 | Best fit适合场景 |
|---|---|---|---|
| Daily OHLCV API日线 OHLCV API | Long history and smaller payloads.通常可查询更长时间跨度的数据,单次响应的数据量也较小。 | Adjusted prices, delisted stocks, exchange coverage.价格复权方式、退市股票数据和交易所覆盖范围。 | Backtests and portfolio research.策略回测与投资组合研究。 |
| Intraday API盘中数据 API | Fine-grained bars for trading analysis.提供时间粒度更细的 K 线,适合交易分析。 | Retention window, call limits, market hours.数据保留期限、请求频率限制和交易时段。 | Signals, charts, and execution research.交易信号、图表分析和交易执行研究。 |
| CSV downloadCSV 下载 | Simple bulk analysis with no client library.无需安装客户端库即可进行批量分析。 | Automation, refresh cadence, file schema.能否自动化获取、数据更新频率和文件字段结构。 | Spreadsheets and one-off research.电子表格分析与一次性研究任务。 |
| Unified data tool多源数据聚合工具 | One discovery and calling layer across providers.通过统一入口查找并调用不同供应商的数据服务。 | Source transparency and normalized fields.数据来源是否透明,以及字段是否经过标准化。 | Agents and multi-source workflows.智能体与多数据源工作流。 |
Run one identical acceptance query against every candidate: a liquid stock, a recent IPO, a ticker change, a delisted security, a split, a special dividend, a foreign listing, and a day with an exchange closure or early close. Compare row counts, timestamps, currencies, raw and adjusted values, volume treatment, and revision behavior. A provider that returns HTTP 200 but omits a delisted symbol or silently changes the adjustment basis has failed the historical-price test.
可以针对所有候选服务商执行同一组验收查询:高流动性股票、新近 IPO、股票代码变更、已退市证券、拆股、特别股息、境外上市证券,以及交易所休市或提前收盘日。逐项比较记录数量、时间戳、币种、原始与复权价格、成交量处理和数据修订行为。即使接口返回 HTTP 200,只要漏掉退市证券或悄悄改变复权基准,也不能算通过历史价格验收。
Choose the API by the final calculation根据最终计算选择 API
Use raw OHLCV with a clear exchange, session, timezone, and latest completed interval. Add corporate-action markers rather than rewriting the visible traded price.
Require adjusted history or reproducible factors, dividend events, delisted securities, and point-in-time identifiers.
Preserve raw and adjusted bars, exact event dates, publication timestamps, and a control window around the event.
Prioritize long intraday retention, deterministic bar construction, session flags, corrections, and realistic data availability time.
使用明确标注交易所、时段、时区和最近完整周期的原始 OHLCV,并以公司行动标记说明事件,不要改写可见成交价。
需要复权历史或可复现的因子、股息事件、退市证券和历史时点标识。
同时保存原始与复权 K 线、准确事件日期、公开时间戳和事件前后的控制窗口。
优先考虑足够长的盘中保留期、确定性 K 线构建、交易时段标记、更正记录和真实可用时间。
A practical integration checklist实用接入检查清单
List exchanges, symbols, start date, interval, timezone, adjustment preference, fields, update cadence, and intended use.
Compare a liquid stock, a split date, a dividend date, a delisted symbol, and a non-US exchange against a trusted exchange or issuer source.
Add pagination, caching, exponential backoff, request logging, and checkpointed downloads. Never assume a free limit is permanent.
Store untouched provider rows, corporate-action events, factors, and normalized bars separately. Do not overwrite raw closes with adjusted values or discard the factor used.
Check OHLC invariants, negative or impossible prices, duplicate timestamps, missing sessions, timezone shifts, currency changes, volume spikes, and continuity around splits before publishing a series.
Fingerprint requests, checkpoint pages and symbols, freeze source versions, and record correction dates. A repeated run should explain every changed row.
Alert on schema drift, delayed updates, falling symbol coverage, quota changes, silent partial responses, and license changes; keep a documented fallback for critical workloads.
列明交易所、股票代码、起始日期、K 线周期、时区、复权方式、所需字段、更新频率和预期用途。
选取一只流动性较高的股票,并覆盖一次拆股日期、一次分红日期、一个已退市股票代码和一个非美国交易所的标的,再逐项与可信的交易所或发行人数据源核对。
加入分页、缓存、指数退避和请求日志,并采用可从检查点续传的下载机制。不要假定免费套餐的限制条件会长期不变。
将服务商原始记录、公司行为事件、复权因子和标准化 K 线分开保存,不能用复权值覆盖原始收盘价,也不能丢弃所使用的复权因子。
发布价格序列前,检查 OHLC 逻辑、负数或不可能价格、重复时间戳、缺失交易日、时区偏移、币种变化、成交量异常和拆股日前后的连续性。
为请求生成指纹,按页面和证券记录检查点,冻结数据来源版本并保存更正日期。重复运行后,每一条发生变化的记录都应能够解释。
针对结构漂移、更新延迟、证券覆盖下降、配额变化、静默返回不完整数据和许可变更设置告警,关键工作负载还应准备有文档的备用方案。
Use QVeris to discover callable market data使用 QVeris 查找可直接调用的市场数据服务
Free plans and endpoints change. QVeris helps agents discover and inspect historical-price capabilities by market, interval, date range, identifier, format, and documented provider boundary before routing a request. It can simplify capability access; the application still owns adjustment policy, trading-calendar logic, point-in-time universes, raw-data retention, quality gates, reproducibility, and licensing.
免费套餐和接口可能发生变化。QVeris 可帮助智能体在路由请求前,按市场、周期、日期范围、证券标识、格式和公开的供应商边界查找并检查历史价格能力。它能够简化能力访问,但复权政策、交易日历、历史时点证券范围、原始数据留存、质量门槛、结果复现和许可管理,仍由应用方负责。
- Search for capabilities by required market, interval, format, and action.
- Inspect tool inputs and outputs before an agent commits to a provider-specific call.
- Keep discovery and execution auditable when workflows span several financial sources.
- 根据所需市场、数据周期、数据格式和操作类型查找匹配的数据服务。
- 智能体决定调用某一供应商的接口前,先检查工具的输入要求和输出结果。
- 工作流涉及多个金融数据源时,确保服务查找和调用过程可追溯、可审计。
FAQ常见问题
Yes. Many APIs offer free daily history, but coverage, history depth, call limits, licensing, and adjusted data vary.
JSON is usually easiest for applications and Python scripts. CSV is often better for bulk downloads, spreadsheets, and reproducible archives.
可以。许多 API 免费提供日线历史数据,但市场覆盖范围、可查询的历史跨度、请求次数限制、许可条款以及复权数据的提供方式各不相同。
JSON 通常最适合应用程序和 Python 脚本;CSV 则更适合批量下载、电子表格处理以及生成可复现的归档数据集。
Adjusted close is enough for some return series, but strategy logic using opens, highs, or lows needs consistently adjusted OHLC and volume or access to the factors required to calculate them.
It depends on the series. A total-return adjustment incorporates cash distributions; a split-only series does not. Label the method and retain the dividend event rather than assuming every “adjusted” field means total return.
No. It excludes delisted and renamed securities and creates survivorship bias. Build the universe from point-in-time listing status and effective identifier history.
They may use different venues, official versus last-trade closes, sessions, currencies, correction timing, or adjustment methods. Compare metadata and raw events before deciding one value is wrong.
部分收益序列只需要复权收盘价,但如果策略使用开盘、最高或最低价,就需要口径一致的复权 OHLC 与成交量,或者能够取得自行计算这些字段所需的复权因子。
取决于序列定义。总收益复权会纳入现金分配,纯拆股复权则不会。必须标明方法并保留股息事件,不能假设所有“复权”字段都代表总收益。
不可以。这样会排除已经退市或更名的证券并产生幸存者偏差。历史证券范围应根据当时的上市状态和标识有效期构建。
它们可能采用不同交易场所、官方收盘价或最后成交价、交易时段、币种、更正时间或复权方法。判断哪一方有误前,应先比较元数据和原始事件。
