Choose a Free Crypto Historical Data API
for Prices and OHLCV选择适合价格分析与回测的
免费加密货币历史数据 API
Compare crypto price and candle APIs by coverage, history, free limits, and provenance—then request and validate the data safely.
按币种覆盖、K线周期、历史范围、免费额度与来源比较加密货币历史行情 API,
再安全请求并校验价格与 OHLCV。
Free crypto historical data API: quick answer免费加密货币历史数据 API:快速结论
Timestamped open, high, low, close, and volume candles for a symbol, interval, and time range.
Free tiers differ in API keys, rate limits, historical depth, asset coverage, granularity, and commercial-use terms.
Check whether candles represent an exchange pair, an aggregate, or on-chain liquidity—and whether volume units are base or quote currency.
Choose the source that matches your market, interval, history, and refresh needs; normalize before charting or backtesting.
按交易对、周期和时间范围返回带时间戳的开、高、低、收与成交量 K线。
不同免费层在 API Key、频率限制、历史深度、币种覆盖、粒度与商用条款上差异明显。
数据究竟来自单一交易所、聚合市场还是链上流动性池,并确认成交量使用基础币还是计价币。
按市场、周期、历史范围与刷新需求选源,并在制图或回测前统一字段与时间戳。
What a crypto historical data API can return加密货币历史数据 API 可以返回哪些数据
“Crypto historical data” can mean a daily coin price, exchange-specific OHLCV candles, an aggregated reference price, market-cap history, or on-chain metrics. These outputs are not interchangeable. Define the dataset before comparing free APIs so a convenient endpoint does not silently change the question you are trying to answer.
“加密货币历史数据”可能指币种每日价格、某一交易所的 OHLCV K线、聚合参考价格、市值历史或链上指标。这些数据不能互相替代。比较免费 API 前应先定义数据集,避免因为某个端点调用方便而悄然改变原本要回答的问题。
Historical crypto prices加密货币历史价格序列
A price-history endpoint commonly returns timestamp and price pairs for a coin ID such as bitcoin, a quote currency such as USD, and a date range or number of days. This format is compact and useful for charts, returns, correlations, and portfolio reporting. Check whether the price is a provider aggregate, an index, or a specific exchange market.
历史价格端点通常根据 bitcoin 等币种 ID、USD 等计价货币,以及日期范围或天数返回时间戳与价格。它适合行情图、收益率、相关性和组合报告。需要确认该价格是供应商聚合价、指数价,还是某个具体交易所市场的成交价。
Crypto OHLCV and candle data加密货币 OHLCV 与 K线数据
Candles add open, high, low, close, and volume for each interval. They are better suited to technical indicators and backtesting, but require an exact market definition: BTC/USD or BTC/USDT, venue, spot or derivative, interval boundary, volume unit, and whether the current candle is final.
K线按周期增加开盘价、最高价、最低价、收盘价与成交量,更适合技术指标和策略回测。但必须明确 BTC/USD 或 BTC/USDT、交易场所、现货或衍生品、周期边界、成交量单位,以及当前 K线是否已经结束。
Market cap, volume, and supply history市值、成交量与供应量历史
Some market-data APIs return price, market capitalization, and 24-hour volume in parallel arrays. These are useful for market reports but should not be confused with the traded volume inside one exchange candle. Supply fields may also differ by circulating, total, or maximum supply methodology.
部分行情 API 会并行返回价格、市值与 24 小时成交量,适合市场报告,但不能把它与某一交易所单根 K线内的实际成交量混为一谈。供应量字段也可能分别采用流通量、总量或最大供应量口径。
On-chain crypto history is a separate dataset加密货币链上历史属于另一类数据
Block height, transaction count, fees, hashrate, difficulty, UTXO statistics, and address activity come from blockchain or on-chain analytics sources. They may explain network conditions, but they do not replace market price candles. Keep market and network datasets separately identified when joining them by time.
区块高度、交易笔数、手续费、算力、难度、UTXO 统计和地址活动来自区块链或链上分析数据源。它们可以解释网络状态,但不能代替市场价格 K线。按时间关联两类数据时,应分别保留市场数据与网络数据的来源标识。
If your requirement is narrower, use the dedicated QVeris guides for a free crypto OHLCV API, a free live crypto data API, or a free Bitcoin historical data API. Keeping those intents separate prevents a broad historical-data page from competing with specialist pages.
如果需求更具体,可阅读 QVeris 的免费加密货币 OHLCV API、免费实时加密货币数据 API或免费比特币历史数据 API专题。分开承载这些意图,可以避免综合历史数据页与专门页面相互竞争。
| Dataset数据集 | Typical fields常见字段 | Best suited to适合场景 | Key ambiguity关键歧义 |
|---|---|---|---|
| Price history价格历史 | timestamp, price | Charts, returns, reporting行情图、收益率、报告 | Aggregate or venue price聚合价或场所价格 |
| OHLCV | time, open, high, low, close, volume | Indicators and backtests指标与策略回测 | Market, boundary, volume unit市场、边界、成交量单位 |
| Market history市场历史 | price, market cap, 24h volume | Market research市场研究 | Provider methodology供应商计算方法 |
| On-chain history链上历史 | blocks, fees, hashrate, UTXO | Network analysis网络分析 | Indexing and metric definition索引与指标定义 |
What developers need from a crypto historical price API开发者需要加密货币历史行情 API 完成什么任务
Build a point-in-time crypto asset universe构建时点一致的加密资产范围
This page targets multi-asset history rather than one Bitcoin series or candle mechanics. Historical research must know which assets existed and were investable on each date. Stable internal IDs should survive ticker reuse, token renames, chain migrations, contract swaps, redenominations, mergers, and delistings. Selecting today’s surviving top coins and fetching their past prices creates survivorship bias before the backtest begins.
本页聚焦多资产历史,不只研究一条比特币序列,也不专门讨论 K线构造。历史研究必须知道每个日期有哪些资产真实存在且可投资。稳定内部 ID 应能跨越代码复用、代币更名、链迁移、合约替换、面额调整、合并和退市。若先选出今天仍存续的热门币种再抓取历史价格,回测开始前就已经产生幸存者偏差。
A symbol is not a durable asset identifier. Store provider ID, network, contract address, migration lineage, active dates, and quote market. The same ticker can identify unrelated tokens, while one project can have several contracts or wrapped representations.
交易代码不是持久资产标识。应保存供应商 ID、网络、合约地址、迁移关系、有效日期和计价市场。同一代码可能代表无关代币,一个项目也可能拥有多个合约或封装资产。
Worked survivorship example: a missing failure can reverse the result幸存者偏差示例:遗漏失败资产会反转回测结论
Assume an equal-weight portfolio legitimately contained assets A, B, and C at the start of a historical period. A returned +20%, B returned +10%, and C later lost all tradable value after liquidity disappeared and its markets were delisted. The point-in-time portfolio return is (20% + 10% − 100%) ÷ 3 = −23.3%. If a researcher begins with today’s surviving asset list, C is absent and the same period appears to return (20% + 10%) ÷ 2 = +15%. Dropping one failed asset has changed a losing result into a profitable one.
Keep C in the historical universe through its real eligibility dates and apply a documented terminal-value policy using the last executable market, recovery value, migration consideration, or zero only when the evidence supports it. Distinguish a delisting from a token contract migration: a migration may require linking old and new contracts with a conversion ratio, while an unsupported or illiquid market may require ending eligibility without declaring the economic asset worthless. Store the venue, pair, last usable quote, liquidity evidence, inactive reason, and decision version so the terminal return can be audited.
幸存者偏差示例:遗漏失败资产会反转回测结论
假设某个历史期初的等权组合真实包含 A、B、C 三种资产。A 的收益为 +20%,B 为 +10%;C 后来因流动性消失并被交易市场下架,最终失去全部可交易价值。按当时真实资产范围计算,组合收益为 (20% + 10% − 100%) ÷ 3 = −23.3%。如果研究人员先从今天仍存续的资产名单出发,C 会被排除,同一期间就会显示为 (20% + 10%) ÷ 2 = +15%。只漏掉一个失败资产,就能把亏损策略改写成盈利策略。
历史资产范围应在 C 真实符合条件的日期内一直保留它,并依据书面规则采用最后可成交市场、清算或回收价值、迁移对价,或仅在证据支持时采用零作为终值。下架与代币合约迁移必须区分:迁移通常需要按兑换比例关联新旧合约;某个市场停止支持或失去流动性,则可能只代表该交易对不再符合条件,并不等于经济资产本身归零。应保存交易场所、交易对、最后可用报价、流动性证据、失效原因和决策版本,使终值收益可以复核。
Historical datasets needed for a multi-asset study多资产研究需要的历史数据层
Maps stable IDs to symbols, names, networks, contracts, launch dates, migration events, and inactive dates. It is the foundation for every historical join.
把稳定 ID 映射到代码、名称、网络、合约、上线日、迁移事件和失效日,是所有历史关联的基础。
Records which exchanges and pairs were active on each date, including markets that later closed or delisted the asset.
记录每个日期活跃的交易所与交易对,包括后来关闭或将资产退市的市场。
Tracks circulating supply, unlocks, burns, redenominations, token merges, and contract swaps so returns and market-cap history are interpretable.
跟踪流通量、解锁、销毁、面额调整、代币合并和合约替换,确保收益率与市值历史可以解释。
Freezes provider methodology and repaired values for a reproducible research run instead of silently inheriting future data revisions.
冻结供应商方法和修复后的数值,使研究可以复现,而不是静默继承未来的数据修订。
Understand the candle before comparing prices比较价格前先弄清一根 K线的定义
- Time boundary: determine whether the timestamp marks candle open or close and whether intervals align to UTC.
- Price basis: distinguish exchange trades, volume-weighted aggregates, index prices, mark prices, and DEX swap prices.
- Volume basis: identify base-asset volume, quote-currency volume, trade count, or provider-calculated volume.
- Incomplete candles: decide whether to exclude the current still-forming candle from indicators and backtests.
- 时间边界:确认时间戳代表 K线开始还是结束,以及周期是否按 UTC 对齐。
- 价格口径:区分交易所成交价、成交量加权聚合价、指数价格、标记价格和 DEX 兑换价格。
- 成交量口径:确认是基础币成交量、计价币成交额、成交笔数,还是供应商计算值。
- 未完成 K线:技术指标与回测通常应排除仍在形成的当前 K线。
Compare crypto history APIs by point-in-time universe integrity按时点资产范围完整性比较加密货币历史 API
| Decision判断项 | Check检查内容 | Why it matters为何重要 |
|---|---|---|
| Asset identity资产身份 | Stable ID, network, contract, symbol history, migration links稳定 ID、网络、合约、代码历史与迁移关系 | Symbols are reused and one project can span contracts.代码会被复用,一个项目也可能跨多个合约。 |
| Inactive assets失效资产 | Delisted tokens, closed markets, dead contracts, inactive dates退市代币、关闭市场、失效合约与终止日期 | Excluding failures creates survivorship-biased returns.排除失败资产会制造幸存者偏差。 |
| Universe snapshots资产范围快照 | Members and rank inputs available for every rebalance date每个调仓日可用的成员与排名输入 | Today’s ranking cannot define a historical portfolio.不能用今天的排名定义历史组合。 |
| Lifecycle events生命周期事件 | Launch, migration, redenomination, merge, burn, unlock上线、迁移、面额调整、合并、销毁与解锁 | Unadjusted events can appear as extreme returns.未经处理的事件可能被误认为极端收益。 |
| Quote consistency计价一致性 | USD, stablecoin, BTC quote, FX conversion path美元、稳定币、BTC 计价与外汇换算路径 | Nominally similar quotes can diverge under stress.压力时期名义相近的计价资产会发生偏离。 |
| Revisions数据修订 | Backfills, provider methodology changes, versioned snapshots回补、供应商方法变化与版本快照 | A result must remain reproducible after provider repairs.供应商修复数据后,研究结果仍应可以复现。 |
| Bulk economics批量成本 | Assets × dates × markets × fields, export and storage rights资产数 × 日期 × 市场 × 字段,以及导出与存储权 | A multi-asset history can exceed free limits quickly.多资产历史很快会超过免费额度。 |
Choose the history layer before the provider先选择历史数据层,再选择供应商
Use it to resolve identity and lifecycle across symbols, networks, contracts, wrappers, migrations, and inactive dates before joining any prices.
用于在关联价格前解析代码、网络、合约、封装资产、迁移和失效日期之间的身份与生命周期。
Provides exchange listings, pair active periods, quote currencies, venue status, and delisting history for historical eligibility tests.
提供交易所上市、交易对有效期、计价币、场所状态和退市历史,用于历史可投资性测试。
Supports consistent daily or intraday observations across a defined universe. Verify missing-value policy and whether inactive assets remain queryable.
为明确资产范围提供一致的日频或盘中观测。应验证缺失值政策,以及失效资产能否继续查询。
Adds unlocks, burns, migrations, redenominations, forks, and supply changes needed to interpret market cap and apparent returns.
补充解锁、销毁、迁移、面额调整、分叉和供应量变化,用于解释市值与表面收益。
A practical free-tier selection checklist免费层选型检查清单
Define eligibility from information available on each rebalance date, including active market, liquidity, age, and excluded asset types.
只使用每个调仓日当时可获得的信息定义资格,包括活跃市场、流动性、资产年龄和排除类型。
Query known delistings, ticker collisions, contract swaps, and zero-liquidity periods. A successful request for BTC proves almost nothing about universe integrity.
查询已知退市、代码冲突、合约替换和零流动性时期。成功获取 BTC 并不能证明资产范围完整。
Store the asset-master snapshot, mapping rules, lifecycle events, and any return adjustment used by the research run.
保存研究所用的资产主数据快照、映射规则、生命周期事件和收益调整方法。
Estimate API calls and rows across all assets and dates, then verify bulk export, caching, research, and derived-data permissions.
按全部资产和日期估算调用量与行数,再确认批量导出、缓存、研究与衍生数据权限。
How to get crypto historical data with an API in Python如何用 Python API 获取加密货币历史数据
A provider-neutral request and validation workflow与供应商无关的请求与校验流程
Before writing client code, record a small data contract: coin or pair identifier, quote currency, venue if applicable, price or OHLCV output, interval, inclusive start and exclusive end, timezone, maximum acceptable staleness, and required provenance fields. This makes it possible to compare providers against the same requirement.
编写客户端代码前,先记录一个小型数据契约:币种或交易对标识、计价货币、交易场所(如适用)、价格或 OHLCV 输出、周期、包含的开始时间与不包含的结束时间、时区、最大可接受延迟,以及必须保存的来源字段。这样才能在同一需求下比较不同供应商。
import requests
import pandas as pd
params = {"symbol": "BTC-USD", "interval": "1h",
"start": "2026-07-01", "end": "2026-07-07"}
rows = requests.get(API_URL, params=params, timeout=20).json()
df = pd.DataFrame(rows)
df["timestamp"] = pd.to_datetime(df["timestamp"], utc=True)
df = df.sort_values("timestamp").drop_duplicates("timestamp")
assert {"open", "high", "low", "close", "volume"} <= set(df.columns)Confirm whether it expects a coin ID, exchange symbol, base/quote pair, contract address, or pool address.
Use explicit UTC boundaries and a supported interval; paginate without overlapping or skipping candles.
Rename fields, parse timestamps, sort, deduplicate, inspect gaps, and record the provider and market provenance.
确认接口使用币种 ID、交易所符号、基础币/计价币、合约地址还是流动性池地址。
使用 UTC 边界和受支持的周期,分页时避免 K线重复或跳过。
统一字段、解析时间戳、排序、去重、检查缺口,并记录供应商与市场来源。
Pagination, rate limits, and retry safety分页、限频与安全重试
Historical endpoints often cap the number of candles returned per call. Advance the next request from the last confirmed timestamp, use the provider’s documented inclusive or exclusive boundary, and deduplicate after concatenation. For 429 and temporary 5xx responses, respect Retry-After, apply bounded exponential backoff, and never retry invalid parameters indefinitely.
历史接口通常限制单次返回的 K线数量。下一页应从最后一个已确认时间戳继续,并按文档区分包含或不包含边界;拼接后再次按时间戳去重。遇到 429 或临时 5xx 时,应遵循 Retry-After、使用有上限的指数退避,且不要无限重试错误参数。
Store the raw response before transforming it. Keep request parameters, retrieval time, final URL or endpoint version, response headers relevant to limits, and a checksum or immutable raw file. When a provider revises historical candles, this record lets you reproduce why a chart or backtest changed.
转换前先保存原始响应。同时保存请求参数、获取时间、最终 URL 或端点版本、与限频相关的响应头,以及校验和或不可变原始文件。当供应商修订历史 K线时,这些记录可以解释行情图或回测结果为什么发生变化。
Quality checks before charting or backtesting制图或回测前的数据质量检查
| Check检查项 | Expected rule预期规则 | Typical failure常见问题 |
|---|---|---|
| Price bounds价格边界 | low ≤ open/close ≤ high | Malformed fields or inconsistent adjustment字段错位或调整口径不一致 |
| Interval continuity周期连续性 | Timestamp difference equals the requested interval相邻时间戳差值等于请求周期 | Maintenance, illiquidity, or pagination gaps维护、低流动性或分页缺口 |
| Uniqueness唯一性 | One row per market and candle-open time每个市场与 K线开始时间仅一行 | Inclusive pagination duplicates包含边界的分页产生重复 |
| Completeness完整性 | No null OHLC; volume rule documentedOHLC 无空值;成交量规则有记录 | Empty candles encoded as zero or null空 K线被编码为零或空值 |
| Final candle最后一根 K线 | Closed before indicator or backtest use进入指标或回测前已经收盘 | Look-ahead or changing values未来函数或数值持续变化 |
Backtest warning: OHLCV bars do not contain tick order inside the candle. If both a stop and target fall within the same bar, bar data alone cannot prove which executed first. Use conservative execution rules or finer-grained data.
回测提醒:OHLCV K线不包含周期内逐笔成交的先后顺序。如果止损价与止盈价同时落在一根 K线范围内,仅靠该 K线无法判断哪个先成交,应使用保守成交规则或更细粒度数据。
How QVeris helps find a free crypto historical data APIQVeris 如何帮助查找免费加密货币历史数据 API
QVeris helps agents and developers discover and inspect callable capabilities. Open the QVeris provider details to review its available tools, inputs, and outputs, and connect the selected capability through the documented QVeris workflow.
QVeris 帮助 Agent 与开发者发现并检查可调用能力。可先使用 QVeris provider details 查找行情数据工具,核对输入输出,再按 QVeris 文档接入选定能力。
QVeris does not make a provider’s free tier unlimited or guarantee data quality. Verify the underlying source, limits, licensing, and candle semantics before production use.
QVeris 不会把供应商免费层变成无限调用,也不保证底层数据质量。生产使用前仍需核实来源、限制、许可与 K线定义。
Free crypto historical data API FAQ免费加密货币历史数据 API 常见问题
It summarizes a market’s open, high, low, close, and traded volume for each candle interval.
Yes. Some public endpoints and free tiers return historical prices or candles, but history, rate limits, stability, attribution, and usage terms vary.
Call a historical endpoint with a coin ID or trading pair, quote currency, date range, and interval, then validate the returned timestamps and price basis.
Not always. Some public endpoints are keyless, while other free tiers require a key for quota tracking. Check authentication and usage terms before integrating.
Many APIs return JSON. Some also provide CSV, while JSON responses can be normalized and exported to CSV after validation.
Yes when the history, granularity, license, and quality fit your test. Inspect gaps, survivorship, market changes, and look-ahead bias.
Call a supported price or candle endpoint with the BTC identifier, interval, and time range; parse JSON into a dataframe and validate timestamps and fields.
No. Exchange candles represent trades on one venue, while aggregated candles combine or derive prices under a provider-specific methodology.
Usually no. Preserve the gap first. If your model requires a regular index, document any forward-fill or zero-volume synthetic candle explicitly.
REST is convenient for history and recovery; WebSocket is useful for live updates. Production systems commonly use both.
It depends on the source, interval, and plan. Check the earliest timestamp, maximum window per call, pagination, and whether older or intraday data requires an upgraded tier.
No. APIs may use different exchanges, aggregates, candle boundaries, quote currencies, outlier rules, and revision policies, so matching timestamps can still have different values.
它按每个 K线周期汇总开盘价、最高价、最低价、收盘价与成交量。
有。部分公共端点和免费层可返回加密货币历史价格或 K线,但历史范围、限频、稳定性、署名与使用条款不同。
交易所 API、聚合行情 API 与可下载数据集都可提供,应按单一市场或聚合价格的需求选择。
可以,但需确认历史深度、粒度、许可与质量,并检查缺口、幸存者偏差和未来函数。
向支持的接口传入币种 ID 或交易对、周期与时间范围,把 JSON 转为数据表后校验时间戳与字段。
不同。交易所 K线代表单一场所成交,聚合 K线则按供应商自己的方法组合或计算多个市场价格。
通常不应该。先保留缺口;如果模型要求规则时间索引,应明确记录前向填充或零成交量合成 K线。
REST 适合历史回填与故障恢复,WebSocket 适合实时更新,生产系统通常会同时使用两者。
取决于数据源、时间粒度与套餐。需要检查最早时间戳、单次请求窗口、分页方式,以及更早或分钟级数据是否要求升级。
不一定。交易所覆盖、聚合方法、K线边界、计价货币、异常值规则和历史修订策略不同,即使时间戳相同也可能返回不同数值。
不一定。部分公共端点无需密钥,另一些免费层会用 API Key 统计额度。接入前应核对认证方式和使用条款。
许多 API 直接返回 JSON,部分来源也提供 CSV;也可以在完成字段与时间戳校验后把 JSON 导出为 CSV。
