@icgio/icg-exchanges-wrapper 1.9.41 → 1.9.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,7 @@
1
1
  const _ = require('lodash')
2
2
 
3
+ const DEFAULT_ORDERBOOK_LEVEL = 50
4
+
3
5
  let first_time = {}, checked_rates = {}, exchange_pair_rates = {}, pair_exchange_rates = {}
4
6
  module.exports.get_exchanges_rates = function (Exchanges, exchange_pair_dict, cb, ws_enabled=true) {
5
7
  checked_rates = {}
@@ -36,7 +38,7 @@ module.exports.get_exchanges_rates = function (Exchanges, exchange_pair_dict, cb
36
38
  }
37
39
  } else {
38
40
  for (let pair of exchange_pair_dict[Exchange_name]) {
39
- Exchange.rate(pair, 50, function (res) {
41
+ Exchange.rate(pair, DEFAULT_ORDERBOOK_LEVEL, function (res) {
40
42
  if (res.success) {
41
43
  _.set(exchange_pair_rates, [Exchange_name, pair], res.body)
42
44
  _.set(pair_exchange_rates, [pair, Exchange_name], res.body)
@@ -57,7 +59,7 @@ module.exports.get_exchanges_rates = function (Exchanges, exchange_pair_dict, cb
57
59
  }
58
60
 
59
61
  let checked_market_history = {}, exchange_pair_market_history = {}, pair_exchange_market_history = {}
60
- module.exports.get_exchanges_market_history = function (Exchanges, exchange_pair_dict, timeframe_in_ms, cb) {
62
+ module.exports.get_exchanges_market_history = function (Exchanges, exchange_pair_dict, timeframe_in_ms, cb, ws_enabled=true) {
61
63
  checked_market_history = {}
62
64
  if (!Array.isArray(Exchanges)) {
63
65
  console.error('Exchanges should be an array')
@@ -69,7 +71,7 @@ module.exports.get_exchanges_market_history = function (Exchanges, exchange_pair
69
71
  continue
70
72
  checked_market_history[Exchange_name] = true
71
73
  if (!exchange_pair_dict[Exchange_name]) continue
72
- if (Exchange.ws_market) {
74
+ if (Exchange.ws_market && ws_enabled) {
73
75
  if (!first_time[Exchange_name]) {
74
76
  Exchange.ws_market(exchange_pair_dict[Exchange_name])
75
77
  first_time[Exchange_name] = true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-exchanges-wrapper",
3
- "version": "1.9.41",
3
+ "version": "1.9.42",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {