Skip to content
Velo

spot.for

Defines which markets to query. Choose exactly one of coins or products, and optionally select specific exchanges (omit for all exchanges).

The .for() step is required before a request can be executed.

Imports

import { Velo } from 'velo-sdk';

Examples

import { Velo, spot } from 'velo-sdk';
 
const velo = new Velo({ apiKey: process.env.VELO_API_KEY! });
 
const data = await velo.query(
  spot
    .price(['close'])
    .for({
      exchanges: ['binance', 'coinbase'],
      coins: ['BTC'],
    })
    .over({
      last: '1D',
      resolution: '1h',
    }),
);

Omitting exchanges selects every spot exchange:

spot.price(['close']).for({ coins: ['BTC'] });

Definition

function for(scope: MarketScope<SpotExchange>): SpotBuilder;

Parameters

scope.coins / scope.products

  • Type: readonly string[]

Provide exactly one of the two.

Use coins for Velo-aggregated symbols, products for exchange-specific symbols.

scope.exchanges

  • Type: readonly SpotExchange[]
  • Optional
  • Default: every spot exchange

When given, the returned row type narrows to exactly the exchanges selected.

Return Type

  • Type: SpotBuilder

Returns a builder with the market scope recorded. Call .over() to add the time window.