New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bybit-api

Package Overview
Dependencies
Maintainers
1
Versions
138
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bybit-api - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

14

lib/websocket-client.js

@@ -1,3 +0,2 @@

const {EventEmitter} = require('events');
const { EventEmitter } = require('events');
const WebSocket = require('ws');

@@ -38,3 +37,3 @@

this.client = new RestClient(null, null, this.options.livenet);
this.client = new RestClient(null, null, this.options.livenet, this.options.restOptions, this.options.requestOptions);
this._subscriptions = new Set();

@@ -69,2 +68,9 @@

_getWsUrl() {
if (this.options.wsUrl) {
return this.options.wsUrl;
}
return wsUrls[this.options.livenet ? 'livenet' : 'testnet'];
}
async _connect() {

@@ -75,3 +81,3 @@ try {

const authParams = await this._authenticate();
const url = wsUrls[this.options.livenet ? 'livenet' : 'testnet'] + authParams;
const url = this._getWsUrl() + authParams;

@@ -78,0 +84,0 @@ this.ws = new WebSocket(url);

{
"name": "bybit-api",
"version": "1.2.2",
"version": "1.2.3",
"description": "A production-ready Node.js connector for the Bybit APIs and WebSockets",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -55,4 +55,32 @@ # bybit-api

const ws = new WebsocketClient({key: API_KEY, secret: PRIVATE_KEY});
const wsConfig = {
key: API_KEY,
secret: PRIVATE_KEY,
// The following parameters are optional:
// defaults to false == testnet. set to true for livenet.
// livenet: true
// override which URL to use for websocket connections
// wsUrl: 'wss://stream.bytick.com/realtime'
// how often to check (in ms) that WS connection is still alive
// pingInterval: 10000,
// how long to wait (in ms) before deciding the connection should be terminated & reconnected
// pongTimeout: 1000,
// how long to wait before attempting to reconnect (in ms) after connection is closed
// reconnectTimeout: 500,
// config options sent to RestClient (used for time sync). See RestClient docs.
// restOptions: { },
// config for axios to pass to RestClient. E.g for proxy support
// requestOptions: { }
};
const ws = new WebsocketClient(wsConfig);
ws.subscribe(['position', 'execution', 'trade']);

@@ -59,0 +87,0 @@ ws.subscribe('kline.BTCUSD.1m');

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