Skip to main content
This endpoint is only available to Enterprise plans.

Endpoint Details

  • URL: wss://production-feed.mobula.io
  • Event Type: feed

Subscription Formats

The Price Feed Stream supports two versions with different subscription methods. Version 2 provides more flexibility with two subscription modes:

Subscribe by Asset IDs

{
  "type": "feed",
  "authorization": "YOUR_API_KEY",
  "kind": "asset_ids",
  "asset_ids": [123, 456],
  "quote_id": 456
}

Subscribe by Token Addresses

{
  "type": "feed",
  "authorization": "YOUR_API_KEY",
  "kind": "address",
  "tokens": [
    {
      "blockchain": "solana",
      "address": "So11111111111111111111111111111111111111112"
    },
    {
      "blockchain": "evm:1",
      "address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
    }
  ],
  "quote": {
    "blockchain": "solana",
    "address": "So11111111111111111111111111111111111111112"
  }
}

V1 Subscription (Legacy)

Subscribe to all assets in the database:
{
  "type": "feed",
  "authorization": "YOUR_API_KEY"
}

Parameters

V2 Parameters

  • kind (required for V2): Subscription mode - asset_ids or address
  • asset_ids (optional): Array of asset IDs to subscribe to. Omit for all assets
  • tokens (optional): Array of token objects with blockchain and address. Omit for all tokens
  • quote_id (optional): Quote asset ID for pricing. Defaults to USD
  • quote (optional): Quote token object with blockchain and address. Defaults to USD
You can find asset IDs using the /all endpoint. If asset_ids or tokens are omitted, you’ll receive updates for all registered assets.

Data Model

Each price update includes the following fields:
{
  timestamp: number;           // Unix timestamp in milliseconds
  price: number;              // Current asset price
  marketDepthUSDUp: number;   // Market depth for upward price movement
  marketDepthUSDDown: number; // Market depth for downward price movement
  volume24h: number;          // 24-hour trading volume
  baseSymbol: string;         // Base asset symbol
  quoteSymbol: string;        // Quote asset symbol (e.g., "USD")
  extra: {
    priceUSD: number;         // Price in USD
    quoteAssetPrice: number;  // Quote asset price
    blockNumber: string;      // Latest block number
  }
}

Example Response

{
  "timestamp": 1733173907000,
  "price": 3881.328639607063,
  "marketDepthUSDUp": 418639.4559697787,
  "marketDepthUSDDown": 623414.4447679224,
  "volume24h": 874713.342519723,
  "baseSymbol": "SWETH",
  "quoteSymbol": "USD",
  "extra": {
    "priceUSD": 3881.328639607063,
    "quoteAssetPrice": 1,
    "blockNumber": "21317425"
  }
}

Pricing Methodology

Our pricing methodology uses a weighted average based on market depth and volume for each contract, then re-weights based on contract volume to calculate the final multichain price. For more details, see our pricing methodology article.

Adding Assets to Feed (V1)

For V1 subscriptions, you can dynamically add assets to your feed:
curl --request GET \
  --url "https://production-api.mobula.io/api/1/feed/create?assetId=<assetId>&quoteId=<quoteId>" \
  --header "Authorization: YOUR_API_KEY" \
  --header "Content-Type: application/json"
Leave quoteId empty to use USD as the default quote currency.

Implementation Example

const socket = new WebSocket("wss://production-feed.mobula.io");

socket.addEventListener("open", () => {
  // V2 subscription by asset IDs
  socket.send(JSON.stringify({
    type: "feed",
    authorization: "YOUR_API_KEY",
    kind: "asset_ids",
    asset_ids: [123, 456],
    quote_id: 456
  }));
});

socket.addEventListener("message", (event) => {
  const data = JSON.parse(event.data);
  
  // Process price update
  console.log(`${data.baseSymbol}/${data.quoteSymbol}: $${data.price}`);
  console.log(`24h Volume: $${data.volume24h}`);
});

socket.addEventListener("error", (error) => {
  console.error("WebSocket error:", error);
});

socket.addEventListener("close", () => {
  console.log("WebSocket connection closed");
});

Unsubscribing from the Stream

Unsubscribe by Asset IDs

{
  "type": "unsubscribe",
  "authorization": "YOUR_API_KEY",
  "payload": {
    "type": "feed",
    "asset_ids": [123, 456]
  }
}

Unsubscribe by Token Addresses

{
  "type": "unsubscribe",
  "authorization": "YOUR_API_KEY",
  "payload": {
    "type": "feed",
    "tokens": [
      {
        "blockchain": "solana",
        "address": "So11111111111111111111111111111111111111112"
      }
    ]
  }
}

Support

Can’t find what you’re looking for? Reach out to us, response times < 1h.