futures.openInterest
Adds futures open-interest columns to an immutable query builder. Calling .openInterest() without arguments selects all dollar open-interest columns.
Imports
import { Velo } from 'velo-sdk';Examples
import { Velo, futures } from 'velo-sdk';
const velo = new Velo({ apiKey: process.env.VELO_API_KEY! });
const data = await velo.query(
futures
.openInterest(['close'], { metric: 'coin' })
.for({
products: ['BTCUSDT'],
})
.over({
last: '1D',
resolution: '1h',
}),
);
const rows = data.rows();Definition
function openInterest(
): FuturesBuilder<C | FuturesOpenInterestColumn<'dollar'>>;
function openInterest<M extends FuturesOpenInterestMetric>(
options: { readonly metric: M },
): FuturesBuilder<C | FuturesOpenInterestColumn<M>>;
function openInterest<P extends FuturesOpenInterestPart>(
parts: readonly P[],
): FuturesBuilder<C | FuturesOpenInterestColumn<'dollar', P>>;
function openInterest<
P extends FuturesOpenInterestPart,
M extends FuturesOpenInterestMetric,
>(
parts: readonly P[],
options: { readonly metric: M },
): FuturesBuilder<C | FuturesOpenInterestColumn<M, P>>;Parameters
parts
- Type:
readonly FuturesOpenInterestPart[] - Optional
- Default:
['high', 'low', 'close']
| Part | coin column | dollar column |
|---|---|---|
high | coin_open_interest_high | dollar_open_interest_high |
low | coin_open_interest_low | dollar_open_interest_low |
close | coin_open_interest_close | dollar_open_interest_close |
options
- Type:
{ readonly metric: 'coin' | 'dollar' } - Optional
- Default:
{ metric: 'dollar' }
Selects whether open interest is measured in coins or dollars.
Return Type
- Type:
FuturesBuilder<C | FuturesOpenInterestColumn<M, P>>
Returns a builder typed with the accumulated columns.