@icgio/icg-utils 1.7.71 → 1.7.73

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.
@@ -184,8 +184,7 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
184
184
  let length = _.keys(curs_dict).length
185
185
  for (let cur in curs_dict) {
186
186
  let exchange = curs_dict[cur]
187
- if (exchange === 'bitforex') {
188
- } else if (exchange === 'bitmart') {
187
+ if (exchange === 'bitmart') {
189
188
  let pair = cur + '_USDT'
190
189
  let url = `https://api-cloud.bitmart.com/spot/v1/symbols/book?symbol=${pair}`
191
190
  limiter.process(needle.get, url, (err, res, body) => {
@@ -237,6 +236,32 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
237
236
  console.error(pair, error)
238
237
  }
239
238
  })
239
+ } else if (exchange === 'fastex') {
240
+ let pair = cur.toUpperCase() + '-USDT'
241
+ let url = `https://exchange.fastex.com/api/v1/orderbook/info?symbol=${pair}`
242
+ limiter.process(needle.get, url, (err, res, body) => {
243
+ try {
244
+ const asks = body.response.entities.asks
245
+ const bids = body.response.entities.bids
246
+ let rate = (parseFloat(asks[0].price) + parseFloat(bids[0].price)) / 2
247
+ result[cur] = {
248
+ USD: rate,
249
+ USDT: rate,
250
+ }
251
+ let result_length = _.keys(result).length
252
+ if (result_length === length) {
253
+ for (let stable of stablecoins) {
254
+ result[stable] = {
255
+ USD: 1,
256
+ USDT: 1,
257
+ }
258
+ }
259
+ cb(result)
260
+ }
261
+ } catch (error) {
262
+ console.error(pair, error)
263
+ }
264
+ })
240
265
  } else if (exchange === 'gate') {
241
266
  let pair = cur + '_USDT'
242
267
  let url = `https://api.gateio.ws/api/v4/spot/order_book?currency_pair=${pair}`
@@ -312,6 +337,32 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
312
337
  console.error(pair, error)
313
338
  }
314
339
  })
340
+ } else if (exchange === 'p2b') {
341
+ let pair = cur + '_USDT'
342
+ let url = `https://api.p2pb2b.com/api/v2/public/depth/result?market=${pair}`
343
+ limiter.process(needle.get, url, (err, res, body) => {
344
+ try {
345
+ const asks = body.result.asks
346
+ const bids = body.result.bids
347
+ let rate = (parseFloat(asks[0][0]) + parseFloat(bids[0][0])) / 2
348
+ result[cur] = {
349
+ USD: rate,
350
+ USDT: rate,
351
+ }
352
+ let result_length = _.keys(result).length
353
+ if (result_length === length) {
354
+ for (let stable of stablecoins) {
355
+ result[stable] = {
356
+ USD: 1,
357
+ USDT: 1,
358
+ }
359
+ }
360
+ cb(result)
361
+ }
362
+ } catch (error) {
363
+ console.error(pair, error)
364
+ }
365
+ })
315
366
  } else if (exchange === 'xt') {
316
367
  let pair = cur.toLowerCase() + '_usdt'
317
368
  let url = `https://sapi.xt.com/v4/public/depth?symbol=${pair}&limit=20`
@@ -446,10 +497,7 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
446
497
  // },
447
498
  // {
448
499
  // AXL: 'coingecko',
449
- // BDCC: 'lbank',
450
- // DMC: 'gate',
451
- // SHRAP: 'lbank',
452
- // SST: 'mexc',
500
+ // TLAND: 'fastex',
453
501
  // },
454
502
  // 'curs_dict'
455
503
  // )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.7.71",
3
+ "version": "1.7.73",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {