@icgio/icg-utils 1.7.53 → 1.7.54
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 -16
- package/package.json +1 -1
package/lib/crypto-rates.js
CHANGED
|
@@ -334,6 +334,19 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
334
334
|
}
|
|
335
335
|
get_crypto_rates(cb, curs, type, source)
|
|
336
336
|
})
|
|
337
|
+
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'MONE')) {
|
|
338
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'MONE')
|
|
339
|
+
needle('get', 'https://www.bitforex.com/api/v1/market/depth?symbol=coin-usdt-mone').then((res) => {
|
|
340
|
+
try {
|
|
341
|
+
const { asks, bids } = JSON.parse(res.body).data
|
|
342
|
+
let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
|
|
343
|
+
result.MONE = {
|
|
344
|
+
USD: rate,
|
|
345
|
+
USDT: rate,
|
|
346
|
+
}
|
|
347
|
+
get_crypto_rates(cb, curs, type, source)
|
|
348
|
+
} catch (error) {}
|
|
349
|
+
})
|
|
337
350
|
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'ROACHCOIN')) {
|
|
338
351
|
let curs = _.without(pair_or_pairs_or_cur_curs, 'ROACHCOIN')
|
|
339
352
|
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=ROACHCOIN_USDT&depth=100').then((res) => {
|
|
@@ -356,23 +369,23 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
356
369
|
}
|
|
357
370
|
get_crypto_rates(cb, curs, type, source)
|
|
358
371
|
})
|
|
359
|
-
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, '
|
|
360
|
-
let curs = _.without(pair_or_pairs_or_cur_curs, '
|
|
361
|
-
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=
|
|
372
|
+
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'SPAI')) {
|
|
373
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'SPAI')
|
|
374
|
+
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=SPAI_USDT&depth=100').then((res) => {
|
|
362
375
|
const { asks, bids } = res.body.data
|
|
363
376
|
let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
|
|
364
|
-
result.
|
|
377
|
+
result.SPAI = {
|
|
365
378
|
USD: rate,
|
|
366
379
|
USDT: rate,
|
|
367
380
|
}
|
|
368
381
|
get_crypto_rates(cb, curs, type, source)
|
|
369
382
|
})
|
|
370
|
-
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, '
|
|
371
|
-
let curs = _.without(pair_or_pairs_or_cur_curs, '
|
|
372
|
-
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=
|
|
383
|
+
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'TIN')) {
|
|
384
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'TIN')
|
|
385
|
+
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=TIN_USDT&depth=100').then((res) => {
|
|
373
386
|
const { asks, bids } = res.body.data
|
|
374
387
|
let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
|
|
375
|
-
result.
|
|
388
|
+
result.TIN = {
|
|
376
389
|
USD: rate,
|
|
377
390
|
USDT: rate,
|
|
378
391
|
}
|
|
@@ -386,14 +399,14 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
386
399
|
}
|
|
387
400
|
}
|
|
388
401
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
402
|
+
get_crypto_rates(
|
|
403
|
+
(res) => {
|
|
404
|
+
console.log(res)
|
|
405
|
+
},
|
|
406
|
+
['BTC', 'ETH', 'ENIX', 'FREN', 'DMC', 'IUS', 'MONE'],
|
|
407
|
+
'curs',
|
|
408
|
+
'coingecko'
|
|
409
|
+
)
|
|
397
410
|
|
|
398
411
|
// dex_rate().then((res) => {
|
|
399
412
|
// console.log(res)
|