Skip to content
Velo

channels.openInterest

Builds a channel for live futures open interest. Accepts a product on one exchange or a coin across exchanges. Pass it to velo.channels.feed() with a data listener to receive updates.

Imports

import { Velo } from 'velo-sdk';

Example

const velo = new Velo({ apiKey: process.env.VELO_API_KEY! });
const product = {
  exchange: 'binance-futures',
  coin: 'BTC',
  product: 'BTCUSDT',
} as const;
 
const single = velo.channels.openInterest(product, { metric: 'dollars' }).on({
  data: (row) => console.log(row.time, row.dollar_open_interest_high),
  error: ({ reason }) => console.error('Channel error:', reason),
});
 
const aggregated = velo.channels.openInterest({ coin: product.coin }, { metric: 'dollars' }).on({
  data: (entries) => console.table(entries),
  error: ({ reason }) => console.error('Aggregated channel error:', reason),
});
 
const watcher = await velo.watch(velo.channels.feed([single, aggregated]), {
  on: { error: (error) => console.error('Connection error:', error) },
});
 
// Later:
watcher.close();

Definition

Simplified signature. The SDK infers the returned channel's data type from the target and options.

function openInterest(
  target: Target<FuturesExchange>,
  options?: { readonly metric?: 'coins' | 'dollars' },
): Channel;

Parameters

target

  • Type: Target<FuturesExchange>
  • Required

A futures product with exchange, coin, and product, as returned by the catalog. Pass { coin } on its own for an aggregated channel across futures exchanges.

options

PropertyTypeDefaultDescription
metric'coins' | 'dollars''dollars'Units for the returned values.

Channel metrics use the plural coins and dollars; historical selectors use coin and dollar.

Return Type

  • Type: Channel

Returns a channel typed with the selected target and options.

MetricFields
coinscoin_open_interest_high, coin_open_interest_low, coin_open_interest_close
dollarsdollar_open_interest_high, dollar_open_interest_low, dollar_open_interest_close

Dollar close uses the latest trade price, so it may fall outside the reported high/low range or differ from historical values.

{
  "exchange": "binance-futures",
  "coin": "BTC",
  "product": "BTCUSDT",
  "time": 1785160560000,
  "dollar_open_interest_high": 65000000,
  "dollar_open_interest_low": 64000000,
  "dollar_open_interest_close": 64500000
}