Fetch XRPUSD price from the XRPL using WebSockets
const WebSocket = require('ws')
const account = 'rXUMMaPpZqPutoRszR29jtC8amWq3APkx'
const ws = new WebSocket('wss://xrpl.ws')
ws.on('open', () => {
ws.send(JSON.stringify({ command: 'account_lines', account }))
})
ws.on('message', data => {
const lines = JSON.parse(data).result.lines
console.log('XRPUSD = ' + lines.filter(l => l.currency === 'USD')[0].limit)
ws.close()
})
'Getting XRPL Price Info...'
no comments