Socket
Socket
Sign inDemoInstall

bitmex-realtime-api

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitmex-realtime-api - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

13

index.js

@@ -12,5 +12,9 @@ const _ = require('lodash');

const endpoints = {
production: 'wss://www.bitmex.com/realtime',
testnet: 'wss://testnet.bitmex.com/realtime'
production: 'wss://ws.bitmex.com/realtime',
testnet: 'wss://ws.testnet.bitmex.com/realtime'
};
const httpEndpoints = {
production: 'https://www.bitmex.com/api/v1',
testnet: 'https://testnet.bitmex.com/api/v1'
}
const noSymbolTables = BitMEXClient.noSymbolTables = [

@@ -49,2 +53,5 @@ 'account',

}
if (!options.httpEndpoint) {
options.httpEndpoint = options.testnet ? httpEndpoints.testnet : httpEndpoints.production;
}
if (process.env.BITMEX_ENDPOINT) options.endpoint = process.env.BITMEX_ENDPOINT;

@@ -62,3 +69,3 @@ debug(options)

// Get valid streams so we can validate our subscriptions.
getStreams(options.endpoint, function(err, streams) {
getStreams(options.httpEndpoint, function(err, streams) {
if (err) throw err;

@@ -65,0 +72,0 @@ emitter.initialized = true;

@@ -36,2 +36,5 @@ const _ = require('lodash');

try {
if (data === "pong") {
return;
}
data = JSON.parse(data);

@@ -38,0 +41,0 @@ debug('Received %j', data);

const superagent = require('superagent');
const url = require('url');
const debug = require('debug')('BitMEX:realtime-api:getStreams');
module.exports = function(wsEndpoint, callback) {
const parsed = url.parse(wsEndpoint);
const httpEndpoint = url.format({
protocol: parsed.protocol === 'wss:' ? 'https:' : 'http',
host: parsed.host
});
module.exports = function(httpEndpoint, callback) {
superagent
.get(httpEndpoint + '/api/v1/schema/websocketHelp')
.get(httpEndpoint + '/schema/websocketHelp')
.end(function(err, res) {

@@ -15,0 +8,0 @@ if (err) return callback(err);

{
"name": "bitmex-realtime-api",
"version": "0.5.0",
"version": "0.5.1",
"description": "A library for interacting with BitMEX's websocket API.",

@@ -26,3 +26,3 @@ "main": "index.js",

"eventemitter2": "^6.4.3",
"lodash": "^4.17.20",
"lodash": "^4.17.21",
"superagent": "^6.1.0",

@@ -29,0 +29,0 @@ "ws": "^7.3.1"

@@ -136,1 +136,11 @@ ### Node.JS Adapter for BitMEX Realtime Data

```
### Heartbeat
https://www.bitmex.com/app/wsAPI#Heartbeats
you can implement a more thorough solution, but hope this helps along
```
setInterval(() => {
client.socket.send("ping")
}, 30 * 1000); // sends ping every 30 s
```
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc