@icgio/icg-utils 1.9.68 → 1.9.69

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.
Files changed (2) hide show
  1. package/lib/rates.js +7 -12
  2. package/package.json +1 -1
package/lib/rates.js CHANGED
@@ -123,12 +123,12 @@ function _fetch_exchange_rates(cb, curs_dict) {
123
123
  let exchange = curs_dict[cur]
124
124
  let pair
125
125
 
126
- if (exchange === 'ascendex') {
127
- pair = cur + '/USDT'
128
- fetchMidPrice(cur, exchange, `https://ascendex.com/api/pro/v1/depth?symbol=${pair}`, (body) => midOf(body.data.data.asks, body.data.data.bids))
129
- } else if (exchange === 'binance') {
126
+ if (exchange === 'binance') {
130
127
  pair = cur + 'USDT'
131
128
  fetchMidPrice(cur, exchange, `https://www.binance.com/api/v3/depth?symbol=${pair}&limit=20`, (body) => midOf(body.asks, body.bids))
129
+ } else if (exchange === 'binancefutures') {
130
+ pair = cur + 'USDT'
131
+ fetchMidPrice(cur, exchange, `https://fapi.binance.com/fapi/v1/depth?symbol=${pair}&limit=20`, (body) => midOf(body.asks, body.bids))
132
132
  } else if (exchange === 'biconomy') {
133
133
  pair = cur + '_USDT'
134
134
  fetchMidPrice(cur, exchange, `https://api.biconomy.com/api/v1/depth?symbol=${pair}&size=5`, (body) => midOf(body.asks, body.bids))
@@ -138,10 +138,6 @@ function _fetch_exchange_rates(cb, curs_dict) {
138
138
  } else if (exchange === 'bitget') {
139
139
  pair = cur + 'USDT'
140
140
  fetchMidPrice(cur, exchange, `https://api.bitget.com/api/v2/spot/market/orderbook?symbol=${pair}&type=step0`, (body) => midOf(body.data.asks, body.data.bids))
141
- } else if (exchange === 'bitmart') {
142
- pair = cur + '_USDT'
143
- if (pair === 'ELON_USDT') pair = '$ELONSOL_USDT'
144
- fetchMidPrice(cur, exchange, `https://api-cloud.bitmart.com/spot/v1/symbols/book?symbol=${pair}`, (body) => (parseFloat(body.data.sells[0].price) + parseFloat(body.data.buys[0].price)) / 2)
145
141
  } else if (exchange === 'bybit') {
146
142
  pair = cur + 'USDT'
147
143
  fetchMidPrice(cur, exchange, `https://api.bybit.com/v5/market/orderbook?category=spot&symbol=${pair}&limit=20`, (body) => midOf(body.result.a, body.result.b))
@@ -154,13 +150,12 @@ function _fetch_exchange_rates(cb, curs_dict) {
154
150
  fetchMidPrice(cur, exchange, `https://api.coinstore.com/api/v1/market/depth/${pair}`, (body) => midOf(body.data.a, body.data.b))
155
151
  } else if (exchange === 'cryptocom') {
156
152
  pair = cur + '_USDT'
157
- fetchMidPrice(cur, exchange, `https://api.crypto.com/v2/public/get-book?instrument_name=${pair}&depth=20`, (body) => midOf(body.result.data[0].asks, body.result.data[0].bids))
153
+ fetchMidPrice(cur, exchange, `https://api.crypto.com/v2/public/get-book?instrument_name=${pair}&depth=20`, (body) =>
154
+ midOf(body.result.data[0].asks, body.result.data[0].bids),
155
+ )
158
156
  } else if (exchange === 'digifinex') {
159
157
  pair = cur + '_USDT'
160
158
  fetchMidPrice(cur, exchange, `https://openapi.digifinex.com/v3/spot/orderbook?symbol=${pair}`, (body) => midOf(body.data.asks, body.data.bids))
161
- } else if (exchange === 'fastex') {
162
- pair = cur.toUpperCase() + '-USDT'
163
- fetchMidPrice(cur, exchange, `https://exchange.fastex.com/api/v1/orderbook/info?symbol=${pair}`, (body) => (parseFloat(body.response.entities.asks[0].price) + parseFloat(body.response.entities.bids[0].price)) / 2)
164
159
  } else if (exchange === 'gate') {
165
160
  pair = cur + '_USDT'
166
161
  fetchMidPrice(cur, exchange, `https://api.gateio.ws/api/v4/spot/order_book?currency_pair=${pair}`, (body) => midOf(body.asks, body.bids))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icgio/icg-utils",
3
- "version": "1.9.68",
3
+ "version": "1.9.69",
4
4
  "description": "Utils package.",
5
5
  "main": "index.js",
6
6
  "directories": {