@icgio/icg-utils 1.7.58 → 1.7.60

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.
Files changed (2) hide show
  1. package/lib/crypto-rates.js +29 -19
  2. package/package.json +1 -1
@@ -324,11 +324,23 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
324
324
  }
325
325
  get_crypto_rates(cb, curs, type, source)
326
326
  })
327
+ } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'GPT')) {
328
+ let curs = _.without(pair_or_pairs_or_cur_curs, 'GPT')
329
+ needle('get', 'https://api.coinstore.com/api/v1/market/depth/gptusdt').then((res) => {
330
+ const asks = res.body.data.a
331
+ const bids = res.body.data.b
332
+ let rate = (parseFloat(asks[0][0]) + parseFloat(bids[0][0])) / 2
333
+ result.GPT = {
334
+ USD: rate,
335
+ USDT: rate,
336
+ }
337
+ get_crypto_rates(cb, curs, type, source)
338
+ })
327
339
  } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'IUS')) {
328
340
  let curs = _.without(pair_or_pairs_or_cur_curs, 'IUS')
329
- needle('get', 'https://api.coinsbit.io/api/v1/public/depth/result?market=IUS_USDT&limit=10').then((res) => {
330
- const { asks, bids } = res.body
331
- let rate = (parseFloat(asks[0][0]) + parseFloat(bids.reverse()[0][0])) / 2
341
+ needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=IUS_USDT&depth=100').then((res) => {
342
+ const { asks, bids } = res.body.data
343
+ let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
332
344
  result.IUS = {
333
345
  USD: rate,
334
346
  USDT: rate,
@@ -338,8 +350,8 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
338
350
  } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'JD')) {
339
351
  let curs = _.without(pair_or_pairs_or_cur_curs, 'JD')
340
352
  needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=JD_USDT&depth=100').then((res) => {
341
- const { asks, bids } = res.body
342
- let rate = (parseFloat(asks[0][0]) + parseFloat(bids.reverse()[0][0])) / 2
353
+ const { asks, bids } = res.body.data
354
+ let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
343
355
  result.JD = {
344
356
  USD: rate,
345
357
  USDT: rate,
@@ -381,20 +393,18 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
381
393
  get_crypto_rates(cb, curs, type, source)
382
394
  } catch (error) {}
383
395
  })
384
- }
385
- // else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'ROACHCOIN')) {
386
- // let curs = _.without(pair_or_pairs_or_cur_curs, 'ROACHCOIN')
387
- // needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=ROACHCOIN_USDT&depth=100').then((res) => {
388
- // const { asks, bids } = res.body.data
389
- // let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
390
- // result.ROACHCOIN = {
391
- // USD: rate,
392
- // USDT: rate,
393
- // }
394
- // get_crypto_rates(cb, curs, type, source)
395
- // })
396
- // }
397
- else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'SDP')) {
396
+ } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'ROACHCOIN')) {
397
+ let curs = _.without(pair_or_pairs_or_cur_curs, 'ROACHCOIN')
398
+ needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=ROACHCOIN_USDT&depth=100').then((res) => {
399
+ const { asks, bids } = res.body.data
400
+ let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
401
+ result.ROACHCOIN = {
402
+ USD: rate,
403
+ USDT: rate,
404
+ }
405
+ get_crypto_rates(cb, curs, type, source)
406
+ })
407
+ } else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'SDP')) {
398
408
  let curs = _.without(pair_or_pairs_or_cur_curs, 'SDP')
399
409
  needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=SDP_USDT&depth=100').then((res) => {
400
410
  const { asks, bids } = res.body.data
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.7.58",
3
+ "version": "1.7.60",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {