NodeJS
npm install velo-node
Examples
Quick Start
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()Orderbook Data
const velo = require('velo-node')
async function doWork() {
const futures = await client.futures()
const future = futures.filter((f) => f.depth)[0]
const dayInMs = 1000 * 60 * 60 * 24
const params = {
exchange: future.exchange,
product: future.product,
begin: Date.now() - dayInMs,
end: Date.now(),
resolution: '5m'
}
const iter = client.depth(params)
for await (const depth of iter) {
console.log(depth)
}
}
const client = new velo.Client('api_key')
doWork()Helper Methods
Key status:
status()Supported futures:
futures(delisted=False)Supported options:
options()Supported spot pairs:
spot(delisted=False)Supported futures columns:
futuresColumns()Supported options columns:
optionsColumns()Supported spot columns:
spotColumns()
Data Methods
Get rows
rows(params)
type: 'futures', 'options', or 'spot'
exchanges, products, coins, columns: arrays
begin, end: millisecond timestamps
resolution: minutes (integer) or resolution (string)
Asynchronously returns individual rows (Objects)
If both `coins` and `products` are specified, only `products` will be used
Get orderbook data
depth(params)
exchange, product, coin: string
begin, end: millisecond timestamps
resolution: minutes (integer) or resolution (string)
Asynchronously returns Object with time, mid, and price:value pairs.
Use 'coin' only for aggregated orderbook data. Use 'product' and 'exchange' for a specific product.
Last updated
Was this helpful?