实时与历史加密货币数据

加密货币行情 API

现货、永续合约与股票代币,CEX 和 DEX 数据一个 API 接入

比特币、以太坊等全市场币种的成交、盘口和 K 线,通过 WebSocket 实时推送;1 分钟到月线的历史数据,通过 REST 随时查询。

  • 支持中心化与链上永续合约
  • 支持股票代币与股票永续合约
  • 最高 20 档盘口深度
加密货币行情覆盖

直连全球Crypto市场脉搏

全面覆盖中心化交易所与链上的现货、永续合约等产品。

类别交易场所类型示例
加密货币现货CEXSPOTBTCUSDT · ETHUSDT · SOLUSDT · XRPUSDT · DOGEUSDT
加密货币永续合约CEXPERPBTCUSDT.P · ETHUSDT.P · SOLUSDT.P · 1000PEPEUSDT.P
链上永续合约DEXPERPDEX-BTCUSDC.P · DEX-ETHUSDC.P · DEX-SOLUSDC.P
股票代币CEXTOKENTSLABUSDT · NVDABUSDT · AAPLBUSDT · SPYBUSDT
股票永续合约CEXPERPTSLAUSDT.P · NVDAUSDT.P · AAPLUSDT.P · QQQUSDT.P
黄金代币CEXSPOTXAUTUSDT · PAXGUSDT
商品永续合约CEXPERPXAUUSDT.P · XAGUSDT.P · CLUSDT.P · NATGASUSDT.P
加密指数永续合约CEXPERPBTCDOMUSDT.P · ALLUSDT.P
API 在线调试

热门币种,在线测试

在 API Playground 里选择币种,马上看到实时数据,不用写一行代码。

Bitcoin
BTCUSDT
-USDT
-
在线调试
Ethereum
ETHUSDT
-USDT
-
在线调试
Solana
SOLUSDT
-USDT
-
在线调试
Dogecoin
DOGEUSDT
-USDT
-
在线调试
打通CEX 与 DEX 隔阂

实时对比CEX与DEX行情

一条 WebSocket 同时订阅中心化交易所和链上 DEX 的同一个合约,两边价差实时可见,做跨市场套利和价差监控都能直接用。

  • 链上盘口最高 20 档
  • 原生 USDC 报价,不做换算
  • 字段和消息格式与 CEX 数据完全一致
获取免费 API Key
持仓量、标记价格、资金费率等

实时追踪关键指标

加密货币永续合约的每笔成交都会附带标记价格、指数价格、资金费率和下次结算时间。不用另外轮询,算基差、盯费率,一条数据流就够了。

  • 标记价格
  • 资金费率
  • 指数价格
  • 持仓量
获取免费 API Key
行情数据接口

加密货币实时与历史数据

实时行情走 WebSocket,快照和历史数据走 REST。现货、合约、美股代币都用同一套请求,接一次就够了。

Infoway Real-time Crypto API
POSThttps://data.infoway.io/crypto/v2/batch_kline
import requests

api_url = "https://data.infoway.io/crypto/v2/batch_kline"

headers = {
    "User-Agent": "Mozilla/5.0",
    "Accept": "application/json",
    "Content-Type": "application/json",
    "apiKey": "yourApikey",
}

payload = {
    "klineType": 1,
    "klineNum": 10,
    "codes": "BTCUSDT,ETHUSDT,SOLUSDT"
}

response = requests.post(api_url, headers=headers, json=payload)
print(f"HTTP code: {response.status_code}")
print(f"message: {response.text}")
为什么选择 Infoway

稳定可靠的加密货币行情API接口

实时与历史数据

实时价格、历史价格,同一个 API 全部提供。

WebSocket 高频推送

成交、K 线、盘口通过一条连接实时推送,无需轮询。

CEX & DEX 数据

同时支持中心化与链上永续合约,返回字段一致。

现货与永续

支持现货和永续合约,合约附带标记价格和资金费率等特殊指标。

股票代币

提供热门股票的代币行情数据,7天24小时追踪链上股票价格

最高 20 档盘口

CEX 市场 5 档,DEX 永续合约最高 20 档。

7×24 小时 数据不断流

行情7天24小时高频率推送。稳定、可靠的数据源

多资产覆盖

股票、外汇、期货、加密货币,一个套餐全包含。

7天免费试用

注册账号自动获得试用API Key,无需绑定信用卡。

获取免费 API Key

用 Infoway API 构建你的产品

为你的金融产品、交易策略、研究和工作流提供数据。

交易机器人

驱动你的自动交易程序

网格、套利、做市机器人,用一条 WebSocket 同时拿现货和合约价格,7×24 小时不掉线。

import asyncio
import json
import uuid

import websockets

WS_URL = "wss://data.infoway.io/ws?business=crypto&apikey=YOUR_API_KEY"
SPOT, PERP = "BTCUSDT", "BTCUSDT.P"
THRESHOLD_BPS = 3  # act when the perpetual drifts 3 bps from spot

book = {}  # symbol -> (best bid, best ask)
state = {"signal": None}


