Endpoint Details
- URL:
wss://api.mobula.io - Event Type:
ohlcv
Pool Mode Subscription
Subscribe to OHLCV data for a specific pool (mode automatically set to"pair"):
Asset Mode Subscription
Subscribe to OHLCV data for a specific token (mode automatically set to"asset"):
Parameters
address(conditional): Pool address for pool mode - required if not usingassetasset(conditional): Token address for asset mode - required if not usingaddresschainId(required): Blockchain identifier - See supported chainsperiod(required): Candlestick timeframe -1s,5s,15s,30s,1m,5m,15m,1h,4h,1d,1w,1M- Accepted aliases:
1minor1for1m,5minor5for5m,15minor15for15m,60for1h,1monthfor1M
- Accepted aliases:
mode(optional): Aggregation mode -pairorasset. Auto-populated based on your query (see below)subscriptionId(optional): Unique identifier for your WebSocket connection. Auto-generated if not providedsubscriptionTracking(optional, default:false): Include subscription details in response logs for debugging
Understanding the mode Parameter
The mode parameter determines how OHLCV data is aggregated and sent:
Pool Mode (mode: "pair"):
- Default when: Using
addressparameter - Data scope: Only trades from the specific pool/pair you subscribed to
- Use case: Track a specific trading venue (e.g., Uniswap V3 USDC/ETH pool)
- Updates: Real-time updates for that single market only
mode: "asset"):
- Default when: Using
assetparameter - Data scope: Aggregated data from the top trading venues for that token
- Use case: Track overall token price action across all major liquidity sources
- Updates: Real-time updates from multiple pools, filtered to the largest pairs (up to 10 venues)
- Aggregation: OHLCV data combines trades from all qualifying pools where the token appears
You can use either pool mode (with
address) or asset mode (with asset), but not both simultaneously.Implementation Example
Pool Mode Example (Single Trading Pair):Connection Keepalive (Ping/Pong)
To maintain active WebSocket connections and prevent timeouts, you can use the ping/pong mechanism: Send ping:Unsubscribing from the Stream
Unsubscribe from All Streams
To terminate all active subscriptions on the current WebSocket connection:Unsubscribe from Specific Subscription
To unsubscribe from a specific subscription using its ID:Unsubscribe from All OHLCV Streams
To unsubscribe from all OHLCV streams while keeping other stream types active:If you didn’t provide a
subscriptionId when subscribing, one is auto-generated. To retrieve it, set "subscriptionTracking": true in the subscription payload.