Last active
April 7, 2020 14:00
-
-
Save prdn/855be71284087a617f9cdb58882ef76d to your computer and use it in GitHub Desktop.
bfx-perf-books-v2.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// INSTALL | |
// requirements: node.js interpreter | |
// run: npm install ws | |
// Subscribe to BTCUSD book on Bitfinex's WebSocket v2 | |
const WS = require('ws') | |
const w = new WS("wss://api-pub.bitfinex.com/ws/2") | |
w.onmessage = function(msg) { console.log(Date.now(), msg.data) } | |
w.onopen = function() { | |
w.send(JSON.stringify({ "event": "subscribe", "channel": "book", "symbol": "tBTCUSD", "prec": "R0", "len": 100 })) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment