@icgio/icg-exchanges-wrapper 1.21.18 → 1.21.19
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 +6 -2
- package/package.json +2 -2
package/middleware/orders.js
CHANGED
|
@@ -1548,6 +1548,7 @@ module.exports = class Orders {
|
|
|
1548
1548
|
get_query_order_all(this.Exchanges, this.exchange_pairs, this.interval_dict)
|
|
1549
1549
|
}
|
|
1550
1550
|
check_rates() {
|
|
1551
|
+
const pending_rate_updates = new Map()
|
|
1551
1552
|
let process_rates = () => {
|
|
1552
1553
|
let pair_list = _.concat(_.keys(this.pair_exchanges), _.keys(this.pair_exchanges_rates_only))
|
|
1553
1554
|
for (let pair of pair_list) {
|
|
@@ -1588,7 +1589,9 @@ module.exports = class Orders {
|
|
|
1588
1589
|
this.rates_combined_major[pair] = this.rates_combined_major[reference_pair]
|
|
1589
1590
|
}
|
|
1590
1591
|
}
|
|
1591
|
-
|
|
1592
|
+
const updates = Array.from(pending_rate_updates.values())
|
|
1593
|
+
pending_rate_updates.clear()
|
|
1594
|
+
this.rates_observable.notify({ updates })
|
|
1592
1595
|
}
|
|
1593
1596
|
const throttled_process_rates = _.throttle(process_rates, PROCESS_RATES_THROTTLE_MS, { leading: true, trailing: true })
|
|
1594
1597
|
let rates_handler = (exchange, pair, res) => {
|
|
@@ -1616,6 +1619,7 @@ module.exports = class Orders {
|
|
|
1616
1619
|
du_ms_interarrival_local_received,
|
|
1617
1620
|
update_time: new Date(),
|
|
1618
1621
|
})
|
|
1622
|
+
pending_rate_updates.set(`${exchange}:${pair}`, { exchange, pair })
|
|
1619
1623
|
/*
|
|
1620
1624
|
* throttle to 20ms
|
|
1621
1625
|
*/
|
|
@@ -1623,7 +1627,7 @@ module.exports = class Orders {
|
|
|
1623
1627
|
} else if (_.get(this.rates, [exchange, pair, 'update_time']) < Date.now() - this.interval_dict[exchange].rates) {
|
|
1624
1628
|
console.log('%s %s rates expired: %j', exchange, pair, res)
|
|
1625
1629
|
if (this.rates[exchange]) delete this.rates[exchange][pair]
|
|
1626
|
-
this.rates_observable.notify()
|
|
1630
|
+
this.rates_observable.notify({ updates: [{ exchange, pair, expired: true }] })
|
|
1627
1631
|
}
|
|
1628
1632
|
}
|
|
1629
1633
|
let get_rates = (Exchanges, ExchangesRatesOnly, exchange_pairs, exchange_pairs_rates_only, interval_dict) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icgio/icg-exchanges-wrapper",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.19",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"homepage": "https://github.com/icgio/icg-exchanges-wrapper#readme",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@icgio/icg-exchanges": "^1.45.10",
|
|
21
|
-
"@icgio/icg-utils": "^1.9.
|
|
21
|
+
"@icgio/icg-utils": "^1.9.62",
|
|
22
22
|
"lodash": "^4.17.23",
|
|
23
23
|
"pg": "^8.17.2"
|
|
24
24
|
}
|