ccxt-ir 4.9.13 → 4.9.15

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