@icgio/icg-utils 1.7.72 → 1.7.75
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/constants/stablecoins.js +1 -1
- package/lib/crypto-rates.js +27 -1
- package/package.json +1 -1
package/constants/stablecoins.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = ['BUSD', 'CUSD', 'DAI', 'FEI', 'FRAX', 'GUSD', 'HUSD', 'IUSD', 'PAX', 'SUSD', 'TUSD', 'USDC', 'USDD', 'USDJ', 'USDK', 'USDP', 'USDT']
|
|
1
|
+
module.exports = ['BUSD', 'CUSD', 'DAI', 'FEI', 'FRAX', 'GUSD', 'HUSD', 'IUSD', 'PAX', 'SUSD', 'TUSD', 'USDC', 'USDD', 'USDJ', 'USDK', 'USDP', 'USDT', 'IDR']
|
package/lib/crypto-rates.js
CHANGED
|
@@ -236,6 +236,32 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
236
236
|
console.error(pair, error)
|
|
237
237
|
}
|
|
238
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
|
+
})
|
|
239
265
|
} else if (exchange === 'gate') {
|
|
240
266
|
let pair = cur + '_USDT'
|
|
241
267
|
let url = `https://api.gateio.ws/api/v4/spot/order_book?currency_pair=${pair}`
|
|
@@ -471,7 +497,7 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type, source = 'coingecko
|
|
|
471
497
|
// },
|
|
472
498
|
// {
|
|
473
499
|
// AXL: 'coingecko',
|
|
474
|
-
//
|
|
500
|
+
// TLAND: 'fastex',
|
|
475
501
|
// },
|
|
476
502
|
// 'curs_dict'
|
|
477
503
|
// )
|