@icgio/icg-utils 1.7.51 → 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 +34 -34
- 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,12 +248,12 @@ 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, '
|
|
261
|
-
let curs = _.without(pair_or_pairs_or_cur_curs, '
|
|
262
|
-
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=
|
|
251
|
+
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'DARK')) {
|
|
252
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'DARK')
|
|
253
|
+
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=DARK_USDT&depth=100').then((res) => {
|
|
263
254
|
const { asks, bids } = res.body.data
|
|
264
255
|
let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
|
|
265
|
-
result.
|
|
256
|
+
result.DARK = {
|
|
266
257
|
USD: rate,
|
|
267
258
|
USDT: rate,
|
|
268
259
|
}
|
|
@@ -290,14 +281,12 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
290
281
|
}
|
|
291
282
|
get_crypto_rates(cb, curs, type, source)
|
|
292
283
|
})
|
|
293
|
-
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, '
|
|
294
|
-
let curs = _.without(pair_or_pairs_or_cur_curs, '
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
USD: rate,
|
|
300
|
-
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,
|
|
301
290
|
}
|
|
302
291
|
get_crypto_rates(cb, curs, type, source)
|
|
303
292
|
})
|
|
@@ -312,6 +301,17 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
312
301
|
}
|
|
313
302
|
get_crypto_rates(cb, curs, type, source)
|
|
314
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
|
+
})
|
|
315
315
|
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'KLC')) {
|
|
316
316
|
let curs = _.without(pair_or_pairs_or_cur_curs, 'KLC')
|
|
317
317
|
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=KLC_USDT&depth=100').then((res) => {
|
|
@@ -334,6 +334,17 @@ 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, 'ROACHCOIN')) {
|
|
338
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'ROACHCOIN')
|
|
339
|
+
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=ROACHCOIN_USDT&depth=100').then((res) => {
|
|
340
|
+
const { asks, bids } = res.body.data
|
|
341
|
+
let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
|
|
342
|
+
result.ROACHCOIN = {
|
|
343
|
+
USD: rate,
|
|
344
|
+
USDT: rate,
|
|
345
|
+
}
|
|
346
|
+
get_crypto_rates(cb, curs, type, source)
|
|
347
|
+
})
|
|
337
348
|
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'SDP')) {
|
|
338
349
|
let curs = _.without(pair_or_pairs_or_cur_curs, 'SDP')
|
|
339
350
|
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=SDP_USDT&depth=100').then((res) => {
|
|
@@ -367,17 +378,6 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
367
378
|
}
|
|
368
379
|
get_crypto_rates(cb, curs, type, source)
|
|
369
380
|
})
|
|
370
|
-
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'WPAY')) {
|
|
371
|
-
let curs = _.without(pair_or_pairs_or_cur_curs, 'WPAY')
|
|
372
|
-
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=WPAY_USDT&depth=100').then((res) => {
|
|
373
|
-
const { asks, bids } = res.body.data
|
|
374
|
-
let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
|
|
375
|
-
result.WPAY = {
|
|
376
|
-
USD: rate,
|
|
377
|
-
USDT: rate,
|
|
378
|
-
}
|
|
379
|
-
get_crypto_rates(cb, curs, type, source)
|
|
380
|
-
})
|
|
381
381
|
} else {
|
|
382
382
|
get_crypto_rates_base(cb, pair_or_pairs_or_cur_curs, type)
|
|
383
383
|
}
|
|
@@ -390,7 +390,7 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
390
390
|
// (res) => {
|
|
391
391
|
// console.log(res)
|
|
392
392
|
// },
|
|
393
|
-
// ['BTC', 'ETH', 'ENIX', '
|
|
393
|
+
// ['BTC', 'ETH', 'ENIX', 'FREN', 'DMC', 'IUS'],
|
|
394
394
|
// 'curs',
|
|
395
395
|
// 'coingecko'
|
|
396
396
|
// )
|