@icgio/icg-utils 1.9.22 → 1.9.23

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.
@@ -316,6 +316,31 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
316
316
  console.error(pair, error)
317
317
  }
318
318
  })
319
+ } else if (exchange === 'htx') {
320
+ let pair = cur.toLowerCase() + 'usdt'
321
+ let url = `https://api.htx.com/market/depth?symbol=${pair}&type=step0`
322
+ limiter.process(needle.get, url, (err, res, body) => {
323
+ try {
324
+ const { asks, bids } = body.tick
325
+ let rate = (parseFloat(asks[0][0]) + parseFloat(bids[0][0])) / 2
326
+ result[cur] = {
327
+ USD: rate,
328
+ USDT: rate,
329
+ }
330
+ let result_length = _.keys(result).length
331
+ if (result_length === length) {
332
+ for (let stable of stablecoins) {
333
+ result[stable] = {
334
+ USD: 1,
335
+ USDT: 1,
336
+ }
337
+ }
338
+ cb(result)
339
+ }
340
+ } catch (error) {
341
+ console.error(pair, error)
342
+ }
343
+ })
319
344
  } else if (exchange === 'lbank') {
320
345
  let pair = cur.toLowerCase() + '_usdt'
321
346
  let url = `https://api.lbank.info/v2/depth.do?symbol=${pair}&size=10`
@@ -551,9 +576,7 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
551
576
  // console.log(res)
552
577
  // },
553
578
  // {
554
- // AXL: 'coingecko',
555
- // ROBIE: 'bitmart',
556
- // POLY: 'ascendex',
579
+ // ETHF: 'htx',
557
580
  // },
558
581
  // 'curs_dict'
559
582
  // )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.9.22",
3
+ "version": "1.9.23",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {