ccxt-ir 4.24.0 → 4.24.1

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 (40) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +262 -262
  4. package/dist/cjs/package.json +1 -1
  5. package/dist/cjs/src/abstract/balinex.js +1 -1
  6. package/dist/cjs/src/balinex.js +217 -217
  7. package/dist/cjs/src/bitbarg.js +322 -322
  8. package/dist/cjs/src/bitpin.js +34 -24
  9. package/dist/cjs/src/nobitex.js +25 -26
  10. package/dist/cjs/src/swapwallet.js +209 -209
  11. package/dist/cjs/src/wallex.js +105 -18
  12. package/js/ccxt.d.ts +772 -772
  13. package/js/ccxt.js +557 -557
  14. package/js/src/abstract/balinex.d.ts +8 -8
  15. package/js/src/abstract/balinex.js +5 -5
  16. package/js/src/abstract/swapwallet.js +5 -5
  17. package/js/src/abstract/wallex.d.ts +2 -0
  18. package/js/src/balinex.d.ts +20 -20
  19. package/js/src/balinex.js +220 -220
  20. package/js/src/base/Exchange.d.ts +926 -926
  21. package/js/src/bitbarg.js +325 -325
  22. package/js/src/bitpin.d.ts +2 -2
  23. package/js/src/bitpin.js +34 -24
  24. package/js/src/coinbaseexchange.d.ts +334 -334
  25. package/js/src/nobitex.d.ts +2 -2
  26. package/js/src/nobitex.js +25 -26
  27. package/js/src/protobuf/mexc/compiled.d.cts +2 -8
  28. package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
  29. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  30. package/js/src/static_dependencies/qs/formats.d.cts +8 -14
  31. package/js/src/static_dependencies/qs/index.d.cts +4 -10
  32. package/js/src/static_dependencies/qs/parse.d.cts +2 -8
  33. package/js/src/static_dependencies/qs/stringify.d.cts +2 -8
  34. package/js/src/static_dependencies/qs/utils.d.cts +9 -15
  35. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  36. package/js/src/swapwallet.js +212 -212
  37. package/js/src/wallex.d.ts +2 -2
  38. package/js/src/wallex.js +105 -18
  39. package/js/test.js +51 -62
  40. package/package.json +1 -1
