WebSocket Streaming
Subscribe to real-time quote updates via a persistent WebSocket connection.
Connection
wss://api.waretto.com/v1/stream?apiKey=wde_YOUR_KEY&symbols=BTC/USD,ETH/USD
| Param | Required | Description |
|---|---|---|
apiKey | Yes | Your API key |
symbols | Yes | Comma-separated (e.g. BTC/USD,ETH/USD) |
Server Messages
snapshotSent immediately after connection for each subscribed symbol.
{
"type": "snapshot",
"symbol": "BTC/USD",
"data": { "price": 67432.80, "bid": 67432.10, "ask": 67433.50, ... }
}subscribedConfirmation after initial connect or subscribe action.
{ "type": "subscribed", "symbols": ["BTC/USD", "ETH/USD"] }quoteReal-time quote update.
{
"type": "quote",
"symbol": "BTC/USD",
"data": { "price": 67435.20, "bid": 67434.90, "ask": 67435.50, ... }
}pongResponse to a client ping.
{ "type": "pong" }Client Messages
subscribeAdd more symbols.
{ "action": "subscribe", "symbols": ["SOL/USD", "AVAX/USD"] }unsubscribeRemove symbols.
{ "action": "unsubscribe", "symbols": ["SOL/USD"] }pingKeep alive. Server responds with pong.
{ "action": "ping" }Full Example
PYTHON
import asyncio
import websockets
import json
async def stream():
uri = "wss://api.waretto.com/v1/stream?apiKey=wde_YOUR_KEY&symbols=BTC/USD,ETH/USD"
async with websockets.connect(uri) as ws:
async for message in ws:
data = json.loads(message)
if data["type"] == "quote":
print(f"{data['symbol']}: {data['data']['price']}")
asyncio.run(stream())CONNECTION LIMITS: Free: 1 connection. Starter: 3. Pro: 10. Enterprise: 50. Excess connections rejected with code 4003.