ccxt-ir 4.9.23 → 4.9.27

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,394 +5,396 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var iranexchange$1 = require('./abstract/iranexchange.js');
6
6
 
7
7
  // ----------------------------------------------------------------------------
8
- // ---------------------------------------------------------------------------
9
- /**
10
- * @class iranexchange
11
- * @augments Exchange
12
- * @description Set rateLimit to 1000 if fully verified
13
- */
14
- class iranexchange extends iranexchange$1["default"] {
15
- describe() {
16
- return this.deepExtend(super.describe(), {
17
- 'id': 'iranexchange',
18
- 'name': 'Iran Exchange',
19
- 'countries': ['IR'],
20
- 'rateLimit': 1000,
21
- 'version': '1',
22
- 'certified': false,
23
- 'pro': false,
24
- 'timeout': 30000,
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
- '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/iran-exchange/64x64.png',
91
- 'api': {
92
- 'public': 'https://api.iranexchange.com/api/public/modules/crypto',
93
- },
94
- 'www': 'https://iranexchange.com/',
95
- 'doc': [
96
- 'https://iranexchange.com/',
97
- ],
98
- },
99
- 'api': {
100
- 'public': {
101
- 'get': {
102
- 'v1/client/listProduct': 1,
103
- 'v1/client/getBySymbol': 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 iranexchange#fetchMarkets
121
- * @description retrieves data on all markets for iranexchange
122
- * @see https://iranexchange.co/
123
- * @param {object} [params] extra parameters specific to the exchange API endpoint
124
- * @returns {object[]} an array of objects representing market data
125
- */
126
- const response = await this.publicGetV1ClientListProduct();
127
- const markets = this.safeList(response, 'data');
128
- const result = [];
129
- for (let i = 0; i < markets.length; i++) {
130
- const market = this.parseMarket(markets[i]);
131
- result.push(market);
132
- }
133
- return result;
134
- }
135
- parseMarket(market) {
136
- // {
137
- // _id: "60b08a57b202353abb592032",
138
- // name: "Bitcoin",
139
- // fa_name: "بیت کوین",
140
- // symbol: "BTC",
141
- // slug: "bitcoin",
142
- // is_sell_to_customer_active: 1,
143
- // is_fast_sell_to_customer_active: 1,
144
- // is_buy_from_customer_active: 1,
145
- // logo: "https://iranexchange.com/strapi/media/BTC_78d99b9d12.png",
146
- // dollar_price: 89240.18,
147
- // sell_to_iranicard_currency_price: 1234526,
148
- // buy_from_iranicard_currency_price: 1239474,
149
- // fast_sell_to_iranicard_currency_price: 1234526,
150
- // buy_from_iranicard_network_list: [
151
- // {
152
- // network: "BTC",
153
- // name: "Bitcoin",
154
- // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
155
- // coin: "BTC",
156
- // withdrawEnable: true,
157
- // depositEnable: true,
158
- // withdrawMin: "0.000100000",
159
- // withdrawMax: null,
160
- // withdrawFee: "0.000100000",
161
- // sameAddress: false,
162
- // memoRegex: null,
163
- // tradeEnable: true
164
- // }
165
- // ],
166
- // sell_to_iranicard_network_list: [
167
- // {
168
- // network: "BTC",
169
- // name: "Bitcoin",
170
- // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
171
- // coin: "BTC",
172
- // withdrawEnable: true,
173
- // depositEnable: true,
174
- // withdrawMin: "0.000100000",
175
- // withdrawMax: null,
176
- // withdrawFee: "0.000100000",
177
- // sameAddress: false,
178
- // memoRegex: null,
179
- // tradeEnable: true
180
- // }
181
- // ],
182
- // is_price_maker_active: 1,
183
- // quotation: {
184
- // maxPrice: "90199.99",
185
- // minPrice: "88925",
186
- // dailyChangePercent: "-0.26"
187
- // },
188
- // dailyChangePercent: -0.26,
189
- // order: 0,
190
- // stock_status: "in_stock",
191
- // stock_label: null,
192
- // stock_description: null
193
- // },
194
- const id = this.safeString(market, 'symbol') + '_' + 'IRT';
195
- let baseId = this.safeString(market, 'symbol');
196
- let quoteId = 'IRT';
197
- const base = this.safeCurrencyCode(baseId);
198
- const quote = this.safeCurrencyCode(quoteId);
199
- baseId = baseId.toLowerCase();
200
- quoteId = quoteId.toLowerCase();
201
- return {
202
- 'id': id,
203
- 'symbol': base + '/' + quote,
204
- 'base': base,
205
- 'quote': quote,
206
- 'settle': undefined,
207
- 'baseId': baseId,
208
- 'quoteId': quoteId,
209
- 'settleId': undefined,
210
- 'type': 'otc',
211
- 'spot': false,
212
- 'margin': false,
213
- 'swap': false,
214
- 'future': false,
215
- 'option': false,
216
- 'active': true,
217
- 'contract': false,
218
- 'linear': undefined,
219
- 'inverse': undefined,
220
- 'contractSize': undefined,
221
- 'expiry': undefined,
222
- 'expiryDatetime': undefined,
223
- 'strike': undefined,
224
- 'optionType': undefined,
225
- 'precision': {
226
- 'amount': undefined,
227
- 'price': undefined,
228
- },
229
- 'limits': {
230
- 'leverage': {
231
- 'min': undefined,
232
- 'max': undefined,
233
- },
234
- 'amount': {
235
- 'min': undefined,
236
- 'max': undefined,
237
- },
238
- 'price': {
239
- 'min': undefined,
240
- 'max': undefined,
241
- },
242
- 'cost': {
243
- 'min': undefined,
244
- 'max': undefined,
245
- },
246
- },
247
- 'created': undefined,
248
- 'info': market,
249
- };
250
- }
251
- async fetchTickers(symbols = undefined, params = {}) {
252
- /**
253
- * @method
254
- * @name iranexchange#fetchTickers
255
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
256
- * @see https://iranexchange.co/
257
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
258
- * @param {object} [params] extra parameters specific to the exchange API endpoint
259
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
260
- */
261
- await this.loadMarkets();
262
- if (symbols !== undefined) {
263
- symbols = this.marketSymbols(symbols);
264
- }
265
- const response = await this.publicGetV1ClientListProduct();
266
- const markets = this.safeList(response, 'data');
267
- const result = {};
268
- for (let i = 0; i < markets.length; i++) {
269
- const ticker = this.parseTicker(markets[i]);
270
- const symbol = ticker['symbol'];
271
- result[symbol] = ticker;
272
- }
273
- return this.filterByArrayTickers(result, 'symbol', symbols);
274
- }
275
- async fetchTicker(symbol, params = {}) {
276
- /**
277
- * @method
278
- * @name iranexchange#fetchTicker
279
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
280
- * @see https://iranexchange.co/
281
- * @param {string} symbol unified symbol of the market to fetch the ticker for
282
- * @param {object} [params] extra parameters specific to the exchange API endpoint
283
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
284
- */
285
- await this.loadMarkets();
286
- const market = this.market(symbol);
287
- const request = {
288
- 'id': market['base'],
289
- };
290
- const response = await this.publicGetV1ClientGetBySymbol(request);
291
- const marketData = this.safeDict(response, 'data');
292
- const ticker = this.parseTicker(marketData);
293
- return ticker;
294
- }
295
- parseTicker(ticker, market = undefined) {
296
- // {
297
- // _id: "60b08a57b202353abb592032",
298
- // name: "Bitcoin",
299
- // fa_name: "بیت کوین",
300
- // symbol: "BTC",
301
- // slug: "bitcoin",
302
- // is_sell_to_customer_active: 1,
303
- // is_fast_sell_to_customer_active: 1,
304
- // is_buy_from_customer_active: 1,
305
- // logo: "https://iranexchange.com/strapi/media/BTC_78d99b9d12.png",
306
- // dollar_price: 89240.18,
307
- // sell_to_iranicard_currency_price: 1234526,
308
- // buy_from_iranicard_currency_price: 1239474,
309
- // fast_sell_to_iranicard_currency_price: 1234526,
310
- // buy_from_iranicard_network_list: [
311
- // {
312
- // network: "BTC",
313
- // name: "Bitcoin",
314
- // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
315
- // coin: "BTC",
316
- // withdrawEnable: true,
317
- // depositEnable: true,
318
- // withdrawMin: "0.000100000",
319
- // withdrawMax: null,
320
- // withdrawFee: "0.000100000",
321
- // sameAddress: false,
322
- // memoRegex: null,
323
- // tradeEnable: true
324
- // }
325
- // ],
326
- // sell_to_iranicard_network_list: [
327
- // {
328
- // network: "BTC",
329
- // name: "Bitcoin",
330
- // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
331
- // coin: "BTC",
332
- // withdrawEnable: true,
333
- // depositEnable: true,
334
- // withdrawMin: "0.000100000",
335
- // withdrawMax: null,
336
- // withdrawFee: "0.000100000",
337
- // sameAddress: false,
338
- // memoRegex: null,
339
- // tradeEnable: true
340
- // }
341
- // ],
342
- // is_price_maker_active: 1,
343
- // quotation: {
344
- // maxPrice: "90199.99",
345
- // minPrice: "88925",
346
- // dailyChangePercent: "-0.26"
347
- // },
348
- // dailyChangePercent: -0.26,
349
- // order: 0,
350
- // stock_status: "in_stock",
351
- // stock_label: null,
352
- // stock_description: null
353
- // }
354
- const marketType = 'otc';
355
- const marketId = this.safeString(ticker, 'symbol') + '_' + 'IRT';
356
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
357
- const quotation = this.safeValue(ticker, 'quotation', {});
358
- const high = this.safeFloat(quotation, 'maxPrice', 0);
359
- const low = this.safeFloat(quotation, 'minPrice', 0);
360
- const bid = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0);
361
- const ask = this.safeFloat(ticker, 'buy_from_iranicard_currency_price', 0);
362
- const last = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0);
363
- const change = this.safeFloat(quotation, 'dailyChangePercent', 0);
364
- return this.safeTicker({
365
- 'symbol': symbol,
366
- 'timestamp': undefined,
367
- 'datetime': undefined,
368
- 'high': high,
369
- 'low': low,
370
- 'bid': bid,
371
- 'bidVolume': undefined,
372
- 'ask': ask,
373
- 'askVolume': undefined,
374
- 'vwap': undefined,
375
- 'open': last,
376
- 'close': last,
377
- 'last': last,
378
- 'previousClose': undefined,
379
- 'change': change,
380
- 'percentage': change,
381
- 'average': undefined,
382
- 'baseVolume': undefined,
383
- 'quoteVolume': undefined,
384
- 'info': ticker,
385
- }, market);
386
- }
387
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
388
- const query = this.omit(params, this.extractParams(path));
389
- let url = this.urls['api']['public'] + '/' + path + '?' + this.urlencode(query);
390
- if (params['id'] !== undefined) {
391
- url = this.urls['api']['public'] + '/' + path + '/' + params['id'];
392
- }
393
- headers = { 'Content-Type': 'application/json' };
394
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
395
- }
8
+ // ---------------------------------------------------------------------------
9
+ /**
10
+ * @class iranexchange
11
+ * @augments Exchange
12
+ * @description Set rateLimit to 1000 if fully verified
13
+ */
14
+ class iranexchange extends iranexchange$1["default"] {
15
+ describe() {
16
+ return this.deepExtend(super.describe(), {
17
+ 'id': 'iranexchange',
18
+ 'name': 'Iran Exchange',
19
+ 'countries': ['IR'],
20
+ 'rateLimit': 1000,
21
+ 'version': '1',
22
+ 'certified': false,
23
+ 'pro': false,
24
+ 'timeout': 30000,
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
+ '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/iran-exchange/64x64.png',
91
+ 'api': {
92
+ 'public': 'https://api.iranexchange.com/api/public/modules/crypto',
93
+ },
94
+ 'www': 'https://iranexchange.com/',
95
+ 'doc': [
96
+ 'https://iranexchange.com/',
97
+ ],
98
+ },
99
+ 'api': {
100
+ 'public': {
101
+ 'get': {
102
+ 'v1/client/listProduct': 1,
103
+ 'v1/client/getBySymbol': 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 iranexchange#fetchMarkets
121
+ * @description retrieves data on all markets for iranexchange
122
+ * @see https://iranexchange.co/
123
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
124
+ * @returns {object[]} an array of objects representing market data
125
+ */
126
+ const response = await this.publicGetV1ClientListProduct();
127
+ const markets = this.safeList(response, 'data');
128
+ const result = [];
129
+ for (let i = 0; i < markets.length; i++) {
130
+ const market = this.parseMarket(markets[i]);
131
+ result.push(market);
132
+ }
133
+ return result;
134
+ }
135
+ parseMarket(market) {
136
+ // {
137
+ // _id: "60b08a57b202353abb592032",
138
+ // name: "Bitcoin",
139
+ // fa_name: "بیت کوین",
140
+ // symbol: "BTC",
141
+ // slug: "bitcoin",
142
+ // is_sell_to_customer_active: 1,
143
+ // is_fast_sell_to_customer_active: 1,
144
+ // is_buy_from_customer_active: 1,
145
+ // logo: "https://iranexchange.com/strapi/media/BTC_78d99b9d12.png",
146
+ // dollar_price: 89240.18,
147
+ // sell_to_iranicard_currency_price: 1234526,
148
+ // buy_from_iranicard_currency_price: 1239474,
149
+ // fast_sell_to_iranicard_currency_price: 1234526,
150
+ // buy_from_iranicard_network_list: [
151
+ // {
152
+ // network: "BTC",
153
+ // name: "Bitcoin",
154
+ // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
155
+ // coin: "BTC",
156
+ // withdrawEnable: true,
157
+ // depositEnable: true,
158
+ // withdrawMin: "0.000100000",
159
+ // withdrawMax: null,
160
+ // withdrawFee: "0.000100000",
161
+ // sameAddress: false,
162
+ // memoRegex: null,
163
+ // tradeEnable: true
164
+ // }
165
+ // ],
166
+ // sell_to_iranicard_network_list: [
167
+ // {
168
+ // network: "BTC",
169
+ // name: "Bitcoin",
170
+ // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
171
+ // coin: "BTC",
172
+ // withdrawEnable: true,
173
+ // depositEnable: true,
174
+ // withdrawMin: "0.000100000",
175
+ // withdrawMax: null,
176
+ // withdrawFee: "0.000100000",
177
+ // sameAddress: false,
178
+ // memoRegex: null,
179
+ // tradeEnable: true
180
+ // }
181
+ // ],
182
+ // is_price_maker_active: 1,
183
+ // quotation: {
184
+ // maxPrice: "90199.99",
185
+ // minPrice: "88925",
186
+ // dailyChangePercent: "-0.26"
187
+ // },
188
+ // dailyChangePercent: -0.26,
189
+ // order: 0,
190
+ // stock_status: "in_stock",
191
+ // stock_label: null,
192
+ // stock_description: null
193
+ // },
194
+ const id = this.safeString(market, 'symbol') + '_' + 'IRT';
195
+ let baseId = this.safeString(market, 'symbol');
196
+ let quoteId = 'IRT';
197
+ const base = this.safeCurrencyCode(baseId);
198
+ const quote = this.safeCurrencyCode(quoteId);
199
+ baseId = baseId.toLowerCase();
200
+ quoteId = quoteId.toLowerCase();
201
+ return {
202
+ 'id': id,
203
+ 'symbol': base + '/' + quote,
204
+ 'base': base,
205
+ 'quote': quote,
206
+ 'settle': undefined,
207
+ 'baseId': baseId,
208
+ 'quoteId': quoteId,
209
+ 'settleId': undefined,
210
+ 'type': 'otc',
211
+ 'spot': false,
212
+ 'margin': false,
213
+ 'swap': false,
214
+ 'future': false,
215
+ 'option': false,
216
+ 'active': true,
217
+ 'contract': false,
218
+ 'linear': undefined,
219
+ 'inverse': undefined,
220
+ 'contractSize': undefined,
221
+ 'expiry': undefined,
222
+ 'expiryDatetime': undefined,
223
+ 'strike': undefined,
224
+ 'optionType': undefined,
225
+ 'precision': {
226
+ 'amount': undefined,
227
+ 'price': undefined,
228
+ },
229
+ 'limits': {
230
+ 'leverage': {
231
+ 'min': undefined,
232
+ 'max': undefined,
233
+ },
234
+ 'amount': {
235
+ 'min': undefined,
236
+ 'max': undefined,
237
+ },
238
+ 'price': {
239
+ 'min': undefined,
240
+ 'max': undefined,
241
+ },
242
+ 'cost': {
243
+ 'min': undefined,
244
+ 'max': undefined,
245
+ },
246
+ },
247
+ 'created': undefined,
248
+ 'info': market,
249
+ };
250
+ }
251
+ async fetchTickers(symbols = undefined, params = {}) {
252
+ /**
253
+ * @method
254
+ * @name iranexchange#fetchTickers
255
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
256
+ * @see https://iranexchange.co/
257
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
258
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
259
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
260
+ */
261
+ await this.loadMarkets();
262
+ if (symbols !== undefined) {
263
+ symbols = this.marketSymbols(symbols);
264
+ }
265
+ const response = await this.publicGetV1ClientListProduct();
266
+ const markets = this.safeList(response, 'data');
267
+ const result = {};
268
+ for (let i = 0; i < markets.length; i++) {
269
+ const ticker = this.parseTicker(markets[i]);
270
+ const symbol = ticker['symbol'];
271
+ result[symbol] = ticker;
272
+ }
273
+ return this.filterByArrayTickers(result, 'symbol', symbols);
274
+ }
275
+ async fetchTicker(symbol, params = {}) {
276
+ /**
277
+ * @method
278
+ * @name iranexchange#fetchTicker
279
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
280
+ * @see https://iranexchange.co/
281
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
282
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
283
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
284
+ */
285
+ await this.loadMarkets();
286
+ const market = this.market(symbol);
287
+ const request = {
288
+ 'id': market['base'],
289
+ };
290
+ const response = await this.publicGetV1ClientGetBySymbol(request);
291
+ const marketData = this.safeDict(response, 'data');
292
+ const ticker = this.parseTicker(marketData);
293
+ return ticker;
294
+ }
295
+ parseTicker(ticker, market = undefined) {
296
+ // {
297
+ // _id: "60b08a57b202353abb592032",
298
+ // name: "Bitcoin",
299
+ // fa_name: "بیت کوین",
300
+ // symbol: "BTC",
301
+ // slug: "bitcoin",
302
+ // is_sell_to_customer_active: 1,
303
+ // is_fast_sell_to_customer_active: 1,
304
+ // is_buy_from_customer_active: 1,
305
+ // logo: "https://iranexchange.com/strapi/media/BTC_78d99b9d12.png",
306
+ // dollar_price: 89240.18,
307
+ // sell_to_iranicard_currency_price: 1234526,
308
+ // buy_from_iranicard_currency_price: 1239474,
309
+ // fast_sell_to_iranicard_currency_price: 1234526,
310
+ // buy_from_iranicard_network_list: [
311
+ // {
312
+ // network: "BTC",
313
+ // name: "Bitcoin",
314
+ // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
315
+ // coin: "BTC",
316
+ // withdrawEnable: true,
317
+ // depositEnable: true,
318
+ // withdrawMin: "0.000100000",
319
+ // withdrawMax: null,
320
+ // withdrawFee: "0.000100000",
321
+ // sameAddress: false,
322
+ // memoRegex: null,
323
+ // tradeEnable: true
324
+ // }
325
+ // ],
326
+ // sell_to_iranicard_network_list: [
327
+ // {
328
+ // network: "BTC",
329
+ // name: "Bitcoin",
330
+ // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
331
+ // coin: "BTC",
332
+ // withdrawEnable: true,
333
+ // depositEnable: true,
334
+ // withdrawMin: "0.000100000",
335
+ // withdrawMax: null,
336
+ // withdrawFee: "0.000100000",
337
+ // sameAddress: false,
338
+ // memoRegex: null,
339
+ // tradeEnable: true
340
+ // }
341
+ // ],
342
+ // is_price_maker_active: 1,
343
+ // quotation: {
344
+ // maxPrice: "90199.99",
345
+ // minPrice: "88925",
346
+ // dailyChangePercent: "-0.26"
347
+ // },
348
+ // dailyChangePercent: -0.26,
349
+ // order: 0,
350
+ // stock_status: "in_stock",
351
+ // stock_label: null,
352
+ // stock_description: null
353
+ // }
354
+ const marketType = 'otc';
355
+ const marketId = this.safeString(ticker, 'symbol') + '_' + 'IRT';
356
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
357
+ const quotation = this.safeValue(ticker, 'quotation', {});
358
+ const dollar_price = this.safeFloat(ticker, 'dollar_price', 0);
359
+ const high = this.safeFloat(quotation, 'maxPrice', 0) * dollar_price;
360
+ const low = this.safeFloat(quotation, 'minPrice', 0) * dollar_price;
361
+ const bid = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price;
362
+ const ask = this.safeFloat(ticker, 'buy_from_iranicard_currency_price', 0) * dollar_price;
363
+ const last = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price;
364
+ const change = this.safeFloat(quotation, 'dailyChangePercent', 0);
365
+ return this.safeTicker({
366
+ 'symbol': symbol,
367
+ 'timestamp': undefined,
368
+ 'datetime': undefined,
369
+ 'high': high,
370
+ 'low': low,
371
+ 'bid': bid,
372
+ 'bidVolume': undefined,
373
+ 'ask': ask,
374
+ 'askVolume': undefined,
375
+ 'vwap': undefined,
376
+ 'open': last,
377
+ 'close': last,
378
+ 'last': last,
379
+ 'previousClose': undefined,
380
+ 'change': change,
381
+ 'percentage': change,
382
+ 'average': undefined,
383
+ 'baseVolume': undefined,
384
+ 'quoteVolume': undefined,
385
+ 'info': ticker,
386
+ }, market);
387
+ }
388
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
389
+ const query = this.omit(params, this.extractParams(path));
390
+ let url = this.urls['api']['public'] + '/' + path + '?' + this.urlencode(query);
391
+ const pair_id = this.safeString(params, 'id');
392
+ if (pair_id !== undefined) {
393
+ url = this.urls['api']['public'] + '/' + path + '/' + pair_id;
394
+ }
395
+ headers = { 'Content-Type': 'application/json' };
396
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
397
+ }
396
398
  }
397
399
 
398
400
  exports["default"] = iranexchange;