Skip to content
Velo

Fetch Orderbook Data

const velo = require('velo-node')
 
async function main() {
  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')
 
main()