Skip to content
Velo

spot.trades

Adds spot trade-count columns to an immutable query builder. Calling .trades() without arguments selects buy, sell, and total trade counts.

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
    .trades(['buy', 'sell'])
    .for({
      products: ['BTC-USD'],
    })
    .over({
      last: '1D',
      resolution: '1h',
    }),
);
 
const rows = data.rows();

Definition

function trades(): SpotBuilder<C | SpotTradeColumn>;
 
function trades<P extends SpotTradePart>(
  parts: readonly P[],
): SpotBuilder<C | SpotTradeColumn<P>>;

Parameters

parts

  • Type: readonly SpotTradePart[]
  • Optional
  • Default: ['buy', 'sell', 'total']
PartSelected column
buybuy_trades
sellsell_trades
totaltotal_trades

Return Type

  • Type: SpotBuilder<C | SpotTradeColumn<P>>

Returns a builder typed with the accumulated columns.