bitmex-simple-ws
Advanced tools
Comparing version 1.0.0 to 1.0.1
44
con.js
@@ -5,4 +5,2 @@ const WebSocket = require('ws'); | ||
const Book = require('./book'); | ||
class Connection extends EventEmitter { | ||
@@ -22,12 +20,2 @@ | ||
this.subscription = {}; | ||
this.book = {}; | ||
this.bookTopics = [ | ||
'orderBookL2_25', | ||
'orderBookL2' | ||
]; | ||
this.on('wsMessage', m => console.log(new Date, m)); | ||
} | ||
@@ -86,19 +74,6 @@ | ||
if(this.bookTopics.includes(payload.table)) { | ||
const { symbol } = payload.data[0]; | ||
const id = `${payload.table}:${symbol}`; | ||
if(this.book[id]) { | ||
this.book[id].handle(payload); | ||
this.emit(id, this.book[id]); | ||
return; | ||
} | ||
} | ||
this.emit('wsMessage', payload); | ||
this.emit('message', payload); | ||
} | ||
rawSubscribe(topic) { | ||
subscribe(topic) { | ||
@@ -114,19 +89,4 @@ if(this.subscription[topic]) { | ||
watchBook(symbol, topic = 'orderBookL2') { | ||
if(!this.bookTopics.includes(topic)) { | ||
throw new Error('This book topic is not supported'); | ||
} | ||
const id = `${topic}:${symbol}`; | ||
if(this.book[id]) { | ||
return; | ||
} | ||
this.book[id] = new Book(id); | ||
this.rawSubscribe(id); | ||
} | ||
} | ||
module.exports = Connection; |
{ | ||
"name": "bitmex-simple-ws", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -23,3 +23,7 @@ "main": "index.js", | ||
}, | ||
"homepage": "https://github.com/askmike/bitmex-simple-ws#readme" | ||
"homepage": "https://github.com/askmike/bitmex-simple-ws#readme", | ||
"dependencies": { | ||
"lodash": "^4.17.11", | ||
"ws": "^7.0.0" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6555
161
2
+ Addedlodash@^4.17.11
+ Addedws@^7.0.0
+ Addedlodash@4.17.21(transitive)
+ Addedws@7.5.10(transitive)