bitmex-realtime-api
Advanced tools
Comparing version 0.4.0 to 0.4.3
@@ -11,5 +11,10 @@ 'use strict'; | ||
client.addStream('XBTUSD', 'instrument', function(data, symbol, tableName) { | ||
client.addStream('XBTUSD', 'quote', function(data, symbol, tableName) { | ||
console.log(`Got update for ${tableName}:${symbol}. Current state:\n${JSON.stringify(data).slice(0, 100)}...`); | ||
// Do something with the table data... | ||
}); | ||
client.addStream('XBTZ19', 'quote', function(data, symbol, tableName) { | ||
console.log(`Got update for ${tableName}:${symbol}. Current state:\n${JSON.stringify(data).slice(0, 100)}...`); | ||
// Do something with the table data... | ||
}); |
@@ -90,2 +90,3 @@ 'use strict'; | ||
memo[tableKey] = this._data[tableKey][symbol] || []; | ||
return memo; | ||
}, {}); | ||
@@ -99,3 +100,3 @@ } | ||
} | ||
return clone(out); | ||
return _.cloneDeep(out); | ||
}; | ||
@@ -175,3 +176,3 @@ | ||
BitMEXClient.prototype.sendSubscribeRequest = function(table, symbol) { | ||
console.log(JSON.stringify({op: 'subscribe', args: `${table}:${symbol}`})) | ||
debug(JSON.stringify({op: 'subscribe', args: `${table}:${symbol}`})) | ||
this.socket.send(JSON.stringify({op: 'subscribe', args: `${table}:${symbol}`})); | ||
@@ -233,6 +234,2 @@ }; | ||
function clone(data) { | ||
return data.map(o => Object.assign({}, o)); | ||
} | ||
if (require.main === module) { | ||
@@ -239,0 +236,0 @@ console.error('This module is not meant to be run directly. Try running example.js instead.'); |
@@ -79,2 +79,4 @@ 'use strict'; | ||
// Emits data split by symbol. | ||
function emitSplitData(emitter, data) { | ||
@@ -96,2 +98,11 @@ const {table, action} = data; | ||
// If an empty partial is emitted, it will look like the following: | ||
// {"table":"order","action":"partial",..."filter":{"symbol":"XBTZ19"}} | ||
// This allows us to know which filtered partial is empty. | ||
// | ||
// We need to emit it so upstream knows we received this, it was just an empty list. | ||
if (data.action === 'partial' && data.filter && data.filter.symbol) { | ||
symbolData[data.filter.symbol] = symbolData[data.filter.symbol] || []; | ||
} | ||
Object.keys(symbolData).forEach((symbol) => { | ||
@@ -98,0 +109,0 @@ const key = `${table}:${action}:${symbol}`; |
{ | ||
"name": "bitmex-realtime-api", | ||
"version": "0.4.0", | ||
"version": "0.4.3", | ||
"description": "A library for interacting with BitMEX's websocket API.", | ||
@@ -23,8 +23,8 @@ "main": "index.js", | ||
"dependencies": { | ||
"debug": "^3.1.0", | ||
"debug": "^4.1.1", | ||
"eventemitter2": "^5.0.1", | ||
"lodash": "^4.17.10", | ||
"superagent": "^3.8.3", | ||
"ws": "^6.0.0" | ||
"superagent": "^5.1.0", | ||
"ws": "^7.2.0" | ||
} | ||
} |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
681
31203
10
4
+ Addeddebug@4.3.4(transitive)
+ Addedfast-safe-stringify@2.1.1(transitive)
+ Addedform-data@3.0.1(transitive)
+ Addedmime@2.6.0(transitive)
+ Addedms@2.1.2(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsemver@7.6.2(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedsuperagent@5.3.1(transitive)
+ Addedws@7.5.9(transitive)
- Removedasync-limiter@1.0.1(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddebug@3.2.7(transitive)
- Removedextend@3.0.2(transitive)
- Removedform-data@2.5.1(transitive)
- Removedisarray@1.0.0(transitive)
- Removedmime@1.6.0(transitive)
- Removedms@2.1.3(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedsuperagent@3.8.3(transitive)
- Removedws@6.2.2(transitive)
Updateddebug@^4.1.1
Updatedsuperagent@^5.1.0
Updatedws@^7.2.0