ccxt-ir 4.9.15 → 4.9.16

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.
@@ -4,372 +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': true,
28
- 'margin': false,
29
- 'swap': false,
30
- 'future': false,
31
- 'option': false,
32
- 'addMargin': false,
33
- 'cancelAllOrders': false,
34
- 'cancelOrder': false,
35
- 'cancelOrders': false,
36
- 'createDepositAddress': false,
37
- 'createOrder': false,
38
- 'createStopLimitOrder': false,
39
- 'createStopMarketOrder': false,
40
- 'createStopOrder': false,
41
- 'editOrder': false,
42
- 'fetchBalance': false,
43
- 'fetchBorrowInterest': false,
44
- 'fetchBorrowRateHistories': false,
45
- 'fetchBorrowRateHistory': false,
46
- 'fetchClosedOrders': false,
47
- 'fetchCrossBorrowRate': false,
48
- 'fetchCrossBorrowRates': false,
49
- 'fetchCurrencies': false,
50
- 'fetchDepositAddress': false,
51
- 'fetchDeposits': false,
52
- 'fetchFundingHistory': false,
53
- 'fetchFundingRate': false,
54
- 'fetchFundingRateHistory': false,
55
- 'fetchFundingRates': false,
56
- 'fetchIndexOHLCV': false,
57
- 'fetchIsolatedBorrowRate': false,
58
- 'fetchIsolatedBorrowRates': false,
59
- 'fetchL2OrderBook': false,
60
- 'fetchL3OrderBook': false,
61
- 'fetchLedger': false,
62
- 'fetchLedgerEntry': false,
63
- 'fetchLeverageTiers': false,
64
- 'fetchMarkets': true,
65
- 'fetchMarkOHLCV': false,
66
- 'fetchMyTrades': false,
67
- 'fetchOHLCV': false,
68
- 'fetchOpenInterestHistory': false,
69
- 'fetchOpenOrders': false,
70
- 'fetchOrder': false,
71
- 'fetchOrderBook': false,
72
- 'fetchOrders': false,
73
- 'fetchOrderTrades': 'emulated',
74
- 'fetchPositions': false,
75
- 'fetchPremiumIndexOHLCV': false,
76
- 'fetchTicker': true,
77
- 'fetchTickers': true,
78
- 'fetchTime': false,
79
- 'fetchTrades': false,
80
- 'fetchTradingFee': false,
81
- 'fetchTradingFees': false,
82
- 'fetchWithdrawals': false,
83
- 'setLeverage': false,
84
- 'setMarginMode': false,
85
- 'transfer': false,
86
- 'withdraw': false,
87
- },
88
- 'comment': 'This comment is optional',
89
- 'urls': {
90
- 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/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': 'spot',
204
- 'spot': true,
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
- }
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
+ 'otc': true,
29
+ 'margin': false,
30
+ 'swap': false,
31
+ 'future': false,
32
+ 'option': false,
33
+ 'addMargin': false,
34
+ 'cancelAllOrders': false,
35
+ 'cancelOrder': false,
36
+ 'cancelOrders': false,
37
+ 'createDepositAddress': false,
38
+ 'createOrder': false,
39
+ 'createStopLimitOrder': false,
40
+ 'createStopMarketOrder': false,
41
+ 'createStopOrder': false,
42
+ 'editOrder': false,
43
+ 'fetchBalance': false,
44
+ 'fetchBorrowInterest': false,
45
+ 'fetchBorrowRateHistories': false,
46
+ 'fetchBorrowRateHistory': false,
47
+ 'fetchClosedOrders': false,
48
+ 'fetchCrossBorrowRate': false,
49
+ 'fetchCrossBorrowRates': false,
50
+ 'fetchCurrencies': false,
51
+ 'fetchDepositAddress': false,
52
+ 'fetchDeposits': false,
53
+ 'fetchFundingHistory': false,
54
+ 'fetchFundingRate': false,
55
+ 'fetchFundingRateHistory': false,
56
+ 'fetchFundingRates': false,
57
+ 'fetchIndexOHLCV': false,
58
+ 'fetchIsolatedBorrowRate': false,
59
+ 'fetchIsolatedBorrowRates': false,
60
+ 'fetchL2OrderBook': false,
61
+ 'fetchL3OrderBook': false,
62
+ 'fetchLedger': false,
63
+ 'fetchLedgerEntry': false,
64
+ 'fetchLeverageTiers': false,
65
+ 'fetchMarkets': true,
66
+ 'fetchMarkOHLCV': false,
67
+ 'fetchMyTrades': false,
68
+ 'fetchOHLCV': false,
69
+ 'fetchOpenInterestHistory': false,
70
+ 'fetchOpenOrders': false,
71
+ 'fetchOrder': false,
72
+ 'fetchOrderBook': false,
73
+ 'fetchOrders': false,
74
+ 'fetchOrderTrades': 'emulated',
75
+ 'fetchPositions': false,
76
+ 'fetchPremiumIndexOHLCV': false,
77
+ 'fetchTicker': true,
78
+ 'fetchTickers': true,
79
+ 'fetchTime': false,
80
+ 'fetchTrades': false,
81
+ 'fetchTradingFee': false,
82
+ 'fetchTradingFees': false,
83
+ 'fetchWithdrawals': false,
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
+ }