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 debuggingmaxUpdatesPerMinute(optional): Limit how often the server sends updates. See Update Rate Throttling below
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.Response Format
Upon subscribing, you first receive a confirmation message:Response Fields
| Field | Type | Description |
|---|---|---|
type | string | Always "ohlcv" |
subscriptionId | string | Unique subscription identifier |
open | number | null | Opening price in USD for the current candle |
high | number | null | Highest price in USD during the candle period |
low | number | null | Lowest price in USD during the candle period |
close | number | null | Latest price in USD (closing price of current candle) |
volume | number | Total trading volume in USD for the candle period |
time | number | Candle start time in milliseconds, aligned to the period |
period | string | Candlestick timeframe (e.g., 1s, 5m, 1h, 1d) |
tradeTime | number | Timestamp of the most recent trade in milliseconds |
address | string | Pool address (only in pool mode) |
asset | string | Token address (only in asset mode) |
The OHLCV candle is updated on every trade internally. Each message you receive contains the latest accurate candle state at the time it was sent.
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.Update Rate Throttling
You can control how frequently the server sends update messages using themaxUpdatesPerMinute field. This is useful for reducing bandwidth when you don’t need every single trade update reflected in real time.
- Per-subscription throttle: Each subscription is throttled independently based on its address/asset and period.
- Candle accuracy preserved: The OHLCV candle (open, high, low, close, volume) is still updated on every trade internally — only the delivery to your client is throttled. When a message is sent, it contains the latest accurate candle state.
- Dropped, not buffered: When an update arrives within the throttle window, it is silently dropped. The next update after the interval elapses will be delivered normally.
maxUpdatesPerMinute | Effective interval | Description |
|---|---|---|
| 600 | 100ms | Maximum rate (~10 updates/sec) |
| 60 | 1s | One update per second |
| 6 | 10s | One update every 10 seconds |
| 1 | 60s | One update per minute (minimum rate) |
When
maxUpdatesPerMinute is not provided, no throttle is applied and updates are delivered as fast as they arrive.Support
Can’t find what you’re looking for? Reach out to us, response times < 1h.Support
Telegram
Support
Slack
Need help?
Email