是否可以从股票部分(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')
})