@icgio/icg-utils 1.7.50 → 1.7.52
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 +33 -0
- package/package.json +1 -1
package/lib/crypto-rates.js
CHANGED
|
@@ -268,6 +268,17 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
268
268
|
}
|
|
269
269
|
get_crypto_rates(cb, curs, type, source)
|
|
270
270
|
})
|
|
271
|
+
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'DARK')) {
|
|
272
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'DARK')
|
|
273
|
+
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=DARK_USDT&depth=100').then((res) => {
|
|
274
|
+
const { asks, bids } = res.body.data
|
|
275
|
+
let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
|
|
276
|
+
result.DARK = {
|
|
277
|
+
USD: rate,
|
|
278
|
+
USDT: rate,
|
|
279
|
+
}
|
|
280
|
+
get_crypto_rates(cb, curs, type, source)
|
|
281
|
+
})
|
|
271
282
|
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'DMC')) {
|
|
272
283
|
let curs = _.without(pair_or_pairs_or_cur_curs, 'DMC')
|
|
273
284
|
needle('get', 'https://api.gateio.ws/api/v4/spot/order_book?currency_pair=DMC_USDT').then((res) => {
|
|
@@ -312,6 +323,17 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
312
323
|
}
|
|
313
324
|
get_crypto_rates(cb, curs, type, source)
|
|
314
325
|
})
|
|
326
|
+
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'KLC')) {
|
|
327
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'KLC')
|
|
328
|
+
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=KLC_USDT&depth=100').then((res) => {
|
|
329
|
+
const { asks, bids } = res.body.data
|
|
330
|
+
let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
|
|
331
|
+
result.KLC = {
|
|
332
|
+
USD: rate,
|
|
333
|
+
USDT: rate,
|
|
334
|
+
}
|
|
335
|
+
get_crypto_rates(cb, curs, type, source)
|
|
336
|
+
})
|
|
315
337
|
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'MEGODS')) {
|
|
316
338
|
let curs = _.without(pair_or_pairs_or_cur_curs, 'MEGODS')
|
|
317
339
|
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=MEGODS_USDT&depth=100').then((res) => {
|
|
@@ -323,6 +345,17 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
323
345
|
}
|
|
324
346
|
get_crypto_rates(cb, curs, type, source)
|
|
325
347
|
})
|
|
348
|
+
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'ROACHCOIN')) {
|
|
349
|
+
let curs = _.without(pair_or_pairs_or_cur_curs, 'ROACHCOIN')
|
|
350
|
+
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=ROACHCOIN_USDT&depth=100').then((res) => {
|
|
351
|
+
const { asks, bids } = res.body.data
|
|
352
|
+
let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
|
|
353
|
+
result.ROACHCOIN = {
|
|
354
|
+
USD: rate,
|
|
355
|
+
USDT: rate,
|
|
356
|
+
}
|
|
357
|
+
get_crypto_rates(cb, curs, type, source)
|
|
358
|
+
})
|
|
326
359
|
} else if (type === 'curs' && _.includes(pair_or_pairs_or_cur_curs, 'SDP')) {
|
|
327
360
|
let curs = _.without(pair_or_pairs_or_cur_curs, 'SDP')
|
|
328
361
|
needle('get', 'https://www.mexc.com/open/api/v2/market/depth?symbol=SDP_USDT&depth=100').then((res) => {
|