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
@@ -4,353 +4,353 @@
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/afratether.js';
9
- // ---------------------------------------------------------------------------
10
- /**
11
- * @class afratether
12
- * @augments Exchange
13
- * @description Set rateLimit to 1000 if fully verified
14
- */
15
- export default class afratether extends Exchange {
16
- describe() {
17
- return this.deepExtend(super.describe(), {
18
- 'id': 'afratether',
19
- 'name': 'Afratether',
20
- 'countries': ['IR'],
21
- 'rateLimit': 1000,
22
- 'version': '1',
23
- 'certified': false,
24
- 'pro': false,
25
- 'has': {
26
- 'CORS': undefined,
27
- 'spot': false,
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
- 'otc': true,
84
- 'setLeverage': false,
85
- 'setMarginMode': false,
86
- 'transfer': false,
87
- 'withdraw': false,
88
- },
89
- 'comment': 'This comment is optional',
90
- 'urls': {
91
- 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/afratether/64x64.png',
92
- 'api': {
93
- 'public': 'https://afrap2p.com',
94
- 'token': 'https://afratether.com',
95
- },
96
- 'www': 'https://afratether.com',
97
- 'doc': [
98
- 'https://afratether.com',
99
- ],
100
- },
101
- 'api': {
102
- 'public': {
103
- 'get': {
104
- 'api/v1.0/price': 1,
105
- 'token': 1,
106
- },
107
- },
108
- },
109
- 'fees': {
110
- 'trading': {
111
- 'tierBased': false,
112
- 'percentage': true,
113
- 'maker': this.parseNumber('0.001'),
114
- 'taker': this.parseNumber('0.001'),
115
- },
116
- },
117
- });
118
- }
119
- async fetchMarkets(params = {}) {
120
- /**
121
- * @method
122
- * @name afratether#fetchMarkets
123
- * @description retrieves data on all markets for afratether
124
- * @see https://afratether.com/
125
- * @param {object} [params] extra parameters specific to the exchange API endpoint
126
- * @returns {object[]} an array of objects representing market data
127
- */
128
- const token = await this.publicGetToken();
129
- const request = {
130
- 'Authorization': token,
131
- };
132
- const response = await this.publicGetApiV10Price(request);
133
- const markets = this.safeList(response, 'Items');
134
- const result = [];
135
- for (let i = 0; i < markets.length; i++) {
136
- const market = this.parseMarket(markets[i]);
137
- result.push(market);
138
- }
139
- return result;
140
- }
141
- parseMarket(market) {
142
- // {
143
- // "currencyAbb": "USDT",
144
- // "nameEn": "Tether",
145
- // "nameFa": "تتر",
146
- // "icon": "/assets/crypto/usdt.png",
147
- // "round": 1000000,
148
- // "currency": "USDT",
149
- // "changeRate24h": "-0.0065",
150
- // "Klines": [
151
- // [
152
- // "1760227200000",
153
- // "1147500",
154
- // "1140000",
155
- // "1145500",
156
- // "1125000",
157
- // "0",
158
- // "0"
159
- // ],
160
- // ],
161
- // "info": {
162
- // "birth_date": 1412553600000,
163
- // "open_24h": 1,
164
- // "open_1w": 1,
165
- // "open_3M": 1,
166
- // "open_1y": 1
167
- // },
168
- // "prices": {
169
- // "USDT": {
170
- // "price": "1"
171
- // },
172
- // "IRR": {
173
- // "price_sell": 1135000,
174
- // "price_buy": 1123000
175
- // }
176
- // }
177
- // }
178
- let baseId = this.safeString(market, 'currency');
179
- let quoteId = 'IRR';
180
- const base = this.safeCurrencyCode(baseId);
181
- const quote = this.safeCurrencyCode(quoteId);
182
- const id = base + quote;
183
- baseId = baseId.toLowerCase();
184
- quoteId = quoteId.toLowerCase();
185
- return {
186
- 'id': id,
187
- 'symbol': base + '/' + quote,
188
- 'base': base,
189
- 'quote': quote,
190
- 'settle': undefined,
191
- 'baseId': baseId,
192
- 'quoteId': quoteId,
193
- 'settleId': undefined,
194
- 'type': 'otc',
195
- 'spot': false,
196
- 'margin': false,
197
- 'swap': false,
198
- 'future': false,
199
- 'option': false,
200
- 'active': true,
201
- 'contract': false,
202
- 'linear': undefined,
203
- 'inverse': undefined,
204
- 'contractSize': undefined,
205
- 'expiry': undefined,
206
- 'expiryDatetime': undefined,
207
- 'strike': undefined,
208
- 'optionType': undefined,
209
- 'precision': {
210
- 'amount': undefined,
211
- 'price': undefined,
212
- },
213
- 'limits': {
214
- 'leverage': {
215
- 'min': undefined,
216
- 'max': undefined,
217
- },
218
- 'amount': {
219
- 'min': undefined,
220
- 'max': undefined,
221
- },
222
- 'price': {
223
- 'min': undefined,
224
- 'max': undefined,
225
- },
226
- 'cost': {
227
- 'min': undefined,
228
- 'max': undefined,
229
- },
230
- },
231
- 'created': undefined,
232
- 'info': market,
233
- };
234
- }
235
- async fetchTickers(symbols = undefined, params = {}) {
236
- /**
237
- * @method
238
- * @name afratether#fetchTickers
239
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
240
- * @see https://afratether.com/
241
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
242
- * @param {object} [params] extra parameters specific to the exchange API endpoint
243
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
244
- */
245
- await this.loadMarkets();
246
- if (symbols !== undefined) {
247
- symbols = this.marketSymbols(symbols);
248
- }
249
- const token = await this.publicGetToken();
250
- const request = {
251
- 'Authorization': token,
252
- };
253
- const response = await this.publicGetApiV10Price(request);
254
- const markets = this.safeList(response, 'Items');
255
- const result = {};
256
- for (let i = 0; i < markets.length; i++) {
257
- const ticker = this.parseTicker(markets[i]);
258
- const symbol = ticker['symbol'];
259
- result[symbol] = ticker;
260
- }
261
- return this.filterByArrayTickers(result, 'symbol', symbols);
262
- }
263
- async fetchTicker(symbol, params = {}) {
264
- /**
265
- * @method
266
- * @name afratether#fetchTicker
267
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
268
- * @see https://afratether.com/
269
- * @param {string} symbol unified symbol of the market to fetch the ticker for
270
- * @param {object} [params] extra parameters specific to the exchange API endpoint
271
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
272
- */
273
- const ticker = await this.fetchTickers([symbol]);
274
- return ticker[symbol];
275
- }
276
- parseTicker(ticker, market = undefined) {
277
- // {
278
- // "currencyAbb": "USDT",
279
- // "nameEn": "Tether",
280
- // "nameFa": "تتر",
281
- // "icon": "/assets/crypto/usdt.png",
282
- // "round": 1000000,
283
- // "currency": "USDT",
284
- // "changeRate24h": "-0.0065",
285
- // "Klines": [
286
- // [
287
- // "1760227200000",
288
- // "1147500",
289
- // "1140000",
290
- // "1145500",
291
- // "1125000",
292
- // "0",
293
- // "0"
294
- // ],
295
- // ],
296
- // "info": {
297
- // "birth_date": 1412553600000,
298
- // "open_24h": 1,
299
- // "open_1w": 1,
300
- // "open_3M": 1,
301
- // "open_1y": 1
302
- // },
303
- // "prices": {
304
- // "USDT": {
305
- // "price": "1"
306
- // },
307
- // "IRR": {
308
- // "price_sell": 1135000,
309
- // "price_buy": 1123000
310
- // }
311
- // }
312
- // }
313
- const marketType = 'otc';
314
- const base = this.safeString(ticker, 'currency');
315
- const quote = 'IRR';
316
- const marketId = base + '/' + quote;
317
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
318
- const prices = this.safeDict(ticker, 'prices', {});
319
- const irrPrices = this.safeDict(prices, 'IRR', {});
320
- const sell = this.safeFloat(irrPrices, 'price_sell', 0);
321
- const buy = this.safeFloat(irrPrices, 'price_buy', 0);
322
- return this.safeTicker({
323
- 'symbol': symbol,
324
- 'timestamp': undefined,
325
- 'datetime': undefined,
326
- 'high': undefined,
327
- 'low': undefined,
328
- 'bid': sell,
329
- 'bidVolume': undefined,
330
- 'ask': buy,
331
- 'askVolume': undefined,
332
- 'vwap': undefined,
333
- 'open': undefined,
334
- 'close': buy,
335
- 'last': buy,
336
- 'previousClose': undefined,
337
- 'change': this.safeFloat(ticker, 'changeRate24h', undefined),
338
- 'percentage': undefined,
339
- 'average': undefined,
340
- 'baseVolume': undefined,
341
- 'quoteVolume': undefined,
342
- 'info': ticker,
343
- }, market);
344
- }
345
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
346
- let url = this.urls['api']['public'] + '/' + path;
347
- if (path === 'token') {
348
- url = this.urls['api']['token'] + '/' + path;
349
- }
350
- headers = { 'Content-Type': 'application/json' };
351
- if (path === 'api/v1.0/price') {
352
- headers = { 'Content-Type': 'application/json', 'Authorization': params['Authorization'].replace('\n', '') };
353
- }
354
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
355
- }
356
- }
7
+ // ---------------------------------------------------------------------------
8
+ import Exchange from './abstract/afratether.js';
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * @class afratether
12
+ * @augments Exchange
13
+ * @description Set rateLimit to 1000 if fully verified
14
+ */
15
+ export default class afratether extends Exchange {
16
+ describe() {
17
+ return this.deepExtend(super.describe(), {
18
+ 'id': 'afratether',
19
+ 'name': 'Afratether',
20
+ 'countries': ['IR'],
21
+ 'rateLimit': 1000,
22
+ 'version': '1',
23
+ 'certified': false,
24
+ 'pro': false,
25
+ 'has': {
26
+ 'CORS': undefined,
27
+ 'spot': false,
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
+ 'otc': true,
84
+ 'setLeverage': false,
85
+ 'setMarginMode': false,
86
+ 'transfer': false,
87
+ 'withdraw': false,
88
+ },
89
+ 'comment': 'This comment is optional',
90
+ 'urls': {
91
+ 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/afratether/64x64.png',
92
+ 'api': {
93
+ 'public': 'https://afrap2p.com',
94
+ 'token': 'https://afratether.com',
95
+ },
96
+ 'www': 'https://afratether.com',
97
+ 'doc': [
98
+ 'https://afratether.com',
99
+ ],
100
+ },
101
+ 'api': {
102
+ 'public': {
103
+ 'get': {
104
+ 'api/v1.0/price': 1,
105
+ 'token': 1,
106
+ },
107
+ },
108
+ },
109
+ 'fees': {
110
+ 'trading': {
111
+ 'tierBased': false,
112
+ 'percentage': true,
113
+ 'maker': this.parseNumber('0.001'),
114
+ 'taker': this.parseNumber('0.001'),
115
+ },
116
+ },
117
+ });
118
+ }
119
+ async fetchMarkets(params = {}) {
120
+ /**
121
+ * @method
122
+ * @name afratether#fetchMarkets
123
+ * @description retrieves data on all markets for afratether
124
+ * @see https://afratether.com/
125
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
126
+ * @returns {object[]} an array of objects representing market data
127
+ */
128
+ const token = await this.publicGetToken();
129
+ const request = {
130
+ 'Authorization': token,
131
+ };
132
+ const response = await this.publicGetApiV10Price(request);
133
+ const markets = this.safeList(response, 'Items');
134
+ const result = [];
135
+ for (let i = 0; i < markets.length; i++) {
136
+ const market = this.parseMarket(markets[i]);
137
+ result.push(market);
138
+ }
139
+ return result;
140
+ }
141
+ parseMarket(market) {
142
+ // {
143
+ // "currencyAbb": "USDT",
144
+ // "nameEn": "Tether",
145
+ // "nameFa": "تتر",
146
+ // "icon": "/assets/crypto/usdt.png",
147
+ // "round": 1000000,
148
+ // "currency": "USDT",
149
+ // "changeRate24h": "-0.0065",
150
+ // "Klines": [
151
+ // [
152
+ // "1760227200000",
153
+ // "1147500",
154
+ // "1140000",
155
+ // "1145500",
156
+ // "1125000",
157
+ // "0",
158
+ // "0"
159
+ // ],
160
+ // ],
161
+ // "info": {
162
+ // "birth_date": 1412553600000,
163
+ // "open_24h": 1,
164
+ // "open_1w": 1,
165
+ // "open_3M": 1,
166
+ // "open_1y": 1
167
+ // },
168
+ // "prices": {
169
+ // "USDT": {
170
+ // "price": "1"
171
+ // },
172
+ // "IRR": {
173
+ // "price_sell": 1135000,
174
+ // "price_buy": 1123000
175
+ // }
176
+ // }
177
+ // }
178
+ let baseId = this.safeString(market, 'currency');
179
+ let quoteId = 'IRR';
180
+ const base = this.safeCurrencyCode(baseId);
181
+ const quote = this.safeCurrencyCode(quoteId);
182
+ const id = base + quote;
183
+ baseId = baseId.toLowerCase();
184
+ quoteId = quoteId.toLowerCase();
185
+ return {
186
+ 'id': id,
187
+ 'symbol': base + '/' + quote,
188
+ 'base': base,
189
+ 'quote': quote,
190
+ 'settle': undefined,
191
+ 'baseId': baseId,
192
+ 'quoteId': quoteId,
193
+ 'settleId': undefined,
194
+ 'type': 'otc',
195
+ 'spot': false,
196
+ 'margin': false,
197
+ 'swap': false,
198
+ 'future': false,
199
+ 'option': false,
200
+ 'active': true,
201
+ 'contract': false,
202
+ 'linear': undefined,
203
+ 'inverse': undefined,
204
+ 'contractSize': undefined,
205
+ 'expiry': undefined,
206
+ 'expiryDatetime': undefined,
207
+ 'strike': undefined,
208
+ 'optionType': undefined,
209
+ 'precision': {
210
+ 'amount': undefined,
211
+ 'price': undefined,
212
+ },
213
+ 'limits': {
214
+ 'leverage': {
215
+ 'min': undefined,
216
+ 'max': undefined,
217
+ },
218
+ 'amount': {
219
+ 'min': undefined,
220
+ 'max': undefined,
221
+ },
222
+ 'price': {
223
+ 'min': undefined,
224
+ 'max': undefined,
225
+ },
226
+ 'cost': {
227
+ 'min': undefined,
228
+ 'max': undefined,
229
+ },
230
+ },
231
+ 'created': undefined,
232
+ 'info': market,
233
+ };
234
+ }
235
+ async fetchTickers(symbols = undefined, params = {}) {
236
+ /**
237
+ * @method
238
+ * @name afratether#fetchTickers
239
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
240
+ * @see https://afratether.com/
241
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
242
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
243
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
244
+ */
245
+ await this.loadMarkets();
246
+ if (symbols !== undefined) {
247
+ symbols = this.marketSymbols(symbols);
248
+ }
249
+ const token = await this.publicGetToken();
250
+ const request = {
251
+ 'Authorization': token,
252
+ };
253
+ const response = await this.publicGetApiV10Price(request);
254
+ const markets = this.safeList(response, 'Items');
255
+ const result = {};
256
+ for (let i = 0; i < markets.length; i++) {
257
+ const ticker = this.parseTicker(markets[i]);
258
+ const symbol = ticker['symbol'];
259
+ result[symbol] = ticker;
260
+ }
261
+ return this.filterByArrayTickers(result, 'symbol', symbols);
262
+ }
263
+ async fetchTicker(symbol, params = {}) {
264
+ /**
265
+ * @method
266
+ * @name afratether#fetchTicker
267
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
268
+ * @see https://afratether.com/
269
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
270
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
271
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
272
+ */
273
+ const ticker = await this.fetchTickers([symbol]);
274
+ return ticker[symbol];
275
+ }
276
+ parseTicker(ticker, market = undefined) {
277
+ // {
278
+ // "currencyAbb": "USDT",
279
+ // "nameEn": "Tether",
280
+ // "nameFa": "تتر",
281
+ // "icon": "/assets/crypto/usdt.png",
282
+ // "round": 1000000,
283
+ // "currency": "USDT",
284
+ // "changeRate24h": "-0.0065",
285
+ // "Klines": [
286
+ // [
287
+ // "1760227200000",
288
+ // "1147500",
289
+ // "1140000",
290
+ // "1145500",
291
+ // "1125000",
292
+ // "0",
293
+ // "0"
294
+ // ],
295
+ // ],
296
+ // "info": {
297
+ // "birth_date": 1412553600000,
298
+ // "open_24h": 1,
299
+ // "open_1w": 1,
300
+ // "open_3M": 1,
301
+ // "open_1y": 1
302
+ // },
303
+ // "prices": {
304
+ // "USDT": {
305
+ // "price": "1"
306
+ // },
307
+ // "IRR": {
308
+ // "price_sell": 1135000,
309
+ // "price_buy": 1123000
310
+ // }
311
+ // }
312
+ // }
313
+ const marketType = 'otc';
314
+ const base = this.safeString(ticker, 'currency');
315
+ const quote = 'IRR';
316
+ const marketId = base + '/' + quote;
317
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
318
+ const prices = this.safeDict(ticker, 'prices', {});
319
+ const irrPrices = this.safeDict(prices, 'IRR', {});
320
+ const sell = this.safeFloat(irrPrices, 'price_sell', 0);
321
+ const buy = this.safeFloat(irrPrices, 'price_buy', 0);
322
+ return this.safeTicker({
323
+ 'symbol': symbol,
324
+ 'timestamp': undefined,
325
+ 'datetime': undefined,
326
+ 'high': undefined,
327
+ 'low': undefined,
328
+ 'bid': sell,
329
+ 'bidVolume': undefined,
330
+ 'ask': buy,
331
+ 'askVolume': undefined,
332
+ 'vwap': undefined,
333
+ 'open': undefined,
334
+ 'close': buy,
335
+ 'last': buy,
336
+ 'previousClose': undefined,
337
+ 'change': this.safeFloat(ticker, 'changeRate24h', undefined),
338
+ 'percentage': undefined,
339
+ 'average': undefined,
340
+ 'baseVolume': undefined,
341
+ 'quoteVolume': undefined,
342
+ 'info': ticker,
343
+ }, market);
344
+ }
345
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
346
+ let url = this.urls['api']['public'] + '/' + path;
347
+ if (path === 'token') {
348
+ url = this.urls['api']['token'] + '/' + path;
349
+ }
350
+ headers = { 'Content-Type': 'application/json' };
351
+ if (path === 'api/v1.0/price') {
352
+ headers = { 'Content-Type': 'application/json', 'Authorization': params['Authorization'].replace('\n', '') };
353
+ }
354
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
355
+ }
356
+ }