This endpoint is only available to Growth and Enterprise plans.

Endpoint Details

  • URL: wss://api.mobula.io
  • Event Type: fast-trade

Subscription Formats

The fast-trade endpoint supports subscribing to trades for multiple pools and tokens with real-time updates. Subscribe to multiple pools and tokens using the items array format with assetMode:
{
  "type": "fast-trade",
  "authorization": "YOUR-API-KEY",
  "payload": {
    "assetMode": false,
    "items": [
      {
        "blockchain": "evm:1",
        "address": "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640"
      },
      {
        "blockchain": "evm:1",
        "address": "0xA0b86a33E6441e88C5F2712C3E9b74B6F3B5C8b6"
      }
    ],
    "subscriptionTracking": true
  }
}

Token Mode Subscription

For token-specific trades (when assetMode is true):
{
  "type": "fast-trade",
  "authorization": "YOUR-API-KEY",
  "payload": {
    "assetMode": true,
    "items": [
      {
        "blockchain": "solana",
        "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
      },
      {
        "blockchain": "evm:1",
        "address": "0xA0b86a33E6441e88C5F2712C3E9b74B6F3B5C8b6"
      }
    ],
    "subscriptionTracking": true
  }
}

Parameters

Core Parameters

  • assetMode (required): Boolean indicating subscription mode
    • false: Subscribe to pools (default)
    • true: Subscribe to tokens
  • items (required): Array of subscription items, each containing:
    • blockchain (required): Blockchain identifier (e.g., "evm:1", "solana")
    • address (required): Pool or token address
  • subscriptionId (optional): Unique identifier for your WebSocket connection. Auto-generated if not provided
  • subscriptionTracking (optional, default: false): Include subscription details in response logs for debugging

Important Notes

This endpoint is specifically for subscribing to trades only. For enriched market data with each trade, use the market-details or token-details endpoints instead.The assetMode parameter determines how the addresses are interpreted:
  • false (default): Addresses are treated as pool addresses
  • true: Addresses are treated as token addresses

Real-Time Updates

After the initial subscription response, you’ll receive real-time updates whenever new trades occur involving the subscribed pools/tokens.

Real-Time Trade Updates

When trades happen involving subscribed items, you’ll receive updates with trade information. The response format depends on the assetMode used in your subscription:

Pool Mode Response (assetMode: false)

{
  "pair": "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640",
  "date": 1704067800000,
  "tokenPrice": 0.0234,
  "tokenPriceVs": 2500.75,
  "tokenAmount": 1000.0,
  "tokenAmountVs": 0.4,
  "tokenAmountUsd": 23.40,
  "type": "sell",
  "operation": "regular",
  "blockchain": "Ethereum",
  "hash": "0xdef789abc012...",
  "sender": "0x1234567890abcdef...",
  "tokenAmountRaw": "1000000000000000000000",
  "tokenAmountRawVs": "400000000000000000",
  "subscriptionId": "sub_abc123",
  "timestamp": 1704067800000
}

Token Mode Response (assetMode: true)

{
  "token": "0xA0b86a33E6441e88C5F2712C3E9b74B6F3B5C8b6",
  "date": 1704067800000,
  "tokenPrice": 0.0234,
  "tokenPriceVs": 2500.75,
  "tokenAmount": 1000.0,
  "tokenAmountVs": 0.4,
  "tokenAmountUsd": 23.40,
  "type": "sell",
  "operation": "regular",
  "blockchain": "Ethereum",
  "hash": "0xdef789abc012...",
  "sender": "0x1234567890abcdef...",
  "tokenAmountRaw": "1000000000000000000000",
  "tokenAmountRawVs": "400000000000000000",
  "subscriptionId": "sub_abc123",
  "timestamp": 1704067800000
}

Response Fields

  • pair: Pool address where the trade occurred (only in pool mode: assetMode = false)
  • token: Base token address involved in the trade (only in token mode: assetMode = true)
  • date: Timestamp of the trade (Unix milliseconds)
  • tokenPrice: Price of the traded token
  • tokenPriceVs: Price of the quote token
  • tokenAmount: Amount of tokens traded (base token)
  • tokenAmountVs: Amount of quote tokens traded
  • tokenAmountUsd: USD value of the trade
  • type: Trade type (“buy” or “sell”)
  • operation: Operation type (“regular”, “arbitrage”, etc.)
  • blockchain: Blockchain name
  • hash: Transaction hash
  • sender: Transaction sender address
  • tokenAmountRaw: Raw token amount (base token)
  • tokenAmountRawVs: Raw token amount (quote token)
  • subscriptionId: Your subscription identifier
  • timestamp: Server timestamp when the update was sent

Unsubscribing from the Stream

Unsubscribe from All Trade Streams

{
  "type": "unsubscribe",
  "authorization": "YOUR-API-KEY",
  "payload": {
    "type": "fast-trade"
  }
}

Unsubscribe from Specific Subscription

{
  "type": "unsubscribe",
  "authorization": "YOUR-API-KEY",
  "payload": {
    "subscriptionId": "sub_abc123"
  }
}

Unsubscribe from Specific Subscription with Type

{
  "type": "unsubscribe",
  "authorization": "YOUR-API-KEY",
  "payload": {
    "type": "fast-trade",
    "subscriptionId": "sub_abc123"
  }
}

Unsubscribe from Specific Items (Partial Unsubscription)

You can unsubscribe from specific pools/tokens while keeping others active in the same subscription:
{
  "type": "unsubscribe",
  "authorization": "YOUR-API-KEY",
  "payload": {
    "type": "fast-trade",
    "items": [
      {
        "blockchain": "evm:1",
        "address": "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640"
      }
    ]
  }
}

Unsubscribe from Multiple Specific Items

{
  "type": "unsubscribe",
  "authorization": "YOUR-API-KEY",
  "payload": {
    "type": "fast-trade",
    "items": [
      {
        "blockchain": "evm:1",
        "address": "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640"
      },
      {
        "blockchain": "evm:1",
        "address": "0xA0b86a33E6441e88C5F2712C3E9b74B6F3B5C8b6"
      }
    ]
  }
}

Unsubscribe from Specific Items in a Specific Subscription

{
  "type": "unsubscribe",
  "authorization": "YOUR-API-KEY",
  "payload": {
    "type": "fast-trade",
    "subscriptionId": "sub_abc123",
    "items": [
      {
        "blockchain": "evm:1",
        "address": "0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640"
      }
    ]
  }
}
If you didn’t provide a subscriptionId when subscribing, one is auto-generated. To retrieve it, set "subscriptionTracking": true in the subscription payload.For partial unsubscriptions without subscriptionId, the system will automatically find and modify subscriptions that contain the specified items, leaving other items in those subscriptions active.