Fetch XRPUSD price from the XRPL using WebSockets

node v14.20.1
version: 3.0.0
endpointsharetweet
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...'
Loading…

no comments

    sign in to comment