channels.price
Builds a channel for live futures or spot OHLC prices and volume. Accepts a product on one exchange.
Pass it to velo.channels.feed() with a data listener to receive updates.
Imports
import { Velo } from 'velo-sdk';Example
const velo = new Velo({ apiKey: process.env.VELO_API_KEY! });
const product = {
exchange: 'binance-futures',
coin: 'BTC',
product: 'BTCUSDT',
} as const;
const single = velo.channels.price(product).on({
data: (row) => console.log(row.time, row.close_price),
error: ({ reason }) => console.error('Channel error:', reason),
});
const watcher = await velo.watch(velo.channels.feed([single]), {
on: { error: (error) => console.error('Connection error:', error) },
});
// Later:
watcher.close();Definition
Simplified signature. The SDK infers the returned channel's data type from the product.
function price(product: Product<FuturesExchange | SpotExchange>): Channel;Parameters
product
- Type:
Product<FuturesExchange | SpotExchange> - Required
A futures or spot product with exchange, coin, and product, as returned by the
catalog. Price has no aggregated coin channel.
Return Type
- Type:
Channel
Returns a channel typed with the selected product.
| Field | Description |
|---|---|
open_price | First price of the minute |
high_price / low_price | Highest and lowest prices so far in the minute |
close_price | Latest price |
coin_volume / dollar_volume | Total volume so far in the minute, in coins or dollars |
{
"exchange": "binance-futures",
"coin": "BTC",
"product": "BTCUSDT",
"time": 1785160560000,
"open_price": 65000,
"high_price": 65120,
"low_price": 64980,
"close_price": 65080,
"coin_volume": 25,
"dollar_volume": 1627000
}