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
@@ -5,373 +5,373 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var sarmayex$1 = require('./abstract/sarmayex.js');
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
- // ---------------------------------------------------------------------------
9
- /**
10
- * @class sarmayex
11
- * @augments Exchange
12
- * @description Set rateLimit to 1000 if fully verified
13
- */
14
- class sarmayex extends sarmayex$1["default"] {
15
- describe() {
16
- return this.deepExtend(super.describe(), {
17
- 'id': 'sarmayex',
18
- 'name': 'Sarmayex',
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/sarmayex/64x64.png',
91
- 'api': {
92
- 'public': 'https://api.sarmayex.com',
93
- },
94
- 'www': 'https://sarmayex.com',
95
- 'doc': [
96
- 'https://sarmayex.com',
97
- ],
98
- },
99
- 'api': {
100
- 'public': {
101
- 'get': {
102
- 'api/v1/public/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
- async fetchMarkets(params = {}) {
117
- /**
118
- * @method
119
- * @name sarmayex#fetchMarkets
120
- * @description retrieves data on all markets for sarmayex
121
- * @see https://api.sarmayex.com/api/v1/public/currencies
122
- * @param {object} [params] extra parameters specific to the exchange API endpoint
123
- * @returns {object[]} an array of objects representing market data
124
- */
125
- let response = await this.publicGetApiV1PublicCurrencies(params);
126
- response = this.safeDict(response, 'data');
127
- const markets = this.safeList(response, 'currencies');
128
- const result = [];
129
- const quotes = ['IRT', 'USDT'];
130
- for (let i = 0; i < markets.length; i++) {
131
- const base = this.safeString(markets[i], 'symbol');
132
- for (let index = 0; index < quotes.length; index++) {
133
- const quote = quotes[index];
134
- markets[i]['base'] = base;
135
- markets[i]['quote'] = quote;
136
- if (base === quote) {
137
- continue;
138
- }
139
- const market = this.parseMarket(markets[i]);
140
- result.push(market);
141
- }
142
- }
143
- return result;
144
- }
145
- parseMarket(market) {
146
- // {
147
- // 'id': 87,
148
- // 'title': 'تتر',
149
- // 'title_en': 'Tether',
150
- // 'symbol': 'USDT',
151
- // 'sell_price': '58,987',
152
- // 'sell_price_usd': '1.0000',
153
- // 'sell_price_wm': '1.062',
154
- // 'sell_price_pm': '1.085',
155
- // 'can_sell': 1,
156
- // 'can_sell_iw': 1,
157
- // 'can_buy': 1,
158
- // 'can_buy_iw': 1,
159
- // 'buy_price': '58,448',
160
- // 'min_buy': '0.00000000',
161
- // 'max_buy': '232348196.00000000',
162
- // 'percent_change_1h': 0.00495761,
163
- // 'percent_change_24h': 0.0333481,
164
- // 'percent_change_7d': 0.0540622,
165
- // 'tick': 4,
166
- // 'need_tag': 0,
167
- // 'need_address': 1,
168
- // 'use_copon': 1,
169
- // 'updated_at': 1717936143,
170
- // 'image': '',
171
- // 'has_content': 1,
172
- // 'withdraw_nets': [],
173
- // 'deposit_nets': [],
174
- // 'sell_request_gateway': 1,
175
- // 'exist_in_wallet': 1,
176
- // 'tags': [
177
- // {
178
- // 'id': 3,
179
- // 'name': 'استیبل کوین',
180
- // },
181
- // {
182
- // 'id': 13,
183
- // 'name': 'قابل پرداخت',
184
- // },
185
- // ],
186
- // };
187
- let baseId = this.safeString(market, 'base');
188
- let quoteId = this.safeString(market, 'quote');
189
- const base = this.safeCurrencyCode(baseId);
190
- const quote = this.safeCurrencyCode(quoteId);
191
- const id = base + quote;
192
- baseId = baseId.toLowerCase();
193
- quoteId = quoteId.toLowerCase();
194
- return {
195
- 'id': id,
196
- 'symbol': base + '/' + quote,
197
- 'base': base,
198
- 'quote': quote,
199
- 'settle': undefined,
200
- 'baseId': baseId,
201
- 'quoteId': quoteId,
202
- 'settleId': undefined,
203
- 'type': 'otc',
204
- 'spot': false,
205
- 'margin': false,
206
- 'swap': false,
207
- 'future': false,
208
- 'option': false,
209
- 'active': true,
210
- 'contract': false,
211
- 'linear': undefined,
212
- 'inverse': undefined,
213
- 'contractSize': undefined,
214
- 'expiry': undefined,
215
- 'expiryDatetime': undefined,
216
- 'strike': undefined,
217
- 'optionType': undefined,
218
- 'precision': {
219
- 'amount': undefined,
220
- 'price': undefined,
221
- },
222
- 'limits': {
223
- 'leverage': {
224
- 'min': undefined,
225
- 'max': undefined,
226
- },
227
- 'amount': {
228
- 'min': undefined,
229
- 'max': undefined,
230
- },
231
- 'price': {
232
- 'min': undefined,
233
- 'max': undefined,
234
- },
235
- 'cost': {
236
- 'min': undefined,
237
- 'max': undefined,
238
- },
239
- },
240
- 'created': undefined,
241
- 'info': market,
242
- };
243
- }
244
- async fetchTickers(symbols = undefined, params = {}) {
245
- /**
246
- * @method
247
- * @name sarmayex#fetchTickers
248
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
249
- * @see https://api.sarmayex.com/api/v1/public/currencies
250
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
251
- * @param {object} [params] extra parameters specific to the exchange API endpoint
252
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
253
- */
254
- await this.loadMarkets();
255
- if (symbols !== undefined) {
256
- symbols = this.marketSymbols(symbols);
257
- }
258
- let response = await this.publicGetApiV1PublicCurrencies(params);
259
- response = this.safeDict(response, 'data');
260
- const markets = this.safeList(response, 'currencies');
261
- const result = {};
262
- const quotes = ['IRT', 'USDT'];
263
- for (let i = 0; i < markets.length; i++) {
264
- const base = this.safeString(markets[i], 'symbol');
265
- for (let index = 0; index < quotes.length; index++) {
266
- const quote = quotes[index];
267
- if (base === quote) {
268
- continue;
269
- }
270
- markets[i]['base'] = base;
271
- markets[i]['quote'] = quote;
272
- markets[i]['symbol'] = base + quote;
273
- const ticker = this.parseTicker(markets[i]);
274
- const symbol = ticker['symbol'];
275
- result[symbol] = ticker;
276
- }
277
- }
278
- return this.filterByArrayTickers(result, 'symbol', symbols);
279
- }
280
- async fetchTicker(symbol, params = {}) {
281
- /**
282
- * @method
283
- * @name sarmayex#fetchTicker
284
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
285
- * @see https://api.sarmayex.com/api/v1/public/currencies
286
- * @param {string} symbol unified symbol of the market to fetch the ticker for
287
- * @param {object} [params] extra parameters specific to the exchange API endpoint
288
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
289
- */
290
- const ticker = await this.fetchTickers([symbol]);
291
- return ticker[symbol];
292
- }
293
- parseTicker(ticker, market = undefined) {
294
- // {
295
- // 'id': 87,
296
- // 'title': 'تتر',
297
- // 'title_en': 'Tether',
298
- // 'symbol': 'USDT',
299
- // 'sell_price': '58,987',
300
- // 'sell_price_usd': '1.0000',
301
- // 'sell_price_wm': '1.062',
302
- // 'sell_price_pm': '1.085',
303
- // 'can_sell': 1,
304
- // 'can_sell_iw': 1,
305
- // 'can_buy': 1,
306
- // 'can_buy_iw': 1,
307
- // 'buy_price': '58,448',
308
- // 'min_buy': '0.00000000',
309
- // 'max_buy': '232348196.00000000',
310
- // 'percent_change_1h': 0.00495761,
311
- // 'percent_change_24h': 0.0333481,
312
- // 'percent_change_7d': 0.0540622,
313
- // 'tick': 4,
314
- // 'need_tag': 0,
315
- // 'need_address': 1,
316
- // 'use_copon': 1,
317
- // 'updated_at': 1717936143,
318
- // 'image': '',
319
- // 'has_content': 1,
320
- // 'withdraw_nets': [],
321
- // 'deposit_nets': [],
322
- // 'sell_request_gateway': 1,
323
- // 'exist_in_wallet': 1,
324
- // 'tags': [
325
- // {
326
- // 'id': 3,
327
- // 'name': 'استیبل کوین',
328
- // },
329
- // {
330
- // 'id': 13,
331
- // 'name': 'قابل پرداخت',
332
- // },
333
- // ],
334
- // };
335
- const marketType = 'otc';
336
- const marketId = this.safeString(ticker, 'symbol');
337
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
338
- ticker['sell_price'] = ticker['sell_price'].replace(',', '');
339
- ticker['sell_price_usd'] = ticker['sell_price'].replace(',', '');
340
- ticker['buy_price'] = ticker['sell_price'].replace(',', '');
341
- let last = this.safeFloat(ticker, 'sell_price_usd', 0);
342
- if (ticker['quote'] === 'IRT') {
343
- last = this.safeFloat(ticker, 'sell_price', 0);
344
- }
345
- const change = this.safeFloat(ticker, 'percent_change_24h', 0);
346
- const timestamp = this.safeInteger(ticker, 'updated_at');
347
- return this.safeTicker({
348
- 'symbol': symbol,
349
- 'timestamp': timestamp * 1000,
350
- 'datetime': this.iso8601(timestamp * 1000),
351
- 'high': undefined,
352
- 'low': undefined,
353
- 'bid': undefined,
354
- 'bidVolume': undefined,
355
- 'ask': undefined,
356
- 'askVolume': undefined,
357
- 'vwap': undefined,
358
- 'open': undefined,
359
- 'close': last,
360
- 'last': last,
361
- 'previousClose': undefined,
362
- 'change': change,
363
- 'percentage': undefined,
364
- 'average': undefined,
365
- 'baseVolume': undefined,
366
- 'quoteVolume': undefined,
367
- 'info': ticker,
368
- }, market);
369
- }
370
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
371
- const url = this.urls['api']['public'] + '/' + path;
372
- headers = { 'Content-Type': 'application/json' };
373
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
374
- }
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class sarmayex
11
+ * @augments Exchange
12
+ * @description Set rateLimit to 1000 if fully verified
13
+ */
14
+ class sarmayex extends sarmayex$1["default"] {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'sarmayex',
18
+ 'name': 'Sarmayex',
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/sarmayex/64x64.png',
91
+ 'api': {
92
+ 'public': 'https://api.sarmayex.com',
93
+ },
94
+ 'www': 'https://sarmayex.com',
95
+ 'doc': [
96
+ 'https://sarmayex.com',
97
+ ],
98
+ },
99
+ 'api': {
100
+ 'public': {
101
+ 'get': {
102
+ 'api/v1/public/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
+ async fetchMarkets(params = {}) {
117
+ /**
118
+ * @method
119
+ * @name sarmayex#fetchMarkets
120
+ * @description retrieves data on all markets for sarmayex
121
+ * @see https://api.sarmayex.com/api/v1/public/currencies
122
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
123
+ * @returns {object[]} an array of objects representing market data
124
+ */
125
+ let response = await this.publicGetApiV1PublicCurrencies(params);
126
+ response = this.safeDict(response, 'data');
127
+ const markets = this.safeList(response, 'currencies');
128
+ const result = [];
129
+ const quotes = ['IRT', 'USDT'];
130
+ for (let i = 0; i < markets.length; i++) {
131
+ const base = this.safeString(markets[i], 'symbol');
132
+ for (let index = 0; index < quotes.length; index++) {
133
+ const quote = quotes[index];
134
+ markets[i]['base'] = base;
135
+ markets[i]['quote'] = quote;
136
+ if (base === quote) {
137
+ continue;
138
+ }
139
+ const market = this.parseMarket(markets[i]);
140
+ result.push(market);
141
+ }
142
+ }
143
+ return result;
144
+ }
145
+ parseMarket(market) {
146
+ // {
147
+ // 'id': 87,
148
+ // 'title': 'تتر',
149
+ // 'title_en': 'Tether',
150
+ // 'symbol': 'USDT',
151
+ // 'sell_price': '58,987',
152
+ // 'sell_price_usd': '1.0000',
153
+ // 'sell_price_wm': '1.062',
154
+ // 'sell_price_pm': '1.085',
155
+ // 'can_sell': 1,
156
+ // 'can_sell_iw': 1,
157
+ // 'can_buy': 1,
158
+ // 'can_buy_iw': 1,
159
+ // 'buy_price': '58,448',
160
+ // 'min_buy': '0.00000000',
161
+ // 'max_buy': '232348196.00000000',
162
+ // 'percent_change_1h': 0.00495761,
163
+ // 'percent_change_24h': 0.0333481,
164
+ // 'percent_change_7d': 0.0540622,
165
+ // 'tick': 4,
166
+ // 'need_tag': 0,
167
+ // 'need_address': 1,
168
+ // 'use_copon': 1,
169
+ // 'updated_at': 1717936143,
170
+ // 'image': '',
171
+ // 'has_content': 1,
172
+ // 'withdraw_nets': [],
173
+ // 'deposit_nets': [],
174
+ // 'sell_request_gateway': 1,
175
+ // 'exist_in_wallet': 1,
176
+ // 'tags': [
177
+ // {
178
+ // 'id': 3,
179
+ // 'name': 'استیبل کوین',
180
+ // },
181
+ // {
182
+ // 'id': 13,
183
+ // 'name': 'قابل پرداخت',
184
+ // },
185
+ // ],
186
+ // };
187
+ let baseId = this.safeString(market, 'base');
188
+ let quoteId = this.safeString(market, 'quote');
189
+ const base = this.safeCurrencyCode(baseId);
190
+ const quote = this.safeCurrencyCode(quoteId);
191
+ const id = base + quote;
192
+ baseId = baseId.toLowerCase();
193
+ quoteId = quoteId.toLowerCase();
194
+ return {
195
+ 'id': id,
196
+ 'symbol': base + '/' + quote,
197
+ 'base': base,
198
+ 'quote': quote,
199
+ 'settle': undefined,
200
+ 'baseId': baseId,
201
+ 'quoteId': quoteId,
202
+ 'settleId': undefined,
203
+ 'type': 'otc',
204
+ 'spot': false,
205
+ 'margin': false,
206
+ 'swap': false,
207
+ 'future': false,
208
+ 'option': false,
209
+ 'active': true,
210
+ 'contract': false,
211
+ 'linear': undefined,
212
+ 'inverse': undefined,
213
+ 'contractSize': undefined,
214
+ 'expiry': undefined,
215
+ 'expiryDatetime': undefined,
216
+ 'strike': undefined,
217
+ 'optionType': undefined,
218
+ 'precision': {
219
+ 'amount': undefined,
220
+ 'price': undefined,
221
+ },
222
+ 'limits': {
223
+ 'leverage': {
224
+ 'min': undefined,
225
+ 'max': undefined,
226
+ },
227
+ 'amount': {
228
+ 'min': undefined,
229
+ 'max': undefined,
230
+ },
231
+ 'price': {
232
+ 'min': undefined,
233
+ 'max': undefined,
234
+ },
235
+ 'cost': {
236
+ 'min': undefined,
237
+ 'max': undefined,
238
+ },
239
+ },
240
+ 'created': undefined,
241
+ 'info': market,
242
+ };
243
+ }
244
+ async fetchTickers(symbols = undefined, params = {}) {
245
+ /**
246
+ * @method
247
+ * @name sarmayex#fetchTickers
248
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
249
+ * @see https://api.sarmayex.com/api/v1/public/currencies
250
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
251
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
252
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
253
+ */
254
+ await this.loadMarkets();
255
+ if (symbols !== undefined) {
256
+ symbols = this.marketSymbols(symbols);
257
+ }
258
+ let response = await this.publicGetApiV1PublicCurrencies(params);
259
+ response = this.safeDict(response, 'data');
260
+ const markets = this.safeList(response, 'currencies');
261
+ const result = {};
262
+ const quotes = ['IRT', 'USDT'];
263
+ for (let i = 0; i < markets.length; i++) {
264
+ const base = this.safeString(markets[i], 'symbol');
265
+ for (let index = 0; index < quotes.length; index++) {
266
+ const quote = quotes[index];
267
+ if (base === quote) {
268
+ continue;
269
+ }
270
+ markets[i]['base'] = base;
271
+ markets[i]['quote'] = quote;
272
+ markets[i]['symbol'] = base + quote;
273
+ const ticker = this.parseTicker(markets[i]);
274
+ const symbol = ticker['symbol'];
275
+ result[symbol] = ticker;
276
+ }
277
+ }
278
+ return this.filterByArrayTickers(result, 'symbol', symbols);
279
+ }
280
+ async fetchTicker(symbol, params = {}) {
281
+ /**
282
+ * @method
283
+ * @name sarmayex#fetchTicker
284
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
285
+ * @see https://api.sarmayex.com/api/v1/public/currencies
286
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
287
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
288
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
289
+ */
290
+ const ticker = await this.fetchTickers([symbol]);
291
+ return ticker[symbol];
292
+ }
293
+ parseTicker(ticker, market = undefined) {
294
+ // {
295
+ // 'id': 87,
296
+ // 'title': 'تتر',
297
+ // 'title_en': 'Tether',
298
+ // 'symbol': 'USDT',
299
+ // 'sell_price': '58,987',
300
+ // 'sell_price_usd': '1.0000',
301
+ // 'sell_price_wm': '1.062',
302
+ // 'sell_price_pm': '1.085',
303
+ // 'can_sell': 1,
304
+ // 'can_sell_iw': 1,
305
+ // 'can_buy': 1,
306
+ // 'can_buy_iw': 1,
307
+ // 'buy_price': '58,448',
308
+ // 'min_buy': '0.00000000',
309
+ // 'max_buy': '232348196.00000000',
310
+ // 'percent_change_1h': 0.00495761,
311
+ // 'percent_change_24h': 0.0333481,
312
+ // 'percent_change_7d': 0.0540622,
313
+ // 'tick': 4,
314
+ // 'need_tag': 0,
315
+ // 'need_address': 1,
316
+ // 'use_copon': 1,
317
+ // 'updated_at': 1717936143,
318
+ // 'image': '',
319
+ // 'has_content': 1,
320
+ // 'withdraw_nets': [],
321
+ // 'deposit_nets': [],
322
+ // 'sell_request_gateway': 1,
323
+ // 'exist_in_wallet': 1,
324
+ // 'tags': [
325
+ // {
326
+ // 'id': 3,
327
+ // 'name': 'استیبل کوین',
328
+ // },
329
+ // {
330
+ // 'id': 13,
331
+ // 'name': 'قابل پرداخت',
332
+ // },
333
+ // ],
334
+ // };
335
+ const marketType = 'otc';
336
+ const marketId = this.safeString(ticker, 'symbol');
337
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
338
+ ticker['sell_price'] = ticker['sell_price'].replace(',', '');
339
+ ticker['sell_price_usd'] = ticker['sell_price'].replace(',', '');
340
+ ticker['buy_price'] = ticker['sell_price'].replace(',', '');
341
+ let last = this.safeFloat(ticker, 'sell_price_usd', 0);
342
+ if (ticker['quote'] === 'IRT') {
343
+ last = this.safeFloat(ticker, 'sell_price', 0);
344
+ }
345
+ const change = this.safeFloat(ticker, 'percent_change_24h', 0);
346
+ const timestamp = this.safeInteger(ticker, 'updated_at');
347
+ return this.safeTicker({
348
+ 'symbol': symbol,
349
+ 'timestamp': timestamp * 1000,
350
+ 'datetime': this.iso8601(timestamp * 1000),
351
+ 'high': undefined,
352
+ 'low': undefined,
353
+ 'bid': undefined,
354
+ 'bidVolume': undefined,
355
+ 'ask': undefined,
356
+ 'askVolume': undefined,
357
+ 'vwap': undefined,
358
+ 'open': undefined,
359
+ 'close': last,
360
+ 'last': last,
361
+ 'previousClose': undefined,
362
+ 'change': change,
363
+ 'percentage': undefined,
364
+ 'average': undefined,
365
+ 'baseVolume': undefined,
366
+ 'quoteVolume': undefined,
367
+ 'info': ticker,
368
+ }, market);
369
+ }
370
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
371
+ const url = this.urls['api']['public'] + '/' + path;
372
+ headers = { 'Content-Type': 'application/json' };
373
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
374
+ }
375
375
  }
376
376
 
377
377
  exports["default"] = sarmayex;