@icgio/icg-exchanges-wrapper 1.17.1 → 1.17.3

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.
@@ -74,7 +74,6 @@ const TRADES_DEFAULT_MS = 7 * 24 * 60 * 60 * 1000
74
74
  const NO_CALLBACK_TIMEOUT_MS = 2 * 60 * 1000
75
75
  const PROCESS_RATES_THROTTLE_MS = 75
76
76
  const ORDER_TYPE_PRIORITY = {
77
- arb: 1,
78
77
  self: 2,
79
78
  maker_1: 3,
80
79
  maker_1_taker: 3,
@@ -137,7 +136,6 @@ module.exports = class Orders {
137
136
  this.no_cancel_range_exchanges = settings.no_cancel_range_exchanges || []
138
137
  this.no_trades_function_exchanges = settings.no_trades_function_exchanges || []
139
138
  this.no_trades_function_f_filled_timeout = 30 * 1000
140
- this.no_arb_exchanges = settings.no_arb_exchanges || []
141
139
  this.buy_sell_limits_threshold = 0.95
142
140
  this.p_filled_threshold = 0
143
141
  this.f_filled_threshold = 0.999
@@ -209,7 +207,6 @@ module.exports = class Orders {
209
207
  this.rates_combined_all = {}
210
208
  this.rates_combined_all_with_buy_sell_limits_against_reserve_balance = {}
211
209
  this.rates_combined_major = {}
212
- this.rates_combined_good_with_buy_sell_limits_against_reserve_balance = {}
213
210
  this.buy_sell_limits_against_reserve_balance = {}
214
211
  this.order_info = {}
215
212
  this.fill_records = [] // { side, usdt_amount, timestamp, order_type }
@@ -219,7 +216,7 @@ module.exports = class Orders {
219
216
  positions_check: false,
220
217
  open_orders_check: true,
221
218
  trades_check: true,
222
- query_order_check_arb_maker_1: true,
219
+ query_order_check_maker_1: true,
223
220
  query_order_check_exchange: {},
224
221
  rates_check: true,
225
222
  market_history_check: true,
@@ -239,7 +236,7 @@ module.exports = class Orders {
239
236
  this.trades_amount_past_hour = {}
240
237
  this.check_trades()
241
238
  }
242
- if (this.function_enabled.query_order_check_arb_maker_1) {
239
+ if (this.function_enabled.query_order_check_maker_1) {
243
240
  for (let exchange in this.Exchanges) {
244
241
  if (this.function_enabled.query_order_check_exchange[exchange]) {
245
242
  this.check_query_order(exchange)
@@ -264,7 +261,7 @@ module.exports = class Orders {
264
261
  this.process_open_orders(this.open_orders)
265
262
  }, PROCESS_OPEN_ORDERS_TRADERS_INTERVAL_MS)
266
263
  }
267
- if (this.function_enabled.query_order_check_arb_maker_1) {
264
+ if (this.function_enabled.query_order_check_maker_1) {
268
265
  setInterval(() => {
269
266
  this.process_query_order(this.query_order)
270
267
  }, PROCESS_OPEN_ORDERS_TRADERS_INTERVAL_MS)
@@ -840,7 +837,7 @@ module.exports = class Orders {
840
837
  // Track fill amounts for imbalance detection
841
838
  if (dict.status === 'F-FILLED') {
842
839
  const order_info_full = _.get(this.order_info, [exchange, pair, type, order_id], {})
843
- const tracked_types = ['maker_1', 'maker_2', 'maker_3', 'arb']
840
+ const tracked_types = ['maker_1', 'maker_2', 'maker_3']
844
841
  if (tracked_types.includes(order_info_full.order_type)) {
845
842
  const usdt_amount = order_info_full.f_amount * order_info_full.price
846
843
  this.fill_records.push({
@@ -1040,12 +1037,12 @@ module.exports = class Orders {
1040
1037
  if (this.cancel_range_orders && !_.includes(this.major_exchanges[pair], exchange) && !_.includes(this.no_cancel_range_exchanges, exchange) && rate_major) {
1041
1038
  // console.log(exchange, pair, rate_major, orders)
1042
1039
  orders.map((order) => {
1043
- if (order.type === 'sell' && order.price < rate_major.asks[0][0] && order.order_status !== 'F-FILLED' && order.order_type !== 'arb' && order.order_type !== 'manual') {
1040
+ if (order.type === 'sell' && order.price < rate_major.asks[0][0] && order.order_status !== 'F-FILLED' && order.order_type !== 'manual') {
1044
1041
  console.log('cancel range order: %s %s %j', exchange, pair, order)
1045
1042
  order.order_type = 'range-order'
1046
1043
  this.cancel_order(exchange, pair, order)
1047
1044
  }
1048
- if (order.type === 'buy' && order.price > rate_major.bids[0][0] && order.order_status !== 'F-FILLED' && order.order_type !== 'arb' && order.order_type !== 'manual') {
1045
+ if (order.type === 'buy' && order.price > rate_major.bids[0][0] && order.order_status !== 'F-FILLED' && order.order_type !== 'manual') {
1049
1046
  console.log('cancel range order: %s %s %j', exchange, pair, order)
1050
1047
  order.order_type = 'range-order'
1051
1048
  this.cancel_order(exchange, pair, order)
@@ -1296,7 +1293,7 @@ module.exports = class Orders {
1296
1293
  }
1297
1294
  let get_query_order_all = (Exchanges, exchange_pairs, interval_dict) => {
1298
1295
  let query_order = (exchange, pair) => {
1299
- let order_info = _.get(this.get_order_info_by_order_type(['arb', 'maker_1']), [exchange, pair], {})
1296
+ let order_info = _.get(this.get_order_info_by_order_type(['maker_1']), [exchange, pair], {})
1300
1297
  let timeout = setTimeout(() => {
1301
1298
  query_order(exchange, pair)
1302
1299
  }, interval_dict[exchange].query_order)
@@ -1308,7 +1305,7 @@ module.exports = class Orders {
1308
1305
  let { open_time } = order_info[type][order_id]
1309
1306
  // console.log(order_id, open_time, open_time < new Date() - 30 * 60 * 1000)
1310
1307
  if (open_time < new Date() - QUERY_ORDER_TIME_IN_MS) {
1311
- // console.log('query_order_arb_maker_1: %s %s %s', exchange, pair, order_id)
1308
+ // console.log('query_order_maker_1: %s %s %s', exchange, pair, order_id)
1312
1309
  Exchanges[exchange].query_order(pair, order_id, (res) => {
1313
1310
  count++
1314
1311
  if (res.success) {
@@ -1343,9 +1340,7 @@ module.exports = class Orders {
1343
1340
  let orderbook_all = {},
1344
1341
  orderbook_all_with_buy_sell_limits_against_reserve_balance = {},
1345
1342
  orderbook_major = {},
1346
- orderbook_major_temp = {},
1347
- orderbook_good_with_buy_sell_limits_against_reserve_balance = {},
1348
- orderbook_good_temp = {}
1343
+ orderbook_major_temp = {}
1349
1344
  let exchanges_list = _.concat(this.pair_exchanges[pair] || [], this.pair_exchanges_rates_only[pair] || [])
1350
1345
  for (let exchange of exchanges_list) {
1351
1346
  if (_.get(this.rates, [exchange, pair, 'asks'], []).length > 0 && _.get(this.rates, [exchange, pair, 'bids'], []).length > 0) {
@@ -1379,17 +1374,8 @@ module.exports = class Orders {
1379
1374
  bids: utils.vol_position_orderbook(rates.bids, this.buy_sell_limits_against_reserve_balance[exchange][pair].sell),
1380
1375
  }
1381
1376
  orderbook_all_with_buy_sell_limits_against_reserve_balance[exchange] = rates_with_buy_sell_limits_against_reserve_balance
1382
-
1383
- if (!_.includes(this.no_arb_exchanges, exchange) || !this.exchange_pairs_rates_only[exchange]) {
1384
- orderbook_good_temp[exchange] = rates_with_buy_sell_limits_against_reserve_balance
1385
- if (_.keys(orderbook_good_temp).length === this.pair_exchanges[pair].length - this.no_arb_exchanges.length) {
1386
- orderbook_good_with_buy_sell_limits_against_reserve_balance = orderbook_good_temp
1387
- }
1388
- }
1389
1377
  } else {
1390
1378
  orderbook_all_with_buy_sell_limits_against_reserve_balance = _.omit(orderbook_all_with_buy_sell_limits_against_reserve_balance, [exchange])
1391
- orderbook_good_with_buy_sell_limits_against_reserve_balance = _.omit(orderbook_good_with_buy_sell_limits_against_reserve_balance, [exchange])
1392
- orderbook_good_temp = _.omit(orderbook_good_temp, [exchange])
1393
1379
  }
1394
1380
  } else {
1395
1381
  orderbook_major = _.omit(orderbook_major, [exchange])
@@ -1418,12 +1404,6 @@ module.exports = class Orders {
1418
1404
  this.rates_combined_major = _.omit(this.rates_combined_major, [pair])
1419
1405
  }
1420
1406
 
1421
- let o_4 = utils.combine_orderbooks(orderbook_good_with_buy_sell_limits_against_reserve_balance, COMBINE_ORDERBOOKS_LEVEL)
1422
- if (o_4.asks.length > 0 && o_4.bids.length > 0) {
1423
- _.set(this.rates_combined_good_with_buy_sell_limits_against_reserve_balance, [pair], o_4)
1424
- } else {
1425
- this.rates_combined_good_with_buy_sell_limits_against_reserve_balance = _.omit(this.rates_combined_good_with_buy_sell_limits_against_reserve_balance, [pair])
1426
- }
1427
1407
  const reference_pair = this.pair_map_rates_only[pair]
1428
1408
  if (this.pair_map_rates_only[pair] && this.rates_combined_major[reference_pair]) {
1429
1409
  this.rates_combined_major[pair] = this.rates_combined_major[reference_pair]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-exchanges-wrapper",
3
- "version": "1.17.1",
3
+ "version": "1.17.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -17,8 +17,8 @@
17
17
  },
18
18
  "homepage": "https://github.com/icgio/icg-exchanges-wrapper#readme",
19
19
  "dependencies": {
20
- "@icgio/icg-exchanges": "^1.40.0",
21
- "@icgio/icg-utils": "^1.9.52",
20
+ "@icgio/icg-exchanges": "^1.40.2",
21
+ "@icgio/icg-utils": "^1.9.53",
22
22
  "lodash": "^4.17.23",
23
23
  "pg": "^8.17.2"
24
24
  }