@icgio/icg-exchanges-wrapper 1.14.217 → 1.14.218
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 +8 -7
- package/package.json +1 -1
package/middleware/account.js
CHANGED
|
@@ -35,11 +35,12 @@ module.exports = class Account {
|
|
|
35
35
|
|
|
36
36
|
console.log('exchange_assets_benchmarks', this.exchange_assets_benchmarks)
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
this.forex_rates = {}
|
|
39
39
|
forex_rate.get_forex_rate_usd(['CNY', 'HKD', 'KRW'], (res) => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
console.log('forex_rates', res)
|
|
41
|
+
this.forex_rates['CNYUSD'] = res['CNY']
|
|
42
|
+
this.forex_rates['HKDUSD'] = res['HKD']
|
|
43
|
+
this.forex_rates['KRWUSD'] = res['KRW']
|
|
43
44
|
})
|
|
44
45
|
}
|
|
45
46
|
get_depth(rates, cmc_rates, percentages) {
|
|
@@ -129,11 +130,11 @@ module.exports = class Account {
|
|
|
129
130
|
if (_.includes(constants.stablecoins, cur)) {
|
|
130
131
|
profit.USD += position
|
|
131
132
|
} else if (_.includes(['KRW'], cur)) {
|
|
132
|
-
profit.USD += position /
|
|
133
|
+
profit.USD += position / this.forex_rates['KRWUSD']
|
|
133
134
|
} else if (_.includes(['HKD'], cur)) {
|
|
134
|
-
profit.USD += position /
|
|
135
|
+
profit.USD += position / this.forex_rates['HKDUSD']
|
|
135
136
|
} else if (_.includes(['CNYT'], cur)) {
|
|
136
|
-
profit.USD += position /
|
|
137
|
+
profit.USD += position / this.forex_rates['CNYUSD']
|
|
137
138
|
} else {
|
|
138
139
|
if (!cmc_rates[cur]) {
|
|
139
140
|
console.log('get_exchange_profit rates_cmc %s does not exist', cur)
|