@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.
- package/lib/crypto-rates.js +29 -19
- package/package.json +1 -1
package/lib/crypto-rates.js
CHANGED
|
@@ -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://
|
|
330
|
-
const { asks, bids } = res.body
|
|
331
|
-
let rate = (parseFloat(asks[0]
|
|
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]
|
|
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
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
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
|