@icgio/icg-exchanges-wrapper 1.18.0 → 1.19.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/orders.js +7 -3
- package/package.json +2 -2
package/middleware/orders.js
CHANGED
|
@@ -177,7 +177,7 @@ module.exports = class Orders {
|
|
|
177
177
|
this.cmc_curs = settings.cmc_curs || []
|
|
178
178
|
this.accounting_benchmark = settings.accounting_benchmark
|
|
179
179
|
this.balance_benchmark = settings.balance_benchmark || {}
|
|
180
|
-
this.
|
|
180
|
+
this.min_reserve_balance_usd = settings.min_reserve_balance_usd || {}
|
|
181
181
|
for (let exchange in exchange_pairs) {
|
|
182
182
|
const exchange_base = utils.exchange_base_from_key(exchange)
|
|
183
183
|
let api_key_temp = cd[exchange]['api_keys'] || cd[exchange]['api_key'],
|
|
@@ -1060,8 +1060,12 @@ module.exports = class Orders {
|
|
|
1060
1060
|
const cur_balance = _.get(this.balances, [exchange, 'available', cur], 0)
|
|
1061
1061
|
const quote_cur_balance = _.get(this.balances, [exchange, 'available', quote_cur], 0)
|
|
1062
1062
|
const pair = cur + quote_cur
|
|
1063
|
-
|
|
1064
|
-
|
|
1063
|
+
const cur_rate_usd = this.account?.get_rate_usd(cur, this.crypto_rates) || 0
|
|
1064
|
+
const quote_rate_usd = this.account?.get_rate_usd(quote_cur, this.crypto_rates) || 0
|
|
1065
|
+
const cur_reserve = cur_rate_usd > 0 ? _.get(this.min_reserve_balance_usd, [exchange, cur], 0) / cur_rate_usd : 0
|
|
1066
|
+
const quote_reserve = quote_rate_usd > 0 ? _.get(this.min_reserve_balance_usd, [exchange, quote_cur], 0) / quote_rate_usd : 0
|
|
1067
|
+
let max_cur_amount = cur_balance - cur_reserve
|
|
1068
|
+
let max_quote_cur_amount = quote_cur_balance - quote_reserve
|
|
1065
1069
|
if (max_cur_amount < 0) max_cur_amount = 0
|
|
1066
1070
|
if (max_quote_cur_amount < 0) max_quote_cur_amount = 0
|
|
1067
1071
|
_.set(this.buy_sell_limits_against_reserve_balance, [exchange, pair], {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@icgio/icg-exchanges-wrapper",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
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.42.
|
|
20
|
+
"@icgio/icg-exchanges": "^1.42.1",
|
|
21
21
|
"@icgio/icg-utils": "^1.9.61",
|
|
22
22
|
"lodash": "^4.17.23",
|
|
23
23
|
"pg": "^8.17.2"
|