@icgio/icg-exchanges-wrapper 1.14.216 → 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)
@@ -1439,14 +1439,14 @@ module.exports = class Orders {
1439
1439
  for (let exchange in exchange_pairs) {
1440
1440
  for (let pair of exchange_pairs[exchange]) {
1441
1441
  if (Exchanges[exchange].ohlcv) {
1442
- let ohlcv_from_timetamp = new Date().floorHours(1).addHours(-OHLCV_DEFAULT_PAST_HOURS)
1443
- let ohlcv_to_timestamp = new Date().floorHours(1)
1442
+ const ohlcv_from_timetamp = new Date().floorHours(1).addHours(-OHLCV_DEFAULT_PAST_HOURS).getTime()
1443
+ const ohlcv_to_timestamp = new Date().floorHours(1).getTime()
1444
1444
  Exchanges[exchange].ohlcv(pair, ohlcv_from_timetamp, ohlcv_to_timestamp, (res) => {
1445
1445
  ohlcv_handler(exchange, pair, res)
1446
1446
  })
1447
1447
  setInterval(() => {
1448
- let ohlcv_from_timetamp = new Date().floorHours(1).addHours(-OHLCV_DEFAULT_PAST_HOURS)
1449
- let ohlcv_to_timestamp = new Date().floorHours(1)
1448
+ const ohlcv_from_timetamp = new Date().floorHours(1).addHours(-OHLCV_DEFAULT_PAST_HOURS).getTime()
1449
+ const ohlcv_to_timestamp = new Date().floorHours(1).getTime()
1450
1450
  Exchanges[exchange].ohlcv(pair, ohlcv_from_timetamp, ohlcv_to_timestamp, (res) => {
1451
1451
  ohlcv_handler(exchange, pair, res)
1452
1452
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-exchanges-wrapper",
3
- "version": "1.14.216",
3
+ "version": "1.14.218",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {