ccxt-ir 4.9.23 → 4.9.25

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 (89) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/abantether.js +344 -344
  5. package/dist/cjs/src/abstract/bitbarg.js +1 -1
  6. package/dist/cjs/src/abstract/bydfi.js +1 -1
  7. package/dist/cjs/src/abstract/cafearz.js +1 -1
  8. package/dist/cjs/src/abstract/hamtapay.js +1 -1
  9. package/dist/cjs/src/abstract/kifpoolme.js +1 -1
  10. package/dist/cjs/src/abstract/mazdax.js +1 -1
  11. package/dist/cjs/src/abstract/pingi.js +1 -1
  12. package/dist/cjs/src/abstract/pooleno.js +1 -1
  13. package/dist/cjs/src/abstract/tehran_exchange.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 +294 -294
  20. package/dist/cjs/src/iranexchange.js +9 -7
  21. package/dist/cjs/src/kcex.js +326 -326
  22. package/dist/cjs/src/kifpoolme.js +401 -401
  23. package/dist/cjs/src/mazdax.js +525 -525
  24. package/dist/cjs/src/ompfinex.js +501 -501
  25. package/dist/cjs/src/pingi.js +437 -437
  26. package/dist/cjs/src/pooleno.js +338 -338
  27. package/dist/cjs/src/sarmayex.js +367 -367
  28. package/dist/cjs/src/tehran_exchange.js +324 -324
  29. package/dist/cjs/src/tetherland.js +358 -358
  30. package/dist/cjs/src/toobit.js +436 -436
  31. package/dist/cjs/src/twox.js +362 -362
  32. package/js/ccxt.d.ts +1 -1
  33. package/js/ccxt.js +1 -1
  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/bydfi.d.ts +11 -11
  40. package/js/src/abstract/bydfi.js +5 -5
  41. package/js/src/abstract/cafearz.d.ts +8 -8
  42. package/js/src/abstract/cafearz.js +5 -5
  43. package/js/src/abstract/hamtapay.d.ts +9 -9
  44. package/js/src/abstract/hamtapay.js +5 -5
  45. package/js/src/abstract/kifpoolme.d.ts +9 -9
  46. package/js/src/abstract/kifpoolme.js +5 -5
  47. package/js/src/abstract/mazdax.d.ts +11 -11
  48. package/js/src/abstract/mazdax.js +5 -5
  49. package/js/src/abstract/pingi.d.ts +9 -9
  50. package/js/src/abstract/pingi.js +5 -5
  51. package/js/src/abstract/pooleno.d.ts +8 -8
  52. package/js/src/abstract/pooleno.js +5 -5
  53. package/js/src/abstract/tehran_exchange.d.ts +9 -9
  54. package/js/src/abstract/tehran_exchange.js +5 -5
  55. package/js/src/abstract/toobit.d.ts +10 -10
  56. package/js/src/afratether.js +350 -350
  57. package/js/src/arzplus.d.ts +26 -26
  58. package/js/src/arzplus.js +575 -575
  59. package/js/src/base/types.d.ts +586 -586
  60. package/js/src/bitbarg.d.ts +21 -21
  61. package/js/src/bitbarg.js +306 -306
  62. package/js/src/bydfi.d.ts +23 -23
  63. package/js/src/bydfi.js +428 -428
  64. package/js/src/cafearz.d.ts +21 -21
  65. package/js/src/cafearz.js +340 -340
  66. package/js/src/hamtapay.d.ts +21 -21
  67. package/js/src/hamtapay.js +297 -297
  68. package/js/src/iranexchange.js +9 -7
  69. package/js/src/kcex.js +329 -329
  70. package/js/src/kifpoolme.d.ts +23 -23
  71. package/js/src/kifpoolme.js +404 -404
  72. package/js/src/mazdax.d.ts +23 -23
  73. package/js/src/mazdax.js +528 -528
  74. package/js/src/ompfinex.js +504 -504
  75. package/js/src/pingi.d.ts +22 -22
  76. package/js/src/pingi.js +440 -440
  77. package/js/src/pooleno.d.ts +21 -21
  78. package/js/src/pooleno.js +341 -341
  79. package/js/src/sarmayex.js +370 -370
  80. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +51 -51
  81. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  82. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +204 -204
  83. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  84. package/js/src/tehran_exchange.d.ts +21 -21
  85. package/js/src/tehran_exchange.js +327 -327
  86. package/js/src/tetherland.js +361 -361
  87. package/js/src/toobit.js +439 -439
  88. package/js/src/twox.js +365 -365
  89. package/package.json +1 -1
