@icgio/icg-exchanges-wrapper 1.9.171 → 1.9.173
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const _ = require('lodash')
|
|
2
2
|
|
|
3
|
-
let first_time = {},
|
|
3
|
+
let first_time = {},
|
|
4
|
+
balances = {}
|
|
4
5
|
module.exports = function (Exchanges, cb) {
|
|
5
6
|
if (!Array.isArray(Exchanges)) {
|
|
6
7
|
console.error('Exchanges should be an array')
|
|
@@ -8,8 +9,7 @@ module.exports = function (Exchanges, cb) {
|
|
|
8
9
|
} else {
|
|
9
10
|
for (let Exchange of Exchanges) {
|
|
10
11
|
if (Exchange.balance_ws) {
|
|
11
|
-
if (Exchange.ws_status().trading === 'n-opened')
|
|
12
|
-
Exchange.ws_account()
|
|
12
|
+
if (Exchange.ws_status().trading === 'n-opened') Exchange.ws_account()
|
|
13
13
|
Exchange.balance_ws(function (res) {
|
|
14
14
|
if (res.success) {
|
|
15
15
|
_.set(balances, Exchange.exchange_id, res.body)
|
|
@@ -17,7 +17,7 @@ module.exports = function (Exchanges, cb) {
|
|
|
17
17
|
delete balances[Exchange.exchange_id]
|
|
18
18
|
}
|
|
19
19
|
})
|
|
20
|
-
} else {
|
|
20
|
+
} else if (Exchange.balance) {
|
|
21
21
|
Exchange.balance(function (res) {
|
|
22
22
|
if (res.success) {
|
|
23
23
|
_.set(balances, Exchange.exchange_id, res.body)
|
|
@@ -42,7 +42,7 @@ module.exports.get_exchanges_rates = function (Exchanges, exchange_pair_dict, cb
|
|
|
42
42
|
})
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
-
} else {
|
|
45
|
+
} else if (Exchange.rate) {
|
|
46
46
|
for (let pair of exchange_pair_dict[Exchange_name]) {
|
|
47
47
|
Exchange.rate(pair, DEFAULT_ORDERBOOK_LEVEL, function (res) {
|
|
48
48
|
if (res.success) {
|
|
@@ -58,6 +58,25 @@ module.exports.get_exchanges_rates = function (Exchanges, exchange_pair_dict, cb
|
|
|
58
58
|
}
|
|
59
59
|
})
|
|
60
60
|
}
|
|
61
|
+
} else if (Exchange.rate_with_routes) {
|
|
62
|
+
for (let pair of exchange_pair_dict[Exchange_name]) {
|
|
63
|
+
Exchange.rate_with_routes(pair, function (res) {
|
|
64
|
+
if (res.success) {
|
|
65
|
+
let { asks, bids } = res.body
|
|
66
|
+
asks = asks.map((ask) => ask.slice(0, 2))
|
|
67
|
+
bids = bids.map((bid) => bid.slice(0, 2))
|
|
68
|
+
_.set(exchange_pair_rates, [Exchange_name, pair], { asks, bids })
|
|
69
|
+
_.set(pair_exchange_rates, [pair, Exchange_name], { asks, bids })
|
|
70
|
+
} else {
|
|
71
|
+
if (exchange_pair_rates[Exchange_name]) {
|
|
72
|
+
delete exchange_pair_rates[Exchange_name][pair]
|
|
73
|
+
}
|
|
74
|
+
if (pair_exchange_rates[pair]) {
|
|
75
|
+
delete pair_exchange_rates[pair][Exchange_name]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
})
|
|
79
|
+
}
|
|
61
80
|
}
|
|
62
81
|
}
|
|
63
82
|
}
|
package/index.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
const get_exchanges_rates = require('./functions/get-exchanges-rates-market-history-ohlcv.js')
|
|
2
|
-
const get_exchanges_market_history = require('./functions/get-exchanges-rates-market-history-ohlcv.js').get_exchanges_market_history
|
|
3
|
-
const get_exchanges_ohlcv = require('./functions/get-exchanges-rates-market-history-ohlcv.js').get_exchanges_ohlcv
|
|
1
|
+
const { get_exchanges_rates, get_exchanges_market_history, get_exchanges_ohlcv } = require('./functions/get-exchanges-rates-market-history-ohlcv.js')
|
|
4
2
|
const get_exchanges_balance = require('./functions/get-exchanges-balance.js')
|
|
5
|
-
const get_exchanges_open_orders = require('./functions/get-exchanges-open-orders.js')
|
|
6
3
|
const get_exchanges_trades = require('./functions/get-exchanges-trades.js')
|
|
7
4
|
|
|
8
5
|
module.exports.functions = {
|
|
@@ -10,7 +7,6 @@ module.exports.functions = {
|
|
|
10
7
|
get_exchanges_market_history,
|
|
11
8
|
get_exchanges_ohlcv,
|
|
12
9
|
get_exchanges_balance,
|
|
13
|
-
get_exchanges_open_orders,
|
|
14
10
|
get_exchanges_trades,
|
|
15
11
|
}
|
|
16
12
|
|
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.173",
|
|
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.27.
|
|
20
|
+
"@icgio/icg-exchanges": "^1.27.119",
|
|
21
21
|
"@icgio/icg-exchanges-data": "^1.6.61",
|
|
22
22
|
"@icgio/icg-utils": "^1.7.37",
|
|
23
23
|
"influx": "^5.7.0",
|
|
File without changes
|
|
File without changes
|