@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.
@@ -35,11 +35,12 @@ module.exports = class Account {
35
35
 
36
36
  console.log('exchange_assets_benchmarks', this.exchange_assets_benchmarks)
37
37
 
38
- let USDCNY, USDHKD, USDKRW
38
+ this.forex_rates = {}
39
39
  forex_rate.get_forex_rate_usd(['CNY', 'HKD', 'KRW'], (res) => {
40
- USDCNY = res['CNY']
41
- USDHKD = res['HKD']
42
- USDKRW = res['KRW']
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 / USDKRW
133
+ profit.USD += position / this.forex_rates['KRWUSD']
133
134
  } else if (_.includes(['HKD'], cur)) {
134
- profit.USD += position / USDHKD
135
+ profit.USD += position / this.forex_rates['HKDUSD']
135
136
  } else if (_.includes(['CNYT'], cur)) {
136
- profit.USD += position / USDCNY
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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-exchanges-wrapper",
3
- "version": "1.14.217",
3
+ "version": "1.14.218",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {