ccxt-ir 4.9.23 → 4.9.25

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 (89) hide show
  1. package/README.md +3 -3
  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/kifpoolme.js +1 -1
  10. package/dist/cjs/src/abstract/mazdax.js +1 -1
  11. package/dist/cjs/src/abstract/pingi.js +1 -1
  12. package/dist/cjs/src/abstract/pooleno.js +1 -1
  13. package/dist/cjs/src/abstract/tehran_exchange.js +1 -1
  14. package/dist/cjs/src/afratether.js +347 -347
  15. package/dist/cjs/src/arzplus.js +572 -572
  16. package/dist/cjs/src/bitbarg.js +303 -303
  17. package/dist/cjs/src/bydfi.js +425 -425
  18. package/dist/cjs/src/cafearz.js +337 -337
  19. package/dist/cjs/src/hamtapay.js +294 -294
  20. package/dist/cjs/src/iranexchange.js +9 -7
  21. package/dist/cjs/src/kcex.js +326 -326
  22. package/dist/cjs/src/kifpoolme.js +401 -401
  23. package/dist/cjs/src/mazdax.js +525 -525
  24. package/dist/cjs/src/ompfinex.js +501 -501
  25. package/dist/cjs/src/pingi.js +437 -437
  26. package/dist/cjs/src/pooleno.js +338 -338
  27. package/dist/cjs/src/sarmayex.js +367 -367
  28. package/dist/cjs/src/tehran_exchange.js +324 -324
  29. package/dist/cjs/src/tetherland.js +358 -358
  30. package/dist/cjs/src/toobit.js +436 -436
  31. package/dist/cjs/src/twox.js +362 -362
  32. package/js/ccxt.d.ts +1 -1
  33. package/js/ccxt.js +1 -1
  34. package/js/src/abantether.js +347 -347
  35. package/js/src/abstract/abantether.d.ts +8 -8
  36. package/js/src/abstract/arzplus.d.ts +11 -11
  37. package/js/src/abstract/bitbarg.d.ts +8 -8
  38. package/js/src/abstract/bitbarg.js +5 -5
  39. package/js/src/abstract/bydfi.d.ts +11 -11
  40. package/js/src/abstract/bydfi.js +5 -5
  41. package/js/src/abstract/cafearz.d.ts +8 -8
  42. package/js/src/abstract/cafearz.js +5 -5
  43. package/js/src/abstract/hamtapay.d.ts +9 -9
  44. package/js/src/abstract/hamtapay.js +5 -5
  45. package/js/src/abstract/kifpoolme.d.ts +9 -9
  46. package/js/src/abstract/kifpoolme.js +5 -5
  47. package/js/src/abstract/mazdax.d.ts +11 -11
  48. package/js/src/abstract/mazdax.js +5 -5
  49. package/js/src/abstract/pingi.d.ts +9 -9
  50. package/js/src/abstract/pingi.js +5 -5
  51. package/js/src/abstract/pooleno.d.ts +8 -8
  52. package/js/src/abstract/pooleno.js +5 -5
  53. package/js/src/abstract/tehran_exchange.d.ts +9 -9
  54. package/js/src/abstract/tehran_exchange.js +5 -5
  55. package/js/src/abstract/toobit.d.ts +10 -10
  56. package/js/src/afratether.js +350 -350
  57. package/js/src/arzplus.d.ts +26 -26
  58. package/js/src/arzplus.js +575 -575
  59. package/js/src/base/types.d.ts +586 -586
  60. package/js/src/bitbarg.d.ts +21 -21
  61. package/js/src/bitbarg.js +306 -306
  62. package/js/src/bydfi.d.ts +23 -23
  63. package/js/src/bydfi.js +428 -428
  64. package/js/src/cafearz.d.ts +21 -21
  65. package/js/src/cafearz.js +340 -340
  66. package/js/src/hamtapay.d.ts +21 -21
  67. package/js/src/hamtapay.js +297 -297
  68. package/js/src/iranexchange.js +9 -7
  69. package/js/src/kcex.js +329 -329
  70. package/js/src/kifpoolme.d.ts +23 -23
  71. package/js/src/kifpoolme.js +404 -404
  72. package/js/src/mazdax.d.ts +23 -23
  73. package/js/src/mazdax.js +528 -528
  74. package/js/src/ompfinex.js +504 -504
  75. package/js/src/pingi.d.ts +22 -22
  76. package/js/src/pingi.js +440 -440
  77. package/js/src/pooleno.d.ts +21 -21
  78. package/js/src/pooleno.js +341 -341
  79. package/js/src/sarmayex.js +370 -370
  80. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +51 -51
  81. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  82. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +204 -204
  83. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  84. package/js/src/tehran_exchange.d.ts +21 -21
  85. package/js/src/tehran_exchange.js +327 -327
  86. package/js/src/tetherland.js +361 -361
  87. package/js/src/toobit.js +439 -439
  88. package/js/src/twox.js +365 -365
  89. package/package.json +1 -1
