@icgio/icg-exchanges-wrapper 1.9.12 → 1.9.13

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.
@@ -65,13 +65,6 @@ module.exports = class Account {
65
65
  USD: 0
66
66
  }
67
67
  for (let cur in exchange_position[exchange]) {
68
- if (!cmc_rates[cur]) {
69
- // console.error('get_exchange_profit rates_cmc %s does not exist', cur)
70
- continue
71
- } else if (cmc_rates[cur].update_time < new Date().getTime() - 4 * 60 * 60 * 1000) { // some currencies like USDT are updating slow
72
- console.error('get_exchange_profit rates_cmc %s expired', cur)
73
- continue
74
- }
75
68
  let position = exchange_position[exchange][cur].amount
76
69
  if (_.includes(constants.stablecoins, cur)) {
77
70
  profit.USD += position
@@ -82,7 +75,12 @@ module.exports = class Account {
82
75
  } else if (_.includes(['CNYT'], cur)) {
83
76
  profit.USD += position / USDCNY
84
77
  } else {
85
- profit.USD += position * cmc_rates[cur].USD
78
+ if (!cmc_rates[cur]) {
79
+ console.error('get_exchange_profit rates_cmc %s does not exist', cur)
80
+ } else if (cmc_rates[cur].update_time < new Date().getTime() - 4 * 60 * 60 * 1000) { // some currencies like USDT are updating slow
81
+ console.error('get_exchange_profit rates_cmc %s expired', cur)
82
+ }
83
+ profit.USD += position * _.get(cmc_rates, [cur, 'USD'], 0)
86
84
  }
87
85
  }
88
86
  _.set(exchange_profit, [exchange], profit)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-exchanges-wrapper",
3
- "version": "1.9.12",
3
+ "version": "1.9.13",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {