@icgio/icg-exchanges-wrapper 1.20.1 → 1.21.1
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.
|
@@ -225,10 +225,14 @@ const get_exchanges_rates = function (Exchanges, exchange_pair_dict, cb, ws_enab
|
|
|
225
225
|
Exchange.ws.market.pair_status[pair] === 'opened' &&
|
|
226
226
|
Exchange.ws.market.asks_dict &&
|
|
227
227
|
Exchange.ws.market.asks_dict[pair] &&
|
|
228
|
-
(typeof Exchange.ws.market.asks_dict[pair].length === 'function'
|
|
228
|
+
(typeof Exchange.ws.market.asks_dict[pair].length === 'function'
|
|
229
|
+
? Exchange.ws.market.asks_dict[pair].length()
|
|
230
|
+
: Exchange.ws.market.asks_dict[pair].length) > 0 &&
|
|
229
231
|
Exchange.ws.market.bids_dict &&
|
|
230
232
|
Exchange.ws.market.bids_dict[pair] &&
|
|
231
|
-
(typeof Exchange.ws.market.bids_dict[pair].length === 'function'
|
|
233
|
+
(typeof Exchange.ws.market.bids_dict[pair].length === 'function'
|
|
234
|
+
? Exchange.ws.market.bids_dict[pair].length()
|
|
235
|
+
: Exchange.ws.market.bids_dict[pair].length) > 0
|
|
232
236
|
|
|
233
237
|
if (pair_ready) {
|
|
234
238
|
// Pair is ready, try to get rate
|
|
@@ -677,15 +681,12 @@ const get_exchanges_market_history = function (Exchanges, exchange_pair_dict, ti
|
|
|
677
681
|
})
|
|
678
682
|
}
|
|
679
683
|
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
const
|
|
686
|
-
checked_ohlcv_exchange = {}
|
|
687
|
-
ohlcv_status = {}
|
|
688
|
-
ohlcv_callback_fired = false // Reset callback flag (separate from ohlcv_status to not pollute _.values())
|
|
684
|
+
const get_exchanges_ohlcv = function (Exchanges, exchange_pair_dict, from_in_ms, to_in_ms, interval, cb) {
|
|
685
|
+
const checked_ohlcv_exchange = {}
|
|
686
|
+
const ohlcv_status = {}
|
|
687
|
+
let ohlcv_callback_fired = false
|
|
688
|
+
const exchange_pair_ohlcv = {}
|
|
689
|
+
const pair_exchange_ohlcv = {}
|
|
689
690
|
if (!Array.isArray(Exchanges)) {
|
|
690
691
|
console.error('Exchanges should be an array')
|
|
691
692
|
return
|
|
@@ -702,7 +703,7 @@ const get_exchanges_ohlcv = function (Exchanges, exchange_pair_dict, from_in_ms,
|
|
|
702
703
|
for (let pair of exchange_pair_dict[Exchange_name]) {
|
|
703
704
|
_.set(ohlcv_status, [Exchange_name + pair], false)
|
|
704
705
|
if (Exchange.ohlcv) {
|
|
705
|
-
Exchange.ohlcv(pair, from_in_ms, to_in_ms, function (res) {
|
|
706
|
+
Exchange.ohlcv(pair, from_in_ms, to_in_ms, interval, function (res) {
|
|
706
707
|
if (res.success) {
|
|
707
708
|
set_pair_data(exchange_pair_ohlcv, pair_exchange_ohlcv, Exchange_name, pair, res.body)
|
|
708
709
|
} else {
|
package/middleware/orders.js
CHANGED
|
@@ -1676,13 +1676,13 @@ module.exports = class Orders {
|
|
|
1676
1676
|
if (Exchanges[exchange].ohlcv) {
|
|
1677
1677
|
const ohlcv_from_timetamp = new Date().floorHours(1).addHours(-OHLCV_DEFAULT_PAST_HOURS).getTime()
|
|
1678
1678
|
const ohlcv_to_timestamp = new Date().floorHours(1).getTime()
|
|
1679
|
-
Exchanges[exchange].ohlcv(pair, ohlcv_from_timetamp, ohlcv_to_timestamp, (res) => {
|
|
1679
|
+
Exchanges[exchange].ohlcv(pair, ohlcv_from_timetamp, ohlcv_to_timestamp, '1h', (res) => {
|
|
1680
1680
|
ohlcv_handler(exchange, pair, res)
|
|
1681
1681
|
})
|
|
1682
1682
|
setInterval(() => {
|
|
1683
1683
|
const ohlcv_from_timetamp = new Date().floorHours(1).addHours(-OHLCV_DEFAULT_PAST_HOURS).getTime()
|
|
1684
1684
|
const ohlcv_to_timestamp = new Date().floorHours(1).getTime()
|
|
1685
|
-
Exchanges[exchange].ohlcv(pair, ohlcv_from_timetamp, ohlcv_to_timestamp, (res) => {
|
|
1685
|
+
Exchanges[exchange].ohlcv(pair, ohlcv_from_timetamp, ohlcv_to_timestamp, '1h', (res) => {
|
|
1686
1686
|
ohlcv_handler(exchange, pair, res)
|
|
1687
1687
|
})
|
|
1688
1688
|
}, interval_dict[exchange].ohlcv)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icgio/icg-exchanges-wrapper",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/icgio/icg-exchanges-wrapper#readme",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@icgio/icg-exchanges": "^1.
|
|
20
|
+
"@icgio/icg-exchanges": "^1.45.2",
|
|
21
21
|
"@icgio/icg-utils": "^1.9.61",
|
|
22
22
|
"lodash": "^4.17.23",
|
|
23
23
|
"pg": "^8.17.2"
|