Why futures traders need tick data
Candles tell you what happened. Ticks tell you how it happened. For crypto futures — funding-driven, 24/7, liquidation-prone — the tick stream is where the real microstructure lives: sweep of the order book, cascade of liquidations, spread blowout between spot and perp. If you backtest a strategy on 1-minute candles but trade off real-time signals, you're simulating a market that doesn't exist.
The problem: every exchange speaks a different dialect. Binance calls it aggTrade, Bybit calls it publicTrade, OKX calls it trades — different field names, different timestamp formats, different sequence semantics. Before you can compare a liquidation cascade across venues, you burn a week writing normalization shims.
TIQEX's answer is one JSON shape for everything: REST for snapshots and history, WebSocket for live ticks, across crypto, futures, FX, and equities. This guide shows the honest, minimal path to a futures tick stream in Python.
Step 1: Know what the API actually gives you
From the official docs (https://tiqex.io/developers):
- REST — snapshot quotes, candles, market metadata, financial news. Example:
curl https://api.tiqex.io/api/v1/market/crypto/quote?symbols=BTCUSDT \
-H "X-API-Key: YOUR_API_KEY"
- WebSocket — live ticks at millisecond delivery. Subscribe JSON:
wss://api.tiqex.io/api/v1/market/stream
{ "action": "subscribe", "market": "crypto", "symbols": ["BTCUSDT"] }
- Coverage — includes futures ("forex, indices, and continuous futures"), plus US/CN/HK equities, FX, crypto, indices, commodities.
Two honest caveats, straight from the docs FAQ:
- WebSocket availability depends on your plan — "Upgrade for WebSocket, lower latency, higher quotas" — so check your console entitlements before wiring production.
- Latency, field granularity, and history depth vary by market and plan, and "output may not match any single exchange tick-for-tick." Treat the stream as a normalized consolidated feed, not a raw exchange tap.
Exact futures symbol codes live in the console symbol lists — look them up there rather than guessing.
Step 2: Subscribe to the live tick stream
Minimal Python with websocket-client:
import json, websocket
WS_URL = "wss://api.tiqex.io/api/v1/market/stream"
API_KEY = "YOUR_API_KEY" # server-side only, never in frontend bundles
def on_message(ws, raw):
tick = json.loads(raw)
# one consistent JSON shape regardless of venue/market
# (field names below are illustrative — confirm against the docs
# endpoint reference before production use)
print(tick.get("symbol"), tick.get("price"), tick.get("ts"))
def on_open(ws):
# subscribe only after the socket is connected —
# sending before run_forever() raises WebSocketConnectionClosedException
ws.send(json.dumps({"action": "subscribe", "market": "crypto",
"symbols": ["BTCUSDT"]})) # batch multiple symbols in one subscribe
ws = websocket.WebSocketApp(
WS_URL,
header={"X-API-Key": API_KEY},
on_open=on_open,
on_message=on_message,
on_error=lambda ws, e: print("ws error:", e),
)
ws.run_forever()
Docs also recommend heartbeat and reconnect guidance for terminals and strategy runtimes — wire on_close to back off and resubscribe, and treat a stream handshake as a one-time event.
Step 3: From ticks to something tradable
Raw ticks are noise; the first useful transform is tick → bar resampling. Buffer ticks in memory and emit 1-second (or 1-minute) OHLCV:
from collections import defaultdict
import time
buckets = defaultdict(list)
def on_tick(tick):
bucket = int(tick["ts"] / 1000) # 1-second buckets
buckets[bucket].append(float(tick["price"]))
if len(buckets) > 120: # keep a rolling window
oldest = min(buckets)
p = buckets.pop(oldest)
print(f"bar t={oldest}: o={p[0]:.1f} h={max(p):.1f} "
f"l={min(p):.1f} c={p[-1]:.1f} n={len(p)}")
Compare your reconstructed bars against the REST candles endpoint for the same symbol — if they drift, you've mis-bucketed timestamps, not discovered alpha.
What to build next
- Liquidation proxy: tick-count spikes + price velocity in a 10-second window correlate with liquidation cascades on perps.
- Basis monitor: stream spot and perp ticks on the same socket, alert when the annualized basis crosses your funding threshold.
- Slippage model: replay ticks through your order size to estimate real fill prices instead of mid-price fantasy.
One API key, one subscribe shape, one JSON response — that's the whole pitch. Get your key at tiqex.io, check your plan's WebSocket entitlement, and you're one script away from a live futures tick feed.