ccxt-ir 4.18.0 → 4.18.1

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 (98) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +257 -257
  4. package/dist/cjs/package.json +1 -1
  5. package/dist/cjs/src/baazar.js +150 -150
  6. package/dist/cjs/src/base/Exchange.js +7364 -7364
  7. package/dist/cjs/src/daric.js +171 -171
  8. package/dist/cjs/src/digikalagold.js +167 -167
  9. package/dist/cjs/src/goldika.js +153 -153
  10. package/dist/cjs/src/goldis.js +147 -147
  11. package/dist/cjs/src/hamrahgold.js +161 -161
  12. package/dist/cjs/src/iranexchange.js +390 -390
  13. package/dist/cjs/src/melligold.js +210 -210
  14. package/dist/cjs/src/milligold.js +146 -146
  15. package/dist/cjs/src/talaavan.js +155 -0
  16. package/dist/cjs/src/talapp.js +146 -146
  17. package/dist/cjs/src/technogold.js +143 -143
  18. package/dist/cjs/src/wallgold.js +154 -154
  19. package/dist/cjs/src/zarafza.js +149 -149
  20. package/dist/cjs/src/zarminex.js +152 -152
  21. package/dist/cjs/src/zarniv.js +168 -168
  22. package/js/ccxt.d.ts +751 -751
  23. package/js/ccxt.js +543 -543
  24. package/js/src/abstract/baazar.d.ts +8 -8
  25. package/js/src/abstract/baazar.js +5 -5
  26. package/js/src/abstract/daric.d.ts +8 -8
  27. package/js/src/abstract/daric.js +5 -5
  28. package/js/src/abstract/digikalagold.d.ts +8 -8
  29. package/js/src/abstract/digikalagold.js +5 -5
  30. package/js/src/abstract/goldika.d.ts +8 -8
  31. package/js/src/abstract/goldika.js +5 -5
  32. package/js/src/abstract/goldis.d.ts +8 -8
  33. package/js/src/abstract/goldis.js +5 -5
  34. package/js/src/abstract/hamrahgold.d.ts +8 -8
  35. package/js/src/abstract/hamrahgold.js +5 -5
  36. package/js/src/abstract/melligold.d.ts +8 -8
  37. package/js/src/abstract/melligold.js +5 -5
  38. package/js/src/abstract/milligold.d.ts +8 -8
  39. package/js/src/abstract/milligold.js +5 -5
  40. package/js/src/abstract/talaavan.d.ts +8 -0
  41. package/js/src/abstract/talaavan.js +11 -0
  42. package/js/src/abstract/talapp.d.ts +8 -8
  43. package/js/src/abstract/talapp.js +5 -5
  44. package/js/src/abstract/technogold.d.ts +8 -8
  45. package/js/src/abstract/technogold.js +5 -5
  46. package/js/src/abstract/wallgold.d.ts +8 -8
  47. package/js/src/abstract/wallgold.js +5 -5
  48. package/js/src/abstract/zarafza.d.ts +8 -8
  49. package/js/src/abstract/zarafza.js +5 -5
  50. package/js/src/abstract/zarminex.d.ts +8 -8
  51. package/js/src/abstract/zarminex.js +5 -5
  52. package/js/src/abstract/zarniv.d.ts +9 -9
  53. package/js/src/abstract/zarniv.js +5 -5
  54. package/js/src/baazar.d.ts +20 -20
  55. package/js/src/baazar.js +153 -153
  56. package/js/src/base/Exchange.d.ts +926 -926
  57. package/js/src/base/Exchange.js +7397 -7397
  58. package/js/src/coinbaseexchange.d.ts +334 -334
  59. package/js/src/daric.d.ts +22 -22
  60. package/js/src/daric.js +174 -174
  61. package/js/src/digikalagold.d.ts +21 -21
  62. package/js/src/digikalagold.js +171 -171
  63. package/js/src/goldika.d.ts +20 -20
  64. package/js/src/goldika.js +156 -156
  65. package/js/src/goldis.d.ts +21 -21
  66. package/js/src/goldis.js +150 -150
  67. package/js/src/hamrahgold.d.ts +21 -21
  68. package/js/src/hamrahgold.js +164 -164
  69. package/js/src/iranexchange.js +393 -393
  70. package/js/src/melligold.d.ts +21 -21
  71. package/js/src/melligold.js +214 -214
  72. package/js/src/milligold.d.ts +20 -20
  73. package/js/src/milligold.js +149 -149
  74. package/js/src/protobuf/mexc/compiled.d.cts +2 -2
  75. package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
  76. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  77. package/js/src/static_dependencies/qs/formats.d.cts +8 -8
  78. package/js/src/static_dependencies/qs/index.d.cts +4 -4
  79. package/js/src/static_dependencies/qs/parse.d.cts +2 -2
  80. package/js/src/static_dependencies/qs/stringify.d.cts +2 -2
  81. package/js/src/static_dependencies/qs/utils.d.cts +9 -9
  82. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  83. package/js/src/{goldcore.d.ts → talaavan.d.ts} +20 -20
  84. package/js/src/{goldcore.js → talaavan.js} +148 -148
  85. package/js/src/talapp.d.ts +20 -20
  86. package/js/src/talapp.js +149 -149
  87. package/js/src/technogold.d.ts +20 -20
  88. package/js/src/technogold.js +146 -146
  89. package/js/src/wallgold.d.ts +21 -21
  90. package/js/src/wallgold.js +157 -157
  91. package/js/src/zarafza.d.ts +20 -20
  92. package/js/src/zarafza.js +152 -152
  93. package/js/src/zarminex.d.ts +20 -20
  94. package/js/src/zarminex.js +155 -155
  95. package/js/src/zarniv.d.ts +21 -21
  96. package/js/src/zarniv.js +171 -171
  97. package/js/test.js +61 -68
  98. package/package.json +1 -1
