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