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

websocket-crypto-api

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

websocket-crypto-api - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

4

exchanges/binance.js

@@ -36,3 +36,3 @@ import Exchanges from "./baseExchange";

console.log(path);
// console.log(path);
path = this._mainUrl + path;

@@ -66,3 +66,3 @@ const ws = new WebSocket(path);

const newSymbol = splitSymbol[0] + splitSymbol[1];
console.log(symbol);
// console.log(symbol);

@@ -69,0 +69,0 @@ let handler = (res) => {

@@ -13,3 +13,3 @@ import Exchanges from "./baseExchange";

};
this.tradeLog = [];
this.streams = {

@@ -68,3 +68,3 @@ // depth: symbol => `ok_sub_spot_${symbol.toLowerCase()}_depth`,

console.log(path);
// console.log(path);

@@ -101,2 +101,11 @@ const ws = new WebSocket(this._mainUrl);

const newSymbol = 't' + splitSymbol[0] + base;
let customEventHandler = (trade) => {
if (this.tradeLog.indexOf(trade.id) === -1) {
this.tradeLog.push(trade.id);
eventHandler(trade);
}
if (this.tradeLog.length > 40){
this.tradeLog.shift();
}
};

@@ -114,5 +123,5 @@ let handler = (res) => {

};
eventHandler(trade)
customEventHandler(trade);
} else if (res.length === 2 && Array.isArray(res[1])) {
res[1].reverse().map(data => {
res[1].reverse().forEach(data => {
const side = data[2] < 0 ? "sell" : "buy";

@@ -124,6 +133,6 @@ let trade = {

price: data[3],
amount: data[2],
amount: Math.abs(data[2]),
symbol: symbol
};
return eventHandler(trade)
customEventHandler(trade);
})

@@ -148,7 +157,7 @@ }

if (res.length === 50) {
res.slice(0, 25).map(r => {
res.slice(0, 25).forEach(r => {
r.splice(1, 1);
this.orderBook.bids.push(r)
});
res.slice(25, 50).map(r => {
res.slice(25, 50).forEach(r => {
// r[2] = Math.abs(r[2]);

@@ -187,6 +196,6 @@ r.splice(1, 1);

let search = this.findIndex(this.orderBook.bids, (res[0]));
search !== -1 ? this.orderBook.bids.splice(search, 1) : this.orderBook.bids
if (search !== -1) this.orderBook.bids.splice(search, 1)
} else {
let search = this.findIndex(this.orderBook.asks, (res[0]));
search !== -1 ? this.orderBook.asks.splice(search, 1) : this.orderBook.asks
if (search !== -1) this.orderBook.asks.splice(search, 1)
}

@@ -193,0 +202,0 @@ }

@@ -68,3 +68,3 @@ import Exchanges from "./baseExchange";

console.log(path);
// console.log(path);

@@ -99,3 +99,4 @@ const ws = new WebSocket(this._mainUrl);

const splitSymbol = symbol.split(/[:/]/);
const newSymbol = splitSymbol[0] + splitSymbol[1];
const base = splitSymbol[1] === 'USDT' ? 'USD' : splitSymbol[1];
const newSymbol = splitSymbol[0] + base;

@@ -130,3 +131,4 @@ let handler = (res) => {

const splitSymbol = symbol.split(/[:/]/);
const newSymbol = splitSymbol[0] + splitSymbol[1];
const base = splitSymbol[1] === 'USDT' ? 'USD' : splitSymbol[1];
const newSymbol = splitSymbol[0] + base;

@@ -142,3 +144,3 @@ let handler = (res) => {

let search = this.findIndex(this.orderBook.bids, d.price);
search !== -1 ? this.orderBook.bids.splice(search, 1) : 1
if (search !== -1) this.orderBook.bids.splice(search, 1)
} else {

@@ -161,3 +163,3 @@ let search = this.findIndex(this.orderBook.bids, d.price);

let search = this.findIndex(this.orderBook.asks, d.price);
search !== -1 ? this.orderBook.asks.splice(search, 1) : 1
if (search !== -1) this.orderBook.asks.splice(search, 1)
} else {

@@ -190,3 +192,4 @@ let search = this.findIndex(this.orderBook.asks, d.price);

const splitSymbol = symbol.split(/[:/]/);
const newSymbol = splitSymbol[0] + splitSymbol[1];
const base = splitSymbol[1] === 'USDT' ? 'USD' : splitSymbol[1];
const newSymbol = splitSymbol[0] + base;

@@ -193,0 +196,0 @@ let handler = data => {

@@ -36,3 +36,3 @@ import Exchanges from "./baseExchange";

console.log(path);
// console.log(path);

@@ -39,0 +39,0 @@ const ws = new WebSocket(this._mainUrl);

{
"name": "websocket-crypto-api",
"version": "0.0.7",
"version": "0.0.8",
"description": "---",

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

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