@@ -5,328 +5,328 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var bitbarg$1 = require('./abstract/bitbarg.js');
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
- // ---------------------------------------------------------------------------
9
- /**
10
- * @class bitbarg
11
- * @augments Exchange
12
- * @description Set rateLimit to 1000 if fully verified
13
- */
14
- class bitbarg extends bitbarg$1["default"] {
15
- describe() {
16
- return this.deepExtend(super.describe(), {
17
- 'id': 'bitbarg',
18
- 'name': 'Bitbarg',
19
- 'countries': ['IR'],
20
- 'rateLimit': 1000,
21
- 'version': '1',
22
- 'certified': false,
23
- 'pro': false,
24
- 'has': {
25
- 'CORS': undefined,
26
- 'spot': true,
27
- 'margin': false,
28
- 'swap': false,
29
- 'future': false,
30
- 'option': false,
31
- 'addMargin': false,
32
- 'cancelAllOrders': false,
33
- 'cancelOrder': false,
34
- 'cancelOrders': false,
35
- 'createDepositAddress': false,
36
- 'createOrder': false,
37
- 'createStopLimitOrder': false,
38
- 'createStopMarketOrder': false,
39
- 'createStopOrder': false,
40
- 'editOrder': false,
41
- 'fetchBalance': false,
42
- 'fetchBorrowInterest': false,
43
- 'fetchBorrowRateHistories': false,
44
- 'fetchBorrowRateHistory': false,
45
- 'fetchClosedOrders': false,
46
- 'fetchCrossBorrowRate': false,
47
- 'fetchCrossBorrowRates': false,
48
- 'fetchCurrencies': false,
49
- 'fetchDepositAddress': false,
50
- 'fetchDeposits': false,
51
- 'fetchFundingHistory': false,
52
- 'fetchFundingRate': false,
53
- 'fetchFundingRateHistory': false,
54
- 'fetchFundingRates': false,
55
- 'fetchIndexOHLCV': false,
56
- 'fetchIsolatedBorrowRate': false,
57
- 'fetchIsolatedBorrowRates': false,
58
- 'fetchL2OrderBook': false,
59
- 'fetchL3OrderBook': false,
60
- 'fetchLedger': false,
61
- 'fetchLedgerEntry': false,
62
- 'fetchLeverageTiers': false,
63
- 'fetchMarkets': true,
64
- 'fetchMarkOHLCV': false,
65
- 'fetchMyTrades': false,
66
- 'fetchOHLCV': false,
67
- 'fetchOpenInterestHistory': false,
68
- 'fetchOpenOrders': false,
69
- 'fetchOrder': false,
70
- 'fetchOrderBook': false,
71
- 'fetchOrders': false,
72
- 'fetchOrderTrades': 'emulated',
73
- 'fetchPositions': false,
74
- 'fetchPremiumIndexOHLCV': false,
75
- 'fetchTicker': true,
76
- 'fetchTickers': true,
77
- 'fetchTime': false,
78
- 'fetchTrades': false,
79
- 'fetchTradingFee': false,
80
- 'fetchTradingFees': false,
81
- 'fetchWithdrawals': false,
82
- 'setLeverage': false,
83
- 'setMarginMode': false,
84
- 'transfer': false,
85
- 'withdraw': false,
86
- },
87
- 'comment': 'This comment is optional',
88
- 'urls': {
89
- 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/bitbarg/64x64.png',
90
- 'api': {
91
- 'public': 'https://api.bitbarg.com',
92
- },
93
- 'www': 'https://bitbarg.com/',
94
- 'doc': [
95
- 'https://bitbarg.com/',
96
- ],
97
- },
98
- 'api': {
99
- 'public': {
100
- 'get': {
101
- '/api/v1/currencies': 1,
102
- },
103
- },
104
- },
105
- 'fees': {
106
- 'trading': {
107
- 'tierBased': false,
108
- 'percentage': true,
109
- 'maker': this.parseNumber('0.001'),
110
- 'taker': this.parseNumber('0.001'),
111
- },
112
- },
113
- });
114
- }
115
- parseMarket(market) {
116
- // "id": 53,
117
- // "icon": "https://s3.bitbarg.com/currencies/btc.webp",
118
- // "tradeActive": true,
119
- // "faName": "بیت کوین",
120
- // "enName": "Bitcoin",
121
- // "coin": "BTC",
122
- // "path": "bitcoin",
123
- // "price": 112192,
124
- // "quote": "813430226.5004",
125
- // "percent": -5.735,
126
- // "decimal": 8,
127
- // "isFavorite": false,
128
- const baseId = this.safeString(market, 'coin');
129
- // Bitbarg reports USDT's price in IRT; all other currencies are
130
- // quoted in USDT.
131
- let quoteId = 'USDT';
132
- if (baseId === 'USDT') {
133
- quoteId = 'IRT';
134
- }
135
- const base = this.safeCurrencyCode(baseId);
136
- const quote = this.safeCurrencyCode(quoteId);
137
- const id = baseId + '/' + quoteId;
138
- return {
139
- 'id': id,
140
- 'symbol': id,
141
- 'base': base,
142
- 'quote': quote,
143
- 'settle': undefined,
144
- 'baseId': baseId,
145
- 'quoteId': quoteId,
146
- 'settleId': undefined,
147
- 'type': 'spot',
148
- 'spot': true,
149
- 'margin': false,
150
- 'swap': false,
151
- 'future': false,
152
- 'option': false,
153
- 'active': true,
154
- 'contract': false,
155
- 'linear': undefined,
156
- 'inverse': undefined,
157
- 'contractSize': undefined,
158
- 'expiry': undefined,
159
- 'expiryDatetime': undefined,
160
- 'strike': undefined,
161
- 'optionType': undefined,
162
- 'precision': {
163
- 'amount': undefined,
164
- 'price': undefined,
165
- },
166
- 'limits': {
167
- 'leverage': {
168
- 'min': undefined,
169
- 'max': undefined,
170
- },
171
- 'amount': {
172
- 'min': undefined,
173
- 'max': undefined,
174
- },
175
- 'price': {
176
- 'min': undefined,
177
- 'max': undefined,
178
- },
179
- 'cost': {
180
- 'min': undefined,
181
- 'max': undefined,
182
- },
183
- },
184
- 'created': undefined,
185
- 'info': market,
186
- };
187
- }
188
- async fetchMarkets(params = {}) {
189
- /**
190
- * @method
191
- * @name bitbarg#fetchMarkets
192
- * @description retrieves data on all markets for bitbarg
193
- * @see https://api.bitbarg.com/api/v1/currencies?pageSize=-1
194
- * @param {object} [params] extra parameters specific to the exchange API endpoint
195
- * @returns {object[]} an array of objects representing market data
196
- */
197
- const request = {
198
- 'pageSize': -1,
199
- };
200
- const response = await this.publicGetApiV1Currencies(this.extend(request, params));
201
- const result = [];
202
- const data = this.safeDict(response, 'result', {});
203
- const items = this.safeList(data, 'items', []);
204
- // Create markets for each currency with IRT quote
205
- for (let i = 0; i < items.length; i++) {
206
- const market = this.parseMarket(items[i]);
207
- result.push(market);
208
- }
209
- return result;
210
- }
211
- async fetchTickers(symbols = undefined, params = {}) {
212
- /**
213
- * @method
214
- * @name bitbarg#fetchTickers
215
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
216
- * @see https://api.bitbarg.com/api/v1/currencies?pageSize=-1
217
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
218
- * @param {object} [params] extra parameters specific to the exchange API endpoint
219
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
220
- */
221
- await this.loadMarkets();
222
- if (symbols !== undefined) {
223
- symbols = this.marketSymbols(symbols);
224
- }
225
- const request = {
226
- 'pageSize': -1,
227
- };
228
- const response = await this.publicGetApiV1Currencies(request);
229
- const data = this.safeDict(response, 'result', {});
230
- const meta = this.safeDict(data, 'meta', {});
231
- const usdtPrice = this.safeFloat(meta, 'usdtPrice');
232
- const items = this.safeList(data, 'items', []);
233
- const result = {};
234
- for (let i = 0; i < items.length; i++) {
235
- const coinData = items[i];
236
- const baseId = this.safeString(coinData, 'coin');
237
- // All currencies are quoted in USDT except USDT itself, which is
238
- // quoted in IRT by the API.
239
- let quoteId = 'USDT';
240
- if (baseId === 'USDT') {
241
- quoteId = 'IRT';
242
- }
243
- const base = this.safeCurrencyCode(baseId);
244
- const quote = this.safeCurrencyCode(quoteId);
245
- const symbol = base + '/' + quote;
246
- const ticker = this.extend({
247
- 'symbol': symbol,
248
- 'baseId': baseId,
249
- 'quoteId': quoteId,
250
- 'id': baseId + '/' + quoteId,
251
- }, coinData);
252
- if (baseId === 'USDT' && usdtPrice !== undefined) {
253
- ticker['price'] = usdtPrice;
254
- }
255
- result[symbol] = this.parseTicker(ticker);
256
- }
257
- return this.filterByArrayTickers(result, 'symbol', symbols);
258
- }
259
- async fetchTicker(symbol, params = {}) {
260
- /**
261
- * @method
262
- * @name bitbarg#fetchTicker
263
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
264
- * @see https://api.bitbarg.com/api/v1/currencies?pageSize=-1
265
- * @param {string} symbol unified symbol of the market to fetch the ticker for
266
- * @param {object} [params] extra parameters specific to the exchange API endpoint
267
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
268
- */
269
- const ticker = await this.fetchTickers([symbol]);
270
- return ticker[symbol];
271
- }
272
- parseTicker(ticker, market = undefined) {
273
- // {
274
- // "id": 1,
275
- // "icon": "https://...",
276
- // "tradeActive": true,
277
- // "faName": "بیت کوین",
278
- // "enName": "Bitcoin",
279
- // "coin": "BTC",
280
- // "path": "bitcoin",
281
- // "price": 110387.56,
282
- // "quote": "57479298399.76",
283
- // "percent": -3.01,
284
- // "decimal": 5,
285
- // "isFavorite": false,
286
- // "chart": [...]
287
- // }
288
- const marketType = 'spot';
289
- const baseId = this.safeString(ticker, 'coin');
290
- let quoteId = 'USDT';
291
- if (baseId === 'USDT') {
292
- quoteId = 'IRT';
293
- }
294
- const marketId = baseId + '/' + quoteId;
295
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
296
- const last = this.safeFloat(ticker, 'price', 0);
297
- const percentage = this.safeFloat(ticker, 'percent', 0);
298
- const baseVolume = this.safeFloat(ticker, 'quote');
299
- return this.safeTicker({
300
- 'symbol': symbol,
301
- 'timestamp': undefined,
302
- 'datetime': undefined,
303
- 'high': undefined,
304
- 'low': undefined,
305
- 'bid': last,
306
- 'bidVolume': undefined,
307
- 'ask': last,
308
- 'askVolume': undefined,
309
- 'vwap': undefined,
310
- 'open': undefined,
311
- 'close': last,
312
- 'last': last,
313
- 'previousClose': undefined,
314
- 'change': undefined,
315
- 'percentage': percentage,
316
- 'average': undefined,
317
- 'baseVolume': baseVolume,
318
- 'quoteVolume': undefined,
319
- 'info': ticker,
320
- }, market);
321
- }
322
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
323
- let url = this.urls['api']['public'] + path;
324
- if (Object.keys(params).length) {
325
- url += '?' + this.urlencode(params);
326
- }
327
- headers = { 'Content-Type': 'application/json' };
328
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
329
- }
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class bitbarg
11
+ * @augments Exchange
12
+ * @description Set rateLimit to 1000 if fully verified
13
+ */
14
+ class bitbarg extends bitbarg$1["default"] {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'bitbarg',
18
+ 'name': 'Bitbarg',
19
+ 'countries': ['IR'],
20
+ 'rateLimit': 1000,
21
+ 'version': '1',
22
+ 'certified': false,
23
+ 'pro': false,
24
+ 'has': {
25
+ 'CORS': undefined,
26
+ 'spot': true,
27
+ 'margin': false,
28
+ 'swap': false,
29
+ 'future': false,
30
+ 'option': false,
31
+ 'addMargin': false,
32
+ 'cancelAllOrders': false,
33
+ 'cancelOrder': false,
34
+ 'cancelOrders': false,
35
+ 'createDepositAddress': false,
36
+ 'createOrder': false,
37
+ 'createStopLimitOrder': false,
38
+ 'createStopMarketOrder': false,
39
+ 'createStopOrder': false,
40
+ 'editOrder': false,
41
+ 'fetchBalance': false,
42
+ 'fetchBorrowInterest': false,
43
+ 'fetchBorrowRateHistories': false,
44
+ 'fetchBorrowRateHistory': false,
45
+ 'fetchClosedOrders': false,
46
+ 'fetchCrossBorrowRate': false,
47
+ 'fetchCrossBorrowRates': false,
48
+ 'fetchCurrencies': false,
49
+ 'fetchDepositAddress': false,
50
+ 'fetchDeposits': false,
51
+ 'fetchFundingHistory': false,
52
+ 'fetchFundingRate': false,
53
+ 'fetchFundingRateHistory': false,
54
+ 'fetchFundingRates': false,
55
+ 'fetchIndexOHLCV': false,
56
+ 'fetchIsolatedBorrowRate': false,
57
+ 'fetchIsolatedBorrowRates': false,
58
+ 'fetchL2OrderBook': false,
59
+ 'fetchL3OrderBook': false,
60
+ 'fetchLedger': false,
61
+ 'fetchLedgerEntry': false,
62
+ 'fetchLeverageTiers': false,
63
+ 'fetchMarkets': true,
64
+ 'fetchMarkOHLCV': false,
65
+ 'fetchMyTrades': false,
66
+ 'fetchOHLCV': false,
67
+ 'fetchOpenInterestHistory': false,
68
+ 'fetchOpenOrders': false,
69
+ 'fetchOrder': false,
70
+ 'fetchOrderBook': false,
71
+ 'fetchOrders': false,
72
+ 'fetchOrderTrades': 'emulated',
73
+ 'fetchPositions': false,
74
+ 'fetchPremiumIndexOHLCV': false,
75
+ 'fetchTicker': true,
76
+ 'fetchTickers': true,
77
+ 'fetchTime': false,
78
+ 'fetchTrades': false,
79
+ 'fetchTradingFee': false,
80
+ 'fetchTradingFees': false,
81
+ 'fetchWithdrawals': false,
82
+ 'setLeverage': false,
83
+ 'setMarginMode': false,
84
+ 'transfer': false,
85
+ 'withdraw': false,
86
+ },
87
+ 'comment': 'This comment is optional',
88
+ 'urls': {
89
+ 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/bitbarg/64x64.png',
90
+ 'api': {
91
+ 'public': 'https://api.bitbarg.com',
92
+ },
93
+ 'www': 'https://bitbarg.com/',
94
+ 'doc': [
95
+ 'https://bitbarg.com/',
96
+ ],
97
+ },
98
+ 'api': {
99
+ 'public': {
100
+ 'get': {
101
+ '/api/v1/currencies': 1,
102
+ },
103
+ },
104
+ },
105
+ 'fees': {
106
+ 'trading': {
107
+ 'tierBased': false,
108
+ 'percentage': true,
109
+ 'maker': this.parseNumber('0.001'),
110
+ 'taker': this.parseNumber('0.001'),
111
+ },
112
+ },
113
+ });
114
+ }
115
+ parseMarket(market) {
116
+ // "id": 53,
117
+ // "icon": "https://s3.bitbarg.com/currencies/btc.webp",
118
+ // "tradeActive": true,
119
+ // "faName": "بیت کوین",
120
+ // "enName": "Bitcoin",
121
+ // "coin": "BTC",
122
+ // "path": "bitcoin",
123
+ // "price": 112192,
124
+ // "quote": "813430226.5004",
125
+ // "percent": -5.735,
126
+ // "decimal": 8,
127
+ // "isFavorite": false,
128
+ const baseId = this.safeString(market, 'coin');
129
+ // Bitbarg reports USDT's price in IRT; all other currencies are
130
+ // quoted in USDT.
131
+ let quoteId = 'USDT';
132
+ if (baseId === 'USDT') {
133
+ quoteId = 'IRT';
134
+ }
135
+ const base = this.safeCurrencyCode(baseId);
136
+ const quote = this.safeCurrencyCode(quoteId);
137
+ const id = baseId + '/' + quoteId;
138
+ return {
139
+ 'id': id,
140
+ 'symbol': id,
141
+ 'base': base,
142
+ 'quote': quote,
143
+ 'settle': undefined,
144
+ 'baseId': baseId,
145
+ 'quoteId': quoteId,
146
+ 'settleId': undefined,
147
+ 'type': 'spot',
148
+ 'spot': true,
149
+ 'margin': false,
150
+ 'swap': false,
151
+ 'future': false,
152
+ 'option': false,
153
+ 'active': true,
154
+ 'contract': false,
155
+ 'linear': undefined,
156
+ 'inverse': undefined,
157
+ 'contractSize': undefined,
158
+ 'expiry': undefined,
159
+ 'expiryDatetime': undefined,
160
+ 'strike': undefined,
161
+ 'optionType': undefined,
162
+ 'precision': {
163
+ 'amount': undefined,
164
+ 'price': undefined,
165
+ },
166
+ 'limits': {
167
+ 'leverage': {
168
+ 'min': undefined,
169
+ 'max': undefined,
170
+ },
171
+ 'amount': {
172
+ 'min': undefined,
173
+ 'max': undefined,
174
+ },
175
+ 'price': {
176
+ 'min': undefined,
177
+ 'max': undefined,
178
+ },
179
+ 'cost': {
180
+ 'min': undefined,
181
+ 'max': undefined,
182
+ },
183
+ },
184
+ 'created': undefined,
185
+ 'info': market,
186
+ };
187
+ }
188
+ async fetchMarkets(params = {}) {
189
+ /**
190
+ * @method
191
+ * @name bitbarg#fetchMarkets
192
+ * @description retrieves data on all markets for bitbarg
193
+ * @see https://api.bitbarg.com/api/v1/currencies?pageSize=-1
194
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
195
+ * @returns {object[]} an array of objects representing market data
196
+ */
197
+ const request = {
198
+ 'pageSize': -1,
199
+ };
200
+ const response = await this.publicGetApiV1Currencies(this.extend(request, params));
201
+ const result = [];
202
+ const data = this.safeDict(response, 'result', {});
203
+ const items = this.safeList(data, 'items', []);
204
+ // Create markets for each currency with IRT quote
205
+ for (let i = 0; i < items.length; i++) {
206
+ const market = this.parseMarket(items[i]);
207
+ result.push(market);
208
+ }
209
+ return result;
210
+ }
211
+ async fetchTickers(symbols = undefined, params = {}) {
212
+ /**
213
+ * @method
214
+ * @name bitbarg#fetchTickers
215
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
216
+ * @see https://api.bitbarg.com/api/v1/currencies?pageSize=-1
217
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
218
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
219
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
220
+ */
221
+ await this.loadMarkets();
222
+ if (symbols !== undefined) {
223
+ symbols = this.marketSymbols(symbols);
224
+ }
225
+ const request = {
226
+ 'pageSize': -1,
227
+ };
228
+ const response = await this.publicGetApiV1Currencies(request);
229
+ const data = this.safeDict(response, 'result', {});
230
+ const meta = this.safeDict(data, 'meta', {});
231
+ const usdtPrice = this.safeFloat(meta, 'usdtPrice');
232
+ const items = this.safeList(data, 'items', []);
233
+ const result = {};
234
+ for (let i = 0; i < items.length; i++) {
235
+ const coinData = items[i];
236
+ const baseId = this.safeString(coinData, 'coin');
237
+ // All currencies are quoted in USDT except USDT itself, which is
238
+ // quoted in IRT by the API.
239
+ let quoteId = 'USDT';
240
+ if (baseId === 'USDT') {
241
+ quoteId = 'IRT';
242
+ }
243
+ const base = this.safeCurrencyCode(baseId);
244
+ const quote = this.safeCurrencyCode(quoteId);
245
+ const symbol = base + '/' + quote;
246
+ const ticker = this.extend({
247
+ 'symbol': symbol,
248
+ 'baseId': baseId,
249
+ 'quoteId': quoteId,
250
+ 'id': baseId + '/' + quoteId,
251
+ }, coinData);
252
+ if (baseId === 'USDT' && usdtPrice !== undefined) {
253
+ ticker['price'] = usdtPrice;
254
+ }
255
+ result[symbol] = this.parseTicker(ticker);
256
+ }
257
+ return this.filterByArrayTickers(result, 'symbol', symbols);
258
+ }
259
+ async fetchTicker(symbol, params = {}) {
260
+ /**
261
+ * @method
262
+ * @name bitbarg#fetchTicker
263
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
264
+ * @see https://api.bitbarg.com/api/v1/currencies?pageSize=-1
265
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
266
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
267
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
268
+ */
269
+ const ticker = await this.fetchTickers([symbol]);
270
+ return ticker[symbol];
271
+ }
272
+ parseTicker(ticker, market = undefined) {
273
+ // {
274
+ // "id": 1,
275
+ // "icon": "https://...",
276
+ // "tradeActive": true,
277
+ // "faName": "بیت کوین",
278
+ // "enName": "Bitcoin",
279
+ // "coin": "BTC",
280
+ // "path": "bitcoin",
281
+ // "price": 110387.56,
282
+ // "quote": "57479298399.76",
283
+ // "percent": -3.01,
284
+ // "decimal": 5,
285
+ // "isFavorite": false,
286
+ // "chart": [...]
287
+ // }
288
+ const marketType = 'spot';
289
+ const baseId = this.safeString(ticker, 'coin');
290
+ let quoteId = 'USDT';
291
+ if (baseId === 'USDT') {
292
+ quoteId = 'IRT';
293
+ }
294
+ const marketId = baseId + '/' + quoteId;
295
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
296
+ const last = this.safeFloat(ticker, 'price', 0);
297
+ const percentage = this.safeFloat(ticker, 'percent', 0);
298
+ const baseVolume = this.safeFloat(ticker, 'quote');
299
+ return this.safeTicker({
300
+ 'symbol': symbol,
301
+ 'timestamp': undefined,
302
+ 'datetime': undefined,
303
+ 'high': undefined,
304
+ 'low': undefined,
305
+ 'bid': last,
306
+ 'bidVolume': undefined,
307
+ 'ask': last,
308
+ 'askVolume': undefined,
309
+ 'vwap': undefined,
310
+ 'open': undefined,
311
+ 'close': last,
312
+ 'last': last,
313
+ 'previousClose': undefined,
314
+ 'change': undefined,
315
+ 'percentage': percentage,
316
+ 'average': undefined,
317
+ 'baseVolume': baseVolume,
318
+ 'quoteVolume': undefined,
319
+ 'info': ticker,
320
+ }, market);
321
+ }
322
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
323
+ let url = this.urls['api']['public'] + path;
324
+ if (Object.keys(params).length) {
325
+ url += '?' + this.urlencode(params);
326
+ }
327
+ headers = { 'Content-Type': 'application/json' };
328
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
329
+ }
330
330
  }
331
331
 
332
332
  exports["default"] = bitbarg;