IEX API Websocket加密

时间:2018-12-12 19:43:59

标签: api websocket cryptocurrency iex

是否可以从股票部分(https://iextrading.com/developer/docs/#crypto)像IEX市场数据(https://iextrading.com/developer/docs/#deep所示)使用网络套接字获取加密货币数据,例如BTCUSDT?

我使用的代码代替fb,我将获得有关加密货币的数据:

const url = 'https://ws-api.iextrading.com/1.0/deep'
 const socket = require('socket.io-client')(url)
 socket.on('connect', () => {
    console.log('Connected');
    socket.emit('subscribe', JSON.stringify({
        symbols: ['fb'],
        channels: ['trades', 'book'],
    }))
})
socket.on('message', message => console.log(message))
socket.on('disconnect', () => console.log('Disconnected.'))
socket.on('error', () => {
    console.log('error')
})

0 个答案:

没有答案