@icgio/icg-exchanges-wrapper 1.17.5 → 1.17.6
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.
- package/middleware/orders.js +1 -38
- package/package.json +1 -1
package/middleware/orders.js
CHANGED
|
@@ -205,8 +205,6 @@ module.exports = class Orders {
|
|
|
205
205
|
this.market_history = {}
|
|
206
206
|
this.ohlcv = {}
|
|
207
207
|
this.crypto_rates = {}
|
|
208
|
-
this.rates_combined_all = {}
|
|
209
|
-
this.rates_combined_all_with_buy_sell_limits_against_reserve_balance = {}
|
|
210
208
|
this.rates_combined_major = {}
|
|
211
209
|
this.buy_sell_limits_against_reserve_balance = {}
|
|
212
210
|
this.order_info = {}
|
|
@@ -1338,17 +1336,10 @@ module.exports = class Orders {
|
|
|
1338
1336
|
let process_rates = () => {
|
|
1339
1337
|
let pair_list = _.concat(_.keys(this.pair_exchanges), _.keys(this.pair_exchanges_rates_only))
|
|
1340
1338
|
for (let pair of pair_list) {
|
|
1341
|
-
let
|
|
1342
|
-
orderbook_all_with_buy_sell_limits_against_reserve_balance = {},
|
|
1343
|
-
orderbook_major = {},
|
|
1339
|
+
let orderbook_major = {},
|
|
1344
1340
|
orderbook_major_temp = {}
|
|
1345
1341
|
let exchanges_list = _.concat(this.pair_exchanges[pair] || [], this.pair_exchanges_rates_only[pair] || [])
|
|
1346
1342
|
for (let exchange of exchanges_list) {
|
|
1347
|
-
if (_.get(this.rates, [exchange, pair, 'asks'], []).length > 0 && _.get(this.rates, [exchange, pair, 'bids'], []).length > 0) {
|
|
1348
|
-
orderbook_all[exchange] = this.rates[exchange][pair]
|
|
1349
|
-
} else {
|
|
1350
|
-
orderbook_all = _.omit(orderbook_all, [exchange])
|
|
1351
|
-
}
|
|
1352
1343
|
if (_.get(this.rates, [exchange, pair, 'asks'], []).length > 0 && _.get(this.rates, [exchange, pair, 'bids'], []).length > 0) {
|
|
1353
1344
|
const rates = _.cloneDeep(this.rates[exchange][pair])
|
|
1354
1345
|
|
|
@@ -1364,40 +1355,12 @@ module.exports = class Orders {
|
|
|
1364
1355
|
orderbook_major = orderbook_major_temp
|
|
1365
1356
|
}
|
|
1366
1357
|
}
|
|
1367
|
-
|
|
1368
|
-
if (_.includes(this.pair_exchanges_rates_only[pair], exchange)) {
|
|
1369
|
-
} else if (
|
|
1370
|
-
_.get(this.buy_sell_limits_against_reserve_balance, [exchange, pair, 'buy']) >= 0 &&
|
|
1371
|
-
_.get(this.buy_sell_limits_against_reserve_balance, [exchange, pair, 'sell']) >= 0
|
|
1372
|
-
) {
|
|
1373
|
-
let rates_with_buy_sell_limits_against_reserve_balance = {
|
|
1374
|
-
asks: utils.sum_position_orderbook(rates.asks, this.buy_sell_limits_against_reserve_balance[exchange][pair].buy),
|
|
1375
|
-
bids: utils.vol_position_orderbook(rates.bids, this.buy_sell_limits_against_reserve_balance[exchange][pair].sell),
|
|
1376
|
-
}
|
|
1377
|
-
orderbook_all_with_buy_sell_limits_against_reserve_balance[exchange] = rates_with_buy_sell_limits_against_reserve_balance
|
|
1378
|
-
} else {
|
|
1379
|
-
orderbook_all_with_buy_sell_limits_against_reserve_balance = _.omit(orderbook_all_with_buy_sell_limits_against_reserve_balance, [exchange])
|
|
1380
|
-
}
|
|
1381
1358
|
} else {
|
|
1382
1359
|
orderbook_major = _.omit(orderbook_major, [exchange])
|
|
1383
1360
|
orderbook_major_temp = _.omit(orderbook_major_temp, [exchange])
|
|
1384
1361
|
}
|
|
1385
1362
|
}
|
|
1386
1363
|
|
|
1387
|
-
let o_1 = utils.combine_orderbooks(orderbook_all, COMBINE_ORDERBOOKS_LEVEL)
|
|
1388
|
-
if (o_1.asks.length > 0 && o_1.bids.length > 0) {
|
|
1389
|
-
_.set(this.rates_combined_all, [pair], o_1)
|
|
1390
|
-
} else {
|
|
1391
|
-
this.rates_combined_all = _.omit(this.rates_combined_all, [pair])
|
|
1392
|
-
}
|
|
1393
|
-
|
|
1394
|
-
let o_2 = utils.combine_orderbooks(orderbook_all_with_buy_sell_limits_against_reserve_balance, COMBINE_ORDERBOOKS_LEVEL)
|
|
1395
|
-
if (o_2.asks.length > 0 && o_2.bids.length > 0) {
|
|
1396
|
-
_.set(this.rates_combined_all_with_buy_sell_limits_against_reserve_balance, [pair], o_2)
|
|
1397
|
-
} else {
|
|
1398
|
-
this.rates_combined_all_with_buy_sell_limits_against_reserve_balance = _.omit(this.rates_combined_all_with_buy_sell_limits_against_reserve_balance, [pair])
|
|
1399
|
-
}
|
|
1400
|
-
|
|
1401
1364
|
let o_3 = utils.combine_orderbooks(orderbook_major, COMBINE_ORDERBOOKS_LEVEL)
|
|
1402
1365
|
if (o_3.asks.length > 0 && o_3.bids.length > 0) {
|
|
1403
1366
|
_.set(this.rates_combined_major, [pair], o_3)
|