ccxt-ir 4.9.13 → 4.9.14

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 (82) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +229 -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/bydfi.js +1 -1
  8. package/dist/cjs/src/abstract/cafearz.js +1 -1
  9. package/dist/cjs/src/abstract/hamtapay.js +1 -1
  10. package/dist/cjs/src/abstract/kifpoolme.js +1 -1
  11. package/dist/cjs/src/abstract/mazdax.js +1 -1
  12. package/dist/cjs/src/abstract/pingi.js +1 -1
  13. package/dist/cjs/src/abstract/pooleno.js +1 -1
  14. package/dist/cjs/src/afratether.js +347 -347
  15. package/dist/cjs/src/arzplus.js +572 -572
  16. package/dist/cjs/src/bitbarg.js +303 -303
  17. package/dist/cjs/src/bydfi.js +425 -425
  18. package/dist/cjs/src/cafearz.js +337 -337
  19. package/dist/cjs/src/hamtapay.js +291 -291
  20. package/dist/cjs/src/kifpoolme.js +401 -401
  21. package/dist/cjs/src/mazdax.js +525 -526
  22. package/dist/cjs/src/pingi.js +437 -438
  23. package/dist/cjs/src/pooleno.js +338 -338
  24. package/dist/cjs/src/tetherland.js +358 -358
  25. package/dist/cjs/src/twox.js +362 -362
  26. package/js/ccxt.d.ts +673 -673
  27. package/js/ccxt.js +491 -491
  28. package/js/src/abantether.js +347 -347
  29. package/js/src/abstract/abantether.d.ts +8 -8
  30. package/js/src/abstract/arzplus.d.ts +11 -11
  31. package/js/src/abstract/bitbarg.d.ts +8 -8
  32. package/js/src/abstract/bitbarg.js +5 -5
  33. package/js/src/abstract/bydfi.d.ts +11 -11
  34. package/js/src/abstract/bydfi.js +5 -5
  35. package/js/src/abstract/cafearz.d.ts +8 -8
  36. package/js/src/abstract/cafearz.js +5 -5
  37. package/js/src/abstract/hamtapay.d.ts +9 -9
  38. package/js/src/abstract/hamtapay.js +5 -5
  39. package/js/src/abstract/kifpoolme.d.ts +9 -9
  40. package/js/src/abstract/kifpoolme.js +5 -5
  41. package/js/src/abstract/mazdax.d.ts +11 -11
  42. package/js/src/abstract/mazdax.js +5 -5
  43. package/js/src/abstract/pingi.d.ts +9 -9
  44. package/js/src/abstract/pingi.js +5 -5
  45. package/js/src/abstract/pooleno.d.ts +8 -8
  46. package/js/src/abstract/pooleno.js +5 -5
  47. package/js/src/afratether.js +350 -350
  48. package/js/src/arzplus.d.ts +26 -26
  49. package/js/src/arzplus.js +575 -575
  50. package/js/src/base/Exchange.d.ts +926 -926
  51. package/js/src/base/types.d.ts +586 -586
  52. package/js/src/bitbarg.d.ts +21 -21
  53. package/js/src/bitbarg.js +306 -306
  54. package/js/src/bydfi.d.ts +23 -23
  55. package/js/src/bydfi.js +428 -428
  56. package/js/src/cafearz.d.ts +21 -21
  57. package/js/src/cafearz.js +340 -340
  58. package/js/src/coinbaseexchange.d.ts +334 -334
  59. package/js/src/hamtapay.d.ts +21 -21
  60. package/js/src/hamtapay.js +294 -294
  61. package/js/src/kifpoolme.d.ts +23 -23
  62. package/js/src/kifpoolme.js +404 -404
  63. package/js/src/mazdax.d.ts +23 -23
  64. package/js/src/mazdax.js +528 -529
  65. package/js/src/pingi.d.ts +22 -22
  66. package/js/src/pingi.js +440 -441
  67. package/js/src/pooleno.d.ts +21 -21
  68. package/js/src/pooleno.js +341 -341
  69. package/js/src/protobuf/mexc/compiled.d.cts +2 -2
  70. package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
  71. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +51 -51
  72. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  73. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +204 -204
  74. package/js/src/static_dependencies/qs/formats.d.cts +8 -8
  75. package/js/src/static_dependencies/qs/index.d.cts +4 -4
  76. package/js/src/static_dependencies/qs/parse.d.cts +2 -2
  77. package/js/src/static_dependencies/qs/stringify.d.cts +2 -2
  78. package/js/src/static_dependencies/qs/utils.d.cts +9 -9
  79. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  80. package/js/src/tetherland.js +361 -361
  81. package/js/src/twox.js +365 -365
  82. package/package.json +1 -1
