Skip to content
Velo

client.rows

Fetches historical futures, options, or spot data and asynchronously yields one row at a time. Requests larger than one API response are split automatically.

Imports

const velo = require('velo-node')

Example

const velo = require('velo-node')
 
async function main() {
  const client = new velo.Client('api_key')
  const end = Date.now()
 
  const rows = client.rows({
    type: 'futures',
    exchanges: ['binance-futures'],
    products: ['BTCUSDT'],
    columns: ['close_price', 'funding_rate'],
    begin: end - 24 * 60 * 60 * 1000,
    end,
    resolution: '5m'
  })
 
  for await (const row of rows) {
    console.log(row)
  }
}
 
main()

Definition

rows(params): AsyncIterable<Object>

Parameters

params

  • Type: Object
PropertyTypeDescription
typestringOne of "futures", "options", or "spot".
exchangesstring[]Exchanges to query. An empty array selects all supported exchanges for the market type.
productsstring[]Exchange-native products to query. Use this or coins.
coinsstring[]Velo-aggregated coins to query. Use this or products.
columnsstring[]Market-data columns to return.
beginnumberBeginning of the time range as a Unix timestamp in milliseconds.
endnumberEnd of the time range as a Unix timestamp in milliseconds.
resolution`numberstring`

At least one of products or coins must be an array. If both are supplied, products is used. String resolutions align begin down and end up to complete bucket boundaries.

Use client.futuresColumns(), client.optionsColumns(), or client.spotColumns() to list the columns accepted for each market type.

Return Type

  • Type: AsyncIterable<Object>

Returns an async iterable immediately. Each yielded object contains the row's identifying fields and the requested market-data columns.

Requests exceeding the API's 22,500-value response limit are divided into consecutive requests while preserving row order.

Errors

Throws an Error before iteration for an invalid market type, time range, resolution, target, or empty columns array. Request errors surface while the async iterable is being consumed.