@icgio/icg-exchanges-wrapper 1.9.138 → 1.9.140
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 +27 -32
- package/package.json +2 -2
package/middleware/orders.js
CHANGED
|
@@ -41,6 +41,7 @@ const RATES_LENGTH_DEFAULT = 50
|
|
|
41
41
|
const MARKET_HISTORY_DEFAULT_TIME = 10 * 60 * 1000
|
|
42
42
|
const TRADES_DEFAULT_TIME = 12 * 60 * 60 * 1000
|
|
43
43
|
const NO_CALLBACK_TIMEOUT = 2 * 60 * 1000
|
|
44
|
+
const COMBINE_ORDERBOOKS_LEVEL = 100
|
|
44
45
|
|
|
45
46
|
module.exports = class Orders {
|
|
46
47
|
constructor(exchange_basecur_curs_dict, cd, settings) {
|
|
@@ -1141,8 +1142,8 @@ module.exports = class Orders {
|
|
|
1141
1142
|
|
|
1142
1143
|
if (_.includes(this.pair_exchanges_rates_only[pair], exchange)) {
|
|
1143
1144
|
} else if (
|
|
1144
|
-
_.get(this.buy_sell_limits_against_reserve_balance, [exchange, pair, 'buy']) &&
|
|
1145
|
-
_.get(this.buy_sell_limits_against_reserve_balance, [exchange, pair, 'sell'])
|
|
1145
|
+
_.get(this.buy_sell_limits_against_reserve_balance, [exchange, pair, 'buy']) >= 0 &&
|
|
1146
|
+
_.get(this.buy_sell_limits_against_reserve_balance, [exchange, pair, 'sell']) >= 0
|
|
1146
1147
|
) {
|
|
1147
1148
|
let rates_with_buy_sell_limits_against_reserve_balance = {
|
|
1148
1149
|
asks: utils.sum_position_orderbook(rates.asks, this.buy_sell_limits_against_reserve_balance[exchange][pair].buy),
|
|
@@ -1158,8 +1159,6 @@ module.exports = class Orders {
|
|
|
1158
1159
|
}
|
|
1159
1160
|
} else {
|
|
1160
1161
|
orderbook_all_with_buy_sell_limits_against_reserve_balance = _.omit(orderbook_all_with_buy_sell_limits_against_reserve_balance, [exchange])
|
|
1161
|
-
orderbook_major = _.omit(orderbook_major, [exchange])
|
|
1162
|
-
orderbook_major_temp = _.omit(orderbook_major_temp, [exchange])
|
|
1163
1162
|
orderbook_good_with_buy_sell_limits_against_reserve_balance = _.omit(orderbook_good_with_buy_sell_limits_against_reserve_balance, [exchange])
|
|
1164
1163
|
orderbook_good_temp = _.omit(orderbook_good_temp, [exchange])
|
|
1165
1164
|
}
|
|
@@ -1168,37 +1167,33 @@ module.exports = class Orders {
|
|
|
1168
1167
|
orderbook_major_temp = _.omit(orderbook_major_temp, [exchange])
|
|
1169
1168
|
}
|
|
1170
1169
|
}
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
}
|
|
1170
|
+
|
|
1171
|
+
let o_1 = utils.combine_orderbooks(orderbook_all, COMBINE_ORDERBOOKS_LEVEL)
|
|
1172
|
+
if (o_1.asks.length > 0 && o_1.bids.length > 0) {
|
|
1173
|
+
_.set(this.rates_combined_all, [pair], o_1)
|
|
1174
|
+
} else {
|
|
1175
|
+
this.rates_combined_all = _.omit(this.rates_combined_all, [pair])
|
|
1178
1176
|
}
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
}
|
|
1177
|
+
|
|
1178
|
+
let o_2 = utils.combine_orderbooks(orderbook_all_with_buy_sell_limits_against_reserve_balance, COMBINE_ORDERBOOKS_LEVEL)
|
|
1179
|
+
if (o_2.asks.length > 0 && o_2.bids.length > 0) {
|
|
1180
|
+
_.set(this.rates_combined_all_with_buy_sell_limits_against_reserve_balance, [pair], o_2)
|
|
1181
|
+
} else {
|
|
1182
|
+
this.rates_combined_all_with_buy_sell_limits_against_reserve_balance = _.omit(this.rates_combined_all_with_buy_sell_limits_against_reserve_balance, [pair])
|
|
1186
1183
|
}
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
}
|
|
1184
|
+
|
|
1185
|
+
let o_3 = utils.combine_orderbooks(orderbook_major, COMBINE_ORDERBOOKS_LEVEL)
|
|
1186
|
+
if (o_3.asks.length > 0 && o_3.bids.length > 0) {
|
|
1187
|
+
_.set(this.rates_combined_major, [pair], o_3)
|
|
1188
|
+
} else {
|
|
1189
|
+
this.rates_combined_major = _.omit(this.rates_combined_major, [pair])
|
|
1194
1190
|
}
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
}
|
|
1191
|
+
|
|
1192
|
+
let o_4 = utils.combine_orderbooks(orderbook_good_with_buy_sell_limits_against_reserve_balance, COMBINE_ORDERBOOKS_LEVEL)
|
|
1193
|
+
if (o_4.asks.length > 0 && o_4.bids.length > 0) {
|
|
1194
|
+
_.set(this.rates_combined_good_with_buy_sell_limits_against_reserve_balance, [pair], o_4)
|
|
1195
|
+
} else {
|
|
1196
|
+
this.rates_combined_good_with_buy_sell_limits_against_reserve_balance = _.omit(this.rates_combined_good_with_buy_sell_limits_against_reserve_balance, [pair])
|
|
1202
1197
|
}
|
|
1203
1198
|
}
|
|
1204
1199
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icgio/icg-exchanges-wrapper",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.140",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@icgio/icg-exchanges": "^1.27.97",
|
|
21
21
|
"@icgio/icg-exchanges-data": "^1.6.52",
|
|
22
|
-
"@icgio/icg-utils": "^1.7.
|
|
22
|
+
"@icgio/icg-utils": "^1.7.23",
|
|
23
23
|
"influx": "^5.7.0",
|
|
24
24
|
"lodash": "^4.17.20",
|
|
25
25
|
"uuid": "^8.3.2",
|