加密市场数据 API
一个 API 获取实时加密价格与成交量:1 分钟到 1 周的 OHLCV K 线、价格变动、逐笔成交、成交 K 线与大额订单。所有交易所的数据已合并并统一格式,无需逐个对接交易所、自行对齐格式。
从 K 线到逐笔:市场实际成交的情况,未经任何解读。成交量、成交与逐笔数据均在所有交易所间聚合。
#面向 AI 智能体与 LLM 的加密市场数据
向接入 BytNode 的 AI 智能体提问:“BTC 过去 24 小时走势如何?”“今天上午 ETH 有大额成交吗?”“给我看 SOL 本周的小时 K 线”:它通过 MCP 工具 get_pair_data 用本数据族作答,无需构造 URL。
{
"name": "get_pair_data",
"arguments": {
"symbol": "BTCUSDT",
"fields": ["klines", "price_change"],
"timeframe": "1h",
"limit": 24
}
}- 给 LLM 的提示:K 线以其窗口的起始时间(
time,UTC)标注——14:00 的小时 K 线覆盖 14:00 至 15:00——且各行从新到旧排列。 - 给开发者:在构建自己的 AI 智能体?把
/v1/klines/history暴露为工具(tool calling),模型即可自行获取 K 线;或直接加载 MCP 工具,省去封装。 - 适用环境:Claude、ChatGPT、Cursor 及任何 MCP 客户端,包括支持 MCP 的 AI 智能体框架,如 LangChain 或 n8n。
通过 MCP 服务器指南接入你的 AI 智能体,或用开源的 Agent Skills 教它使用 BytNode。
#OHLCV K 线
此接口的全部 18 个字段(取自接口契约)
time | ISO 8601 UTC, milliseconds (2026-09-28T14:00:00.000Z) | Start of the bucket the row covers: a 1h bucket at 14:00 covers 14:00:00 to 14:59:59.999. |
open | quote currency (USDT for BTCUSDT) | Opening price of the candle. |
high | quote currency (USDT for BTCUSDT) | Highest price of the candle. |
low | quote currency (USDT for BTCUSDT) | Lowest price of the candle. |
close | quote currency (USDT for BTCUSDT) | Closing price of the candle (last price for the open candle). |
volume | base asset quantity (BTC for BTCUSDT) | Traded volume over the row, base asset units (BTC for BTCUSDT, NOT dollars), aggregated across venues, over the market(s) the route covers: spot + perpetual futures on `/v1/klines` and `/v1/trades-kline`, the path's market alone on a `/spot` or `/futures` route (a name without a market suffix covers every market of its route; `volume_spot` / `volume_futures` restrict). `null` when a market is not available (never a partial sum). |
buy_volume | base asset quantity (BTC for BTCUSDT) | Aggressive (taker) buy volume, base asset units, aggregated across venues. |
sell_volume | base asset quantity (BTC for BTCUSDT) | Aggressive (taker) sell volume, base asset units, aggregated across venues. |
is_volume_estimated | `true` when some base-asset quantities of this row were ESTIMATED from USD amounts (history where a source reported amounts but not quantities): a buy or sell amount is converted at that source's own average price when its total quantity is known, otherwise at the candle's typical price (high + low + close) / 3. Every quantity a source measured is kept as is. `false` = all measured. `null` when the volume itself is `null` (not available). | |
volume_spot | base asset quantity (BTC for BTCUSDT) | Volume traded on the SPOT market, summed across venues, base asset units. `null` while not available yet (never a partial sum). |
buy_volume_spot | base asset quantity (BTC for BTCUSDT) | Aggressive (taker) buy volume on the SPOT market, across venues. |
sell_volume_spot | base asset quantity (BTC for BTCUSDT) | Aggressive (taker) sell volume on the SPOT market, across venues. |
is_volume_spot_estimated | `true` when the spot quantities of this candle were ESTIMATED from USD amounts and the candle's typical price (high + low + close) / 3 (data written before quantities were recorded; mean error 0.04 % in 1m, 0.37 % in 1d); `false` = measured. `null` when the volume itself is `null` (not available). | |
volume_futures | base asset quantity (BTC for BTCUSDT) | Volume traded on PERPETUAL FUTURES, summed across venues, in base asset units. `null` when not available yet (never a partial sum). |
buy_volume_futures | base asset quantity (BTC for BTCUSDT) | Aggressive (taker) buy volume on PERPETUAL FUTURES, across venues. |
sell_volume_futures | base asset quantity (BTC for BTCUSDT) | Aggressive (taker) sell volume on PERPETUAL FUTURES, across venues. |
is_volume_futures_estimated | `true` when `volume_futures` was ESTIMATED from USD amounts and the candle's typical price; `false` = measured. `null` when the volume itself is `null` (not available). | |
is_closed | `true` = the row is final; `false` = provisional: the latest bucket while it still settles (a few seconds after its end, e.g. a candle whose volumes are not final yet), or the period in progress with `?live=1` on the routes that take it. Exception, rare: when a venue delivers trades LATE (seconds to minutes, e.g. during a burst), a closed row built from trades (trade candles, candle volumes, CVD, buy/sell ratio, trades per second) is corrected afterwards to include them, usually within minutes and at most one hour later; the correction only adds the late trades. |
两条路由:/v1/klines 返回最近一根已收盘的 K 线(一个对象;加 ?live=1 返回进行中的 K 线,is_closed: false),/v1/klines/history 返回 K 线列表,从新到旧(参数见下)。K 线周期放在 timeframe 中,必填:1m、5m、15m、30m、1h、4h、1d、1w。缺失或不在列表中:422。
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
symbol | string | 必填 | 资产。 |
timeframe | string | 必填 | K 线周期:1m、5m、15m、30m、1h、4h、1d 或 1w。 |
limit | integer | 100 | K 线数量,1 到 1000。 |
since_ms / until_ms | integer | — | 带日期的时间窗口,以毫秒为单位,在 limit 之前生效。 |
curl -H "X-API-KEY: $BYTNODE_API_KEY" \
"https://api.bytnode.com/v1/klines/history?symbol=BTCUSDT&timeframe=1h&limit=100"| 字段 | 类型 | 说明 |
|---|---|---|
time | string | K 线起始时间,ISO 8601。 |
open, high, low, close | float | 四个价格。 |
volume | float | 所有市场的成交量:现货加永续合约,汇总所有交易所,以基础资产为单位(不带市场后缀的字段名覆盖所有市场)。任一部分未知时为 null;稳定币为现货成交量。 |
buy_volume / sell_volume | float | 所有市场(现货 + 合约)的主动买入与卖出成交量,以基础资产为单位。任一部分未知时为 null。 |
is_volume_estimated | boolean | 当该 K 线的聚合成交量经过重建(较早的历史)时为 true,实测时为 false。 |
volume_spot | float | 现货市场所有平台合计成交量,以基础资产为单位:buy_volume_spot + sell_volume_spot。在尚未最终确定或未知时为 null。 |
buy_volume_spot | float | 现货市场所有平台以市价买入成交的数量,以基础资产为单位。 |
sell_volume_spot | float | 现货市场所有平台以市价卖出成交的数量,以基础资产为单位。 |
is_volume_spot_estimated | boolean | 当该 K 线的聚合成交量经过重建(较早的历史)时为 true,实测时为 false。 |
volume_futures | float | 该 K 线的永续合约成交量,跨交易所求和,以基础资产为单位(未知时为 null;稳定币没有合约市场,为 null)。 |
buy_volume_futures / sell_volume_futures | float | 永续合约上的主动买入与卖出成交量,汇总所有交易所,以基础资产为单位。 |
is_closed | boolean | 只提供已收盘的 K 线(从不提供正在形成的 K 线)。K 线成交量最终确定后为 true(收盘后几秒);在此之前成交量可能为 null。 |
#涨跌幅
此接口的全部 11 个字段(取自接口契约)
time | ISO 8601 UTC, milliseconds (2026-09-28T14:00:00.000Z) | Instant of the latest trade of the reference spot market (`price` is that trade's price, the close of `/v1/klines?live=1`); if it has not traded since the latest closed one-minute candle, the end of that candle (`price` = its close). Exception: USDTUSDC, which no spot candle source lists, gives the instant of its latest trade, `price` being the volume-weighted price of its last 90 seconds. |
price | quote currency (USDT for BTCUSDT) | Price. |
changes_pct | Price change over each window, keyed by window (`1m` … `1w`), in percent. | |
changes_pct.1m | percent | Price change over the last 1m, in percent. |
changes_pct.5m | percent | Price change over the last 5m, in percent. |
changes_pct.15m | percent | Price change over the last 15m, in percent. |
changes_pct.30m | percent | Price change over the last 30m, in percent. |
changes_pct.1h | percent | Price change over the last 1h, in percent. |
changes_pct.4h | percent | Price change over the last 4h, in percent. |
changes_pct.1d | percent | Price change over the last 1d, in percent. |
changes_pct.1w | percent | Price change over the last 1w, in percent. |
八个周期的百分比变化,按需计算,分别相对一分钟、五分钟、一小时、一周前的价格。缺少历史的周期为 null,绝不会报错。
{
"status": "ok",
"server_time": "2026-10-10T08:51:08.454Z",
"data_type": "price_change",
"symbol": "BTCUSDT",
"data": {
"time": "2026-10-10T08:50:00.000Z",
"price": 82818.72,
"changes_pct": {
"1m": 0.0201927489674, "5m": 0.0452759586592, "15m": -0.0102140384352,
"30m": -0.0437873393277, "1h": 0.0500741326695, "4h": 0.18183489701,
"1d": 0.240522875817, "1w": -2.15235074281
}
}
}这是少数为稳定币提供数据的接口之一:此时会回退使用现货逐笔数据。
#按秒聚合的成交
此接口的全部 10 个字段(取自接口契约)
time | ISO 8601 UTC, milliseconds (2026-09-28T14:00:00.000Z) | Start of the second the row covers. |
volume | base asset quantity (BTC for BTCUSDT) | Traded volume over the row, base asset units (BTC for BTCUSDT, NOT dollars), aggregated across venues, over the market(s) the route covers: spot + perpetual futures on `/v1/klines` and `/v1/trades-kline`, the path's market alone on a `/spot` or `/futures` route (a name without a market suffix covers every market of its route; `volume_spot` / `volume_futures` restrict). `null` when a market is not available (never a partial sum). |
trade_count | count | Number of trades. `null` when the number is not known: history imported from an outside source carries the buy and sell volumes, not the trade count. |
buy_volume | base asset quantity (BTC for BTCUSDT) | Aggressive (taker) buy volume, base asset units, aggregated across venues. |
sell_volume | base asset quantity (BTC for BTCUSDT) | Aggressive (taker) sell volume, base asset units, aggregated across venues. |
is_closed | `true` = the row is final; `false` = provisional: the latest bucket while it still settles (a few seconds after its end, e.g. a candle whose volumes are not final yet), or the period in progress with `?live=1` on the routes that take it. Exception, rare: when a venue delivers trades LATE (seconds to minutes, e.g. during a burst), a closed row built from trades (trade candles, candle volumes, CVD, buy/sell ratio, trades per second) is corrected afterwards to include them, usually within minutes and at most one hour later; the correction only adds the late trades. | |
net_volume | base asset quantity (BTC for BTCUSDT) | buy_volume - sell_volume over the row, base asset units. Positive = net buying. |
avg_trade_size | base asset quantity (BTC for BTCUSDT) | Average trade size, base asset units (NOT dollars: multiply by the price for a notional). |
trade_rate | trades per second | Average number of trades per second over the bucket. `null` when `trade_count` is. |
is_volume_estimated | `true` when some base-asset quantities of this row were ESTIMATED from USD amounts (history where a source reported amounts but not quantities): a buy or sell amount is converted at that source's own average price when its total quantity is known, otherwise at the candle's typical price (high + low + close) / 3. Every quantity a source measured is kept as is. `false` = all measured. `null` when the volume itself is `null` (not available). |
每秒一行,所有交易所合计。因此 limit 参数计的是秒数,而不是成交笔数。
| 字段 | 类型 | 说明 |
|---|---|---|
time | string | 对应的秒。 |
volume | float | 总成交量,各交易所合计。 |
trade_count | integer | 成交笔数,各交易所合计。 |
buy_volume | float | 市价买入量。 |
sell_volume | float | 市价卖出量。 |
永续合约按分钟或按 bucket 的同一买卖拆分,即 /v1/cvd/futures/history 的 buy_volume / sell_volume。
#逐笔成交与大额订单
此接口的全部 6 个字段(取自接口契约)
time | ISO 8601 UTC, milliseconds (2026-09-28T14:00:00.000Z) | Execution instant of the trade, as stated by the venue (milliseconds). |
id | Opaque, stable identifier of the trade (16 hex characters): the same trade always has the same `id`, so it can be used to deduplicate or resume. It reveals nothing about the venue. | |
side | Trades: `buy` or `sell` (aggressor side). Liquidations: `long` or `short` (the position liquidated). | |
price | quote currency (USDT for BTCUSDT) | Price. |
quantity | base asset quantity (BTC for BTCUSDT) | Quantity traded or liquidated, in base asset units. |
value_usd | USD | Notional value: price × quantity, in the pair's quote currency (USDT for BTCUSDT), taken as USD. |
此接口的全部 6 个字段(取自接口契约)
time | ISO 8601 UTC, milliseconds (2026-09-28T14:00:00.000Z) | Execution instant of the trade, as stated by the venue (milliseconds). |
id | Opaque, stable identifier of the trade (16 hex characters): the same trade always has the same `id`, so it can be used to deduplicate or resume. It reveals nothing about the venue. | |
side | Trades: `buy` or `sell` (aggressor side). Liquidations: `long` or `short` (the position liquidated). | |
price | quote currency (USDT for BTCUSDT) | Price. |
quantity | base asset quantity (BTC for BTCUSDT) | Quantity traded or liquidated, in base asset units. |
value_usd | USD | Notional value: price × quantity, in the pair's quote currency (USDT for BTCUSDT), taken as USD. |
逐笔成交(每笔执行),每行一笔,所有交易所合并,且不标注来源——与 WebSocket 频道 trades.spot 和 trades.futures 中的成交相同,id 也相同。limit 取值 1 到 10000。不带其他参数时返回最新的成交。如需读取某个时间区间,请加上 since_ms、until_ms 和/或 order(asc 或 desc):每页最多覆盖 15 分钟,响应中带有 next,即下一页的 URL,可直接调用(区间读完时为 null)。按 next 逐页读取,每笔成交恰好返回一次且按顺序。/v1/trades/large 同样适用,/v1/trades-kline/futures/seconds 则按 limit 秒分页。
| 字段 | 类型 | 说明 |
|---|---|---|
time | string | 成交时间戳。 |
side | string | buy 或 sell:流动性吃单方的方向。 |
price | float | 成交价。 |
quantity | float | 数量,以基础资产为单位。 |
value_usd | float | 美元价值(价格 × 数量)。 |
此接口的全部 6 个字段(取自接口契约)
time | ISO 8601 UTC, milliseconds (2026-09-28T14:00:00.000Z) | Execution instant of the trade, as stated by the venue (milliseconds). |
id | Opaque, stable identifier of the trade (16 hex characters): the same trade always has the same `id`, so it can be used to deduplicate or resume. It reveals nothing about the venue. | |
side | Trades: `buy` or `sell` (aggressor side). Liquidations: `long` or `short` (the position liquidated). | |
price | quote currency (USDT for BTCUSDT) | Price. |
quantity | base asset quantity (BTC for BTCUSDT) | Quantity traded or liquidated, in base asset units. |
value_usd | USD | Notional value: price × quantity, in the pair's quote currency (USDT for BTCUSDT), taken as USD. |
同一期货数据流,按规模筛选:读盘,找出真正重要的订单。
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
symbol | string | 必填 | 资产。 |
min_usd | float | 100000 | 最低金额(美元)。下限为 1000。 |
limit | integer | 100 | 事件数量,1 到 10 000。 |
# The last fifty orders above $250,000
curl -H "X-API-KEY: $BYTNODE_API_KEY" \
"https://api.bytnode.com/v1/trades/large?symbol=BTCUSDT&min_usd=250000&limit=50"#成交 K 线(trades kline)
此接口的全部 11 个字段(取自接口契约)
time | ISO 8601 UTC, milliseconds (2026-09-28T14:00:00.000Z) | Start of the bucket the row covers: a 1h bucket at 14:00 covers 14:00:00 to 14:59:59.999. |
trade_count | count | Number of trades. `null` when the number is not known: history imported from an outside source carries the buy and sell volumes, not the trade count. |
avg_trade_size | base asset quantity (BTC for BTCUSDT) | Average trade size, base asset units (NOT dollars: multiply by the price for a notional). |
volume | base asset quantity (BTC for BTCUSDT) | Traded volume over the row, base asset units (BTC for BTCUSDT, NOT dollars), aggregated across venues, over the market(s) the route covers: spot + perpetual futures on `/v1/klines` and `/v1/trades-kline`, the path's market alone on a `/spot` or `/futures` route (a name without a market suffix covers every market of its route; `volume_spot` / `volume_futures` restrict). `null` when a market is not available (never a partial sum). |
buy_volume | base asset quantity (BTC for BTCUSDT) | Aggressive (taker) buy volume, base asset units, aggregated across venues. |
sell_volume | base asset quantity (BTC for BTCUSDT) | Aggressive (taker) sell volume, base asset units, aggregated across venues. |
net_volume | base asset quantity (BTC for BTCUSDT) | buy_volume - sell_volume over the row, base asset units. Positive = net buying. |
buy_sell_coverage_ratio | fraction (0.585 = 58.5 %) | Share of the volume (in USD) whose buy/sell split is known. 1 = every trade is split. Below 1 on part of the history, where some sources did not report the aggressor side: `buy_volume` and `sell_volume` then cover that share only, so `buy_volume + sell_volume` < `volume`; `buy_ratio` and the CVD describe the covered share. `null` when the bucket has no volume. |
trade_rate | trades per second | Average number of trades per second over the bucket. `null` when `trade_count` is. |
is_volume_estimated | `true` when some base-asset quantities of this row were ESTIMATED from USD amounts (history where a source reported amounts but not quantities): a buy or sell amount is converted at that source's own average price when its total quantity is known, otherwise at the candle's typical price (high + low + close) / 3. Every quantity a source measured is kept as is. `false` = all measured. `null` when the volume itself is `null` (not available). | |
is_closed | `true` = the row is final; `false` = provisional: the latest bucket while it still settles (a few seconds after its end, e.g. a candle whose volumes are not final yet), or the period in progress with `?live=1` on the routes that take it. Exception, rare: when a venue delivers trades LATE (seconds to minutes, e.g. during a burst), a closed row built from trades (trade candles, candle volumes, CVD, buy/sell ratio, trades per second) is corrected afterwards to include them, usually within minutes and at most one hour later; the correction only adds the late trades. |
此接口的全部 11 个字段(取自接口契约)
time | ISO 8601 UTC, milliseconds (2026-09-28T14:00:00.000Z) | Start of the bucket the row covers: a 1h bucket at 14:00 covers 14:00:00 to 14:59:59.999. |
trade_count | count | Number of trades. `null` when the number is not known: history imported from an outside source carries the buy and sell volumes, not the trade count. |
avg_trade_size | base asset quantity (BTC for BTCUSDT) | Average trade size, base asset units (NOT dollars: multiply by the price for a notional). |
volume | base asset quantity (BTC for BTCUSDT) | Traded volume over the row, base asset units (BTC for BTCUSDT, NOT dollars), aggregated across venues, over the market(s) the route covers: spot + perpetual futures on `/v1/klines` and `/v1/trades-kline`, the path's market alone on a `/spot` or `/futures` route (a name without a market suffix covers every market of its route; `volume_spot` / `volume_futures` restrict). `null` when a market is not available (never a partial sum). |
buy_volume | base asset quantity (BTC for BTCUSDT) | Aggressive (taker) buy volume, base asset units, aggregated across venues. |
sell_volume | base asset quantity (BTC for BTCUSDT) | Aggressive (taker) sell volume, base asset units, aggregated across venues. |
net_volume | base asset quantity (BTC for BTCUSDT) | buy_volume - sell_volume over the row, base asset units. Positive = net buying. |
buy_sell_coverage_ratio | fraction (0.585 = 58.5 %) | Share of the volume (in USD) whose buy/sell split is known. 1 = every trade is split. Below 1 on part of the history, where some sources did not report the aggressor side: `buy_volume` and `sell_volume` then cover that share only, so `buy_volume + sell_volume` < `volume`; `buy_ratio` and the CVD describe the covered share. `null` when the bucket has no volume. |
trade_rate | trades per second | Average number of trades per second over the bucket. `null` when `trade_count` is. |
is_volume_estimated | `true` when some base-asset quantities of this row were ESTIMATED from USD amounts (history where a source reported amounts but not quantities): a buy or sell amount is converted at that source's own average price when its total quantity is known, otherwise at the candle's typical price (high + low + close) / 3. Every quantity a source measured is kept as is. `false` = all measured. `null` when the volume itself is `null` (not available). | |
is_closed | `true` = the row is final; `false` = provisional: the latest bucket while it still settles (a few seconds after its end, e.g. a candle whose volumes are not final yet), or the period in progress with `?live=1` on the routes that take it. Exception, rare: when a venue delivers trades LATE (seconds to minutes, e.g. during a burst), a closed row built from trades (trade candles, candle volumes, CVD, buy/sell ratio, trades per second) is corrected afterwards to include them, usually within minutes and at most one hour later; the correction only adds the late trades. |
基于成交而非价格构建的 K 线(“trades kline”):有多少订单成交、方向如何、金额多少,始终在所有交易所间聚合。逐笔成交本身见 /v1/trades/spot 和 /v1/trades/futures。
每个接口都有对应的历史:/v1/trades-kline/history、/v1/trades-kline/spot/history、/v1/trades-kline/futures/history。
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
symbol | string | 必填 | 资产。 |
timeframe | string | 必填 | 1m、5m、15m、30m、1h、4h、1d。缺失或无效:422。 |
live | boolean | false | 仅用于最新值接口:返回正在形成的 K 线。 |
limit | integer | 100 | 用于 /history 接口,1 到 1000。这些接口只提供已收盘的 K 线。 |
since_ms / until_ms | integer | — | 用于 /history 接口:带日期的时间窗口,以毫秒为单位,在 limit 之前生效。 |
# The 5-minute trade candle in progress
curl -H "X-API-KEY: $BYTNODE_API_KEY" \
"https://api.bytnode.com/v1/trades-kline?symbol=BTCUSDT&timeframe=5m&live=1"| 字段 | 类型 | 说明 |
|---|---|---|
time | string | 该行的时间点(取代原来的键,例如 bucket):通用客户端只需读取一个键。 |
trade_count | integer | 窗口内的成交笔数。 |
avg_trade_size | float | null | 平均成交规模,以基础资产为单位(BTCUSDT 为 BTC),而非美元:乘以价格即得名义价值。 |
volume | float | 总成交量,以基础资产为单位(BTCUSDT 为 BTC)——而非美元。 |
buy_volume / sell_volume | float | 买入与卖出成交量,以基础资产为单位。 |
net_volume | float | 买入量减卖出量,以基础资产为单位。正值 = 净买入。 |
trade_rate | float | 每秒成交笔数:笔数除以周期时长,正在形成的 K 线也如此计算,以保持定义一致。 |
is_volume_estimated | boolean | 当该 K 线的聚合成交量经过重建(较早的历史)时为 true,实测时为 false。 |
is_closed | boolean | 仅在正在形成的 K 线上为假。 |
关于稳定币
/v1/trades-kline 和 /v1/trades-kline/spot 仍有数据,因为稳定币有现货市场。/v1/trades-kline/futures 返回 data: null 并带有 unavailable: "not_applicable":稳定币没有期货市场。