ccxt-ir 4.18.0 → 4.19.0

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 (103) hide show
  1. package/README.md +4 -4
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +260 -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 +213 -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/dist/cjs/src/zarpin.js +185 -0
  23. package/js/ccxt.d.ts +754 -751
  24. package/js/ccxt.js +545 -543
  25. package/js/src/abstract/baazar.d.ts +8 -8
  26. package/js/src/abstract/baazar.js +5 -5
  27. package/js/src/abstract/daric.d.ts +8 -8
  28. package/js/src/abstract/daric.js +5 -5
  29. package/js/src/abstract/digikalagold.d.ts +8 -8
  30. package/js/src/abstract/digikalagold.js +5 -5
  31. package/js/src/abstract/goldika.d.ts +8 -8
  32. package/js/src/abstract/goldika.js +5 -5
  33. package/js/src/abstract/goldis.d.ts +8 -8
  34. package/js/src/abstract/goldis.js +5 -5
  35. package/js/src/abstract/hamrahgold.d.ts +8 -8
  36. package/js/src/abstract/hamrahgold.js +5 -5
  37. package/js/src/abstract/melligold.d.ts +8 -8
  38. package/js/src/abstract/melligold.js +5 -5
  39. package/js/src/abstract/milligold.d.ts +8 -8
  40. package/js/src/abstract/milligold.js +5 -5
  41. package/js/src/abstract/talaavan.d.ts +8 -0
  42. package/js/src/abstract/talaavan.js +11 -0
  43. package/js/src/abstract/talapp.d.ts +8 -8
  44. package/js/src/abstract/talapp.js +5 -5
  45. package/js/src/abstract/technogold.d.ts +8 -8
  46. package/js/src/abstract/technogold.js +5 -5
  47. package/js/src/abstract/wallgold.d.ts +8 -8
  48. package/js/src/abstract/wallgold.js +5 -5
  49. package/js/src/abstract/zarafza.d.ts +8 -8
  50. package/js/src/abstract/zarafza.js +5 -5
  51. package/js/src/abstract/zarminex.d.ts +8 -8
  52. package/js/src/abstract/zarminex.js +5 -5
  53. package/js/src/abstract/zarniv.d.ts +9 -9
  54. package/js/src/abstract/zarniv.js +5 -5
  55. package/js/src/abstract/zarpin.d.ts +8 -0
  56. package/js/src/abstract/zarpin.js +11 -0
  57. package/js/src/baazar.d.ts +20 -20
  58. package/js/src/baazar.js +153 -153
  59. package/js/src/base/Exchange.d.ts +926 -926
  60. package/js/src/base/Exchange.js +7397 -7397
  61. package/js/src/coinbaseexchange.d.ts +334 -334
  62. package/js/src/daric.d.ts +22 -22
  63. package/js/src/daric.js +174 -174
  64. package/js/src/digikalagold.d.ts +21 -21
  65. package/js/src/digikalagold.js +171 -171
  66. package/js/src/goldika.d.ts +20 -20
  67. package/js/src/goldika.js +156 -156
  68. package/js/src/goldis.d.ts +21 -21
  69. package/js/src/goldis.js +150 -150
  70. package/js/src/hamrahgold.d.ts +21 -21
  71. package/js/src/hamrahgold.js +164 -164
  72. package/js/src/iranexchange.js +393 -393
  73. package/js/src/melligold.d.ts +21 -21
  74. package/js/src/melligold.js +217 -214
  75. package/js/src/milligold.d.ts +20 -20
  76. package/js/src/milligold.js +149 -149
  77. package/js/src/protobuf/mexc/compiled.d.cts +2 -2
  78. package/js/src/static_dependencies/fflake/browser.d.ts +222 -222
  79. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  80. package/js/src/static_dependencies/qs/formats.d.cts +8 -8
  81. package/js/src/static_dependencies/qs/index.d.cts +4 -4
  82. package/js/src/static_dependencies/qs/parse.d.cts +2 -2
  83. package/js/src/static_dependencies/qs/stringify.d.cts +2 -2
  84. package/js/src/static_dependencies/qs/utils.d.cts +9 -9
  85. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  86. package/js/src/{goldcore.d.ts → talaavan.d.ts} +20 -20
  87. package/js/src/{goldcore.js → talaavan.js} +148 -148
  88. package/js/src/talapp.d.ts +20 -20
  89. package/js/src/talapp.js +149 -149
  90. package/js/src/technogold.d.ts +20 -20
  91. package/js/src/technogold.js +146 -146
  92. package/js/src/wallgold.d.ts +21 -21
  93. package/js/src/wallgold.js +157 -157
  94. package/js/src/zarafza.d.ts +20 -20
  95. package/js/src/zarafza.js +152 -152
  96. package/js/src/zarminex.d.ts +20 -20
  97. package/js/src/zarminex.js +155 -155
  98. package/js/src/zarniv.d.ts +21 -21
  99. package/js/src/zarniv.js +171 -171
  100. package/js/src/zarpin.d.ts +21 -0
  101. package/js/src/zarpin.js +184 -0
  102. package/js/test.js +27 -68
  103. package/package.json +1 -1
@@ -5,396 +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 dollar_price = this.safeFloat(ticker, 'dollar_price', 0);
359
- const high = this.safeFloat(quotation, 'maxPrice', 0) * dollar_price / 10;
360
- const low = this.safeFloat(quotation, 'minPrice', 0) * dollar_price / 10;
361
- const bid = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price / 10;
362
- const ask = this.safeFloat(ticker, 'buy_from_iranicard_currency_price', 0) * dollar_price / 10;
363
- const last = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price / 10;
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
- }
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 / 10;
360
+ const low = this.safeFloat(quotation, 'minPrice', 0) * dollar_price / 10;
361
+ const bid = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price / 10;
362
+ const ask = this.safeFloat(ticker, 'buy_from_iranicard_currency_price', 0) * dollar_price / 10;
363
+ const last = this.safeFloat(ticker, 'sell_to_iranicard_currency_price', 0) * dollar_price / 10;
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
+ }
398
398
  }
399
399
 
400
400
  exports["default"] = iranexchange;