實時與歷史加密貨幣數據

加密貨幣行情 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 無需信用卡