@icgio/icg-exchanges-wrapper 1.14.69 → 1.14.70
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 +13 -11
- package/package.json +3 -3
package/middleware/orders.js
CHANGED
|
@@ -2,7 +2,7 @@ const _ = require('lodash')
|
|
|
2
2
|
|
|
3
3
|
const { v4: uuid } = require('uuid')
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const ICGExchanges = require('@icgio/icg-exchanges')
|
|
6
6
|
const utils = require('@icgio/icg-utils').utils
|
|
7
7
|
const { coinmarketcap: get_coinmarketcap_rates, observable: Observable } = require('@icgio/icg-utils')
|
|
8
8
|
|
|
@@ -75,10 +75,12 @@ module.exports = class Orders {
|
|
|
75
75
|
this.exchange_cur_quote_cur = exchange_cur_quote_cur
|
|
76
76
|
this.exchange_cur_quote_cur_rates_only = exchange_cur_quote_cur_rates_only
|
|
77
77
|
this.pair_map_rates_only = pair_map_rates_only || {}
|
|
78
|
-
let { exchange_pairs, pair_exchanges } = utils.exchange_cur_quote_cur_converter(exchange_cur_quote_cur)
|
|
78
|
+
let { exchange_pairs, pair_exchanges, exchange_pairs_without_2, pair_exchanges_without_2 } = utils.exchange_cur_quote_cur_converter(exchange_cur_quote_cur)
|
|
79
79
|
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)
|
|
80
80
|
this.exchange_pairs = exchange_pairs
|
|
81
|
+
this.exchange_pairs_without_2 = exchange_pairs_without_2
|
|
81
82
|
this.pair_exchanges = pair_exchanges
|
|
83
|
+
this.pair_exchanges_without_2 = pair_exchanges_without_2
|
|
82
84
|
this.exchange_pairs_rates_only = exchange_pairs_rates_only
|
|
83
85
|
this.pair_exchanges_rates_only = pair_exchanges_rates_only
|
|
84
86
|
this.rates_only_exchanges = pair_exchanges_rates_only
|
|
@@ -130,7 +132,7 @@ module.exports = class Orders {
|
|
|
130
132
|
} else {
|
|
131
133
|
limits = STANDARD_LIMITS
|
|
132
134
|
}
|
|
133
|
-
this.Exchanges[exchange] = new
|
|
135
|
+
this.Exchanges[exchange] = new ICGExchanges[_.upperFirst(exchange.replace('_2', ''))](api_key_temp, secret_key_temp, _.assign(limits, cd[exchange]))
|
|
134
136
|
if (!this.interval_dict || !this.interval_dict[exchange]) {
|
|
135
137
|
this.interval_dict[exchange] = {
|
|
136
138
|
balances: 10 * 1000,
|
|
@@ -154,7 +156,7 @@ module.exports = class Orders {
|
|
|
154
156
|
}
|
|
155
157
|
}
|
|
156
158
|
for (let exchange in this.exchange_cur_quote_cur_rates_only) {
|
|
157
|
-
this.ExchangesRatesOnly[exchange] = new
|
|
159
|
+
this.ExchangesRatesOnly[exchange] = new ICGExchanges[_.upperFirst(exchange)]('', '', STANDARD_LIMITS)
|
|
158
160
|
}
|
|
159
161
|
this.balances = {}
|
|
160
162
|
this.positions = {}
|
|
@@ -1327,7 +1329,7 @@ module.exports = class Orders {
|
|
|
1327
1329
|
if (!this.ws_market_first_time) {
|
|
1328
1330
|
this.ws_market_first_time = {}
|
|
1329
1331
|
}
|
|
1330
|
-
for (let exchange in
|
|
1332
|
+
for (let exchange in exchange_pairs) {
|
|
1331
1333
|
if (Exchanges[exchange].ws_market && Exchanges[exchange].exchange_type === 'spot') {
|
|
1332
1334
|
if (!this.ws_market_first_time[exchange]) {
|
|
1333
1335
|
Exchanges[exchange].ws_market(exchange_pairs[exchange])
|
|
@@ -1369,7 +1371,7 @@ module.exports = class Orders {
|
|
|
1369
1371
|
}
|
|
1370
1372
|
}
|
|
1371
1373
|
}
|
|
1372
|
-
for (let exchange in
|
|
1374
|
+
for (let exchange in exchange_pairs_rates_only) {
|
|
1373
1375
|
if (ExchangesRatesOnly[exchange].ws_market) {
|
|
1374
1376
|
if (!this.ws_market_first_time[exchange]) {
|
|
1375
1377
|
ExchangesRatesOnly[exchange].ws_market(exchange_pairs_rates_only[exchange])
|
|
@@ -1391,7 +1393,7 @@ module.exports = class Orders {
|
|
|
1391
1393
|
}
|
|
1392
1394
|
}
|
|
1393
1395
|
}
|
|
1394
|
-
get_rates(this.Exchanges, this.ExchangesRatesOnly, this.
|
|
1396
|
+
get_rates(this.Exchanges, this.ExchangesRatesOnly, this.exchange_pairs_without_2, this.exchange_pairs_rates_only, this.interval_dict)
|
|
1395
1397
|
}
|
|
1396
1398
|
check_market_history() {
|
|
1397
1399
|
let market_history_handler = (exchange, pair, res) => {
|
|
@@ -1403,7 +1405,7 @@ module.exports = class Orders {
|
|
|
1403
1405
|
}
|
|
1404
1406
|
}
|
|
1405
1407
|
let get_market_history = (Exchanges, exchange_pairs, interval_dict) => {
|
|
1406
|
-
for (let exchange in
|
|
1408
|
+
for (let exchange in exchange_pairs) {
|
|
1407
1409
|
const market_history_timeframe = exchange === 'coinbene' ? 30 * 24 * 60 * 60 * 1000 : MARKET_HISTORY_DEFAULT_MS
|
|
1408
1410
|
if (Exchanges[exchange].ws_market && Exchanges[exchange].exchange_type === 'spot') {
|
|
1409
1411
|
if (!this.ws_market_first_time[exchange]) {
|
|
@@ -1426,7 +1428,7 @@ module.exports = class Orders {
|
|
|
1426
1428
|
}
|
|
1427
1429
|
}
|
|
1428
1430
|
}
|
|
1429
|
-
get_market_history(this.Exchanges, this.
|
|
1431
|
+
get_market_history(this.Exchanges, this.exchange_pairs_without_2, this.interval_dict)
|
|
1430
1432
|
}
|
|
1431
1433
|
check_ohlcv() {
|
|
1432
1434
|
const OHLCV_DEFAULT_PAST_HOURS = 24
|
|
@@ -1444,7 +1446,7 @@ module.exports = class Orders {
|
|
|
1444
1446
|
}
|
|
1445
1447
|
}
|
|
1446
1448
|
let get_ohlcv = (Exchanges, exchange_pairs, interval_dict) => {
|
|
1447
|
-
for (let exchange in
|
|
1449
|
+
for (let exchange in exchange_pairs) {
|
|
1448
1450
|
for (let pair of exchange_pairs[exchange]) {
|
|
1449
1451
|
if (Exchanges[exchange].ohlcv) {
|
|
1450
1452
|
let ohlcv_from_timetamp = new Date().floorHours(1).addHours(-OHLCV_DEFAULT_PAST_HOURS)
|
|
@@ -1463,7 +1465,7 @@ module.exports = class Orders {
|
|
|
1463
1465
|
}
|
|
1464
1466
|
}
|
|
1465
1467
|
}
|
|
1466
|
-
get_ohlcv(this.Exchanges, this.
|
|
1468
|
+
get_ohlcv(this.Exchanges, this.exchange_pairs_without_2, this.interval_dict)
|
|
1467
1469
|
}
|
|
1468
1470
|
check_cmc_rates(data, type, source) {
|
|
1469
1471
|
let check_cmc_rates_base = (data, type, source) => {
|
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.70",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"homepage": "https://github.com/icgio/icg-exchanges-wrapper#readme",
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@icgio/icg-exchanges": "^1.32.45",
|
|
21
|
-
"@icgio/icg-exchanges-data": "^1.10.
|
|
22
|
-
"@icgio/icg-utils": "^1.9.
|
|
21
|
+
"@icgio/icg-exchanges-data": "^1.10.37",
|
|
22
|
+
"@icgio/icg-utils": "^1.9.15",
|
|
23
23
|
"influx": "^5.10.0",
|
|
24
24
|
"lodash": "^4.17.20",
|
|
25
25
|
"uuid": "^11.1.0",
|