@icgio/icg-exchanges-wrapper 1.13.16 → 1.14.0
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/account.js +3 -3
- package/middleware/orders.js +10 -10
- package/package.json +6 -6
package/middleware/account.js
CHANGED
|
@@ -50,14 +50,14 @@ module.exports = class Account {
|
|
|
50
50
|
let depth = {}
|
|
51
51
|
for (let exchange in rates) {
|
|
52
52
|
for (let pair in rates[exchange]) {
|
|
53
|
-
let [cur,
|
|
53
|
+
let [cur, quote_cur] = utils.parse_pair(pair)
|
|
54
54
|
let { asks, bids } = rates[exchange][pair]
|
|
55
55
|
let mid = (asks[0][0] + bids[0][0]) / 2
|
|
56
56
|
for (let percentage of percentages) {
|
|
57
57
|
let ask_depth = utils.price_position(asks, mid * (1 + percentage)).sum
|
|
58
58
|
let bid_depth = utils.price_position(bids, mid / (1 + percentage)).sum
|
|
59
|
-
let ask_depth_in_usd = ask_depth * _.get(cmc_rates, [
|
|
60
|
-
let bid_depth_in_usd = bid_depth * _.get(cmc_rates, [
|
|
59
|
+
let ask_depth_in_usd = ask_depth * _.get(cmc_rates, [quote_cur, 'USD'], 0)
|
|
60
|
+
let bid_depth_in_usd = bid_depth * _.get(cmc_rates, [quote_cur, 'USD'], 0)
|
|
61
61
|
_.set(depth, [exchange, pair, 'ask', percentage], '$' + ask_depth_in_usd.toFixed(2))
|
|
62
62
|
_.set(depth, [exchange, pair, 'bid', percentage], '$' + bid_depth_in_usd.toFixed(2))
|
|
63
63
|
}
|
package/middleware/orders.js
CHANGED
|
@@ -728,13 +728,13 @@ module.exports = class Orders {
|
|
|
728
728
|
if (res.success) {
|
|
729
729
|
_.set(this.balances, [exchange], Object.assign(res.body, { update_time: new Date() }))
|
|
730
730
|
for (let exchange in this.exchange_basecur_curs) {
|
|
731
|
-
for (let
|
|
732
|
-
this.exchange_basecur_curs[exchange][
|
|
731
|
+
for (let quote_cur in this.exchange_basecur_curs[exchange]) {
|
|
732
|
+
this.exchange_basecur_curs[exchange][quote_cur].map((cur) => {
|
|
733
733
|
let cur_balance = _.get(this.balances, [exchange, 'available', cur], 0)
|
|
734
|
-
let
|
|
735
|
-
let pair = cur +
|
|
734
|
+
let quote_cur_balance = _.get(this.balances, [exchange, 'available', quote_cur], 0)
|
|
735
|
+
let pair = cur + quote_cur
|
|
736
736
|
let max_cur_amount = cur_balance - _.get(this.min_reserve_balance, [exchange, cur], 0)
|
|
737
|
-
let
|
|
737
|
+
let max_quote_cur_amount = quote_cur_balance - _.get(this.min_reserve_balance, [exchange, quote_cur], 0)
|
|
738
738
|
if (max_cur_amount > 0) {
|
|
739
739
|
} else {
|
|
740
740
|
// if (cur_balance > 0) {
|
|
@@ -742,16 +742,16 @@ module.exports = class Orders {
|
|
|
742
742
|
// }
|
|
743
743
|
max_cur_amount = 0
|
|
744
744
|
}
|
|
745
|
-
if (
|
|
745
|
+
if (max_quote_cur_amount > 0) {
|
|
746
746
|
} else {
|
|
747
|
-
// if (
|
|
748
|
-
// console.log('balance low', exchange,
|
|
747
|
+
// if (quote_cur_balance > 0) {
|
|
748
|
+
// console.log('balance low', exchange, quote_cur, quote_cur_balance, this.min_reserve_balance[exchange][quote_cur])
|
|
749
749
|
// }
|
|
750
|
-
|
|
750
|
+
max_quote_cur_amount = 0
|
|
751
751
|
}
|
|
752
752
|
_.set(this.buy_sell_limits_against_reserve_balance, [exchange, pair], {
|
|
753
753
|
sell: max_cur_amount,
|
|
754
|
-
buy:
|
|
754
|
+
buy: max_quote_cur_amount,
|
|
755
755
|
})
|
|
756
756
|
})
|
|
757
757
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icgio/icg-exchanges-wrapper",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
},
|
|
18
18
|
"homepage": "https://github.com/icgio/icg-exchanges-wrapper#readme",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@icgio/icg-exchanges": "^1.
|
|
21
|
-
"@icgio/icg-exchanges-data": "^1.
|
|
22
|
-
"@icgio/icg-utils": "^1.
|
|
23
|
-
"influx": "^5.
|
|
20
|
+
"@icgio/icg-exchanges": "^1.32.1",
|
|
21
|
+
"@icgio/icg-exchanges-data": "^1.10.0",
|
|
22
|
+
"@icgio/icg-utils": "^1.9.0",
|
|
23
|
+
"influx": "^5.10.0",
|
|
24
24
|
"lodash": "^4.17.20",
|
|
25
25
|
"uuid": "^9.0.1",
|
|
26
|
-
"ws": "^8.
|
|
26
|
+
"ws": "^8.18.1"
|
|
27
27
|
}
|
|
28
28
|
}
|