Real-time & Historical

Crypto Market Data API

Spot, Perpetuals and Tokenized Stocks From CEX & DEX Venues, in One API

Stream live trades, order books and candles for Bitcoin, Ethereum and the rest of the market over WebSocket, and pull history from 1-minute to monthly candles over REST. Crypto never closes, and neither does the feed.

  • Centralized and on-chain perpetuals on one WebSocket
  • Stock tokens and stock perpetuals that trade 24/7
  • Up to 20 levels of order book depth
Crypto Market Data Coverage

From Bitcoin to Tesla, Around the Clock

Every product returns the same fields over the same WebSocket.

CATEGORYVENUETYPEEXAMPLES
Crypto SpotCEXSPOTBTCUSDT · ETHUSDT · SOLUSDT · XRPUSDT · DOGEUSDT
Crypto PerpetualsCEXPERPBTCUSDT.P · ETHUSDT.P · SOLUSDT.P · 1000PEPEUSDT.P
On-chain PerpetualsDEXPERPDEX-BTCUSDC.P · DEX-ETHUSDC.P · DEX-SOLUSDC.P
Stock TokensCEXTOKENTSLABUSDT · NVDABUSDT · AAPLBUSDT · SPYBUSDT
Stock PerpetualsCEXPERPTSLAUSDT.P · NVDAUSDT.P · AAPLUSDT.P · QQQUSDT.P
Gold TokensCEXSPOTXAUTUSDT · PAXGUSDT
Commodity PerpetualsCEXPERPXAUUSDT.P · XAGUSDT.P · CLUSDT.P · NATGASUSDT.P
Crypto Index PerpetualsCEXPERPBTCDOMUSDT.P · ALLUSDT.P
API Playground

Try Popular Coins Live

Pick a coin in the API Playground and see live data right away, without writing a line of code.

Bitcoin
BTCUSDT
-USDT
-
Test Live
Ethereum
ETHUSDT
-USDT
-
Test Live
Solana
SOLUSDT
-USDT
-
Test Live
Dogecoin
DOGEUSDT
-USDT
-
Test Live
DEX & CEX Data API

On-Chain & Exchange Prices

Subscribe to the same market on a centralized exchange and an on-chain DEX through one WebSocket connection.

  • Up to 20 levels of on-chain order book depth
  • Native USDC quotes, never converted
  • Same fields and message format as CEX data
Get Free API Key
Crypto Perpetual Data

Track Funding Rates, Index Price & More

Every perpetual contract streams its mark price, index price, funding rate and open interest alongside trades and candles, on centralized and on-chain venues alike.

  • Mark Price
  • Funding Rate
  • Index Price
  • Open Interest
Get Free API Key
Market Data Endpoints

Live Trades, Deep Books, Clean Candles

Stream real-time crypto prices over WebSocket, or query snapshots and crypto historical data over REST. The same request works for spot, perpetuals and tokenized stocks.

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}")
Why Infoway

The Best Crypto Price API For Every Asset Class

Real-time & Historical

Live prices plus 1-minute to monthly candles from the same API.

WebSocket Streaming

Trades, candles and order books pushed over one connection. No polling.

CEX & DEX Data

Centralized and on-chain perpetuals in one feed, with the same fields.

Spot & Perpetuals

Spot pairs and perpetual contracts, with mark price, funding and open interest.

Tokenized Stocks

Stock tokens and stock perpetuals that keep trading after the bell.

Up to 20-Level Books

5 levels on CEX markets, up to 20 on DEX perpetuals.

Open 24/7

Crypto never closes, and neither does the feed.

One Plan, Every Asset

Stocks, forex, futures and crypto in one subscription.

7-Day Free Trial

Full access to real-time quotes and history for 7 days, no credit card required.

Get Free API Key

Build with Infoway API

Power your financial products, strategies, research, and workflows.

TRADING BOT

Run Bots on One Stream

Feed grid, arbitrage and market-making bots with spot and perpetual prices from a single WebSocket, around the clock.

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())
EXCHANGES & WALLETS

Power Tickers and Charts

Show live prices, order books and candles in your app without running your own exchange connections.

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 & LLM AGENTS

Feed Your AI with High Quality Market Data

Give LLMs and trading agents structured, real-time prices, fundamentals and news through our API or MCP server.

Get Started

Access Market Data Your Way

Infoway Official SDK

Access Infoway market data directly from your code with developer-friendly SDKs built for seamless integration.

Google Sheets Add-on

Bring market data directly into Google Sheets to analyze, track, and work with financial data without writing code.

Install Now

FAQ

If you need any help, please feel free to contact our support team.

Get Started. For Free!

Get instant access to Infoway's market data APIs with a free trial. Simply sign up with your email and get your API key.

Get Free API Key No Credit Card Required