bitmex-realtime-api
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -85,12 +85,12 @@ 'use strict'; | ||
// By looking at what we're subscribed to, we can save time by only emitting those events. | ||
const matchingStreams = emitter._listenerTree[table]; | ||
const symbolData = _.mapValues(matchingStreams, () => []); | ||
// Generate data by symbol | ||
const symbolData = data.data.reduce((accumulator, currentValue) => { | ||
if (accumulator.hasOwnProperty(currentValue[filterKey])) { | ||
accumulator[currentValue[filterKey]].push(currentValue); | ||
} else { | ||
accumulator[currentValue[filterKey]] = [currentValue]; | ||
} | ||
return accumulator; | ||
}, {}); | ||
// This is similar to _groupBy, but faster. | ||
for (let i = 0; i < data.data.length; i++) { | ||
const d = data.data[i]; | ||
if (symbolData[d[filterKey]]) symbolData[d[filterKey]].push(d); | ||
} | ||
Object.keys(symbolData).forEach((symbol) => { | ||
@@ -97,0 +97,0 @@ const key = `${table}:${action}:${symbol}`; |
{ | ||
"name": "bitmex-realtime-api", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "A library for interacting with BitMEX's websocket API.", | ||
@@ -23,8 +23,8 @@ "main": "index.js", | ||
"dependencies": { | ||
"debug": "^2.6.6", | ||
"eventemitter2": "^4.1.0", | ||
"lodash": "^4.17.4", | ||
"superagent": "^3.5.2", | ||
"ws": "^2.3.1" | ||
"debug": "^3.1.0", | ||
"eventemitter2": "^5.0.1", | ||
"lodash": "^4.17.10", | ||
"superagent": "^3.8.3", | ||
"ws": "^6.0.0" | ||
} | ||
} |
@@ -116,4 +116,3 @@ ### Node.JS Adapter for BitMEX Realtime Data | ||
The following streams require authentication via an API key. Use | ||
[this Python script](https://github.com/BitMEX/market-maker/blob/master/generate-api-key.py) to easily create a key. | ||
The following streams require authentication via an API key. | ||
@@ -120,0 +119,0 @@ ``` |
Sorry, the diff of this file is not supported yet
670
35701
136
+ Addedasync-limiter@1.0.1(transitive)
+ Addedeventemitter2@5.0.1(transitive)
+ Addedws@6.2.2(transitive)
- Removeddebug@2.6.9(transitive)
- Removedeventemitter2@4.1.2(transitive)
- Removedms@2.0.0(transitive)
- Removedsafe-buffer@5.0.1(transitive)
- Removedultron@1.1.1(transitive)
- Removedws@2.3.1(transitive)
Updateddebug@^3.1.0
Updatedeventemitter2@^5.0.1
Updatedlodash@^4.17.10
Updatedsuperagent@^3.8.3
Updatedws@^6.0.0