spot.price
Adds spot price columns to an immutable query builder. Calling .price() without arguments selects all four OHLC columns.
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({
products: ['BTC-USD'],
})
.over({
last: '1D',
resolution: '1h',
}),
);
const rows = data.rows();Definition
function price(): SpotBuilder<C | SpotPriceColumn>;
function price<P extends SpotPricePart>(
parts: readonly P[],
): SpotBuilder<C | SpotPriceColumn<P>>;Parameters
parts
- Type:
readonly SpotPricePart[] - Optional
- Default:
['open', 'high', 'low', 'close']
| Part | Selected column |
|---|---|
open | open_price |
high | high_price |
low | low_price |
close | close_price |
Return Type
- Type:
SpotBuilder<C | SpotPriceColumn<P>>
Returns a builder typed with the accumulated columns.