### Install velo-node with npm Source: https://github.com/velodataorg/velo-node/blob/main/README.md Install the velo-node library using npm. This is the first step to using the Velo API in your NodeJS project. ```bash npm install velo-node ``` -------------------------------- ### List Spot Trading Products Source: https://context7.com/velodataorg/velo-node/llms.txt Get an array of spot trading products from supported exchanges using `client.spot()`. The result can be filtered to find specific pairs. ```javascript const velo = require('velo-node') async function listSpot() { const client = new velo.Client('YOUR_API_KEY') const spotProducts = await client.spot() console.log(`Found ${spotProducts.length} spot products`) const btcProducts = spotProducts.filter(p => p.product.startsWith('BTC')) console.log('BTC spot pairs:', btcProducts.map(p => `${p.exchange}:${p.product}`)) // ['binance:BTCUSDT', 'coinbase:BTC-USD', 'bybit-spot:BTCUSDT', ...] } ``` -------------------------------- ### Query Multi-Exchange Spot Market Data by Coin Source: https://context7.com/velodataorg/velo-node/llms.txt Fetches historical spot market data aggregated across multiple exchanges for specified coins. This example uses the `coins` parameter instead of `products` and queries all supported spot exchanges. ```javascript // Cross-exchange aggregated query using coins instead of products async function fetchMultiExchangeSpot() { const client = new velo.Client('YOUR_API_KEY') const columns = client.spotColumns() const params = { type: 'spot', columns: ['open_price', 'close_price', 'dollar_volume'], exchanges: [], // empty = all supported spot exchanges coins: ['BTC', 'ETH'], begin: Date.now() - 1000 * 60 * 60 * 24 * 7, // last 7 days end: Date.now(), resolution: '1d' // daily candles } const rows = client.rows(params) for await (const row of rows) { console.log(row) } } ``` -------------------------------- ### Get Available Spot Market Data Columns Source: https://context7.com/velodataorg/velo-node/llms.txt Retrieves a list of column names available for spot market data queries. Use this to determine which columns can be requested. ```javascript const velo = require('velo-node') const client = new velo.Client('YOUR_API_KEY') const columns = client.spotColumns() console.log('Spot columns:', columns) /* [ 'open_price', 'high_price', 'low_price', 'close_price', 'coin_volume', 'dollar_volume', 'buy_trades', 'sell_trades', 'total_trades', 'buy_coin_volume', 'sell_coin_volume', 'buy_dollar_volume', 'sell_dollar_volume' ] */ ``` -------------------------------- ### Get Available Futures Columns Source: https://context7.com/velodataorg/velo-node/llms.txt Obtain the full list of column names for futures market data queries using `client.futuresColumns()`. These can be passed to `client.rows()`. ```javascript const velo = require('velo-node') const client = new velo.Client('YOUR_API_KEY') const columns = client.futuresColumns() console.log('All futures columns:', columns) /* [ 'open_price', 'high_price', 'low_price', 'close_price', 'coin_volume', 'dollar_volume', 'buy_trades', 'sell_trades', 'total_trades', 'buy_coin_volume', 'sell_coin_volume', 'buy_dollar_volume', 'sell_dollar_volume', 'coin_open_interest_high', 'coin_open_interest_low', 'coin_open_interest_close', 'dollar_open_interest_high', 'dollar_open_interest_low', 'dollar_open_interest_close', 'funding_rate', 'funding_rate_avg', 'premium', 'buy_liquidations', 'sell_liquidations', 'buy_liquidations_coin_volume', 'sell_liquidations_coin_volume', 'liquidations_coin_volume', 'buy_liquidations_dollar_volume', 'sell_liquidations_dollar_volume', 'liquidations_dollar_volume', '3m_basis_ann' ] */ // Select only OHLCV columns const ohlcv = columns.slice(0, 5) console.log('OHLCV columns:', ohlcv) // ['open_price', 'high_price', 'low_price', 'close_price', 'coin_volume'] ``` -------------------------------- ### Get Library Version with client.version Source: https://context7.com/velodataorg/velo-node/llms.txt Retrieves the current version string of the velo-node library. Useful for checking compatibility or debugging. ```javascript const velo = require('velo-node') const client = new velo.Client('YOUR_API_KEY') console.log('velo-node version:', client.version()) // 'velo-node version: 1.5.5' ``` -------------------------------- ### Get Available Options Market Data Columns Source: https://context7.com/velodataorg/velo-node/llms.txt Retrieves a list of column names for options market data queries, including implied volatility and Greeks. Use this to identify available options-related data points. ```javascript const velo = require('velo-node') const client = new velo.Client('YOUR_API_KEY') const columns = client.optionsColumns() console.log('Options columns:', columns) /* [ 'iv_1w', 'iv_1m', 'iv_3m', 'iv_6m', 'skew_1w', 'skew_1m', 'skew_3m', 'skew_6m', 'vega_coins', 'vega_dollars', 'call_delta_coins', 'call_delta_dollars', 'put_delta_coins', 'put_delta_dollars', 'gamma_coins', 'gamma_dollars', 'call_volume', 'call_premium', 'call_notional', 'put_volume', 'put_premium', 'put_notional', 'dollar_volume', 'dvol_open', 'dvol_high', 'dvol_low', 'dvol_close', 'index_price' ] */ ``` -------------------------------- ### Query Historical Futures Market Data Source: https://context7.com/velodataorg/velo-node/llms.txt Fetches historical OHLCV and derived metric rows for futures contracts. This example demonstrates filtering by a specific product on an exchange and setting a time range and resolution. ```javascript const velo = require('velo-node') async function fetchFuturesData() { const client = new velo.Client('YOUR_API_KEY') // Get available products and select BTC perpetual on Binance const futures = await client.futures() const btcBinance = futures.find(f => f.exchange === 'binance-futures' && f.product === 'BTCUSDT') const params = { type: 'futures', columns: ['open_price', 'close_price', 'dollar_volume', 'funding_rate', 'dollar_open_interest_close'], exchanges: [btcBinance.exchange], products: [btcBinance.product], begin: Date.now() - 1000 * 60 * 60 * 24, // last 24 hours end: Date.now(), resolution: '1h' // hourly candles } const rows = client.rows(params) for await (const row of rows) { console.log(row) /* { time: '2024-01-15T10:00:00.000Z', exchange: 'binance-futures', product: 'BTCUSDT', open_price: 42500.1, close_price: 42780.5, dollar_volume: 1234567890.12, funding_rate: 0.0001, dollar_open_interest_close: 9876543210.00 } */ } } fetchFuturesData().catch(console.error) ``` -------------------------------- ### Check Velo API Status Source: https://context7.com/velodataorg/velo-node/llms.txt Use `client.status()` to get a plain-text status string from the Velo API health endpoint. This is useful for verifying connectivity and API key validity. ```javascript const velo = require('velo-node') async function checkStatus() { const client = new velo.Client('YOUR_API_KEY') try { const status = await client.status() console.log('API status:', status) // Expected output: "API status: ok" } catch (err) { console.error('API unreachable:', err.message) } } checkStatus() ``` -------------------------------- ### client.options() Source: https://context7.com/velodataorg/velo-node/llms.txt Returns options products available on Deribit. ```APIDOC ## `client.options()` — List Options Products Returns options products available on Deribit. ```javascript const velo = require('velo-node') async function listOptions() { const client = new velo.Client('YOUR_API_KEY') const options = await client.options() console.log(`Found ${options.length} options products`) console.log('Sample:', options[0]) // { exchange: 'deribit', product: 'BTC', ... } } listOptions() ``` ``` -------------------------------- ### Client Initialization Source: https://context7.com/velodataorg/velo-node/llms.txt Instantiate the Client with your Velo API key. An optional second argument sets the number of automatic retries on 5xx errors (default: 2). ```APIDOC ## Client Initialization Instantiate the `Client` with your Velo API key. An optional second argument sets the number of automatic retries on 5xx errors (default: 2). ```javascript const velo = require('velo-node') // Basic initialization const client = new velo.Client('YOUR_API_KEY') // With custom retry count const clientWithRetry = new velo.Client('YOUR_API_KEY', 3) ``` ``` -------------------------------- ### List Options Products Source: https://context7.com/velodataorg/velo-node/llms.txt Retrieve options products available on Deribit using `client.options()`. The output includes exchange, product, and other metadata. ```javascript const velo = require('velo-node') async function listOptions() { const client = new velo.Client('YOUR_API_KEY') const options = await client.options() console.log(`Found ${options.length} options products`) console.log('Sample:', options[0]) // { exchange: 'deribit', product: 'BTC', ... } } ``` -------------------------------- ### Fetch and Process Futures Data with velo-node Source: https://github.com/velodataorg/velo-node/blob/main/README.md Demonstrates how to initialize the Velo client, fetch futures data, extract relevant columns and exchanges, and then retrieve and log rows for a specified time range and resolution. Ensure you have your 'api_key' to instantiate the client. ```javascript const velo = require('velo-node') async function doWork() { const futures = await client.futures() const future = futures[0] const columns = client.futuresColumns() const twoColumns = columns.slice(0, 2) const params = { type: 'futures', columns: twoColumns, exchanges: [future.exchange], products: [future.product], begin: Date.now() - 1000 * 60 * 11, // 10 minutes end: Date.now(), resolution: '1m' // 1 minute } const rows = client.rows(params) for await (const row of rows) { console.log(row) } } const client = new velo.Client('api_key') doWork() ``` -------------------------------- ### client.spot([delisted]) Source: https://context7.com/velodataorg/velo-node/llms.txt Returns an array of spot trading products from supported exchanges (Binance, Coinbase, Bybit Spot, OKEx). ```APIDOC ## `client.spot([delisted])` — List Spot Products Returns an array of spot trading products from supported exchanges (Binance, Coinbase, Bybit Spot, OKEx). ```javascript const velo = require('velo-node') async function listSpot() { const client = new velo.Client('YOUR_API_KEY') const spotProducts = await client.spot() console.log(`Found ${spotProducts.length} spot products`) const btcProducts = spotProducts.filter(p => p.product.startsWith('BTC')) console.log('BTC spot pairs:', btcProducts.map(p => `${p.exchange}:${p.product}`)) // ['binance:BTCUSDT', 'coinbase:BTC-USD', 'bybit-spot:BTCUSDT', ...] } listSpot() ``` ``` -------------------------------- ### Initialize Velo Node Client Source: https://context7.com/velodataorg/velo-node/llms.txt Instantiate the Client with your Velo API key. An optional second argument sets the number of automatic retries on 5xx errors. ```javascript const velo = require('velo-node') // Basic initialization const client = new velo.Client('YOUR_API_KEY') ``` ```javascript const velo = require('velo-node') // With custom retry count const clientWithRetry = new velo.Client('YOUR_API_KEY', 3) ``` -------------------------------- ### client.spotColumns() Source: https://context7.com/velodataorg/velo-node/llms.txt Retrieves a list of column names that can be used for querying spot market data. ```APIDOC ## `client.spotColumns()` — Available Spot Columns Returns the list of column names available for spot market data queries. ### Usage ```javascript const velo = require('velo-node') const client = new velo.Client('YOUR_API_KEY') const columns = client.spotColumns() console.log('Spot columns:', columns) ``` ### Response Example ```json [ "open_price", "high_price", "low_price", "close_price", "coin_volume", "dollar_volume", "buy_trades", "sell_trades", "total_trades", "buy_coin_volume", "sell_coin_volume", "buy_dollar_volume", "sell_dollar_volume" ] ``` ``` -------------------------------- ### WebSocket News Stream with client.news.stream Source: https://context7.com/velodataorg/velo-node/llms.txt Establishes a WebSocket connection for real-time news events. Returns a standard `ws.WebSocket` instance for handling connection events. ```javascript const velo = require('velo-node') function startNewsStream() { const client = new velo.Client('YOUR_API_KEY') // Returns a ws.WebSocket instance const socket = client.news.stream() socket.on('open', () => { console.log('Connected to Velo news stream') }) socket.on('message', (data) => { const story = JSON.parse(data) console.log('Breaking news:', story) /* { id: '...', title: 'Major exchange reports outage', url: 'https://...', time: 1705312200000, priority: 'high' } */ }) socket.on('close', () => { console.log('Disconnected from news stream') // Implement reconnect logic here if needed setTimeout(startNewsStream, 5000) }) socket.on('error', (err) => { console.error('WebSocket error:', err.message) }) return socket } startNewsStream() ``` -------------------------------- ### client.version() Source: https://context7.com/velodataorg/velo-node/llms.txt Retrieves the current version string of the velo-node library. ```APIDOC ## client.version() — Get Library Version ### Description Returns the current version string of the velo-node library. ### Response #### Success Response (string) - **version** (string) - The version string of the velo-node library. ### Request Example ```javascript const version = client.version() console.log('velo-node version:', version) // 'velo-node version: 1.5.5' ``` ``` -------------------------------- ### client.news.stream() Source: https://context7.com/velodataorg/velo-node/llms.txt Establishes a WebSocket connection to receive real-time, high-priority news events. This method returns a standard `ws.WebSocket` instance. ```APIDOC ## client.news.stream() — WebSocket News Stream ### Description Opens a WebSocket connection to receive real-time priority news events. Returns a standard `ws.WebSocket` instance that emits `open`, `message`, `close`, and `error` events. ### Response #### Success Response (WebSocket) - **socket** (ws.WebSocket) - A WebSocket instance. - **Events**: - **open**: Emitted when the connection is established. - **message**: Emitted when a new news story is received. The data is a JSON string representing the story object. - **close**: Emitted when the connection is closed. - **error**: Emitted when an error occurs. ### Request Example ```javascript const socket = client.news.stream() socket.on('open', () => { console.log('Connected to Velo news stream') }) socket.on('message', (data) => { const story = JSON.parse(data) console.log('Breaking news:', story) }) socket.on('close', () => { console.log('Disconnected from news stream') }) socket.on('error', (err) => { console.error('WebSocket error:', err.message) }) ``` ### News Story Object Example (on 'message') ```json { "id": "...", "title": "Major exchange reports outage", "url": "https://...", "time": 1705312200000, "priority": "high" } ``` ``` -------------------------------- ### List Futures Products Source: https://context7.com/velodataorg/velo-node/llms.txt Retrieve an array of tradable futures products from all supported exchanges using `client.futures()`. Pass `true` to include delisted instruments. ```javascript const velo = require('velo-node') async function listFutures() { const client = new velo.Client('YOUR_API_KEY') // Active futures only const futures = await client.futures() console.log(`Found ${futures.length} active futures products`) console.log('First product:', futures[0]) // { exchange: 'binance-futures', product: 'BTCUSDT', ... } ``` ```javascript // Include delisted instruments const allFutures = await client.futures(true) console.log(`Found ${allFutures.length} total futures (including delisted)`) } ``` -------------------------------- ### client.optionsColumns() Source: https://context7.com/velodataorg/velo-node/llms.txt Retrieves a list of column names for querying options market data, including implied volatility and Greeks. ```APIDOC ## `client.optionsColumns()` — Available Options Columns Returns the list of column names available for options market data queries, including implied volatility, Greeks, and DVOL. ### Usage ```javascript const velo = require('velo-node') const client = new velo.Client('YOUR_API_KEY') const columns = client.optionsColumns() console.log('Options columns:', columns) ``` ### Response Example ```json [ "iv_1w", "iv_1m", "iv_3m", "iv_6m", "skew_1w", "skew_1m", "skew_3m", "skew_6m", "vega_coins", "vega_dollars", "call_delta_coins", "call_delta_dollars", "put_delta_coins", "put_delta_dollars", "gamma_coins", "gamma_dollars", "call_volume", "call_premium", "call_notional", "put_volume", "put_premium", "put_notional", "dollar_volume", "dvol_open", "dvol_high", "dvol_low", "dvol_close", "index_price" ] ``` ``` -------------------------------- ### Fetch News Stories with client.news.stories Source: https://context7.com/velodataorg/velo-node/llms.txt Retrieves historical crypto news stories. Use `{ begin: 0 }` for all history or a millisecond timestamp for stories from a specific point. ```javascript const velo = require('velo-node') async function fetchNews() { const client = new velo.Client('YOUR_API_KEY') // Fetch all available stories const stories = await client.news.stories({ begin: 0 }) console.log(`Fetched ${stories.length} stories`) console.log('Latest story:', stories[stories.length - 1]) /* { id: '...', title: 'Bitcoin hits new all-time high', url: 'https://...', time: 1705312200000, ... } */ // Fetch stories from the last 24 hours const recentStories = await client.news.stories({ begin: Date.now() - 1000 * 60 * 60 * 24 }) console.log(`Recent stories: ${recentStories.length}`) } fetchNews().catch(console.error) ``` -------------------------------- ### client.marketCaps(params) Source: https://context7.com/velodataorg/velo-node/llms.txt Fetches historical market capitalization data, including circulating supply in dollars. ```APIDOC ## `client.marketCaps(params)` — Query Market Capitalizations Fetches circulating-supply market cap data. Accepts the same time range and resolution parameters as `rows()`. ### Parameters - `coins` (string[]): Filter by coin symbol (e.g. `['BTC', 'ETH']`) - `begin` (number): Start timestamp in milliseconds - `end` (number): End timestamp in milliseconds - `resolution` (string|number): Candle size: `'1m'`, `'5m'`, `'1h'`, `'1d'`, `'1w'`, `'1M'`, or numeric minutes ### Usage Example ```javascript const velo = require('velo-node') async function fetchMarketCaps() { const client = new velo.Client('YOUR_API_KEY') const params = { coins: ['BTC', 'ETH', 'SOL'], begin: Date.now() - 1000 * 60 * 60 * 24 * 30, // last 30 days end: Date.now(), resolution: '1d' } try { const caps = await client.marketCaps(params) for (const cap of caps) { console.log(cap) } } catch (err) { console.error('Failed to fetch market caps:', err.message) } } fetchMarketCaps() ``` ### Response Example (Single Cap Entry) ```json { "time": "...", "coin": "BTC", "circ_dollars": 850000000000.00 } ``` ``` -------------------------------- ### client.futuresColumns() Source: https://context7.com/velodataorg/velo-node/llms.txt Returns the full list of column names available when querying futures market data rows. Pass a subset of these to the `columns` field in `client.rows()`. ```APIDOC ## `client.futuresColumns()` — Available Futures Columns Returns the full list of column names available when querying futures market data rows. Pass a subset of these to the `columns` field in `client.rows()`. ```javascript const velo = require('velo-node') const client = new velo.Client('YOUR_API_KEY') const columns = client.futuresColumns() console.log('All futures columns:', columns) /* [ 'open_price', 'high_price', 'low_price', 'close_price', 'coin_volume', 'dollar_volume', 'buy_trades', 'sell_trades', 'total_trades', 'buy_coin_volume', 'sell_coin_volume', 'buy_dollar_volume', 'sell_dollar_volume', 'coin_open_interest_high', 'coin_open_interest_low', 'coin_open_interest_close', 'dollar_open_interest_high', 'dollar_open_interest_low', 'dollar_open_interest_close', 'funding_rate', 'funding_rate_avg', 'premium', 'buy_liquidations', 'sell_liquidations', 'buy_liquidations_coin_volume', 'sell_liquidations_coin_volume', 'liquidations_coin_volume', 'buy_liquidations_dollar_volume', 'sell_liquidations_dollar_volume', 'liquidations_dollar_volume', '3m_basis_ann' ] */ // Select only OHLCV columns const ohlcv = columns.slice(0, 5) console.log('OHLCV columns:', ohlcv) // ['open_price', 'high_price', 'low_price', 'close_price', 'coin_volume'] ``` ``` -------------------------------- ### Query Order Book Depth with client.depth Source: https://context7.com/velodataorg/velo-node/llms.txt Retrieves order book depth (level 2) data as an async iterator. Supports minute resolutions. Query by either `exchange`+`product` or `coin`, but not both. ```javascript const velo = require('velo-node') async function fetchOrderBookDepth() { const client = new velo.Client('YOUR_API_KEY') const params = { exchange: 'binance-futures', product: 'BTCUSDT', begin: Date.now() - 1000 * 60 * 60 * 6, // last 6 hours end: Date.now(), resolution: 5 // 5-minute snapshots } const depthRows = client.depth(params) for await (const row of depthRows) { console.log(row) /* { time: 1705312200000, mid: 42650.5, '42600': 1.234, // depth at price level '42650': 5.678, '42700': 2.345, ... } */ } } // Alternatively, query by coin across exchanges async function fetchDepthByCoin() { const client = new velo.Client('YOUR_API_KEY') const params = { coin: 'BTC', begin: Date.now() - 1000 * 60 * 60, end: Date.now(), resolution: 1 // 1-minute } const depthRows = client.depth(params) for await (const row of depthRows) { console.log(row) } } fetchOrderBookDepth().catch(console.error) ``` -------------------------------- ### client.futures([delisted]) Source: https://context7.com/velodataorg/velo-node/llms.txt Returns an array of tradable futures products across all supported exchanges. Pass `true` to include delisted instruments. Each object contains `exchange`, `product`, and metadata fields. ```APIDOC ## `client.futures([delisted])` — List Futures Products Returns an array of tradable futures products across all supported exchanges. Pass `true` to include delisted instruments. Each object contains `exchange`, `product`, and metadata fields. ```javascript const velo = require('velo-node') async function listFutures() { const client = new velo.Client('YOUR_API_KEY') // Active futures only const futures = await client.futures() console.log(`Found ${futures.length} active futures products`) console.log('First product:', futures[0]) // { exchange: 'binance-futures', product: 'BTCUSDT', ... } // Include delisted instruments const allFutures = await client.futures(true) console.log(`Found ${allFutures.length} total futures (including delisted)`) } listFutures() ``` ``` -------------------------------- ### client.depth(params) Source: https://context7.com/velodataorg/velo-node/llms.txt Fetches order book depth (level 2) data as an async iterator. Each record includes time, mid-price, and price-keyed depth information. Supports various minute resolutions. ```APIDOC ## client.depth(params) — Query Order Book Depth ### Description Returns order book depth (level 2) data as an async iterator. Each row contains a `time`, `mid` price, and price-keyed depth values. Supports resolutions of 1, 5, 10, 15, 30, or 60 minutes (and multiples of 60). Use either `exchange`+`product` or `coin` (not both). ### Parameters #### Query Parameters - **exchange** (string) - Optional - The exchange name (e.g., 'binance-futures'). Use with `product`. - **product** (string) - Optional - The trading product symbol (e.g., 'BTCUSDT'). Use with `exchange`. - **coin** (string) - Optional - The cryptocurrency symbol (e.g., 'BTC'). Use instead of `exchange` and `product`. - **begin** (number) - Required - Start timestamp in milliseconds. - **end** (number) - Required - End timestamp in milliseconds. - **resolution** (number) - Required - Data resolution in minutes (e.g., 5 for 5-minute snapshots). ### Request Example ```javascript // Query by exchange and product const params = { exchange: 'binance-futures', product: 'BTCUSDT', begin: Date.now() - 1000 * 60 * 60 * 6, // last 6 hours end: Date.now(), resolution: 5 // 5-minute snapshots } const depthRows = client.depth(params) for await (const row of depthRows) { console.log(row) } // Query by coin const paramsByCoin = { coin: 'BTC', begin: Date.now() - 1000 * 60 * 60, end: Date.now(), resolution: 1 // 1-minute } const depthRowsByCoin = client.depth(paramsByCoin) for await (const row of depthRowsByCoin) { console.log(row) } ``` ### Response #### Success Response (200) - **depthRows** (AsyncIterator) - An async iterator yielding depth data objects. - **time** (number) - Timestamp of the data point in milliseconds. - **mid** (number) - The mid-price of the order book. - **[price_level]** (number) - Depth at a specific price level (e.g., '42600': 1.234). ``` -------------------------------- ### Query Futures Term Structure with client.termStructure Source: https://context7.com/velodataorg/velo-node/llms.txt Fetches the forward curve for futures. Use this to compute basis and carry across contract maturities. Requires a valid API key. ```javascript const velo = require('velo-node') async function fetchTermStructure() { const client = new velo.Client('YOUR_API_KEY') const params = { coins: ['BTC'], begin: Date.now() - 1000 * 60 * 60 * 24 * 7, // last 7 days end: Date.now(), resolution: '1h' } try { const terms = await client.termStructure(params) for (const term of terms) { console.log(term) // { time: '...', coin: 'BTC', exchange: 'binance-futures', product: 'BTCUSDT_241227', ... } } } catch (err) { console.error('Term structure error:', err.message) } } fetchTermStructure() ``` -------------------------------- ### client.news.stories(params) Source: https://context7.com/velodataorg/velo-node/llms.txt Retrieves historical cryptocurrency news stories. You can fetch all available history or stories from a specific point in time. ```APIDOC ## client.news.stories(params) — Fetch News Stories ### Description Fetches historical crypto news stories. Pass `{ begin: 0 }` for all available history, or a millisecond timestamp to retrieve stories from a specific point in time. ### Parameters #### Query Parameters - **begin** (number) - Required - Timestamp in milliseconds. Use `0` for all history or a specific timestamp to fetch stories from that point onwards. ### Request Example ```javascript // Fetch all available stories const stories = await client.news.stories({ begin: 0 }) // Fetch stories from the last 24 hours const recentStories = await client.news.stories({ begin: Date.now() - 1000 * 60 * 60 * 24 }) ``` ### Response #### Success Response (200) - **stories** (Array) - An array of news story objects. - **id** (string) - Unique identifier for the story. - **title** (string) - The headline of the news story. - **url** (string) - The URL to the full news article. - **time** (number) - Timestamp of the story in milliseconds. - ... (other relevant fields) ``` -------------------------------- ### Query Market Capitalizations Source: https://context7.com/velodataorg/velo-node/llms.txt Fetches historical market capitalization data for specified coins. This method accepts similar time range and resolution parameters as the `rows()` method. ```javascript const velo = require('velo-node') async function fetchMarketCaps() { const client = new velo.Client('YOUR_API_KEY') const params = { coins: ['BTC', 'ETH', 'SOL'], begin: Date.now() - 1000 * 60 * 60 * 24 * 30, // last 30 days end: Date.now(), resolution: '1d' } try { const caps = await client.marketCaps(params) for (const cap of caps) { console.log(cap) // { time: '...', coin: 'BTC', circ_dollars: 850000000000.00 } } } catch (err) { console.error('Failed to fetch market caps:', err.message) } } fetchMarketCaps() ``` -------------------------------- ### client.status() Source: https://context7.com/velodataorg/velo-node/llms.txt Returns a plain-text status string from the Velo API health endpoint. Useful for verifying connectivity and API key validity before running queries. ```APIDOC ## `client.status()` — Check API Status Returns a plain-text status string from the Velo API health endpoint. Useful for verifying connectivity and API key validity before running queries. ```javascript const velo = require('velo-node') async function checkStatus() { const client = new velo.Client('YOUR_API_KEY') try { const status = await client.status() console.log('API status:', status) // Expected output: "API status: ok" } catch (err) { console.error('API unreachable:', err.message) } } checkStatus() ``` ``` -------------------------------- ### client.termStructure(params) Source: https://context7.com/velodataorg/velo-node/llms.txt Retrieves the forward curve or term structure data for futures, which is useful for calculating basis and carry across different contract maturities. ```APIDOC ## client.termStructure(params) — Query Futures Term Structure ### Description Returns the forward curve / term structure data for futures, useful for computing basis and carry across contract maturities. ### Parameters #### Query Parameters - **coins** (string[]) - Required - List of coins to query (e.g., ['BTC']) - **begin** (number) - Required - Start timestamp in milliseconds - **end** (number) - Required - End timestamp in milliseconds - **resolution** (string) - Required - Data resolution (e.g., '1h') ### Request Example ```javascript const params = { coins: ['BTC'], begin: Date.now() - 1000 * 60 * 60 * 24 * 7, // last 7 days end: Date.now(), resolution: '1h' } const terms = await client.termStructure(params) ``` ### Response #### Success Response (200) - **terms** (Array) - An array of term structure objects. - **time** (string) - Timestamp of the data point. - **coin** (string) - The cryptocurrency symbol. - **exchange** (string) - The exchange where the future is traded. - **product** (string) - The specific futures contract identifier. - ... (other relevant fields) ``` -------------------------------- ### client.rows(params) Source: https://context7.com/velodataorg/velo-node/llms.txt Fetches historical market data rows (OHLCV and derived metrics) for specified instruments and time ranges. Handles query chunking and streams results. ```APIDOC ## `client.rows(params)` — Query Historical Market Data Rows The core data-fetching method. Returns an async iterator over OHLCV and derived metric rows for the specified instruments, time range, and resolution. Internally handles query chunking to stay within API limits, streaming results back row by row. ### Parameters - `type` (string): `'futures'`, `'spot'`, or `'options'` - `columns` (string[]): Columns to fetch (from `*Columns()` helpers) - `exchanges` (string[]): Exchange names; pass `[]` for all - `products` (string[]): Product names (e.g. `['BTCUSDT']`) - `coins` (string[]): Alternatively, filter by coin (e.g. `['BTC']`) - `begin` (number): Start timestamp in milliseconds - `end` (number): End timestamp in milliseconds - `resolution` (string|number): Candle size: `'1m'`, `'5m'`, `'1h'`, `'1d'`, `'1w'`, `'1M'`, or numeric minutes ### Usage Example (Futures Data) ```javascript const velo = require('velo-node') async function fetchFuturesData() { const client = new velo.Client('YOUR_API_KEY') const futures = await client.futures() const btcBinance = futures.find(f => f.exchange === 'binance-futures' && f.product === 'BTCUSDT') const params = { type: 'futures', columns: ['open_price', 'close_price', 'dollar_volume', 'funding_rate', 'dollar_open_interest_close'], exchanges: [btcBinance.exchange], products: [btcBinance.product], begin: Date.now() - 1000 * 60 * 60 * 24, // last 24 hours end: Date.now(), resolution: '1h' // hourly candles } const rows = client.rows(params) for await (const row of rows) { console.log(row) } } fetchFuturesData().catch(console.error) ``` ### Response Example (Single Row) ```json { "time": "2024-01-15T10:00:00.000Z", "exchange": "binance-futures", "product": "BTCUSDT", "open_price": 42500.1, "close_price": 42780.5, "dollar_volume": 1234567890.12, "funding_rate": 0.0001, "dollar_open_interest_close": 9876543210.00 } ``` ### Usage Example (Multi-Exchange Spot Data) ```javascript async function fetchMultiExchangeSpot() { const client = new velo.Client('YOUR_API_KEY') const columns = client.spotColumns() const params = { type: 'spot', columns: ['open_price', 'close_price', 'dollar_volume'], exchanges: [], // empty = all supported spot exchanges coins: ['BTC', 'ETH'], begin: Date.now() - 1000 * 60 * 60 * 24 * 7, // last 7 days end: Date.now(), resolution: '1d' // daily candles } const rows = client.rows(params) for await (const row of rows) { console.log(row) } } ``` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.