@@ -4,396 +4,396 @@
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/iranexchange.js';
9
- // ---------------------------------------------------------------------------
10
- /**
11
- * @class iranexchange
12
- * @augments Exchange
13
- * @description Set rateLimit to 1000 if fully verified
14
- */
15
- export default class iranexchange extends Exchange {
16
- describe() {
17
- return this.deepExtend(super.describe(), {
18
- 'id': 'iranexchange',
19
- 'name': 'Iran Exchange',
20
- 'countries': ['IR'],
21
- 'rateLimit': 1000,
22
- 'version': '1',
23
- 'certified': false,
24
- 'pro': false,
25
- 'timeout': 30000,
26
- 'has': {
27
- 'CORS': undefined,
28
- 'spot': false,
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
- 'fetchLedger': false,
62
- 'fetchLedgerEntry': false,
63
- 'fetchLeverageTiers': false,
64
- 'fetchMarkets': true,
65
- 'fetchMarkOHLCV': false,
66
- 'fetchMyTrades': false,
67
- 'fetchOHLCV': false,
68
- 'fetchOpenInterestHistory': false,
69
- 'fetchOpenOrders': false,
70
- 'fetchOrder': false,
71
- 'fetchOrderBook': false,
72
- 'fetchOrders': false,
73
- 'fetchOrderTrades': 'emulated',
74
- 'fetchPositions': false,
75
- 'fetchPremiumIndexOHLCV': false,
76
- 'fetchTicker': true,
77
- 'fetchTickers': true,
78
- 'fetchTime': false,
79
- 'fetchTrades': false,
80
- 'fetchTradingFee': false,
81
- 'fetchTradingFees': false,
82
- 'fetchWithdrawals': false,
83
- 'otc': true,
84
- 'setLeverage': false,
85
- 'setMarginMode': false,
86
- 'transfer': false,
87
- 'withdraw': false,
88
- },
89
- 'comment': 'This comment is optional',
90
- 'urls': {
91
- 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/iran-exchange/64x64.png',
92
- 'api': {
93
- 'public': 'https://api.iranexchange.com/api/public/modules/crypto',
94
- },
95
- 'www': 'https://iranexchange.com/',
96
- 'doc': [
97
- 'https://iranexchange.com/',
98
- ],
99
- },
100
- 'api': {
101
- 'public': {
102
- 'get': {
103
- 'v1/client/listProduct': 1,
104
- 'v1/client/getBySymbol': 1,
105
- },
106
- },
107
- },
108
- 'fees': {
109
- 'trading': {
110
- 'tierBased': false,
111
- 'percentage': true,
112
- 'maker': this.parseNumber('0.001'),
113
- 'taker': this.parseNumber('0.001'),
114
- },
115
- },
116
- });
117
- }
118
- async fetchMarkets(params = {}) {
119
- /**
120
- * @method
121
- * @name iranexchange#fetchMarkets
122
- * @description retrieves data on all markets for iranexchange
123
- * @see https://iranexchange.co/
124
- * @param {object} [params] extra parameters specific to the exchange API endpoint
125
- * @returns {object[]} an array of objects representing market data
126
- */
127
- const response = await this.publicGetV1ClientListProduct();
128
- const markets = this.safeList(response, 'data');
129
- const result = [];
130
- for (let i = 0; i < markets.length; i++) {
131
- const market = this.parseMarket(markets[i]);
132
- result.push(market);
133
- }
134
- return result;
135
- }
136
- parseMarket(market) {
137
- // {
138
- // _id: "60b08a57b202353abb592032",
139
- // name: "Bitcoin",
140
- // fa_name: "بیت کوین",
141
- // symbol: "BTC",
142
- // slug: "bitcoin",
143
- // is_sell_to_customer_active: 1,
144
- // is_fast_sell_to_customer_active: 1,
145
- // is_buy_from_customer_active: 1,
146
- // logo: "https://iranexchange.com/strapi/media/BTC_78d99b9d12.png",
147
- // dollar_price: 89240.18,
148
- // sell_to_iranicard_currency_price: 1234526,
149
- // buy_from_iranicard_currency_price: 1239474,
150
- // fast_sell_to_iranicard_currency_price: 1234526,
151
- // buy_from_iranicard_network_list: [
152
- // {
153
- // network: "BTC",
154
- // name: "Bitcoin",
155
- // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
156
- // coin: "BTC",
157
- // withdrawEnable: true,
158
- // depositEnable: true,
159
- // withdrawMin: "0.000100000",
160
- // withdrawMax: null,
161
- // withdrawFee: "0.000100000",
162
- // sameAddress: false,
163
- // memoRegex: null,
164
- // tradeEnable: true
165
- // }
166
- // ],
167
- // sell_to_iranicard_network_list: [
168
- // {
169
- // network: "BTC",
170
- // name: "Bitcoin",
171
- // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
172
- // coin: "BTC",
173
- // withdrawEnable: true,
174
- // depositEnable: true,
175
- // withdrawMin: "0.000100000",
176
- // withdrawMax: null,
177
- // withdrawFee: "0.000100000",
178
- // sameAddress: false,
179
- // memoRegex: null,
180
- // tradeEnable: true
181
- // }
182
- // ],
183
- // is_price_maker_active: 1,
184
- // quotation: {
185
- // maxPrice: "90199.99",
186
- // minPrice: "88925",
187
- // dailyChangePercent: "-0.26"
188
- // },
189
- // dailyChangePercent: -0.26,
190
- // order: 0,
191
- // stock_status: "in_stock",
192
- // stock_label: null,
193
- // stock_description: null
194
- // },
195
- const id = this.safeString(market, 'symbol') + '_' + 'IRT';
196
- let baseId = this.safeString(market, 'symbol');
197
- let quoteId = 'IRT';
198
- const base = this.safeCurrencyCode(baseId);
199
- const quote = this.safeCurrencyCode(quoteId);
200
- baseId = baseId.toLowerCase();
201
- quoteId = quoteId.toLowerCase();
202
- return {
203
- 'id': id,
204
- 'symbol': base + '/' + quote,
205
- 'base': base,
206
- 'quote': quote,
207
- 'settle': undefined,
208
- 'baseId': baseId,
209
- 'quoteId': quoteId,
210
- 'settleId': undefined,
211
- 'type': 'otc',
212
- 'spot': false,
213
- 'margin': false,
214
- 'swap': false,
215
- 'future': false,
216
- 'option': false,
217
- 'active': true,
218
- 'contract': false,
219
- 'linear': undefined,
220
- 'inverse': undefined,
221
- 'contractSize': undefined,
222
- 'expiry': undefined,
223
- 'expiryDatetime': undefined,
224
- 'strike': undefined,
225
- 'optionType': undefined,
226
- 'precision': {
227
- 'amount': undefined,
228
- 'price': undefined,
229
- },
230
- 'limits': {
231
- 'leverage': {
232
- 'min': undefined,
233
- 'max': undefined,
234
- },
235
- 'amount': {
236
- 'min': undefined,
237
- 'max': undefined,
238
- },
239
- 'price': {
240
- 'min': undefined,
241
- 'max': undefined,
242
- },
243
- 'cost': {
244
- 'min': undefined,
245
- 'max': undefined,
246
- },
247
- },
248
- 'created': undefined,
249
- 'info': market,
250
- };
251
- }
252
- async fetchTickers(symbols = undefined, params = {}) {
253
- /**
254
- * @method
255
- * @name iranexchange#fetchTickers
256
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
257
- * @see https://iranexchange.co/
258
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
259
- * @param {object} [params] extra parameters specific to the exchange API endpoint
260
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
261
- */
262
- await this.loadMarkets();
263
- if (symbols !== undefined) {
264
- symbols = this.marketSymbols(symbols);
265
- }
266
- const response = await this.publicGetV1ClientListProduct();
267
- const markets = this.safeList(response, 'data');
268
- const result = {};
269
- for (let i = 0; i < markets.length; i++) {
270
- const ticker = this.parseTicker(markets[i]);
271
- const symbol = ticker['symbol'];
272
- result[symbol] = ticker;
273
- }
274
- return this.filterByArrayTickers(result, 'symbol', symbols);
275
- }
276
- async fetchTicker(symbol, params = {}) {
277
- /**
278
- * @method
279
- * @name iranexchange#fetchTicker
280
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
281
- * @see https://iranexchange.co/
282
- * @param {string} symbol unified symbol of the market to fetch the ticker for
283
- * @param {object} [params] extra parameters specific to the exchange API endpoint
284
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
285
- */
286
- await this.loadMarkets();
287
- const market = this.market(symbol);
288
- const request = {
289
- 'id': market['base'],
290
- };
291
- const response = await this.publicGetV1ClientGetBySymbol(request);
292
- const marketData = this.safeDict(response, 'data');
293
- const ticker = this.parseTicker(marketData);
294
- return ticker;
295
- }
296
- parseTicker(ticker, market = undefined) {
297
- // {
298
- // _id: "60b08a57b202353abb592032",
299
- // name: "Bitcoin",
300
- // fa_name: "بیت کوین",
301
- // symbol: "BTC",
302
- // slug: "bitcoin",
303
- // is_sell_to_customer_active: 1,
304
- // is_fast_sell_to_customer_active: 1,
305
- // is_buy_from_customer_active: 1,
306
- // logo: "https://iranexchange.com/strapi/media/BTC_78d99b9d12.png",
307
- // dollar_price: 89240.18,
308
- // sell_to_iranicard_currency_price: 1234526,
309
- // buy_from_iranicard_currency_price: 1239474,
310
- // fast_sell_to_iranicard_currency_price: 1234526,
311
- // buy_from_iranicard_network_list: [
312
- // {
313
- // network: "BTC",
314
- // name: "Bitcoin",
315
- // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
316
- // coin: "BTC",
317
- // withdrawEnable: true,
318
- // depositEnable: true,
319
- // withdrawMin: "0.000100000",
320
- // withdrawMax: null,
321
- // withdrawFee: "0.000100000",
322
- // sameAddress: false,
323
- // memoRegex: null,
324
- // tradeEnable: true
325
- // }
326
- // ],
327
- // sell_to_iranicard_network_list: [
328
- // {
329
- // network: "BTC",
330
- // name: "Bitcoin",
331
- // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
332
- // coin: "BTC",
333
- // withdrawEnable: true,
334
- // depositEnable: true,
335
- // withdrawMin: "0.000100000",
336
- // withdrawMax: null,
337
- // withdrawFee: "0.000100000",
338
- // sameAddress: false,
339
- // memoRegex: null,
340
- // tradeEnable: true
341
- // }
342
- // ],
343
- // is_price_maker_active: 1,
344
- // quotation: {
345
- // maxPrice: "90199.99",
346
- // minPrice: "88925",
347
- // dailyChangePercent: "-0.26"
348
- // },
349
- // dailyChangePercent: -0.26,
350
- // order: 0,
351
- // stock_status: "in_stock",
352
- // stock_label: null,
353
- // stock_description: null
354
- // }
355
- const marketType = 'otc';
356
- const marketId = this.safeString(ticker, 'symbol') + '_' + 'IRT';
357
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
358
- const quotation = this.safeValue(ticker, 'quotation', {});
359
- const dollar_price = this.safeFloat(ticker, 'dollar_price', 0);
360
- const high = this.safeFloat(quotation, 'maxPrice', 0) * dollar_price / 10;
361
- const low = this.safeFloat(quotation, 'minPrice', 0) * dollar_price / 10;
362
- const bid = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price / 10;
363
- const ask = this.safeFloat(ticker, 'buy_from_iranicard_currency_price', 0) * dollar_price / 10;
364
- const last = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price / 10;
365
- const change = this.safeFloat(quotation, 'dailyChangePercent', 0);
366
- return this.safeTicker({
367
- 'symbol': symbol,
368
- 'timestamp': undefined,
369
- 'datetime': undefined,
370
- 'high': high,
371
- 'low': low,
372
- 'bid': bid,
373
- 'bidVolume': undefined,
374
- 'ask': ask,
375
- 'askVolume': undefined,
376
- 'vwap': undefined,
377
- 'open': last,
378
- 'close': last,
379
- 'last': last,
380
- 'previousClose': undefined,
381
- 'change': change,
382
- 'percentage': change,
383
- 'average': undefined,
384
- 'baseVolume': undefined,
385
- 'quoteVolume': undefined,
386
- 'info': ticker,
387
- }, market);
388
- }
389
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
390
- const query = this.omit(params, this.extractParams(path));
391
- let url = this.urls['api']['public'] + '/' + path + '?' + this.urlencode(query);
392
- const pair_id = this.safeString(params, 'id');
393
- if (pair_id !== undefined) {
394
- url = this.urls['api']['public'] + '/' + path + '/' + pair_id;
395
- }
396
- headers = { 'Content-Type': 'application/json' };
397
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
398
- }
399
- }
7
+ // ---------------------------------------------------------------------------
8
+ import Exchange from './abstract/iranexchange.js';
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * @class iranexchange
12
+ * @augments Exchange
13
+ * @description Set rateLimit to 1000 if fully verified
14
+ */
15
+ export default class iranexchange extends Exchange {
16
+ describe() {
17
+ return this.deepExtend(super.describe(), {
18
+ 'id': 'iranexchange',
19
+ 'name': 'Iran Exchange',
20
+ 'countries': ['IR'],
21
+ 'rateLimit': 1000,
22
+ 'version': '1',
23
+ 'certified': false,
24
+ 'pro': false,
25
+ 'timeout': 30000,
26
+ 'has': {
27
+ 'CORS': undefined,
28
+ 'spot': false,
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
+ 'fetchLedger': false,
62
+ 'fetchLedgerEntry': false,
63
+ 'fetchLeverageTiers': false,
64
+ 'fetchMarkets': true,
65
+ 'fetchMarkOHLCV': false,
66
+ 'fetchMyTrades': false,
67
+ 'fetchOHLCV': false,
68
+ 'fetchOpenInterestHistory': false,
69
+ 'fetchOpenOrders': false,
70
+ 'fetchOrder': false,
71
+ 'fetchOrderBook': false,
72
+ 'fetchOrders': false,
73
+ 'fetchOrderTrades': 'emulated',
74
+ 'fetchPositions': false,
75
+ 'fetchPremiumIndexOHLCV': false,
76
+ 'fetchTicker': true,
77
+ 'fetchTickers': true,
78
+ 'fetchTime': false,
79
+ 'fetchTrades': false,
80
+ 'fetchTradingFee': false,
81
+ 'fetchTradingFees': false,
82
+ 'fetchWithdrawals': false,
83
+ 'otc': true,
84
+ 'setLeverage': false,
85
+ 'setMarginMode': false,
86
+ 'transfer': false,
87
+ 'withdraw': false,
88
+ },
89
+ 'comment': 'This comment is optional',
90
+ 'urls': {
91
+ 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/iran-exchange/64x64.png',
92
+ 'api': {
93
+ 'public': 'https://api.iranexchange.com/api/public/modules/crypto',
94
+ },
95
+ 'www': 'https://iranexchange.com/',
96
+ 'doc': [
97
+ 'https://iranexchange.com/',
98
+ ],
99
+ },
100
+ 'api': {
101
+ 'public': {
102
+ 'get': {
103
+ 'v1/client/listProduct': 1,
104
+ 'v1/client/getBySymbol': 1,
105
+ },
106
+ },
107
+ },
108
+ 'fees': {
109
+ 'trading': {
110
+ 'tierBased': false,
111
+ 'percentage': true,
112
+ 'maker': this.parseNumber('0.001'),
113
+ 'taker': this.parseNumber('0.001'),
114
+ },
115
+ },
116
+ });
117
+ }
118
+ async fetchMarkets(params = {}) {
119
+ /**
120
+ * @method
121
+ * @name iranexchange#fetchMarkets
122
+ * @description retrieves data on all markets for iranexchange
123
+ * @see https://iranexchange.co/
124
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
125
+ * @returns {object[]} an array of objects representing market data
126
+ */
127
+ const response = await this.publicGetV1ClientListProduct();
128
+ const markets = this.safeList(response, 'data');
129
+ const result = [];
130
+ for (let i = 0; i < markets.length; i++) {
131
+ const market = this.parseMarket(markets[i]);
132
+ result.push(market);
133
+ }
134
+ return result;
135
+ }
136
+ parseMarket(market) {
137
+ // {
138
+ // _id: "60b08a57b202353abb592032",
139
+ // name: "Bitcoin",
140
+ // fa_name: "بیت کوین",
141
+ // symbol: "BTC",
142
+ // slug: "bitcoin",
143
+ // is_sell_to_customer_active: 1,
144
+ // is_fast_sell_to_customer_active: 1,
145
+ // is_buy_from_customer_active: 1,
146
+ // logo: "https://iranexchange.com/strapi/media/BTC_78d99b9d12.png",
147
+ // dollar_price: 89240.18,
148
+ // sell_to_iranicard_currency_price: 1234526,
149
+ // buy_from_iranicard_currency_price: 1239474,
150
+ // fast_sell_to_iranicard_currency_price: 1234526,
151
+ // buy_from_iranicard_network_list: [
152
+ // {
153
+ // network: "BTC",
154
+ // name: "Bitcoin",
155
+ // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
156
+ // coin: "BTC",
157
+ // withdrawEnable: true,
158
+ // depositEnable: true,
159
+ // withdrawMin: "0.000100000",
160
+ // withdrawMax: null,
161
+ // withdrawFee: "0.000100000",
162
+ // sameAddress: false,
163
+ // memoRegex: null,
164
+ // tradeEnable: true
165
+ // }
166
+ // ],
167
+ // sell_to_iranicard_network_list: [
168
+ // {
169
+ // network: "BTC",
170
+ // name: "Bitcoin",
171
+ // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
172
+ // coin: "BTC",
173
+ // withdrawEnable: true,
174
+ // depositEnable: true,
175
+ // withdrawMin: "0.000100000",
176
+ // withdrawMax: null,
177
+ // withdrawFee: "0.000100000",
178
+ // sameAddress: false,
179
+ // memoRegex: null,
180
+ // tradeEnable: true
181
+ // }
182
+ // ],
183
+ // is_price_maker_active: 1,
184
+ // quotation: {
185
+ // maxPrice: "90199.99",
186
+ // minPrice: "88925",
187
+ // dailyChangePercent: "-0.26"
188
+ // },
189
+ // dailyChangePercent: -0.26,
190
+ // order: 0,
191
+ // stock_status: "in_stock",
192
+ // stock_label: null,
193
+ // stock_description: null
194
+ // },
195
+ const id = this.safeString(market, 'symbol') + '_' + 'IRT';
196
+ let baseId = this.safeString(market, 'symbol');
197
+ let quoteId = 'IRT';
198
+ const base = this.safeCurrencyCode(baseId);
199
+ const quote = this.safeCurrencyCode(quoteId);
200
+ baseId = baseId.toLowerCase();
201
+ quoteId = quoteId.toLowerCase();
202
+ return {
203
+ 'id': id,
204
+ 'symbol': base + '/' + quote,
205
+ 'base': base,
206
+ 'quote': quote,
207
+ 'settle': undefined,
208
+ 'baseId': baseId,
209
+ 'quoteId': quoteId,
210
+ 'settleId': undefined,
211
+ 'type': 'otc',
212
+ 'spot': false,
213
+ 'margin': false,
214
+ 'swap': false,
215
+ 'future': false,
216
+ 'option': false,
217
+ 'active': true,
218
+ 'contract': false,
219
+ 'linear': undefined,
220
+ 'inverse': undefined,
221
+ 'contractSize': undefined,
222
+ 'expiry': undefined,
223
+ 'expiryDatetime': undefined,
224
+ 'strike': undefined,
225
+ 'optionType': undefined,
226
+ 'precision': {
227
+ 'amount': undefined,
228
+ 'price': undefined,
229
+ },
230
+ 'limits': {
231
+ 'leverage': {
232
+ 'min': undefined,
233
+ 'max': undefined,
234
+ },
235
+ 'amount': {
236
+ 'min': undefined,
237
+ 'max': undefined,
238
+ },
239
+ 'price': {
240
+ 'min': undefined,
241
+ 'max': undefined,
242
+ },
243
+ 'cost': {
244
+ 'min': undefined,
245
+ 'max': undefined,
246
+ },
247
+ },
248
+ 'created': undefined,
249
+ 'info': market,
250
+ };
251
+ }
252
+ async fetchTickers(symbols = undefined, params = {}) {
253
+ /**
254
+ * @method
255
+ * @name iranexchange#fetchTickers
256
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
257
+ * @see https://iranexchange.co/
258
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
259
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
260
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
261
+ */
262
+ await this.loadMarkets();
263
+ if (symbols !== undefined) {
264
+ symbols = this.marketSymbols(symbols);
265
+ }
266
+ const response = await this.publicGetV1ClientListProduct();
267
+ const markets = this.safeList(response, 'data');
268
+ const result = {};
269
+ for (let i = 0; i < markets.length; i++) {
270
+ const ticker = this.parseTicker(markets[i]);
271
+ const symbol = ticker['symbol'];
272
+ result[symbol] = ticker;
273
+ }
274
+ return this.filterByArrayTickers(result, 'symbol', symbols);
275
+ }
276
+ async fetchTicker(symbol, params = {}) {
277
+ /**
278
+ * @method
279
+ * @name iranexchange#fetchTicker
280
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
281
+ * @see https://iranexchange.co/
282
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
283
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
284
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
285
+ */
286
+ await this.loadMarkets();
287
+ const market = this.market(symbol);
288
+ const request = {
289
+ 'id': market['base'],
290
+ };
291
+ const response = await this.publicGetV1ClientGetBySymbol(request);
292
+ const marketData = this.safeDict(response, 'data');
293
+ const ticker = this.parseTicker(marketData);
294
+ return ticker;
295
+ }
296
+ parseTicker(ticker, market = undefined) {
297
+ // {
298
+ // _id: "60b08a57b202353abb592032",
299
+ // name: "Bitcoin",
300
+ // fa_name: "بیت کوین",
301
+ // symbol: "BTC",
302
+ // slug: "bitcoin",
303
+ // is_sell_to_customer_active: 1,
304
+ // is_fast_sell_to_customer_active: 1,
305
+ // is_buy_from_customer_active: 1,
306
+ // logo: "https://iranexchange.com/strapi/media/BTC_78d99b9d12.png",
307
+ // dollar_price: 89240.18,
308
+ // sell_to_iranicard_currency_price: 1234526,
309
+ // buy_from_iranicard_currency_price: 1239474,
310
+ // fast_sell_to_iranicard_currency_price: 1234526,
311
+ // buy_from_iranicard_network_list: [
312
+ // {
313
+ // network: "BTC",
314
+ // name: "Bitcoin",
315
+ // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
316
+ // coin: "BTC",
317
+ // withdrawEnable: true,
318
+ // depositEnable: true,
319
+ // withdrawMin: "0.000100000",
320
+ // withdrawMax: null,
321
+ // withdrawFee: "0.000100000",
322
+ // sameAddress: false,
323
+ // memoRegex: null,
324
+ // tradeEnable: true
325
+ // }
326
+ // ],
327
+ // sell_to_iranicard_network_list: [
328
+ // {
329
+ // network: "BTC",
330
+ // name: "Bitcoin",
331
+ // addressRegex: "^[13][a-km-zA-HJ-NP-Z1-9]{25,34}$|^[(bc1q)|(bc1p)][0-9A-Za-z]{37,62}$",
332
+ // coin: "BTC",
333
+ // withdrawEnable: true,
334
+ // depositEnable: true,
335
+ // withdrawMin: "0.000100000",
336
+ // withdrawMax: null,
337
+ // withdrawFee: "0.000100000",
338
+ // sameAddress: false,
339
+ // memoRegex: null,
340
+ // tradeEnable: true
341
+ // }
342
+ // ],
343
+ // is_price_maker_active: 1,
344
+ // quotation: {
345
+ // maxPrice: "90199.99",
346
+ // minPrice: "88925",
347
+ // dailyChangePercent: "-0.26"
348
+ // },
349
+ // dailyChangePercent: -0.26,
350
+ // order: 0,
351
+ // stock_status: "in_stock",
352
+ // stock_label: null,
353
+ // stock_description: null
354
+ // }
355
+ const marketType = 'otc';
356
+ const marketId = this.safeString(ticker, 'symbol') + '_' + 'IRT';
357
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
358
+ const quotation = this.safeValue(ticker, 'quotation', {});
359
+ const dollar_price = this.safeFloat(ticker, 'dollar_price', 0);
360
+ const high = this.safeFloat(quotation, 'maxPrice', 0) * dollar_price / 10;
361
+ const low = this.safeFloat(quotation, 'minPrice', 0) * dollar_price / 10;
362
+ const bid = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price / 10;
363
+ const ask = this.safeFloat(ticker, 'buy_from_iranicard_currency_price', 0) * dollar_price / 10;
364
+ const last = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price / 10;
365
+ const change = this.safeFloat(quotation, 'dailyChangePercent', 0);
366
+ return this.safeTicker({
367
+ 'symbol': symbol,
368
+ 'timestamp': undefined,
369
+ 'datetime': undefined,
370
+ 'high': high,
371
+ 'low': low,
372
+ 'bid': bid,
373
+ 'bidVolume': undefined,
374
+ 'ask': ask,
375
+ 'askVolume': undefined,
376
+ 'vwap': undefined,
377
+ 'open': last,
378
+ 'close': last,
379
+ 'last': last,
380
+ 'previousClose': undefined,
381
+ 'change': change,
382
+ 'percentage': change,
383
+ 'average': undefined,
384
+ 'baseVolume': undefined,
385
+ 'quoteVolume': undefined,
386
+ 'info': ticker,
387
+ }, market);
388
+ }
389
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
390
+ const query = this.omit(params, this.extractParams(path));
391
+ let url = this.urls['api']['public'] + '/' + path + '?' + this.urlencode(query);
392
+ const pair_id = this.safeString(params, 'id');
393
+ if (pair_id !== undefined) {
394
+ url = this.urls['api']['public'] + '/' + path + '/' + pair_id;
395
+ }
396
+ headers = { 'Content-Type': 'application/json' };
397
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
398
+ }
399
+ }