@@ -4,373 +4,373 @@
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/sarmayex.js';
9
- // ---------------------------------------------------------------------------
10
- /**
11
- * @class sarmayex
12
- * @augments Exchange
13
- * @description Set rateLimit to 1000 if fully verified
14
- */
15
- export default class sarmayex extends Exchange {
16
- describe() {
17
- return this.deepExtend(super.describe(), {
18
- 'id': 'sarmayex',
19
- 'name': 'Sarmayex',
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/sarmayex/64x64.png',
92
- 'api': {
93
- 'public': 'https://api.sarmayex.com',
94
- },
95
- 'www': 'https://sarmayex.com',
96
- 'doc': [
97
- 'https://sarmayex.com',
98
- ],
99
- },
100
- 'api': {
101
- 'public': {
102
- 'get': {
103
- 'api/v1/public/currencies': 1,
104
- },
105
- },
106
- },
107
- 'fees': {
108
- 'trading': {
109
- 'tierBased': false,
110
- 'percentage': true,
111
- 'maker': this.parseNumber('0.001'),
112
- 'taker': this.parseNumber('0.001'),
113
- },
114
- },
115
- });
116
- }
117
- async fetchMarkets(params = {}) {
118
- /**
119
- * @method
120
- * @name sarmayex#fetchMarkets
121
- * @description retrieves data on all markets for sarmayex
122
- * @see https://api.sarmayex.com/api/v1/public/currencies
123
- * @param {object} [params] extra parameters specific to the exchange API endpoint
124
- * @returns {object[]} an array of objects representing market data
125
- */
126
- let response = await this.publicGetApiV1PublicCurrencies(params);
127
- response = this.safeDict(response, 'data');
128
- const markets = this.safeList(response, 'currencies');
129
- const result = [];
130
- const quotes = ['IRT', 'USDT'];
131
- for (let i = 0; i < markets.length; i++) {
132
- const base = this.safeString(markets[i], 'symbol');
133
- for (let index = 0; index < quotes.length; index++) {
134
- const quote = quotes[index];
135
- markets[i]['base'] = base;
136
- markets[i]['quote'] = quote;
137
- if (base === quote) {
138
- continue;
139
- }
140
- const market = this.parseMarket(markets[i]);
141
- result.push(market);
142
- }
143
- }
144
- return result;
145
- }
146
- parseMarket(market) {
147
- // {
148
- // 'id': 87,
149
- // 'title': 'تتر',
150
- // 'title_en': 'Tether',
151
- // 'symbol': 'USDT',
152
- // 'sell_price': '58,987',
153
- // 'sell_price_usd': '1.0000',
154
- // 'sell_price_wm': '1.062',
155
- // 'sell_price_pm': '1.085',
156
- // 'can_sell': 1,
157
- // 'can_sell_iw': 1,
158
- // 'can_buy': 1,
159
- // 'can_buy_iw': 1,
160
- // 'buy_price': '58,448',
161
- // 'min_buy': '0.00000000',
162
- // 'max_buy': '232348196.00000000',
163
- // 'percent_change_1h': 0.00495761,
164
- // 'percent_change_24h': 0.0333481,
165
- // 'percent_change_7d': 0.0540622,
166
- // 'tick': 4,
167
- // 'need_tag': 0,
168
- // 'need_address': 1,
169
- // 'use_copon': 1,
170
- // 'updated_at': 1717936143,
171
- // 'image': '',
172
- // 'has_content': 1,
173
- // 'withdraw_nets': [],
174
- // 'deposit_nets': [],
175
- // 'sell_request_gateway': 1,
176
- // 'exist_in_wallet': 1,
177
- // 'tags': [
178
- // {
179
- // 'id': 3,
180
- // 'name': 'استیبل کوین',
181
- // },
182
- // {
183
- // 'id': 13,
184
- // 'name': 'قابل پرداخت',
185
- // },
186
- // ],
187
- // };
188
- let baseId = this.safeString(market, 'base');
189
- let quoteId = this.safeString(market, 'quote');
190
- const base = this.safeCurrencyCode(baseId);
191
- const quote = this.safeCurrencyCode(quoteId);
192
- const id = base + quote;
193
- baseId = baseId.toLowerCase();
194
- quoteId = quoteId.toLowerCase();
195
- return {
196
- 'id': id,
197
- 'symbol': base + '/' + quote,
198
- 'base': base,
199
- 'quote': quote,
200
- 'settle': undefined,
201
- 'baseId': baseId,
202
- 'quoteId': quoteId,
203
- 'settleId': undefined,
204
- 'type': 'otc',
205
- 'spot': false,
206
- 'margin': false,
207
- 'swap': false,
208
- 'future': false,
209
- 'option': false,
210
- 'active': true,
211
- 'contract': false,
212
- 'linear': undefined,
213
- 'inverse': undefined,
214
- 'contractSize': undefined,
215
- 'expiry': undefined,
216
- 'expiryDatetime': undefined,
217
- 'strike': undefined,
218
- 'optionType': undefined,
219
- 'precision': {
220
- 'amount': undefined,
221
- 'price': undefined,
222
- },
223
- 'limits': {
224
- 'leverage': {
225
- 'min': undefined,
226
- 'max': undefined,
227
- },
228
- 'amount': {
229
- 'min': undefined,
230
- 'max': undefined,
231
- },
232
- 'price': {
233
- 'min': undefined,
234
- 'max': undefined,
235
- },
236
- 'cost': {
237
- 'min': undefined,
238
- 'max': undefined,
239
- },
240
- },
241
- 'created': undefined,
242
- 'info': market,
243
- };
244
- }
245
- async fetchTickers(symbols = undefined, params = {}) {
246
- /**
247
- * @method
248
- * @name sarmayex#fetchTickers
249
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
250
- * @see https://api.sarmayex.com/api/v1/public/currencies
251
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
252
- * @param {object} [params] extra parameters specific to the exchange API endpoint
253
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
254
- */
255
- await this.loadMarkets();
256
- if (symbols !== undefined) {
257
- symbols = this.marketSymbols(symbols);
258
- }
259
- let response = await this.publicGetApiV1PublicCurrencies(params);
260
- response = this.safeDict(response, 'data');
261
- const markets = this.safeList(response, 'currencies');
262
- const result = {};
263
- const quotes = ['IRT', 'USDT'];
264
- for (let i = 0; i < markets.length; i++) {
265
- const base = this.safeString(markets[i], 'symbol');
266
- for (let index = 0; index < quotes.length; index++) {
267
- const quote = quotes[index];
268
- if (base === quote) {
269
- continue;
270
- }
271
- markets[i]['base'] = base;
272
- markets[i]['quote'] = quote;
273
- markets[i]['symbol'] = base + quote;
274
- const ticker = this.parseTicker(markets[i]);
275
- const symbol = ticker['symbol'];
276
- result[symbol] = ticker;
277
- }
278
- }
279
- return this.filterByArrayTickers(result, 'symbol', symbols);
280
- }
281
- async fetchTicker(symbol, params = {}) {
282
- /**
283
- * @method
284
- * @name sarmayex#fetchTicker
285
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
286
- * @see https://api.sarmayex.com/api/v1/public/currencies
287
- * @param {string} symbol unified symbol of the market to fetch the ticker for
288
- * @param {object} [params] extra parameters specific to the exchange API endpoint
289
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
290
- */
291
- const ticker = await this.fetchTickers([symbol]);
292
- return ticker[symbol];
293
- }
294
- parseTicker(ticker, market = undefined) {
295
- // {
296
- // 'id': 87,
297
- // 'title': 'تتر',
298
- // 'title_en': 'Tether',
299
- // 'symbol': 'USDT',
300
- // 'sell_price': '58,987',
301
- // 'sell_price_usd': '1.0000',
302
- // 'sell_price_wm': '1.062',
303
- // 'sell_price_pm': '1.085',
304
- // 'can_sell': 1,
305
- // 'can_sell_iw': 1,
306
- // 'can_buy': 1,
307
- // 'can_buy_iw': 1,
308
- // 'buy_price': '58,448',
309
- // 'min_buy': '0.00000000',
310
- // 'max_buy': '232348196.00000000',
311
- // 'percent_change_1h': 0.00495761,
312
- // 'percent_change_24h': 0.0333481,
313
- // 'percent_change_7d': 0.0540622,
314
- // 'tick': 4,
315
- // 'need_tag': 0,
316
- // 'need_address': 1,
317
- // 'use_copon': 1,
318
- // 'updated_at': 1717936143,
319
- // 'image': '',
320
- // 'has_content': 1,
321
- // 'withdraw_nets': [],
322
- // 'deposit_nets': [],
323
- // 'sell_request_gateway': 1,
324
- // 'exist_in_wallet': 1,
325
- // 'tags': [
326
- // {
327
- // 'id': 3,
328
- // 'name': 'استیبل کوین',
329
- // },
330
- // {
331
- // 'id': 13,
332
- // 'name': 'قابل پرداخت',
333
- // },
334
- // ],
335
- // };
336
- const marketType = 'otc';
337
- const marketId = this.safeString(ticker, 'symbol');
338
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
339
- ticker['sell_price'] = ticker['sell_price'].replace(',', '');
340
- ticker['sell_price_usd'] = ticker['sell_price'].replace(',', '');
341
- ticker['buy_price'] = ticker['sell_price'].replace(',', '');
342
- let last = this.safeFloat(ticker, 'sell_price_usd', 0);
343
- if (ticker['quote'] === 'IRT') {
344
- last = this.safeFloat(ticker, 'sell_price', 0);
345
- }
346
- const change = this.safeFloat(ticker, 'percent_change_24h', 0);
347
- const timestamp = this.safeInteger(ticker, 'updated_at');
348
- return this.safeTicker({
349
- 'symbol': symbol,
350
- 'timestamp': timestamp * 1000,
351
- 'datetime': this.iso8601(timestamp * 1000),
352
- 'high': undefined,
353
- 'low': undefined,
354
- 'bid': undefined,
355
- 'bidVolume': undefined,
356
- 'ask': undefined,
357
- 'askVolume': undefined,
358
- 'vwap': undefined,
359
- 'open': undefined,
360
- 'close': last,
361
- 'last': last,
362
- 'previousClose': undefined,
363
- 'change': change,
364
- 'percentage': undefined,
365
- 'average': undefined,
366
- 'baseVolume': undefined,
367
- 'quoteVolume': undefined,
368
- 'info': ticker,
369
- }, market);
370
- }
371
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
372
- const url = this.urls['api']['public'] + '/' + path;
373
- headers = { 'Content-Type': 'application/json' };
374
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
375
- }
376
- }
7
+ // ---------------------------------------------------------------------------
8
+ import Exchange from './abstract/sarmayex.js';
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * @class sarmayex
12
+ * @augments Exchange
13
+ * @description Set rateLimit to 1000 if fully verified
14
+ */
15
+ export default class sarmayex extends Exchange {
16
+ describe() {
17
+ return this.deepExtend(super.describe(), {
18
+ 'id': 'sarmayex',
19
+ 'name': 'Sarmayex',
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/sarmayex/64x64.png',
92
+ 'api': {
93
+ 'public': 'https://api.sarmayex.com',
94
+ },
95
+ 'www': 'https://sarmayex.com',
96
+ 'doc': [
97
+ 'https://sarmayex.com',
98
+ ],
99
+ },
100
+ 'api': {
101
+ 'public': {
102
+ 'get': {
103
+ 'api/v1/public/currencies': 1,
104
+ },
105
+ },
106
+ },
107
+ 'fees': {
108
+ 'trading': {
109
+ 'tierBased': false,
110
+ 'percentage': true,
111
+ 'maker': this.parseNumber('0.001'),
112
+ 'taker': this.parseNumber('0.001'),
113
+ },
114
+ },
115
+ });
116
+ }
117
+ async fetchMarkets(params = {}) {
118
+ /**
119
+ * @method
120
+ * @name sarmayex#fetchMarkets
121
+ * @description retrieves data on all markets for sarmayex
122
+ * @see https://api.sarmayex.com/api/v1/public/currencies
123
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
124
+ * @returns {object[]} an array of objects representing market data
125
+ */
126
+ let response = await this.publicGetApiV1PublicCurrencies(params);
127
+ response = this.safeDict(response, 'data');
128
+ const markets = this.safeList(response, 'currencies');
129
+ const result = [];
130
+ const quotes = ['IRT', 'USDT'];
131
+ for (let i = 0; i < markets.length; i++) {
132
+ const base = this.safeString(markets[i], 'symbol');
133
+ for (let index = 0; index < quotes.length; index++) {
134
+ const quote = quotes[index];
135
+ markets[i]['base'] = base;
136
+ markets[i]['quote'] = quote;
137
+ if (base === quote) {
138
+ continue;
139
+ }
140
+ const market = this.parseMarket(markets[i]);
141
+ result.push(market);
142
+ }
143
+ }
144
+ return result;
145
+ }
146
+ parseMarket(market) {
147
+ // {
148
+ // 'id': 87,
149
+ // 'title': 'تتر',
150
+ // 'title_en': 'Tether',
151
+ // 'symbol': 'USDT',
152
+ // 'sell_price': '58,987',
153
+ // 'sell_price_usd': '1.0000',
154
+ // 'sell_price_wm': '1.062',
155
+ // 'sell_price_pm': '1.085',
156
+ // 'can_sell': 1,
157
+ // 'can_sell_iw': 1,
158
+ // 'can_buy': 1,
159
+ // 'can_buy_iw': 1,
160
+ // 'buy_price': '58,448',
161
+ // 'min_buy': '0.00000000',
162
+ // 'max_buy': '232348196.00000000',
163
+ // 'percent_change_1h': 0.00495761,
164
+ // 'percent_change_24h': 0.0333481,
165
+ // 'percent_change_7d': 0.0540622,
166
+ // 'tick': 4,
167
+ // 'need_tag': 0,
168
+ // 'need_address': 1,
169
+ // 'use_copon': 1,
170
+ // 'updated_at': 1717936143,
171
+ // 'image': '',
172
+ // 'has_content': 1,
173
+ // 'withdraw_nets': [],
174
+ // 'deposit_nets': [],
175
+ // 'sell_request_gateway': 1,
176
+ // 'exist_in_wallet': 1,
177
+ // 'tags': [
178
+ // {
179
+ // 'id': 3,
180
+ // 'name': 'استیبل کوین',
181
+ // },
182
+ // {
183
+ // 'id': 13,
184
+ // 'name': 'قابل پرداخت',
185
+ // },
186
+ // ],
187
+ // };
188
+ let baseId = this.safeString(market, 'base');
189
+ let quoteId = this.safeString(market, 'quote');
190
+ const base = this.safeCurrencyCode(baseId);
191
+ const quote = this.safeCurrencyCode(quoteId);
192
+ const id = base + quote;
193
+ baseId = baseId.toLowerCase();
194
+ quoteId = quoteId.toLowerCase();
195
+ return {
196
+ 'id': id,
197
+ 'symbol': base + '/' + quote,
198
+ 'base': base,
199
+ 'quote': quote,
200
+ 'settle': undefined,
201
+ 'baseId': baseId,
202
+ 'quoteId': quoteId,
203
+ 'settleId': undefined,
204
+ 'type': 'otc',
205
+ 'spot': false,
206
+ 'margin': false,
207
+ 'swap': false,
208
+ 'future': false,
209
+ 'option': false,
210
+ 'active': true,
211
+ 'contract': false,
212
+ 'linear': undefined,
213
+ 'inverse': undefined,
214
+ 'contractSize': undefined,
215
+ 'expiry': undefined,
216
+ 'expiryDatetime': undefined,
217
+ 'strike': undefined,
218
+ 'optionType': undefined,
219
+ 'precision': {
220
+ 'amount': undefined,
221
+ 'price': undefined,
222
+ },
223
+ 'limits': {
224
+ 'leverage': {
225
+ 'min': undefined,
226
+ 'max': undefined,
227
+ },
228
+ 'amount': {
229
+ 'min': undefined,
230
+ 'max': undefined,
231
+ },
232
+ 'price': {
233
+ 'min': undefined,
234
+ 'max': undefined,
235
+ },
236
+ 'cost': {
237
+ 'min': undefined,
238
+ 'max': undefined,
239
+ },
240
+ },
241
+ 'created': undefined,
242
+ 'info': market,
243
+ };
244
+ }
245
+ async fetchTickers(symbols = undefined, params = {}) {
246
+ /**
247
+ * @method
248
+ * @name sarmayex#fetchTickers
249
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
250
+ * @see https://api.sarmayex.com/api/v1/public/currencies
251
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
252
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
253
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
254
+ */
255
+ await this.loadMarkets();
256
+ if (symbols !== undefined) {
257
+ symbols = this.marketSymbols(symbols);
258
+ }
259
+ let response = await this.publicGetApiV1PublicCurrencies(params);
260
+ response = this.safeDict(response, 'data');
261
+ const markets = this.safeList(response, 'currencies');
262
+ const result = {};
263
+ const quotes = ['IRT', 'USDT'];
264
+ for (let i = 0; i < markets.length; i++) {
265
+ const base = this.safeString(markets[i], 'symbol');
266
+ for (let index = 0; index < quotes.length; index++) {
267
+ const quote = quotes[index];
268
+ if (base === quote) {
269
+ continue;
270
+ }
271
+ markets[i]['base'] = base;
272
+ markets[i]['quote'] = quote;
273
+ markets[i]['symbol'] = base + quote;
274
+ const ticker = this.parseTicker(markets[i]);
275
+ const symbol = ticker['symbol'];
276
+ result[symbol] = ticker;
277
+ }
278
+ }
279
+ return this.filterByArrayTickers(result, 'symbol', symbols);
280
+ }
281
+ async fetchTicker(symbol, params = {}) {
282
+ /**
283
+ * @method
284
+ * @name sarmayex#fetchTicker
285
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
286
+ * @see https://api.sarmayex.com/api/v1/public/currencies
287
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
288
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
289
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
290
+ */
291
+ const ticker = await this.fetchTickers([symbol]);
292
+ return ticker[symbol];
293
+ }
294
+ parseTicker(ticker, market = undefined) {
295
+ // {
296
+ // 'id': 87,
297
+ // 'title': 'تتر',
298
+ // 'title_en': 'Tether',
299
+ // 'symbol': 'USDT',
300
+ // 'sell_price': '58,987',
301
+ // 'sell_price_usd': '1.0000',
302
+ // 'sell_price_wm': '1.062',
303
+ // 'sell_price_pm': '1.085',
304
+ // 'can_sell': 1,
305
+ // 'can_sell_iw': 1,
306
+ // 'can_buy': 1,
307
+ // 'can_buy_iw': 1,
308
+ // 'buy_price': '58,448',
309
+ // 'min_buy': '0.00000000',
310
+ // 'max_buy': '232348196.00000000',
311
+ // 'percent_change_1h': 0.00495761,
312
+ // 'percent_change_24h': 0.0333481,
313
+ // 'percent_change_7d': 0.0540622,
314
+ // 'tick': 4,
315
+ // 'need_tag': 0,
316
+ // 'need_address': 1,
317
+ // 'use_copon': 1,
318
+ // 'updated_at': 1717936143,
319
+ // 'image': '',
320
+ // 'has_content': 1,
321
+ // 'withdraw_nets': [],
322
+ // 'deposit_nets': [],
323
+ // 'sell_request_gateway': 1,
324
+ // 'exist_in_wallet': 1,
325
+ // 'tags': [
326
+ // {
327
+ // 'id': 3,
328
+ // 'name': 'استیبل کوین',
329
+ // },
330
+ // {
331
+ // 'id': 13,
332
+ // 'name': 'قابل پرداخت',
333
+ // },
334
+ // ],
335
+ // };
336
+ const marketType = 'otc';
337
+ const marketId = this.safeString(ticker, 'symbol');
338
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
339
+ ticker['sell_price'] = ticker['sell_price'].replace(',', '');
340
+ ticker['sell_price_usd'] = ticker['sell_price'].replace(',', '');
341
+ ticker['buy_price'] = ticker['sell_price'].replace(',', '');
342
+ let last = this.safeFloat(ticker, 'sell_price_usd', 0);
343
+ if (ticker['quote'] === 'IRT') {
344
+ last = this.safeFloat(ticker, 'sell_price', 0);
345
+ }
346
+ const change = this.safeFloat(ticker, 'percent_change_24h', 0);
347
+ const timestamp = this.safeInteger(ticker, 'updated_at');
348
+ return this.safeTicker({
349
+ 'symbol': symbol,
350
+ 'timestamp': timestamp * 1000,
351
+ 'datetime': this.iso8601(timestamp * 1000),
352
+ 'high': undefined,
353
+ 'low': undefined,
354
+ 'bid': undefined,
355
+ 'bidVolume': undefined,
356
+ 'ask': undefined,
357
+ 'askVolume': undefined,
358
+ 'vwap': undefined,
359
+ 'open': undefined,
360
+ 'close': last,
361
+ 'last': last,
362
+ 'previousClose': undefined,
363
+ 'change': change,
364
+ 'percentage': undefined,
365
+ 'average': undefined,
366
+ 'baseVolume': undefined,
367
+ 'quoteVolume': undefined,
368
+ 'info': ticker,
369
+ }, market);
370
+ }
371
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
372
+ const url = this.urls['api']['public'] + '/' + path;
373
+ headers = { 'Content-Type': 'application/json' };
374
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
375
+ }
376
+ }