@icgio/icg-utils 1.9.46 → 1.9.48
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 -0
- package/lib/utils.js +3 -1
- package/package.json +1 -1
package/lib/crypto-rates.js
CHANGED
|
@@ -103,6 +103,25 @@ let get_crypto_rates = (cb, pair_or_pairs_or_cur_curs, type) => {
|
|
|
103
103
|
console.error(pair, error)
|
|
104
104
|
}
|
|
105
105
|
})
|
|
106
|
+
} else if (exchange === 'biconomy') {
|
|
107
|
+
let pair = cur + '_USDT'
|
|
108
|
+
let url = `https://api.biconomy.com/api/v1/depth?symbol=${pair}&size=5`
|
|
109
|
+
limiter.process(needle.get, url, (err, res, body) => {
|
|
110
|
+
try {
|
|
111
|
+
const { asks, bids } = body
|
|
112
|
+
let rate = (parseFloat(asks[0][0]) + parseFloat(bids[0][0])) / 2
|
|
113
|
+
result[cur] = {
|
|
114
|
+
USD: rate,
|
|
115
|
+
USDT: rate,
|
|
116
|
+
}
|
|
117
|
+
let result_length = _.keys(result).length
|
|
118
|
+
if (result_length === length) {
|
|
119
|
+
cb(result)
|
|
120
|
+
}
|
|
121
|
+
} catch (error) {
|
|
122
|
+
console.error(pair, error)
|
|
123
|
+
}
|
|
124
|
+
})
|
|
106
125
|
} else if (exchange === 'bingx') {
|
|
107
126
|
let pair = cur + 'USDT'
|
|
108
127
|
let url = `https://www.binance.com/api/v3/depth?symbol=${pair}&limit=20`
|
package/lib/utils.js
CHANGED
|
@@ -837,7 +837,9 @@ function number_with_commas(x) {
|
|
|
837
837
|
const EXCHANGE_ACCOUNT_KEY_RE = /^([a-z0-9]+)_(\d+)$/
|
|
838
838
|
|
|
839
839
|
function normalize_exchange_key(exchange) {
|
|
840
|
-
return String(exchange || '')
|
|
840
|
+
return String(exchange || '')
|
|
841
|
+
.trim()
|
|
842
|
+
.toLowerCase()
|
|
841
843
|
}
|
|
842
844
|
|
|
843
845
|
function is_exchange_account_key(exchange) {
|