@icgio/icg-utils 1.7.53 → 1.7.55
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 +34 -9
- package/package.json +1 -1
package/lib/crypto-rates.js
CHANGED
|
@@ -270,6 +270,18 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
270
270
|
}
|
|
271
271
|
get_crypto_rates(cb, curs, type, source)
|
|
272
272
|
})
|
|
273
|
+
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'DFI')) {
|
|
274
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'DFI')
|
|
275
|
+
needle('get', 'https://api.coinstore.com/api/v1/market/depth/dfiusdt').then((res) => {
|
|
276
|
+
const asks = res.body.data.a
|
|
277
|
+
const bids = res.body.data.b
|
|
278
|
+
let rate = (parseFloat(asks[0][0]) + parseFloat(bids[0][0])) / 2
|
|
279
|
+
result.DFI = {
|
|
280
|
+
USD: rate,
|
|
281
|
+
USDT: rate,
|
|
282
|
+
}
|
|
283
|
+
get_crypto_rates(cb, curs, type, source)
|
|
284
|
+
})
|
|
273
285
|
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'ENIX')) {
|
|
274
286
|
let curs = _.without(pair_or_pairs_or_cur_curs, 'ENIX')
|
|
275
287
|
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=ENIX_USDT&depth=100').then((res) => {
|
|
@@ -334,6 +346,19 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
334
346
|
}
|
|
335
347
|
get_crypto_rates(cb, curs, type, source)
|
|
336
348
|
})
|
|
349
|
+
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'MONE')) {
|
|
350
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'MONE')
|
|
351
|
+
needle('get', 'https://www.bitforex.com/api/v1/market/depth?symbol=coin-usdt-mone').then((res) => {
|
|
352
|
+
try {
|
|
353
|
+
const { asks, bids } = JSON.parse(res.body).data
|
|
354
|
+
let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
|
|
355
|
+
result.MONE = {
|
|
356
|
+
USD: rate,
|
|
357
|
+
USDT: rate,
|
|
358
|
+
}
|
|
359
|
+
get_crypto_rates(cb, curs, type, source)
|
|
360
|
+
} catch (error) {}
|
|
361
|
+
})
|
|
337
362
|
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'ROACHCOIN')) {
|
|
338
363
|
let curs = _.without(pair_or_pairs_or_cur_curs, 'ROACHCOIN')
|
|
339
364
|
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=ROACHCOIN_USDT&depth=100').then((res) => {
|
|
@@ -356,23 +381,23 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
356
381
|
}
|
|
357
382
|
get_crypto_rates(cb, curs, type, source)
|
|
358
383
|
})
|
|
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=
|
|
384
|
+
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'SPAI')) {
|
|
385
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'SPAI')
|
|
386
|
+
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=SPAI_USDT&depth=100').then((res) => {
|
|
362
387
|
const { asks, bids } = res.body.data
|
|
363
388
|
let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
|
|
364
|
-
result.
|
|
389
|
+
result.SPAI = {
|
|
365
390
|
USD: rate,
|
|
366
391
|
USDT: rate,
|
|
367
392
|
}
|
|
368
393
|
get_crypto_rates(cb, curs, type, source)
|
|
369
394
|
})
|
|
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=
|
|
395
|
+
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'TIN')) {
|
|
396
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'TIN')
|
|
397
|
+
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=TIN_USDT&depth=100').then((res) => {
|
|
373
398
|
const { asks, bids } = res.body.data
|
|
374
399
|
let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
|
|
375
|
-
result.
|
|
400
|
+
result.TIN = {
|
|
376
401
|
USD: rate,
|
|
377
402
|
USDT: rate,
|
|
378
403
|
}
|
|
@@ -390,7 +415,7 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
390
415
|
// (res) => {
|
|
391
416
|
// console.log(res)
|
|
392
417
|
// },
|
|
393
|
-
// ['BTC', 'ETH', 'ENIX', 'FREN', 'DMC', 'IUS'],
|
|
418
|
+
// ['BTC', 'DFI', 'ETH', 'ENIX', 'FREN', 'DMC', 'IUS', 'MONE'],
|
|
394
419
|
// 'curs',
|
|
395
420
|
// 'coingecko'
|
|
396
421
|
// )
|