@icgio/icg-exchanges-wrapper 1.14.119 → 1.14.120

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.
@@ -75,12 +75,12 @@ module.exports = class Orders {
75
75
  this.exchange_cur_quote_cur = exchange_cur_quote_cur
76
76
  this.exchange_cur_quote_cur_rates_only = exchange_cur_quote_cur_rates_only
77
77
  this.pair_map_rates_only = pair_map_rates_only || {}
78
- let { exchange_pairs, pair_exchanges, exchange_pairs_without_2, pair_exchanges_without_2 } = utils.exchange_cur_quote_cur_converter(exchange_cur_quote_cur)
78
+ let { exchange_pairs, pair_exchanges, exchange_pairs_without_numbers, pair_exchanges_without_numbers } = utils.exchange_cur_quote_cur_converter(exchange_cur_quote_cur)
79
79
  let { exchange_pairs: exchange_pairs_rates_only, pair_exchanges: pair_exchanges_rates_only } = utils.exchange_cur_quote_cur_converter(exchange_cur_quote_cur_rates_only)
80
80
  this.exchange_pairs = exchange_pairs
81
- this.exchange_pairs_without_2 = exchange_pairs_without_2
81
+ this.exchange_pairs_without_numbers = exchange_pairs_without_numbers
82
82
  this.pair_exchanges = pair_exchanges
83
- this.pair_exchanges_without_2 = pair_exchanges_without_2
83
+ this.pair_exchanges_without_numbers = pair_exchanges_without_numbers
84
84
  this.exchange_pairs_rates_only = exchange_pairs_rates_only
85
85
  this.pair_exchanges_rates_only = pair_exchanges_rates_only
86
86
  this.rates_only_exchanges = pair_exchanges_rates_only
@@ -93,7 +93,7 @@ module.exports = class Orders {
93
93
  this.check_init_order_opened_timeout = 5 * 1000
94
94
  this.cancel_previous_orders = settings.cancel_previous_orders || false
95
95
  this.cancel_range_orders = settings.cancel_range_orders || false
96
- this.delete_connection_error_order_timeout = 2 * 60 * 1000
96
+ this.delete_connection_error_orders_timeout = 2 * 60 * 1000
97
97
  this.delete_finished_orders_timeout = 30 * 1000 // CANCELED or F-FILLED
98
98
  this.interval_dict = settings.interval_dict || {}
99
99
  this.major_exchanges = settings.major_exchanges || []
@@ -131,7 +131,7 @@ module.exports = class Orders {
131
131
  } else {
132
132
  limits = STANDARD_LIMITS
133
133
  }
134
- this.Exchanges[exchange] = new ICGExchanges[_.upperFirst(exchange.replace('_2', ''))](api_key_temp, secret_key_temp, _.assign(limits, cd[exchange]))
134
+ this.Exchanges[exchange] = new ICGExchanges[_.upperFirst(_split(exchange, '_')[0])](api_key_temp, secret_key_temp, _.assign(limits, cd[exchange]))
135
135
  if (!this.interval_dict || !this.interval_dict[exchange]) {
136
136
  this.interval_dict[exchange] = {
137
137
  balances: 10 * 1000,
@@ -238,8 +238,8 @@ module.exports = class Orders {
238
238
  this.account?.update_non_initial_from_balances(balances)
239
239
  }
240
240
  limit_trade(exchange, pair, method, price, amount, id = uuid(), order_type = '', limiter_on = true, api_key_index) {
241
- price = round_price(_.upperFirst(exchange.replace('_2', '')), pair, price)
242
- amount = round_amount(_.upperFirst(exchange.replace('_2', '')), pair, amount)
241
+ price = round_price(exchange, pair, price)
242
+ amount = round_amount(exchange, pair, amount)
243
243
  // console.log('%s %s %s %s %s %s at %s', limiter_on, order_type, exchange, pair, method, amount, price)
244
244
  this.update_order_info(
245
245
  exchange,
@@ -346,7 +346,7 @@ module.exports = class Orders {
346
346
  } else if (res.error === 'connection-error') {
347
347
  setTimeout(() => {
348
348
  this.delete_order_info(exchange, pair, method, id, order_type + ' limit-trade-' + res.error)
349
- }, this.delete_connection_error_order_timeout)
349
+ }, this.delete_connection_error_orders_timeout)
350
350
  } else {
351
351
  if (order_type.startsWith('self') || order_type.startsWith('maker_2')) {
352
352
  this.delete_order_info(exchange, pair, method, id, order_type + ' limit-trade-timeout')
@@ -481,7 +481,7 @@ module.exports = class Orders {
481
481
  trades[exchange][pair].trades.map((trade) => {
482
482
  if (_.get(this.order_info, [exchange, pair, trade.type, trade.order_id])) {
483
483
  let order_info = this.order_info[exchange][pair][trade.type][trade.order_id]
484
- trade.amount = round_amount(_.upperFirst(exchange.replace('_2', '')), pair, trade.amount)
484
+ trade.amount = round_amount(exchange, pair, trade.amount)
485
485
  if (_.includes(['CANCELED', 'CANCELING'], order_info.status) && trade.amount > order_info.f_amount) {
486
486
  let type = trade.type,
487
487
  order_id = trade.order_id
@@ -642,7 +642,7 @@ module.exports = class Orders {
642
642
  open_orders[exchange][pair].open_orders.map((order) => {
643
643
  if (_.get(this.order_info, [exchange, pair, order.type, order.order_id])) {
644
644
  let order_info = this.order_info[exchange][pair][order.type][order.order_id]
645
- order.f_amount = round_amount(_.upperFirst(exchange.replace('_2', '')), pair, order.f_amount)
645
+ order.f_amount = round_amount(exchange, pair, order.f_amount)
646
646
  if (_.includes(['N-FILLED', 'P-FILLED'], order_info.status) && order.f_amount > order_info.f_amount && order.f_amount / order_info.t_amount > this.f_filled_threshold) {
647
647
  // console.log('ORDERS: %s %s ORDER F-FILLED', exchange, pair)
648
648
  this.update_order_info(
@@ -684,8 +684,8 @@ module.exports = class Orders {
684
684
  }
685
685
  } else if (this.get_order_info_status_all(exchange, pair, 'both', 'INIT') && this.check_init_order_opened) {
686
686
  this.get_order_info_status_all(exchange, pair, 'both', 'INIT').map((init_order) => {
687
- let init_order_price = round_price(exchange.replace('_2', ''), pair, init_order.price)
688
- let order_price = round_price(exchange.replace('_2', ''), pair, order.price)
687
+ let init_order_price = round_price(exchange, pair, init_order.price)
688
+ let order_price = round_price(exchange, pair, order.price)
689
689
  let init_order_time = init_order.open_time.getTime()
690
690
  let order_time = order.open_time.getTime()
691
691
  if (
@@ -1383,7 +1383,7 @@ module.exports = class Orders {
1383
1383
  }
1384
1384
  }
1385
1385
  }
1386
- get_rates(this.Exchanges, this.ExchangesRatesOnly, this.exchange_pairs_without_2, this.exchange_pairs_rates_only, this.interval_dict)
1386
+ get_rates(this.Exchanges, this.ExchangesRatesOnly, this.exchange_pairs_without_numbers, this.exchange_pairs_rates_only, this.interval_dict)
1387
1387
  }
1388
1388
  check_market_history() {
1389
1389
  let market_history_handler = (exchange, pair, res) => {
@@ -1418,7 +1418,7 @@ module.exports = class Orders {
1418
1418
  }
1419
1419
  }
1420
1420
  }
1421
- get_market_history(this.Exchanges, this.exchange_pairs_without_2, this.interval_dict)
1421
+ get_market_history(this.Exchanges, this.exchange_pairs_without_numbers, this.interval_dict)
1422
1422
  }
1423
1423
  check_ohlcv() {
1424
1424
  const OHLCV_DEFAULT_PAST_HOURS = 24
@@ -1455,7 +1455,7 @@ module.exports = class Orders {
1455
1455
  }
1456
1456
  }
1457
1457
  }
1458
- get_ohlcv(this.Exchanges, this.exchange_pairs_without_2, this.interval_dict)
1458
+ get_ohlcv(this.Exchanges, this.exchange_pairs_without_numbers, this.interval_dict)
1459
1459
  }
1460
1460
  check_cmc_rates(data, type, source) {
1461
1461
  let check_cmc_rates_base = (data, type, source) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-exchanges-wrapper",
3
- "version": "1.14.119",
3
+ "version": "1.14.120",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -18,8 +18,8 @@
18
18
  "homepage": "https://github.com/icgio/icg-exchanges-wrapper#readme",
19
19
  "dependencies": {
20
20
  "@icgio/icg-exchanges": "^1.32.69",
21
- "@icgio/icg-exchanges-data": "^1.10.59",
22
- "@icgio/icg-utils": "^1.9.20",
21
+ "@icgio/icg-exchanges-data": "^1.10.60",
22
+ "@icgio/icg-utils": "^1.9.21",
23
23
  "influx": "^5.10.0",
24
24
  "lodash": "^4.17.20",
25
25
  "uuid": "^11.1.0",