@@ -5,353 +5,353 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var afratether$1 = require('./abstract/afratether.js');
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
- // ---------------------------------------------------------------------------
9
- /**
10
- * @class afratether
11
- * @augments Exchange
12
- * @description Set rateLimit to 1000 if fully verified
13
- */
14
- class afratether extends afratether$1["default"] {
15
- describe() {
16
- return this.deepExtend(super.describe(), {
17
- 'id': 'afratether',
18
- 'name': 'Afratether',
19
- 'countries': ['IR'],
20
- 'rateLimit': 1000,
21
- 'version': '1',
22
- 'certified': false,
23
- 'pro': false,
24
- 'has': {
25
- 'CORS': undefined,
26
- 'spot': false,
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
- 'otc': true,
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/afratether/64x64.png',
91
- 'api': {
92
- 'public': 'https://afrap2p.com',
93
- 'token': 'https://afratether.com',
94
- },
95
- 'www': 'https://afratether.com',
96
- 'doc': [
97
- 'https://afratether.com',
98
- ],
99
- },
100
- 'api': {
101
- 'public': {
102
- 'get': {
103
- 'api/v1.0/price': 1,
104
- 'token': 1,
105
- },
106
- },
107
- },
108
- 'fees': {
109
- 'trading': {
110
- 'tierBased': false,
111
- 'percentage': true,
112
- 'maker': this.parseNumber('0.001'),
113
- 'taker': this.parseNumber('0.001'),
114
- },
115
- },
116
- });
117
- }
118
- async fetchMarkets(params = {}) {
119
- /**
120
- * @method
121
- * @name afratether#fetchMarkets
122
- * @description retrieves data on all markets for afratether
123
- * @see https://afratether.com/
124
- * @param {object} [params] extra parameters specific to the exchange API endpoint
125
- * @returns {object[]} an array of objects representing market data
126
- */
127
- const token = await this.publicGetToken();
128
- const request = {
129
- 'Authorization': token,
130
- };
131
- const response = await this.publicGetApiV10Price(request);
132
- const markets = this.safeList(response, 'Items');
133
- const result = [];
134
- for (let i = 0; i < markets.length; i++) {
135
- const market = this.parseMarket(markets[i]);
136
- result.push(market);
137
- }
138
- return result;
139
- }
140
- parseMarket(market) {
141
- // {
142
- // "currencyAbb": "USDT",
143
- // "nameEn": "Tether",
144
- // "nameFa": "تتر",
145
- // "icon": "/assets/crypto/usdt.png",
146
- // "round": 1000000,
147
- // "currency": "USDT",
148
- // "changeRate24h": "-0.0065",
149
- // "Klines": [
150
- // [
151
- // "1760227200000",
152
- // "1147500",
153
- // "1140000",
154
- // "1145500",
155
- // "1125000",
156
- // "0",
157
- // "0"
158
- // ],
159
- // ],
160
- // "info": {
161
- // "birth_date": 1412553600000,
162
- // "open_24h": 1,
163
- // "open_1w": 1,
164
- // "open_3M": 1,
165
- // "open_1y": 1
166
- // },
167
- // "prices": {
168
- // "USDT": {
169
- // "price": "1"
170
- // },
171
- // "IRR": {
172
- // "price_sell": 1135000,
173
- // "price_buy": 1123000
174
- // }
175
- // }
176
- // }
177
- let baseId = this.safeString(market, 'currency');
178
- let quoteId = 'IRR';
179
- const base = this.safeCurrencyCode(baseId);
180
- const quote = this.safeCurrencyCode(quoteId);
181
- const id = base + quote;
182
- baseId = baseId.toLowerCase();
183
- quoteId = quoteId.toLowerCase();
184
- return {
185
- 'id': id,
186
- 'symbol': base + '/' + quote,
187
- 'base': base,
188
- 'quote': quote,
189
- 'settle': undefined,
190
- 'baseId': baseId,
191
- 'quoteId': quoteId,
192
- 'settleId': undefined,
193
- 'type': 'otc',
194
- 'spot': false,
195
- 'margin': false,
196
- 'swap': false,
197
- 'future': false,
198
- 'option': false,
199
- 'active': true,
200
- 'contract': false,
201
- 'linear': undefined,
202
- 'inverse': undefined,
203
- 'contractSize': undefined,
204
- 'expiry': undefined,
205
- 'expiryDatetime': undefined,
206
- 'strike': undefined,
207
- 'optionType': undefined,
208
- 'precision': {
209
- 'amount': undefined,
210
- 'price': undefined,
211
- },
212
- 'limits': {
213
- 'leverage': {
214
- 'min': undefined,
215
- 'max': undefined,
216
- },
217
- 'amount': {
218
- 'min': undefined,
219
- 'max': undefined,
220
- },
221
- 'price': {
222
- 'min': undefined,
223
- 'max': undefined,
224
- },
225
- 'cost': {
226
- 'min': undefined,
227
- 'max': undefined,
228
- },
229
- },
230
- 'created': undefined,
231
- 'info': market,
232
- };
233
- }
234
- async fetchTickers(symbols = undefined, params = {}) {
235
- /**
236
- * @method
237
- * @name afratether#fetchTickers
238
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
239
- * @see https://afratether.com/
240
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
241
- * @param {object} [params] extra parameters specific to the exchange API endpoint
242
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
243
- */
244
- await this.loadMarkets();
245
- if (symbols !== undefined) {
246
- symbols = this.marketSymbols(symbols);
247
- }
248
- const token = await this.publicGetToken();
249
- const request = {
250
- 'Authorization': token,
251
- };
252
- const response = await this.publicGetApiV10Price(request);
253
- const markets = this.safeList(response, 'Items');
254
- const result = {};
255
- for (let i = 0; i < markets.length; i++) {
256
- const ticker = this.parseTicker(markets[i]);
257
- const symbol = ticker['symbol'];
258
- result[symbol] = ticker;
259
- }
260
- return this.filterByArrayTickers(result, 'symbol', symbols);
261
- }
262
- async fetchTicker(symbol, params = {}) {
263
- /**
264
- * @method
265
- * @name afratether#fetchTicker
266
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
267
- * @see https://afratether.com/
268
- * @param {string} symbol unified symbol of the market to fetch the ticker for
269
- * @param {object} [params] extra parameters specific to the exchange API endpoint
270
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
271
- */
272
- const ticker = await this.fetchTickers([symbol]);
273
- return ticker[symbol];
274
- }
275
- parseTicker(ticker, market = undefined) {
276
- // {
277
- // "currencyAbb": "USDT",
278
- // "nameEn": "Tether",
279
- // "nameFa": "تتر",
280
- // "icon": "/assets/crypto/usdt.png",
281
- // "round": 1000000,
282
- // "currency": "USDT",
283
- // "changeRate24h": "-0.0065",
284
- // "Klines": [
285
- // [
286
- // "1760227200000",
287
- // "1147500",
288
- // "1140000",
289
- // "1145500",
290
- // "1125000",
291
- // "0",
292
- // "0"
293
- // ],
294
- // ],
295
- // "info": {
296
- // "birth_date": 1412553600000,
297
- // "open_24h": 1,
298
- // "open_1w": 1,
299
- // "open_3M": 1,
300
- // "open_1y": 1
301
- // },
302
- // "prices": {
303
- // "USDT": {
304
- // "price": "1"
305
- // },
306
- // "IRR": {
307
- // "price_sell": 1135000,
308
- // "price_buy": 1123000
309
- // }
310
- // }
311
- // }
312
- const marketType = 'otc';
313
- const base = this.safeString(ticker, 'currency');
314
- const quote = 'IRR';
315
- const marketId = base + '/' + quote;
316
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
317
- const prices = this.safeDict(ticker, 'prices', {});
318
- const irrPrices = this.safeDict(prices, 'IRR', {});
319
- const sell = this.safeFloat(irrPrices, 'price_sell', 0);
320
- const buy = this.safeFloat(irrPrices, 'price_buy', 0);
321
- return this.safeTicker({
322
- 'symbol': symbol,
323
- 'timestamp': undefined,
324
- 'datetime': undefined,
325
- 'high': undefined,
326
- 'low': undefined,
327
- 'bid': sell,
328
- 'bidVolume': undefined,
329
- 'ask': buy,
330
- 'askVolume': undefined,
331
- 'vwap': undefined,
332
- 'open': undefined,
333
- 'close': buy,
334
- 'last': buy,
335
- 'previousClose': undefined,
336
- 'change': this.safeFloat(ticker, 'changeRate24h', undefined),
337
- 'percentage': undefined,
338
- 'average': undefined,
339
- 'baseVolume': undefined,
340
- 'quoteVolume': undefined,
341
- 'info': ticker,
342
- }, market);
343
- }
344
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
345
- let url = this.urls['api']['public'] + '/' + path;
346
- if (path === 'token') {
347
- url = this.urls['api']['token'] + '/' + path;
348
- }
349
- headers = { 'Content-Type': 'application/json' };
350
- if (path === 'api/v1.0/price') {
351
- headers = { 'Content-Type': 'application/json', 'Authorization': params['Authorization'].replace('\n', '') };
352
- }
353
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
354
- }
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class afratether
11
+ * @augments Exchange
12
+ * @description Set rateLimit to 1000 if fully verified
13
+ */
14
+ class afratether extends afratether$1["default"] {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'afratether',
18
+ 'name': 'Afratether',
19
+ 'countries': ['IR'],
20
+ 'rateLimit': 1000,
21
+ 'version': '1',
22
+ 'certified': false,
23
+ 'pro': false,
24
+ 'has': {
25
+ 'CORS': undefined,
26
+ 'spot': false,
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
+ 'otc': true,
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/afratether/64x64.png',
91
+ 'api': {
92
+ 'public': 'https://afrap2p.com',
93
+ 'token': 'https://afratether.com',
94
+ },
95
+ 'www': 'https://afratether.com',
96
+ 'doc': [
97
+ 'https://afratether.com',
98
+ ],
99
+ },
100
+ 'api': {
101
+ 'public': {
102
+ 'get': {
103
+ 'api/v1.0/price': 1,
104
+ 'token': 1,
105
+ },
106
+ },
107
+ },
108
+ 'fees': {
109
+ 'trading': {
110
+ 'tierBased': false,
111
+ 'percentage': true,
112
+ 'maker': this.parseNumber('0.001'),
113
+ 'taker': this.parseNumber('0.001'),
114
+ },
115
+ },
116
+ });
117
+ }
118
+ async fetchMarkets(params = {}) {
119
+ /**
120
+ * @method
121
+ * @name afratether#fetchMarkets
122
+ * @description retrieves data on all markets for afratether
123
+ * @see https://afratether.com/
124
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
125
+ * @returns {object[]} an array of objects representing market data
126
+ */
127
+ const token = await this.publicGetToken();
128
+ const request = {
129
+ 'Authorization': token,
130
+ };
131
+ const response = await this.publicGetApiV10Price(request);
132
+ const markets = this.safeList(response, 'Items');
133
+ const result = [];
134
+ for (let i = 0; i < markets.length; i++) {
135
+ const market = this.parseMarket(markets[i]);
136
+ result.push(market);
137
+ }
138
+ return result;
139
+ }
140
+ parseMarket(market) {
141
+ // {
142
+ // "currencyAbb": "USDT",
143
+ // "nameEn": "Tether",
144
+ // "nameFa": "تتر",
145
+ // "icon": "/assets/crypto/usdt.png",
146
+ // "round": 1000000,
147
+ // "currency": "USDT",
148
+ // "changeRate24h": "-0.0065",
149
+ // "Klines": [
150
+ // [
151
+ // "1760227200000",
152
+ // "1147500",
153
+ // "1140000",
154
+ // "1145500",
155
+ // "1125000",
156
+ // "0",
157
+ // "0"
158
+ // ],
159
+ // ],
160
+ // "info": {
161
+ // "birth_date": 1412553600000,
162
+ // "open_24h": 1,
163
+ // "open_1w": 1,
164
+ // "open_3M": 1,
165
+ // "open_1y": 1
166
+ // },
167
+ // "prices": {
168
+ // "USDT": {
169
+ // "price": "1"
170
+ // },
171
+ // "IRR": {
172
+ // "price_sell": 1135000,
173
+ // "price_buy": 1123000
174
+ // }
175
+ // }
176
+ // }
177
+ let baseId = this.safeString(market, 'currency');
178
+ let quoteId = 'IRR';
179
+ const base = this.safeCurrencyCode(baseId);
180
+ const quote = this.safeCurrencyCode(quoteId);
181
+ const id = base + quote;
182
+ baseId = baseId.toLowerCase();
183
+ quoteId = quoteId.toLowerCase();
184
+ return {
185
+ 'id': id,
186
+ 'symbol': base + '/' + quote,
187
+ 'base': base,
188
+ 'quote': quote,
189
+ 'settle': undefined,
190
+ 'baseId': baseId,
191
+ 'quoteId': quoteId,
192
+ 'settleId': undefined,
193
+ 'type': 'otc',
194
+ 'spot': false,
195
+ 'margin': false,
196
+ 'swap': false,
197
+ 'future': false,
198
+ 'option': false,
199
+ 'active': true,
200
+ 'contract': false,
201
+ 'linear': undefined,
202
+ 'inverse': undefined,
203
+ 'contractSize': undefined,
204
+ 'expiry': undefined,
205
+ 'expiryDatetime': undefined,
206
+ 'strike': undefined,
207
+ 'optionType': undefined,
208
+ 'precision': {
209
+ 'amount': undefined,
210
+ 'price': undefined,
211
+ },
212
+ 'limits': {
213
+ 'leverage': {
214
+ 'min': undefined,
215
+ 'max': undefined,
216
+ },
217
+ 'amount': {
218
+ 'min': undefined,
219
+ 'max': undefined,
220
+ },
221
+ 'price': {
222
+ 'min': undefined,
223
+ 'max': undefined,
224
+ },
225
+ 'cost': {
226
+ 'min': undefined,
227
+ 'max': undefined,
228
+ },
229
+ },
230
+ 'created': undefined,
231
+ 'info': market,
232
+ };
233
+ }
234
+ async fetchTickers(symbols = undefined, params = {}) {
235
+ /**
236
+ * @method
237
+ * @name afratether#fetchTickers
238
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
239
+ * @see https://afratether.com/
240
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
241
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
242
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
243
+ */
244
+ await this.loadMarkets();
245
+ if (symbols !== undefined) {
246
+ symbols = this.marketSymbols(symbols);
247
+ }
248
+ const token = await this.publicGetToken();
249
+ const request = {
250
+ 'Authorization': token,
251
+ };
252
+ const response = await this.publicGetApiV10Price(request);
253
+ const markets = this.safeList(response, 'Items');
254
+ const result = {};
255
+ for (let i = 0; i < markets.length; i++) {
256
+ const ticker = this.parseTicker(markets[i]);
257
+ const symbol = ticker['symbol'];
258
+ result[symbol] = ticker;
259
+ }
260
+ return this.filterByArrayTickers(result, 'symbol', symbols);
261
+ }
262
+ async fetchTicker(symbol, params = {}) {
263
+ /**
264
+ * @method
265
+ * @name afratether#fetchTicker
266
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
267
+ * @see https://afratether.com/
268
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
269
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
270
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
271
+ */
272
+ const ticker = await this.fetchTickers([symbol]);
273
+ return ticker[symbol];
274
+ }
275
+ parseTicker(ticker, market = undefined) {
276
+ // {
277
+ // "currencyAbb": "USDT",
278
+ // "nameEn": "Tether",
279
+ // "nameFa": "تتر",
280
+ // "icon": "/assets/crypto/usdt.png",
281
+ // "round": 1000000,
282
+ // "currency": "USDT",
283
+ // "changeRate24h": "-0.0065",
284
+ // "Klines": [
285
+ // [
286
+ // "1760227200000",
287
+ // "1147500",
288
+ // "1140000",
289
+ // "1145500",
290
+ // "1125000",
291
+ // "0",
292
+ // "0"
293
+ // ],
294
+ // ],
295
+ // "info": {
296
+ // "birth_date": 1412553600000,
297
+ // "open_24h": 1,
298
+ // "open_1w": 1,
299
+ // "open_3M": 1,
300
+ // "open_1y": 1
301
+ // },
302
+ // "prices": {
303
+ // "USDT": {
304
+ // "price": "1"
305
+ // },
306
+ // "IRR": {
307
+ // "price_sell": 1135000,
308
+ // "price_buy": 1123000
309
+ // }
310
+ // }
311
+ // }
312
+ const marketType = 'otc';
313
+ const base = this.safeString(ticker, 'currency');
314
+ const quote = 'IRR';
315
+ const marketId = base + '/' + quote;
316
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
317
+ const prices = this.safeDict(ticker, 'prices', {});
318
+ const irrPrices = this.safeDict(prices, 'IRR', {});
319
+ const sell = this.safeFloat(irrPrices, 'price_sell', 0);
320
+ const buy = this.safeFloat(irrPrices, 'price_buy', 0);
321
+ return this.safeTicker({
322
+ 'symbol': symbol,
323
+ 'timestamp': undefined,
324
+ 'datetime': undefined,
325
+ 'high': undefined,
326
+ 'low': undefined,
327
+ 'bid': sell,
328
+ 'bidVolume': undefined,
329
+ 'ask': buy,
330
+ 'askVolume': undefined,
331
+ 'vwap': undefined,
332
+ 'open': undefined,
333
+ 'close': buy,
334
+ 'last': buy,
335
+ 'previousClose': undefined,
336
+ 'change': this.safeFloat(ticker, 'changeRate24h', undefined),
337
+ 'percentage': undefined,
338
+ 'average': undefined,
339
+ 'baseVolume': undefined,
340
+ 'quoteVolume': undefined,
341
+ 'info': ticker,
342
+ }, market);
343
+ }
344
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
345
+ let url = this.urls['api']['public'] + '/' + path;
346
+ if (path === 'token') {
347
+ url = this.urls['api']['token'] + '/' + path;
348
+ }
349
+ headers = { 'Content-Type': 'application/json' };
350
+ if (path === 'api/v1.0/price') {
351
+ headers = { 'Content-Type': 'application/json', 'Authorization': params['Authorization'].replace('\n', '') };
352
+ }
353
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
354
+ }
355
355
  }
356
356
 
357
357
  exports["default"] = afratether;