def frame(code, data=None):
    msg = {"code": code, "trace": uuid.uuid4().hex}
    if data is not None:
        msg["data"] = data
    return json.dumps(msg)


async def heartbeat(ws):
    while True:
        await asyncio.sleep(30)
        await ws.send(frame(10010))


def on_book(symbol, bid, ask):
    book[symbol] = (bid, ask)
    if SPOT not in book or PERP not in book:
        return
    spot_mid = sum(book[SPOT]) / 2
    perp_mid = sum(book[PERP]) / 2
    basis_bps = (perp_mid - spot_mid) / spot_mid * 10_000
    if basis_bps >= THRESHOLD_BPS:
        signal = "sell perp, buy spot"
    elif basis_bps <= -THRESHOLD_BPS:
        signal = "buy perp, sell spot"
    else:
        signal = "flat"
    if signal != state["signal"]:  # act only when the signal changes
        state["signal"] = signal
        print(f"basis {basis_bps:+.1f} bps -> {signal}")  # place orders via your exchange here


async def run_bot():
    while True:
        try:
            async with websockets.connect(WS_URL) as ws:
                await ws.send(frame(10003, {"codes": f"{SPOT},{PERP}"}))  # spot + perp order books
                hb = asyncio.create_task(heartbeat(ws))
                try:
                    async for raw in ws:
                        msg = json.loads(raw)
                        if msg.get("code") == 10005:  # depth push
                            d = msg["data"]
                            on_book(d["s"], float(d["b"][0][0]), float(d["a"][0][0]))
                finally:
                    hb.cancel()
        except (websockets.ConnectionClosed, OSError):
            await asyncio.sleep(5)  # back off before reconnecting


asyncio.run(run_bot())
交易所与钱包

行情页、K 线图,直接接入

在你的 App 里展示实时价格、盘口和 K 线,不用自己逐个对接交易所。

import asyncio
import json
import uuid

import requests
import websockets

API_KEY = "YOUR_API_KEY"
REST_URL = "https://data.infoway.io/crypto/v2/batch_kline"
WS_URL = f"wss://data.infoway.io/ws?business=crypto&apikey={API_KEY}"
SYMBOL = "ETHUSDT"

candles = {}  # candle open time (unix s) -> [open, high, low, close, volume]


def frame(code, data=None):
    msg = {"code": code, "trace": uuid.uuid4().hex}
    if data is not None:
        msg["data"] = data
    return json.dumps(msg)


def ohlcv(c):
    return [float(c[k]) for k in ("o", "h", "l", "c", "v")]


def load_history(count=120):
    """Fill the chart with the latest 1-minute candles before going live."""
    body = {"klineType": 1, "klineNum": count, "codes": SYMBOL}
    resp = requests.post(REST_URL, headers={"apiKey": API_KEY}, json=body, timeout=10).json()
    for c in resp["data"][0]["respList"]:
        candles[int(c["t"])] = ohlcv(c)


def update_ticker(price):
    print(f"{SYMBOL}  {price:,.2f}")  # refresh the price in your ticker bar


def update_chart(c):
    t = int(c["t"])
    is_new_bar = t not in candles
    candles[t] = ohlcv(c)  # the open candle is pushed again on every change
    if is_new_bar:
        print(f"new 1m bar, chart now has {len(candles)} candles")  # append a bar
    # else: redraw the last bar with candles[t]


async def heartbeat(ws):
    while True:
        await asyncio.sleep(30)
        await ws.send(frame(10010))


async def live_chart():
    while True:
        try:
            load_history()  # also refills any gap after a reconnect
            async with websockets.connect(WS_URL) as ws:
                await ws.send(frame(10000, {"codes": SYMBOL}))                             # trades
                await ws.send(frame(10006, {"arr": [{"type": 1, "codes": SYMBOL}]}))  # 1m candles
                hb = asyncio.create_task(heartbeat(ws))
                try:
                    async for raw in ws:
                        msg = json.loads(raw)
                        if msg.get("code") == 10002:
                            update_ticker(float(msg["data"]["p"]))
                        elif msg.get("code") == 10008:
                            update_chart(msg["data"])
                finally:
                    hb.cancel()
        except (websockets.ConnectionClosed, OSError, requests.RequestException):
            await asyncio.sleep(5)  # back off before reconnecting


asyncio.run(live_chart())
AI 与大模型智能体

为你的 AI 提供高质量行情数据

通过 API 或 MCP 服务,为大模型和交易智能体提供结构化的实时价格、基本面数据和新闻。

立即开始

选择适合你的接入方式

Infoway 官方 SDK

用对开发者友好的 SDK,在代码里直接获取 Infoway 行情数据,轻松完成集成。

Google Sheets 插件

把行情数据直接导入 Google Sheets,不写代码也能分析、跟踪和处理金融数据。

立即安装

常见问题

如需帮助,请随时联系客服。

免费开始使用市场数据

免费试用 Infoway 市场数据 API,马上获取接口访问权限。只需使用邮箱注册,即可获得您的 API Key。

获取免费APIKey 无需信用卡