Socket
Socket
Sign inDemoInstall

bitmex-realtime-api

Package Overview
Dependencies
42
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.4.0 to 0.4.3

7

example.js

@@ -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...
});

9

index.js

@@ -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"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc