@icgio/icg-utils 1.7.54 → 1.7.56
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 +42 -8
- 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) => {
|
|
@@ -281,6 +293,17 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
281
293
|
}
|
|
282
294
|
get_crypto_rates(cb, curs, type, source)
|
|
283
295
|
})
|
|
296
|
+
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'FIRM')) {
|
|
297
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'FIRM')
|
|
298
|
+
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=FIRM_USDT&depth=100').then((res) => {
|
|
299
|
+
const { asks, bids } = res.body
|
|
300
|
+
let rate = (parseFloat(asks[0][0]) + parseFloat(bids.reverse()[0][0])) / 2
|
|
301
|
+
result.FIRM = {
|
|
302
|
+
USD: rate,
|
|
303
|
+
USDT: rate,
|
|
304
|
+
}
|
|
305
|
+
get_crypto_rates(cb, curs, type, source)
|
|
306
|
+
})
|
|
284
307
|
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'FREN')) {
|
|
285
308
|
let curs = _.without(pair_or_pairs_or_cur_curs, 'FREN')
|
|
286
309
|
dex_rate().then((res) => {
|
|
@@ -312,6 +335,17 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
312
335
|
}
|
|
313
336
|
get_crypto_rates(cb, curs, type, source)
|
|
314
337
|
})
|
|
338
|
+
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'JD')) {
|
|
339
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'JD')
|
|
340
|
+
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
|
|
343
|
+
result.JD = {
|
|
344
|
+
USD: rate,
|
|
345
|
+
USDT: rate,
|
|
346
|
+
}
|
|
347
|
+
get_crypto_rates(cb, curs, type, source)
|
|
348
|
+
})
|
|
315
349
|
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'KLC')) {
|
|
316
350
|
let curs = _.without(pair_or_pairs_or_cur_curs, 'KLC')
|
|
317
351
|
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=KLC_USDT&depth=100').then((res) => {
|
|
@@ -399,14 +433,14 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
399
433
|
}
|
|
400
434
|
}
|
|
401
435
|
|
|
402
|
-
get_crypto_rates(
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
)
|
|
436
|
+
// get_crypto_rates(
|
|
437
|
+
// (res) => {
|
|
438
|
+
// console.log(res)
|
|
439
|
+
// },
|
|
440
|
+
// ['BTC', 'DFI', 'ETH', 'ENIX', 'FREN', 'DMC', 'IUS', 'MONE'],
|
|
441
|
+
// 'curs',
|
|
442
|
+
// 'coingecko'
|
|
443
|
+
// )
|
|
410
444
|
|
|
411
445
|
// dex_rate().then((res) => {
|
|
412
446
|
// console.log(res)
|