@icgio/icg-utils 1.7.52 → 1.7.53
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 +19 -41
- package/package.json +1 -1
package/lib/crypto-rates.js
CHANGED
|
@@ -237,16 +237,7 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
237
237
|
}
|
|
238
238
|
coins_map = source === 'coingecko' ? process_coins_map_coingecko(coins_map_raw_coingecko) : process_coins_map_coinmarketcap(coins_map_raw_coinmarketcap)
|
|
239
239
|
try {
|
|
240
|
-
if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, '
|
|
241
|
-
let curs = _.without(pair_or_pairs_or_cur_curs, 'FREN')
|
|
242
|
-
dex_rate().then((res) => {
|
|
243
|
-
result.FREN = {
|
|
244
|
-
USD: res.FRENUSDT,
|
|
245
|
-
USDT: res.FRENUSDT,
|
|
246
|
-
}
|
|
247
|
-
get_crypto_rates(cb, curs, type, source)
|
|
248
|
-
})
|
|
249
|
-
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'BBDC')) {
|
|
240
|
+
if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'BBDC')) {
|
|
250
241
|
let curs = _.without(pair_or_pairs_or_cur_curs, 'BBDC')
|
|
251
242
|
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=BBDC_USDT&depth=100').then((res) => {
|
|
252
243
|
const { asks, bids } = res.body.data
|
|
@@ -257,17 +248,6 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
257
248
|
}
|
|
258
249
|
get_crypto_rates(cb, curs, type, source)
|
|
259
250
|
})
|
|
260
|
-
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'CLOAK')) {
|
|
261
|
-
let curs = _.without(pair_or_pairs_or_cur_curs, 'CLOAK')
|
|
262
|
-
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=CLOAK_USDT&depth=100').then((res) => {
|
|
263
|
-
const { asks, bids } = res.body.data
|
|
264
|
-
let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
|
|
265
|
-
result.CLOAK = {
|
|
266
|
-
USD: rate,
|
|
267
|
-
USDT: rate,
|
|
268
|
-
}
|
|
269
|
-
get_crypto_rates(cb, curs, type, source)
|
|
270
|
-
})
|
|
271
251
|
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'DARK')) {
|
|
272
252
|
let curs = _.without(pair_or_pairs_or_cur_curs, 'DARK')
|
|
273
253
|
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=DARK_USDT&depth=100').then((res) => {
|
|
@@ -301,14 +281,12 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
301
281
|
}
|
|
302
282
|
get_crypto_rates(cb, curs, type, source)
|
|
303
283
|
})
|
|
304
|
-
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, '
|
|
305
|
-
let curs = _.without(pair_or_pairs_or_cur_curs, '
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
USD: rate,
|
|
311
|
-
USDT: rate,
|
|
284
|
+
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'FREN')) {
|
|
285
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'FREN')
|
|
286
|
+
dex_rate().then((res) => {
|
|
287
|
+
result.FREN = {
|
|
288
|
+
USD: res.FRENUSDT,
|
|
289
|
+
USDT: res.FRENUSDT,
|
|
312
290
|
}
|
|
313
291
|
get_crypto_rates(cb, curs, type, source)
|
|
314
292
|
})
|
|
@@ -323,6 +301,17 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
323
301
|
}
|
|
324
302
|
get_crypto_rates(cb, curs, type, source)
|
|
325
303
|
})
|
|
304
|
+
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'IUS')) {
|
|
305
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'IUS')
|
|
306
|
+
needle('get', 'https://api.coinsbit.io/api/v1/public/depth/result?market=IUS_USDT&limit=10').then((res) => {
|
|
307
|
+
const { asks, bids } = res.body
|
|
308
|
+
let rate = (parseFloat(asks[0][0]) + parseFloat(bids.reverse()[0][0])) / 2
|
|
309
|
+
result.IUS = {
|
|
310
|
+
USD: rate,
|
|
311
|
+
USDT: rate,
|
|
312
|
+
}
|
|
313
|
+
get_crypto_rates(cb, curs, type, source)
|
|
314
|
+
})
|
|
326
315
|
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'KLC')) {
|
|
327
316
|
let curs = _.without(pair_or_pairs_or_cur_curs, 'KLC')
|
|
328
317
|
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=KLC_USDT&depth=100').then((res) => {
|
|
@@ -389,17 +378,6 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
389
378
|
}
|
|
390
379
|
get_crypto_rates(cb, curs, type, source)
|
|
391
380
|
})
|
|
392
|
-
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'WPAY')) {
|
|
393
|
-
let curs = _.without(pair_or_pairs_or_cur_curs, 'WPAY')
|
|
394
|
-
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=WPAY_USDT&depth=100').then((res) => {
|
|
395
|
-
const { asks, bids } = res.body.data
|
|
396
|
-
let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
|
|
397
|
-
result.WPAY = {
|
|
398
|
-
USD: rate,
|
|
399
|
-
USDT: rate,
|
|
400
|
-
}
|
|
401
|
-
get_crypto_rates(cb, curs, type, source)
|
|
402
|
-
})
|
|
403
381
|
} else {
|
|
404
382
|
get_crypto_rates_base(cb, pair_or_pairs_or_cur_curs, type)
|
|
405
383
|
}
|
|
@@ -412,7 +390,7 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
412
390
|
// (res) => {
|
|
413
391
|
// console.log(res)
|
|
414
392
|
// },
|
|
415
|
-
// ['BTC', 'ETH', 'ENIX', '
|
|
393
|
+
// ['BTC', 'ETH', 'ENIX', 'FREN', 'DMC', 'IUS'],
|
|
416
394
|
// 'curs',
|
|
417
395
|
// 'coingecko'
|
|
418
396
|
// )
|