The Execution Data channel provides real-time trade execution information for authorized Order Routing customers. Subscribe to receive notifications as trades execute on the platform.

Subscribe to Execution Data

Request

{
  "type": "subscribe",
  "channels": [
    {
      "type": "execution_data",
      "params": {
        "market": "BTCUSD"
      }
    }
  ]
}

Response

{
  "type": "subscribe",
  "channels": [
    {
      "type": "execution_data",
      "success": true
    }
  ]
}

Error Response

{
  "type": "subscribe",
  "channels": [
    {
      "type": "execution_data",
      "success": false,
      "error": "UNKNOWN_CHANNEL_PARAMS_CONFIGURATION"
    }
  ]
}

Execution Message Format

Each trade execution generates a message with the following format:
{
  "channel": "execution_data",
  "payload": {
    "market": "BTCUSD",
    "price": "50000.00",
    "amount": "0.5",
    "executed_at": "2024-01-15T10:30:00.123456789Z"
  }
}

Message Fields

FieldTypeDescription
marketstringThe market pair (e.g., “BTCUSD”)
pricestringExecution price as a decimal string
amountstringExecuted amount as a decimal string
executed_atstringTimestamp in RFC3339Nano format

Multiple Market Subscriptions

Subscribe to multiple markets simultaneously:
{
  "type": "subscribe",
  "channels": [
    {
      "type": "execution_data",
      "params": {
        "market": "BTCUSD"
      }
    },
    {
      "type": "execution_data",
      "params": {
        "market": "ETHUSD"
      }
    }
  ]
}

Processing Execution Data

Real-time Updates

  • Messages are sent immediately when trades execute
  • No messages during idle periods with no trading activity
  • All executions are delivered in chronological order

Example Implementation

class ExecutionMonitor {
  constructor() {
    this.executions = [];
    this.volumeByMarket = new Map();
  }

  handleExecution(message) {
    const execution = message.payload;
    
    // Store execution
    this.executions.push(execution);
    
    // Update volume tracking
    const currentVolume = this.volumeByMarket.get(execution.market) || 0;
    const executionVolume = parseFloat(execution.price) * parseFloat(execution.amount);
    this.volumeByMarket.set(execution.market, currentVolume + executionVolume);
    
    // Process execution
    this.processExecution(execution);
  }

  processExecution(execution) {
    console.log(`Trade executed in ${execution.market}:`,
      `${execution.amount} @ ${execution.price}`,
      `at ${execution.executed_at}`);
    
    // Your custom logic here
    // - Update charts
    // - Trigger alerts
    // - Calculate metrics
  }

  getRecentExecutions(market, count = 10) {
    return this.executions
      .filter(e => e.market === market)
      .slice(-count);
  }

  getTotalVolume(market) {
    return this.volumeByMarket.get(market) || 0;
  }
}

Unsubscribe

To stop receiving execution data:
{
  "type": "unsubscribe",
  "channels": [
    {
      "type": "execution_data",
      "params": {
        "market": "BTCUSD"
      }
    }
  ]
}

List Active Subscriptions

Get all active execution data subscriptions:
{
  "type": "subscription_list"
}

Response

{
  "type": "subscription_list",
  "channels": [
    {
      "type": "execution_data",
      "params": {
        "market": "BTCUSD"
      }
    },
    {
      "type": "execution_data",
      "params": {
        "market": "ETHUSD"
      }
    }
  ]
}
Questions? Contact Support.