Skip to content
Velo

orderbook.levels

Describes an orderbook depth request. Takes the whole scope in one object: a target, a time window, and a resolution. Pass the result to velo.query() or velo.stream().

Imports

import { Velo } from 'velo-sdk';

Examples

import { Velo, orderbook } from 'velo-sdk';
 
const velo = new Velo({ apiKey: process.env.VELO_API_KEY! });
 
const data = await velo.query(
  orderbook.levels({
    exchange: 'binance-futures',
    product: 'BTCUSDT',
    last: '1h',
    resolution: '1m',
  }),
);
 
const latest = data.snapshotAt(-1);

Definition

function levels(scope: OrderbookScope): OrderbookLevelsBuilder;

Parameters

scope.exchange and scope.product

  • Type: FuturesExchange and string
  • Use both together to target one exchange product

scope.coin

  • Type: string
  • Use alone for the Velo-aggregated book

Provide either coin or both exchange and product.

scope.between / scope.last

  • Type: readonly [number | Date, number | Date] (between) or LastDuration (last)

Provide exactly one of the two.

  • between is a [begin, end) pair of Date objects or millisecond timestamps
  • last is a trailing duration, anchored when the request is executed

scope.resolution

  • Type: OrderbookResolution

Only minute-based resolutions are supported.

Return Type

  • Type: OrderbookLevelsBuilder

Returns a request. Executing it resolves to OrderbookData, which exposes rows(), snapshots(), and snapshotAt().

Requests wider than the per-request bucket cap are split into several HTTP requests automatically.