package/js/src/cafearz.js CHANGED
@@ -4,343 +4,343 @@
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/cafearz.js';
9
- // ---------------------------------------------------------------------------
10
- /**
11
- * @class cafearz
12
- * @augments Exchange
13
- * @description Set rateLimit to 1000 if fully verified
14
- */
15
- export default class cafearz extends Exchange {
16
- describe() {
17
- return this.deepExtend(super.describe(), {
18
- 'id': 'cafearz',
19
- 'name': 'Cafearz',
20
- 'countries': ['IR'],
21
- 'rateLimit': 1000,
22
- 'version': '1',
23
- 'certified': false,
24
- 'pro': false,
25
- 'has': {
26
- 'CORS': undefined,
27
- 'spot': true,
28
- 'margin': false,
29
- 'swap': false,
30
- 'future': false,
31
- 'option': false,
32
- 'addMargin': false,
33
- 'cancelAllOrders': false,
34
- 'cancelOrder': false,
35
- 'cancelOrders': false,
36
- 'createDepositAddress': false,
37
- 'createOrder': false,
38
- 'createStopLimitOrder': false,
39
- 'createStopMarketOrder': false,
40
- 'createStopOrder': false,
41
- 'editOrder': false,
42
- 'fetchBalance': false,
43
- 'fetchBorrowInterest': false,
44
- 'fetchBorrowRateHistories': false,
45
- 'fetchBorrowRateHistory': false,
46
- 'fetchClosedOrders': false,
47
- 'fetchCrossBorrowRate': false,
48
- 'fetchCrossBorrowRates': false,
49
- 'fetchCurrencies': false,
50
- 'fetchDepositAddress': false,
51
- 'fetchDeposits': false,
52
- 'fetchFundingHistory': false,
53
- 'fetchFundingRate': false,
54
- 'fetchFundingRateHistory': false,
55
- 'fetchFundingRates': false,
56
- 'fetchIndexOHLCV': false,
57
- 'fetchIsolatedBorrowRate': false,
58
- 'fetchIsolatedBorrowRates': false,
59
- 'fetchL2OrderBook': false,
60
- 'fetchL3OrderBook': false,
61
- 'fetchLedger': false,
62
- 'fetchLedgerEntry': false,
63
- 'fetchLeverageTiers': false,
64
- 'fetchMarkets': true,
65
- 'fetchMarkOHLCV': false,
66
- 'fetchMyTrades': false,
67
- 'fetchOHLCV': false,
68
- 'fetchOpenInterestHistory': false,
69
- 'fetchOpenOrders': false,
70
- 'fetchOrder': false,
71
- 'fetchOrderBook': false,
72
- 'fetchOrders': false,
73
- 'fetchOrderTrades': 'emulated',
74
- 'fetchPositions': false,
75
- 'fetchPremiumIndexOHLCV': false,
76
- 'fetchTicker': true,
77
- 'fetchTickers': true,
78
- 'fetchTime': false,
79
- 'fetchTrades': false,
80
- 'fetchTradingFee': false,
81
- 'fetchTradingFees': false,
82
- 'fetchWithdrawals': false,
83
- '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/cafearz/64x64.png',
92
- 'api': {
93
- 'public': 'https://api2.cafearz.com',
94
- },
95
- 'www': 'https://cafearz.com/',
96
- 'doc': [
97
- 'https://cafearz.com/',
98
- ],
99
- },
100
- 'api': {
101
- 'public': {
102
- 'get': {
103
- '/api/client/v1/currencies/prices/digital': 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
- parseMarket(market) {
118
- // {
119
- // "symbol": "BTC",
120
- // "name": "Bitcoin",
121
- // "title": "بیت کوین",
122
- // "service_id": 14,
123
- // "rank": 1,
124
- // "price": {
125
- // "buy": 12726581792.3999996185302734375,
126
- // "sell": 12571941095.936672210693359375,
127
- // "dollar": 110387.5599999999976716935634613037109375
128
- // },
129
- // "chart": {
130
- // "changes": "down",
131
- // "changes_percentage": 107.0799999999999982946974341757595539093017578125,
132
- // "data": {
133
- // "1404/07/05": "109643.46000000",
134
- // "1404/07/06": "109635.85000000",
135
- // "1404/07/07": "112163.95000000",
136
- // "1404/07/08": "114311.96000000",
137
- // "1404/07/09": "114048.93000000",
138
- // "1404/07/10": "118594.99000000",
139
- // "1404/07/11": "120529.35000000",
140
- // "1404/07/12": "122232.00000000",
141
- // "1404/07/13": "122391.00000000",
142
- // "1404/07/14": "123482.31000000",
143
- // "1404/07/15": "124658.54000000",
144
- // "1404/07/16": "121332.95000000",
145
- // "1404/07/17": "123306.00000000",
146
- // "1404/07/18": "121662.40000000",
147
- // "1404/07/19": "113613.18000000"
148
- // }
149
- // },
150
- // "decimal_digit": "5",
151
- // "market_cap": 2018807729876.182861328125,
152
- // "volume_24h": 57479298399.76000213623046875,
153
- // "percent_change_1h": 0.00643466000000000003244959856374407536350190639495849609375,
154
- // "percent_change_24h": -3.013435680000000171929741554777137935161590576171875,
155
- // "percent_change_7d": -3.848675339999999778228811919689178466796875,
156
- // "base_icon": "https://api2.cafearz.com/assets/images/coins/1.png",
157
- // "icon": "https://storage.cafearz.com/wp-content/uploads/coins/BTC.png"
158
- // },
159
- const baseId = this.safeString(market, 'symbol');
160
- const quoteId = 'IRT';
161
- const base = this.safeCurrencyCode(baseId);
162
- const quote = this.safeCurrencyCode(quoteId);
163
- const id = baseId + '/' + quoteId;
164
- return {
165
- 'id': id,
166
- 'symbol': base + '/' + quote,
167
- 'base': base,
168
- 'quote': quote,
169
- 'settle': undefined,
170
- 'baseId': baseId,
171
- 'quoteId': quoteId,
172
- 'settleId': undefined,
173
- 'type': 'spot',
174
- 'spot': false,
175
- 'margin': false,
176
- 'swap': false,
177
- 'future': false,
178
- 'option': false,
179
- 'active': true,
180
- 'contract': false,
181
- 'linear': undefined,
182
- 'inverse': undefined,
183
- 'contractSize': undefined,
184
- 'expiry': undefined,
185
- 'expiryDatetime': undefined,
186
- 'strike': undefined,
187
- 'optionType': undefined,
188
- 'precision': {
189
- 'amount': undefined,
190
- 'price': undefined,
191
- },
192
- 'limits': {
193
- 'leverage': {
194
- 'min': undefined,
195
- 'max': undefined,
196
- },
197
- 'amount': {
198
- 'min': undefined,
199
- 'max': undefined,
200
- },
201
- 'price': {
202
- 'min': undefined,
203
- 'max': undefined,
204
- },
205
- 'cost': {
206
- 'min': undefined,
207
- 'max': undefined,
208
- },
209
- },
210
- 'created': undefined,
211
- 'info': market,
212
- };
213
- }
214
- async fetchMarkets(params = {}) {
215
- /**
216
- * @method
217
- * @name cafearz#fetchMarkets
218
- * @description retrieves data on all markets for cafearz
219
- * @see https://api2.cafearz.com/api/client/v1/currencies/prices/digital
220
- * @param {object} [params] extra parameters specific to the exchange API endpoint
221
- * @returns {object[]} an array of objects representing market data
222
- */
223
- const response = await this.publicGetApiClientV1CurrenciesPricesDigital(params);
224
- const result = [];
225
- const prices = this.safeDict(response, 'prices', {});
226
- const symbols = Object.keys(prices);
227
- // Create markets for each symbol with IRT quote
228
- for (let i = 0; i < symbols.length; i++) {
229
- const market = this.parseMarket(prices[symbols[i]]);
230
- result.push(market);
231
- }
232
- return result;
233
- }
234
- async fetchTickers(symbols = undefined, params = {}) {
235
- /**
236
- * @method
237
- * @name cafearz#fetchTickers
238
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
239
- * @see https://api2.cafearz.com/api/client/v1/currencies/prices/digital
240
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
241
- * @param {object} [params] extra parameters specific to the exchange API endpoint
242
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
243
- */
244
- await this.loadMarkets();
245
- if (symbols !== undefined) {
246
- symbols = this.marketSymbols(symbols);
247
- }
248
- const response = await this.publicGetApiClientV1CurrenciesPricesDigital(params);
249
- const prices = this.safeDict(response, 'prices', {});
250
- const result = {};
251
- const coinSymbols = Object.keys(prices);
252
- for (let i = 0; i < coinSymbols.length; i++) {
253
- const baseId = coinSymbols[i];
254
- const coinData = prices[baseId];
255
- // Create ticker for IRT quote
256
- const quoteId = 'IRT';
257
- const base = this.safeCurrencyCode(baseId);
258
- const quote = this.safeCurrencyCode(quoteId);
259
- const symbol = base + '/' + quote;
260
- const ticker = this.extend({
261
- 'symbol': symbol,
262
- 'baseId': baseId,
263
- 'quoteId': quoteId,
264
- 'id': baseId + '/' + quoteId,
265
- }, coinData);
266
- result[symbol] = this.parseTicker(ticker);
267
- }
268
- return this.filterByArrayTickers(result, 'symbol', symbols);
269
- }
270
- async fetchTicker(symbol, params = {}) {
271
- /**
272
- * @method
273
- * @name cafearz#fetchTicker
274
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
275
- * @see https://api2.cafearz.com/api/client/v1/currencies/prices/digital
276
- * @param {string} symbol unified symbol of the market to fetch the ticker for
277
- * @param {object} [params] extra parameters specific to the exchange API endpoint
278
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
279
- */
280
- const ticker = await this.fetchTickers([symbol]);
281
- return ticker[symbol];
282
- }
283
- parseTicker(ticker, market = undefined) {
284
- // {
285
- // "symbol": "BTC",
286
- // "name": "Bitcoin",
287
- // "title": "بیت کوین",
288
- // "service_id": 14,
289
- // "rank": 1,
290
- // "price": {
291
- // "buy": 13462469875.799999,
292
- // "sell": 13298881860,
293
- // "dollar": 117689.22
294
- // },
295
- // "chart": {
296
- // "changes": "down",
297
- // "changes_percentage": 101.33,
298
- // "data": {...}
299
- // },
300
- // "decimal_digit": "5",
301
- // "market_cap": 2018807729876.182861,
302
- // "volume_24h": 57479298399.76,
303
- // "percent_change_1h": 0.00643466,
304
- // "percent_change_24h": -3.013435,
305
- // "percent_change_7d": -3.848675,
306
- // "base_icon": "...",
307
- // "icon": "..."
308
- // }
309
- const marketType = 'otc';
310
- const marketId = this.safeString(ticker, 'id');
311
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
312
- const priceData = this.safeDict(ticker, 'price', {});
313
- const last = this.safeFloat(priceData, 'buy', 0);
314
- const bid = this.safeFloat(priceData, 'sell', 0);
315
- const ask = this.safeFloat(priceData, 'buy', 0);
316
- const percentage = this.safeFloat(ticker, 'percent_change_24h', 0);
317
- const baseVolume = this.safeFloat(ticker, 'volume_24h');
318
- return this.safeTicker({
319
- 'symbol': symbol,
320
- 'timestamp': undefined,
321
- 'datetime': undefined,
322
- 'high': undefined,
323
- 'low': undefined,
324
- 'bid': bid,
325
- 'bidVolume': undefined,
326
- 'ask': ask,
327
- 'askVolume': undefined,
328
- 'vwap': undefined,
329
- 'open': undefined,
330
- 'close': last,
331
- 'last': last,
332
- 'previousClose': undefined,
333
- 'change': undefined,
334
- 'percentage': percentage,
335
- 'average': undefined,
336
- 'baseVolume': baseVolume,
337
- 'quoteVolume': undefined,
338
- 'info': ticker,
339
- }, market);
340
- }
341
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
342
- const url = this.urls['api']['public'] + path;
343
- headers = { 'Content-Type': 'application/json' };
344
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
345
- }
346
- }
7
+ // ---------------------------------------------------------------------------
8
+ import Exchange from './abstract/cafearz.js';
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * @class cafearz
12
+ * @augments Exchange
13
+ * @description Set rateLimit to 1000 if fully verified
14
+ */
15
+ export default class cafearz extends Exchange {
16
+ describe() {
17
+ return this.deepExtend(super.describe(), {
18
+ 'id': 'cafearz',
19
+ 'name': 'Cafearz',
20
+ 'countries': ['IR'],
21
+ 'rateLimit': 1000,
22
+ 'version': '1',
23
+ 'certified': false,
24
+ 'pro': false,
25
+ 'has': {
26
+ 'CORS': undefined,
27
+ 'spot': true,
28
+ 'margin': false,
29
+ 'swap': false,
30
+ 'future': false,
31
+ 'option': false,
32
+ 'addMargin': false,
33
+ 'cancelAllOrders': false,
34
+ 'cancelOrder': false,
35
+ 'cancelOrders': false,
36
+ 'createDepositAddress': false,
37
+ 'createOrder': false,
38
+ 'createStopLimitOrder': false,
39
+ 'createStopMarketOrder': false,
40
+ 'createStopOrder': false,
41
+ 'editOrder': false,
42
+ 'fetchBalance': false,
43
+ 'fetchBorrowInterest': false,
44
+ 'fetchBorrowRateHistories': false,
45
+ 'fetchBorrowRateHistory': false,
46
+ 'fetchClosedOrders': false,
47
+ 'fetchCrossBorrowRate': false,
48
+ 'fetchCrossBorrowRates': false,
49
+ 'fetchCurrencies': false,
50
+ 'fetchDepositAddress': false,
51
+ 'fetchDeposits': false,
52
+ 'fetchFundingHistory': false,
53
+ 'fetchFundingRate': false,
54
+ 'fetchFundingRateHistory': false,
55
+ 'fetchFundingRates': false,
56
+ 'fetchIndexOHLCV': false,
57
+ 'fetchIsolatedBorrowRate': false,
58
+ 'fetchIsolatedBorrowRates': false,
59
+ 'fetchL2OrderBook': false,
60
+ 'fetchL3OrderBook': false,
61
+ 'fetchLedger': false,
62
+ 'fetchLedgerEntry': false,
63
+ 'fetchLeverageTiers': false,
64
+ 'fetchMarkets': true,
65
+ 'fetchMarkOHLCV': false,
66
+ 'fetchMyTrades': false,
67
+ 'fetchOHLCV': false,
68
+ 'fetchOpenInterestHistory': false,
69
+ 'fetchOpenOrders': false,
70
+ 'fetchOrder': false,
71
+ 'fetchOrderBook': false,
72
+ 'fetchOrders': false,
73
+ 'fetchOrderTrades': 'emulated',
74
+ 'fetchPositions': false,
75
+ 'fetchPremiumIndexOHLCV': false,
76
+ 'fetchTicker': true,
77
+ 'fetchTickers': true,
78
+ 'fetchTime': false,
79
+ 'fetchTrades': false,
80
+ 'fetchTradingFee': false,
81
+ 'fetchTradingFees': false,
82
+ 'fetchWithdrawals': false,
83
+ '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/cafearz/64x64.png',
92
+ 'api': {
93
+ 'public': 'https://api2.cafearz.com',
94
+ },
95
+ 'www': 'https://cafearz.com/',
96
+ 'doc': [
97
+ 'https://cafearz.com/',
98
+ ],
99
+ },
100
+ 'api': {
101
+ 'public': {
102
+ 'get': {
103
+ '/api/client/v1/currencies/prices/digital': 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
+ parseMarket(market) {
118
+ // {
119
+ // "symbol": "BTC",
120
+ // "name": "Bitcoin",
121
+ // "title": "بیت کوین",
122
+ // "service_id": 14,
123
+ // "rank": 1,
124
+ // "price": {
125
+ // "buy": 12726581792.3999996185302734375,
126
+ // "sell": 12571941095.936672210693359375,
127
+ // "dollar": 110387.5599999999976716935634613037109375
128
+ // },
129
+ // "chart": {
130
+ // "changes": "down",
131
+ // "changes_percentage": 107.0799999999999982946974341757595539093017578125,
132
+ // "data": {
133
+ // "1404/07/05": "109643.46000000",
134
+ // "1404/07/06": "109635.85000000",
135
+ // "1404/07/07": "112163.95000000",
136
+ // "1404/07/08": "114311.96000000",
137
+ // "1404/07/09": "114048.93000000",
138
+ // "1404/07/10": "118594.99000000",
139
+ // "1404/07/11": "120529.35000000",
140
+ // "1404/07/12": "122232.00000000",
141
+ // "1404/07/13": "122391.00000000",
142
+ // "1404/07/14": "123482.31000000",
143
+ // "1404/07/15": "124658.54000000",
144
+ // "1404/07/16": "121332.95000000",
145
+ // "1404/07/17": "123306.00000000",
146
+ // "1404/07/18": "121662.40000000",
147
+ // "1404/07/19": "113613.18000000"
148
+ // }
149
+ // },
150
+ // "decimal_digit": "5",
151
+ // "market_cap": 2018807729876.182861328125,
152
+ // "volume_24h": 57479298399.76000213623046875,
153
+ // "percent_change_1h": 0.00643466000000000003244959856374407536350190639495849609375,
154
+ // "percent_change_24h": -3.013435680000000171929741554777137935161590576171875,
155
+ // "percent_change_7d": -3.848675339999999778228811919689178466796875,
156
+ // "base_icon": "https://api2.cafearz.com/assets/images/coins/1.png",
157
+ // "icon": "https://storage.cafearz.com/wp-content/uploads/coins/BTC.png"
158
+ // },
159
+ const baseId = this.safeString(market, 'symbol');
160
+ const quoteId = 'IRT';
161
+ const base = this.safeCurrencyCode(baseId);
162
+ const quote = this.safeCurrencyCode(quoteId);
163
+ const id = baseId + '/' + quoteId;
164
+ return {
165
+ 'id': id,
166
+ 'symbol': base + '/' + quote,
167
+ 'base': base,
168
+ 'quote': quote,
169
+ 'settle': undefined,
170
+ 'baseId': baseId,
171
+ 'quoteId': quoteId,
172
+ 'settleId': undefined,
173
+ 'type': 'spot',
174
+ 'spot': false,
175
+ 'margin': false,
176
+ 'swap': false,
177
+ 'future': false,
178
+ 'option': false,
179
+ 'active': true,
180
+ 'contract': false,
181
+ 'linear': undefined,
182
+ 'inverse': undefined,
183
+ 'contractSize': undefined,
184
+ 'expiry': undefined,
185
+ 'expiryDatetime': undefined,
186
+ 'strike': undefined,
187
+ 'optionType': undefined,
188
+ 'precision': {
189
+ 'amount': undefined,
190
+ 'price': undefined,
191
+ },
192
+ 'limits': {
193
+ 'leverage': {
194
+ 'min': undefined,
195
+ 'max': undefined,
196
+ },
197
+ 'amount': {
198
+ 'min': undefined,
199
+ 'max': undefined,
200
+ },
201
+ 'price': {
202
+ 'min': undefined,
203
+ 'max': undefined,
204
+ },
205
+ 'cost': {
206
+ 'min': undefined,
207
+ 'max': undefined,
208
+ },
209
+ },
210
+ 'created': undefined,
211
+ 'info': market,
212
+ };
213
+ }
214
+ async fetchMarkets(params = {}) {
215
+ /**
216
+ * @method
217
+ * @name cafearz#fetchMarkets
218
+ * @description retrieves data on all markets for cafearz
219
+ * @see https://api2.cafearz.com/api/client/v1/currencies/prices/digital
220
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
221
+ * @returns {object[]} an array of objects representing market data
222
+ */
223
+ const response = await this.publicGetApiClientV1CurrenciesPricesDigital(params);
224
+ const result = [];
225
+ const prices = this.safeDict(response, 'prices', {});
226
+ const symbols = Object.keys(prices);
227
+ // Create markets for each symbol with IRT quote
228
+ for (let i = 0; i < symbols.length; i++) {
229
+ const market = this.parseMarket(prices[symbols[i]]);
230
+ result.push(market);
231
+ }
232
+ return result;
233
+ }
234
+ async fetchTickers(symbols = undefined, params = {}) {
235
+ /**
236
+ * @method
237
+ * @name cafearz#fetchTickers
238
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
239
+ * @see https://api2.cafearz.com/api/client/v1/currencies/prices/digital
240
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
241
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
242
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
243
+ */
244
+ await this.loadMarkets();
245
+ if (symbols !== undefined) {
246
+ symbols = this.marketSymbols(symbols);
247
+ }
248
+ const response = await this.publicGetApiClientV1CurrenciesPricesDigital(params);
249
+ const prices = this.safeDict(response, 'prices', {});
250
+ const result = {};
251
+ const coinSymbols = Object.keys(prices);
252
+ for (let i = 0; i < coinSymbols.length; i++) {
253
+ const baseId = coinSymbols[i];
254
+ const coinData = prices[baseId];
255
+ // Create ticker for IRT quote
256
+ const quoteId = 'IRT';
257
+ const base = this.safeCurrencyCode(baseId);
258
+ const quote = this.safeCurrencyCode(quoteId);
259
+ const symbol = base + '/' + quote;
260
+ const ticker = this.extend({
261
+ 'symbol': symbol,
262
+ 'baseId': baseId,
263
+ 'quoteId': quoteId,
264
+ 'id': baseId + '/' + quoteId,
265
+ }, coinData);
266
+ result[symbol] = this.parseTicker(ticker);
267
+ }
268
+ return this.filterByArrayTickers(result, 'symbol', symbols);
269
+ }
270
+ async fetchTicker(symbol, params = {}) {
271
+ /**
272
+ * @method
273
+ * @name cafearz#fetchTicker
274
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
275
+ * @see https://api2.cafearz.com/api/client/v1/currencies/prices/digital
276
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
277
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
278
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
279
+ */
280
+ const ticker = await this.fetchTickers([symbol]);
281
+ return ticker[symbol];
282
+ }
283
+ parseTicker(ticker, market = undefined) {
284
+ // {
285
+ // "symbol": "BTC",
286
+ // "name": "Bitcoin",
287
+ // "title": "بیت کوین",
288
+ // "service_id": 14,
289
+ // "rank": 1,
290
+ // "price": {
291
+ // "buy": 13462469875.799999,
292
+ // "sell": 13298881860,
293
+ // "dollar": 117689.22
294
+ // },
295
+ // "chart": {
296
+ // "changes": "down",
297
+ // "changes_percentage": 101.33,
298
+ // "data": {...}
299
+ // },
300
+ // "decimal_digit": "5",
301
+ // "market_cap": 2018807729876.182861,
302
+ // "volume_24h": 57479298399.76,
303
+ // "percent_change_1h": 0.00643466,
304
+ // "percent_change_24h": -3.013435,
305
+ // "percent_change_7d": -3.848675,
306
+ // "base_icon": "...",
307
+ // "icon": "..."
308
+ // }
309
+ const marketType = 'otc';
310
+ const marketId = this.safeString(ticker, 'id');
311
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
312
+ const priceData = this.safeDict(ticker, 'price', {});
313
+ const last = this.safeFloat(priceData, 'buy', 0);
314
+ const bid = this.safeFloat(priceData, 'sell', 0);
315
+ const ask = this.safeFloat(priceData, 'buy', 0);
316
+ const percentage = this.safeFloat(ticker, 'percent_change_24h', 0);
317
+ const baseVolume = this.safeFloat(ticker, 'volume_24h');
318
+ return this.safeTicker({
319
+ 'symbol': symbol,
320
+ 'timestamp': undefined,
321
+ 'datetime': undefined,
322
+ 'high': undefined,
323
+ 'low': undefined,
324
+ 'bid': bid,
325
+ 'bidVolume': undefined,
326
+ 'ask': ask,
327
+ 'askVolume': undefined,
328
+ 'vwap': undefined,
329
+ 'open': undefined,
330
+ 'close': last,
331
+ 'last': last,
332
+ 'previousClose': undefined,
333
+ 'change': undefined,
334
+ 'percentage': percentage,
335
+ 'average': undefined,
336
+ 'baseVolume': baseVolume,
337
+ 'quoteVolume': undefined,
338
+ 'info': ticker,
339
+ }, market);
340
+ }
341
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
342
+ const url = this.urls['api']['public'] + path;
343
+ headers = { 'Content-Type': 'application/json' };
344
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
345
+ }
346
+ }