Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.


Real-time Market Prices

node v10.24.1
version: 1.0.0
const Web3Data = require("web3data-js@0.6.1") const w3d = new Web3Data(process.env.API_KEY) const BASE = 'eth' const QUOTE = 'usd' // Initiate the websocket connection w3d.connect() // Watch for changes in market prices of the pair 'eth_usd' w3d.on({eventName: 'market:prices:updates', filters: {pair:`${BASE}_${QUOTE}`}}, data => { // Here we could place our trading logic. For instance: // if price > n then executeTrade(pair, ammount) console.log(`Price update - was: ${data.previousPrice} is: ${data.price}`) })

no comments

    sign in to comment