Skip to content

Get Open Interest (WebSocket)

Retrieve open interest data for all trading markets through the WebSocket connection. Open interest represents the total number of outstanding derivative contracts that have not been settled.

Endpoint

ws.send() wss://api.synthetix.io/v1/ws/info

Request

Request Format

{
  "id": "oi-1",
  "method": "post",
  "params": {
    "action": "getOpenInterest"
  }
}

Request Parameters

ParameterTypeRequiredDescription
idstringYesClient-generated unique request identifier
methodstringYesMust be "post"
paramsobjectYesRequest parameters wrapper
params.actionstringYesMust be "getOpenInterest"

Response

Success Response

{
  "id": "oi-1",
  "status": 200,
  "result": {
    "response": [
      {
        "symbol": "BTC-USDT",
        "openInterest": "1250.50",
        "longOpenInterest": "750.25",
        "shortOpenInterest": "500.25",
        "timestamp": 1704067200000
      },
      {
        "symbol": "ETH-USDT",
        "openInterest": "8500.75",
        "longOpenInterest": "4800.50",
        "shortOpenInterest": "3700.25",
        "timestamp": 1704067200000
      },
      {
        "symbol": "SOL-USDT",
        "openInterest": "45000.00",
        "longOpenInterest": "25000.00",
        "shortOpenInterest": "20000.00",
        "timestamp": 1704067200000
      }
    ],
    "status": "success"
  }
}

Open Interest Object

FieldTypeDescription
symbolstringTrading pair symbol (e.g., "BTC-USDT")
openIntereststringTotal open interest in base asset
longOpenIntereststringLong positions open interest in base asset
shortOpenIntereststringShort positions open interest in base asset
timestampintegerUnix milliseconds timestamp when open interest was last updated

Error Response

{
  "id": "oi-1",
  "status": 500,
  "result": null,
  "error": {
    "code": 500,
    "message": "Failed to retrieve open interest data"
  }
}

WebSocket Connection Example

const ws = new WebSocket('wss://papi.synthetix.io/v1/ws/info');
 
ws.onopen = () => {
  // Request open interest for all markets
  ws.send(JSON.stringify({
    id: 'oi-1',
    method: 'post',
    params: {
      action: 'getOpenInterest'
    }
  }));
};
 
ws.onmessage = (event) => {
  const response = JSON.parse(event.data);
 
  if (response.id === 'oi-1' && response.status === 200) {
    const openInterestData = response.result.response;
    console.log('Open Interest Data:', openInterestData);
    // Process open interest
    openInterestData.forEach(market => {
      console.log(`${market.symbol}:`);
      console.log(`  Total OI: ${market.openInterest}`);
      console.log(`  Long: ${market.longOpenInterest}`);
      console.log(`  Short: ${market.shortOpenInterest}`);
    });
  }
};

Implementation Notes

  • Public Data: No authentication required for this endpoint
  • All Markets: Returns open interest for all available markets in a single request
  • No Filtering: Cannot filter by symbol - all markets are always returned
  • Precision: Values are returned as decimal strings to preserve precision
  • Real-time Data: Open interest updates as positions are opened/closed
  • Long/Short Split: Provides breakdown of long vs short open interest

Use Cases

Market Analysis

  • Monitor market sentiment through long/short ratio
  • Identify overcrowded trades
  • Track market liquidity
  • Analyze position imbalances

Risk Management

  • Assess market exposure
  • Monitor systemic risk
  • Track position concentration
  • Evaluate market capacity

Trading Strategy

  • Contrarian indicators from extreme long/short ratios
  • Liquidity assessment for large orders
  • Market depth analysis
  • Position sizing based on open interest

Performance Considerations

  • Low Latency: WebSocket connection provides faster response times than REST
  • Persistent Connection: Reuse the same connection for multiple requests
  • All Markets: Single request returns all markets (no need for multiple calls)
  • Efficient: Minimal payload for quick data retrieval

Understanding Open Interest

Key Metrics

MetricDescription
Total Open InterestSum of all outstanding long and short positions
Long Open InterestTotal size of all long positions
Short Open InterestTotal size of all short positions
Long/Short RatioRatio of long to short positions (sentiment indicator)

Interpretation

  • Rising OI + Rising Price: Strong bullish trend (new longs entering)
  • Rising OI + Falling Price: Strong bearish trend (new shorts entering)
  • Falling OI + Rising Price: Short covering rally (weak bullish)
  • Falling OI + Falling Price: Long liquidations (weak bearish)

Validation Rules

  • No authentication required (public Info WebSocket)
  • No parameters required beyond the action
  • Returns all available markets

Related Endpoints