ccxt-ir 4.9.25 → 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.
Files changed (107) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/abantether.js +344 -344
  5. package/dist/cjs/src/abstract/bitbarg.js +1 -1
  6. package/dist/cjs/src/abstract/bydfi.js +1 -1
  7. package/dist/cjs/src/abstract/cafearz.js +1 -1
  8. package/dist/cjs/src/abstract/hamtapay.js +1 -1
  9. package/dist/cjs/src/abstract/iranexchange.js +1 -1
  10. package/dist/cjs/src/abstract/kifpoolme.js +1 -1
  11. package/dist/cjs/src/abstract/mazdax.js +1 -1
  12. package/dist/cjs/src/abstract/pingi.js +1 -1
  13. package/dist/cjs/src/abstract/pooleno.js +1 -1
  14. package/dist/cjs/src/abstract/tehran_exchange.js +1 -1
  15. package/dist/cjs/src/afratether.js +347 -347
  16. package/dist/cjs/src/arzplus.js +572 -572
  17. package/dist/cjs/src/bit24.js +380 -379
  18. package/dist/cjs/src/bitbarg.js +303 -303
  19. package/dist/cjs/src/bitpin.js +478 -469
  20. package/dist/cjs/src/bydfi.js +425 -425
  21. package/dist/cjs/src/cafearz.js +337 -337
  22. package/dist/cjs/src/hamtapay.js +294 -294
  23. package/dist/cjs/src/iranexchange.js +390 -390
  24. package/dist/cjs/src/kcex.js +326 -326
  25. package/dist/cjs/src/kifpoolme.js +401 -401
  26. package/dist/cjs/src/mazdax.js +525 -525
  27. package/dist/cjs/src/ompfinex.js +501 -501
  28. package/dist/cjs/src/pingi.js +437 -437
  29. package/dist/cjs/src/pooleno.js +338 -338
  30. package/dist/cjs/src/sarmayex.js +367 -367
  31. package/dist/cjs/src/tehran_exchange.js +324 -324
  32. package/dist/cjs/src/tetherland.js +358 -358
  33. package/dist/cjs/src/toobit.js +436 -436
  34. package/dist/cjs/src/twox.js +362 -362
  35. package/js/ccxt.d.ts +1 -1
  36. package/js/ccxt.js +1 -1
  37. package/js/src/abantether.js +347 -347
  38. package/js/src/abstract/abantether.d.ts +8 -8
  39. package/js/src/abstract/arzplus.d.ts +11 -11
  40. package/js/src/abstract/bitbarg.d.ts +8 -8
  41. package/js/src/abstract/bitbarg.js +5 -5
  42. package/js/src/abstract/bitpin.d.ts +11 -10
  43. package/js/src/abstract/bydfi.d.ts +11 -11
  44. package/js/src/abstract/bydfi.js +5 -5
  45. package/js/src/abstract/cafearz.d.ts +8 -8
  46. package/js/src/abstract/cafearz.js +5 -5
  47. package/js/src/abstract/hamtapay.d.ts +9 -9
  48. package/js/src/abstract/hamtapay.js +5 -5
  49. package/js/src/abstract/iranexchange.d.ts +9 -9
  50. package/js/src/abstract/iranexchange.js +5 -5
  51. package/js/src/abstract/kifpoolme.d.ts +9 -9
  52. package/js/src/abstract/kifpoolme.js +5 -5
  53. package/js/src/abstract/mazdax.d.ts +11 -11
  54. package/js/src/abstract/mazdax.js +5 -5
  55. package/js/src/abstract/pingi.d.ts +9 -9
  56. package/js/src/abstract/pingi.js +5 -5
  57. package/js/src/abstract/pooleno.d.ts +8 -8
  58. package/js/src/abstract/pooleno.js +5 -5
  59. package/js/src/abstract/tehran_exchange.d.ts +9 -9
  60. package/js/src/abstract/tehran_exchange.js +5 -5
  61. package/js/src/abstract/toobit.d.ts +10 -10
  62. package/js/src/afratether.js +350 -350
  63. package/js/src/arzplus.d.ts +26 -26
  64. package/js/src/arzplus.js +575 -575
  65. package/js/src/base/Exchange.d.ts +926 -926
  66. package/js/src/base/types.d.ts +586 -586
  67. package/js/src/bit24.js +383 -382
  68. package/js/src/bitbarg.d.ts +21 -21
  69. package/js/src/bitbarg.js +306 -306
  70. package/js/src/bitpin.js +481 -472
  71. package/js/src/bydfi.d.ts +23 -23
  72. package/js/src/bydfi.js +428 -428
  73. package/js/src/cafearz.d.ts +21 -21
  74. package/js/src/cafearz.js +340 -340
  75. package/js/src/coinbaseexchange.d.ts +334 -334
  76. package/js/src/hamtapay.d.ts +21 -21
  77. package/js/src/hamtapay.js +297 -297
  78. package/js/src/iranexchange.d.ts +21 -21
  79. package/js/src/iranexchange.js +393 -393
  80. package/js/src/kcex.js +329 -329
  81. package/js/src/kifpoolme.d.ts +23 -23
  82. package/js/src/kifpoolme.js +404 -404
  83. package/js/src/mazdax.d.ts +23 -23
  84. package/js/src/mazdax.js +528 -528
  85. package/js/src/ompfinex.js +504 -504
  86. package/js/src/pingi.d.ts +22 -22
  87. package/js/src/pingi.js +440 -440
  88. package/js/src/pooleno.d.ts +21 -21
  89. package/js/src/pooleno.js +341 -341
  90. package/js/src/protobuf/mexc/compiled.d.cts +2 -2
  91. package/js/src/sarmayex.js +370 -370
  92. package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
  93. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +51 -51
  94. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
  95. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +204 -204
  96. package/js/src/static_dependencies/qs/formats.d.cts +8 -8
  97. package/js/src/static_dependencies/qs/index.d.cts +4 -4
  98. package/js/src/static_dependencies/qs/parse.d.cts +2 -2
  99. package/js/src/static_dependencies/qs/stringify.d.cts +2 -2
  100. package/js/src/static_dependencies/qs/utils.d.cts +9 -9
  101. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +1 -1
  102. package/js/src/tehran_exchange.d.ts +21 -21
  103. package/js/src/tehran_exchange.js +327 -327
  104. package/js/src/tetherland.js +361 -361
  105. package/js/src/toobit.js +439 -439
  106. package/js/src/twox.js +365 -365
  107. 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;
361
- const low = this.safeFloat(quotation, 'minPrice', 0) * dollar_price;
362
- const bid = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price;
363
- const ask = this.safeFloat(ticker, 'buy_from_iranicard_currency_price', 0) * dollar_price;
364
- const last = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price;
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;
361
+ const low = this.safeFloat(quotation, 'minPrice', 0) * dollar_price;
362
+ const bid = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price;
363
+ const ask = this.safeFloat(ticker, 'buy_from_iranicard_currency_price', 0) * dollar_price;
364
+ const last = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price;
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
+ }