@icgio/icg-exchanges-wrapper 1.14.22 → 1.14.24
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 +15 -11
- package/package.json +4 -4
package/middleware/orders.js
CHANGED
|
@@ -57,12 +57,13 @@ const NO_CALLBACK_TIMEOUT = 2 * 60 * 1000
|
|
|
57
57
|
const COMBINE_ORDERBOOKS_LEVEL = 100
|
|
58
58
|
|
|
59
59
|
module.exports = class Orders {
|
|
60
|
-
constructor(
|
|
61
|
-
let {
|
|
62
|
-
this.
|
|
63
|
-
|
|
64
|
-
this.
|
|
65
|
-
let { exchange_pairs
|
|
60
|
+
constructor(exchange_cur_quote_cur_dict, cd, settings) {
|
|
61
|
+
let { exchange_cur_quote_cur, exchange_cur_quote_cur_rates_only, pair_map_rates_only } = exchange_cur_quote_cur_dict
|
|
62
|
+
this.exchange_cur_quote_cur = exchange_cur_quote_cur
|
|
63
|
+
this.exchange_cur_quote_cur_rates_only = exchange_cur_quote_cur_rates_only
|
|
64
|
+
this.pair_map_rates_only = pair_map_rates_only
|
|
65
|
+
let { exchange_pairs, pair_exchanges } = utils.exchange_cur_quote_cur_converter(exchange_cur_quote_cur)
|
|
66
|
+
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)
|
|
66
67
|
this.exchange_pairs = exchange_pairs
|
|
67
68
|
this.pair_exchanges = pair_exchanges
|
|
68
69
|
this.exchange_pairs_rates_only = exchange_pairs_rates_only
|
|
@@ -137,7 +138,7 @@ module.exports = class Orders {
|
|
|
137
138
|
this.interval_dict[exchange].ohlcv = this.interval_dict[exchange].ohlcv || 10 * 60 * 1000
|
|
138
139
|
}
|
|
139
140
|
}
|
|
140
|
-
for (let exchange in this.
|
|
141
|
+
for (let exchange in this.exchange_cur_quote_cur_rates_only) {
|
|
141
142
|
this.ExchangesRatesOnly[exchange] = new icg_exchanges[_.upperFirst(exchange)]('', '', STANDARD_LIMITS)
|
|
142
143
|
}
|
|
143
144
|
this.balances = {}
|
|
@@ -742,9 +743,9 @@ module.exports = class Orders {
|
|
|
742
743
|
let balances_handler = (exchange, res) => {
|
|
743
744
|
if (res.success) {
|
|
744
745
|
_.set(this.balances, [exchange], Object.assign(res.body, { update_time: new Date() }))
|
|
745
|
-
for (let exchange in this.
|
|
746
|
-
for (let quote_cur in this.
|
|
747
|
-
this.
|
|
746
|
+
for (let exchange in this.exchange_cur_quote_cur) {
|
|
747
|
+
for (let quote_cur in this.exchange_cur_quote_cur[exchange]) {
|
|
748
|
+
this.exchange_cur_quote_cur[exchange][quote_cur].map((cur) => {
|
|
748
749
|
let cur_balance = _.get(this.balances, [exchange, 'available', cur], 0)
|
|
749
750
|
let quote_cur_balance = _.get(this.balances, [exchange, 'available', quote_cur], 0)
|
|
750
751
|
let pair = cur + quote_cur
|
|
@@ -1291,8 +1292,11 @@ module.exports = class Orders {
|
|
|
1291
1292
|
asks = asks.slice(0, RATES_LENGTH_MAX)
|
|
1292
1293
|
bids = bids.slice(0, RATES_LENGTH_MAX)
|
|
1293
1294
|
_.set(this.rates, [exchange, pair], { asks, bids, update_time: new Date() })
|
|
1294
|
-
// console.log(exchange, pair)
|
|
1295
1295
|
process_rates()
|
|
1296
|
+
if (this.pair_map_rates_only && this.pair_map_rates_only[pair]) {
|
|
1297
|
+
const reference_pair = this.pair_map_rates_only[pair]
|
|
1298
|
+
this.rates_combined_major[reference_pair] = this.rates_combined_major[pair]
|
|
1299
|
+
}
|
|
1296
1300
|
} else if (_.get(this.rates, [exchange, pair, 'update_time']) < new Date().getTime() - this.interval_dict[exchange].rates) {
|
|
1297
1301
|
this.info_log('%s %s rates expired: %j', exchange, pair, res)
|
|
1298
1302
|
this.rates[exchange] = _.omit(this.rates[exchange], [pair])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icgio/icg-exchanges-wrapper",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.24",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/icgio/icg-exchanges-wrapper#readme",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@icgio/icg-exchanges": "^1.32.
|
|
21
|
-
"@icgio/icg-exchanges-data": "^1.10.
|
|
22
|
-
"@icgio/icg-utils": "^1.9.
|
|
20
|
+
"@icgio/icg-exchanges": "^1.32.21",
|
|
21
|
+
"@icgio/icg-exchanges-data": "^1.10.11",
|
|
22
|
+
"@icgio/icg-utils": "^1.9.13",
|
|
23
23
|
"influx": "^5.10.0",
|
|
24
24
|
"lodash": "^4.17.20",
|
|
25
25
|
"uuid": "^11.1.0",
|