ccxt-ir 4.9.22 → 4.9.23

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 (102) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +4 -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 +11 -0
  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/bitbarg.js +303 -303
  18. package/dist/cjs/src/bydfi.js +425 -425
  19. package/dist/cjs/src/cafearz.js +337 -337
  20. package/dist/cjs/src/hamtapay.js +294 -294
  21. package/dist/cjs/src/iranexchange.js +398 -0
  22. package/dist/cjs/src/kcex.js +326 -326
  23. package/dist/cjs/src/kifpoolme.js +401 -401
  24. package/dist/cjs/src/mazdax.js +525 -525
  25. package/dist/cjs/src/ompfinex.js +501 -501
  26. package/dist/cjs/src/pingi.js +437 -437
  27. package/dist/cjs/src/pooleno.js +338 -338
  28. package/dist/cjs/src/sarmayex.js +367 -367
  29. package/dist/cjs/src/tehran_exchange.js +324 -324
  30. package/dist/cjs/src/tetherland.js +358 -358
  31. package/dist/cjs/src/toobit.js +436 -436
  32. package/dist/cjs/src/twox.js +362 -362
  33. package/js/ccxt.d.ts +5 -2
  34. package/js/ccxt.js +4 -2
  35. package/js/src/abantether.js +347 -347
  36. package/js/src/abstract/abantether.d.ts +8 -8
  37. package/js/src/abstract/arzplus.d.ts +11 -11
  38. package/js/src/abstract/bitbarg.d.ts +8 -8
  39. package/js/src/abstract/bitbarg.js +5 -5
  40. package/js/src/abstract/bydfi.d.ts +11 -11
  41. package/js/src/abstract/bydfi.js +5 -5
  42. package/js/src/abstract/cafearz.d.ts +8 -8
  43. package/js/src/abstract/cafearz.js +5 -5
  44. package/js/src/abstract/hamtapay.d.ts +9 -9
  45. package/js/src/abstract/hamtapay.js +5 -5
  46. package/js/src/abstract/iranexchange.d.ts +9 -0
  47. package/js/src/abstract/iranexchange.js +11 -0
  48. package/js/src/abstract/kifpoolme.d.ts +9 -9
  49. package/js/src/abstract/kifpoolme.js +5 -5
  50. package/js/src/abstract/mazdax.d.ts +11 -11
  51. package/js/src/abstract/mazdax.js +5 -5
  52. package/js/src/abstract/pingi.d.ts +9 -9
  53. package/js/src/abstract/pingi.js +5 -5
  54. package/js/src/abstract/pooleno.d.ts +8 -8
  55. package/js/src/abstract/pooleno.js +5 -5
  56. package/js/src/abstract/tehran_exchange.d.ts +9 -9
  57. package/js/src/abstract/tehran_exchange.js +5 -5
  58. package/js/src/abstract/toobit.d.ts +10 -10
  59. package/js/src/afratether.js +350 -350
  60. package/js/src/arzplus.d.ts +26 -26
  61. package/js/src/arzplus.js +575 -575
  62. package/js/src/base/Exchange.d.ts +2 -2
  63. package/js/src/base/types.d.ts +586 -586
  64. package/js/src/bitbarg.d.ts +21 -21
  65. package/js/src/bitbarg.js +306 -306
  66. package/js/src/bydfi.d.ts +23 -23
  67. package/js/src/bydfi.js +428 -428
  68. package/js/src/cafearz.d.ts +21 -21
  69. package/js/src/cafearz.js +340 -340
  70. package/js/src/coinbaseexchange.d.ts +1 -1
  71. package/js/src/hamtapay.d.ts +21 -21
  72. package/js/src/hamtapay.js +297 -297
  73. package/js/src/iranexchange.d.ts +21 -0
  74. package/js/src/iranexchange.js +397 -0
  75. package/js/src/kcex.js +329 -329
  76. package/js/src/kifpoolme.d.ts +23 -23
  77. package/js/src/kifpoolme.js +404 -404
  78. package/js/src/mazdax.d.ts +23 -23
  79. package/js/src/mazdax.js +528 -528
  80. package/js/src/ompfinex.js +504 -504
  81. package/js/src/pingi.d.ts +22 -22
  82. package/js/src/pingi.js +440 -440
  83. package/js/src/pooleno.d.ts +21 -21
  84. package/js/src/pooleno.js +341 -341
  85. package/js/src/protobuf/mexc/compiled.d.cts +0 -6
  86. package/js/src/sarmayex.js +370 -370
  87. package/js/src/static_dependencies/fflake/browser.d.ts +5 -5
  88. package/js/src/static_dependencies/jsencrypt/lib/asn1js/asn1.d.ts +51 -51
  89. package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +101 -101
  90. package/js/src/static_dependencies/noble-curves/abstract/weierstrass.d.ts +204 -204
  91. package/js/src/static_dependencies/qs/formats.d.cts +0 -6
  92. package/js/src/static_dependencies/qs/index.d.cts +0 -6
  93. package/js/src/static_dependencies/qs/parse.d.cts +0 -6
  94. package/js/src/static_dependencies/qs/stringify.d.cts +0 -6
  95. package/js/src/static_dependencies/qs/utils.d.cts +0 -6
  96. package/js/src/static_dependencies/starknet/utils/calldata/parser/index.d.ts +5 -5
  97. package/js/src/tehran_exchange.d.ts +21 -21
  98. package/js/src/tehran_exchange.js +327 -327
  99. package/js/src/tetherland.js +361 -361
  100. package/js/src/toobit.js +439 -439
  101. package/js/src/twox.js +365 -365
  102. package/package.json +1 -1
package/js/src/mazdax.js CHANGED
@@ -4,531 +4,531 @@
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/mazdax.js';
9
- // ---------------------------------------------------------------------------
10
- /**
11
- * @class mazdax
12
- * @augments Exchange
13
- * @description Mazdax SPOT exchange implementation
14
- */
15
- export default class mazdax extends Exchange {
16
- describe() {
17
- return this.deepExtend(super.describe(), {
18
- 'id': 'mazdax',
19
- 'name': 'Mazdax',
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': true,
68
- 'fetchOpenInterestHistory': false,
69
- 'fetchOpenOrders': false,
70
- 'fetchOrder': false,
71
- 'fetchOrderBook': true,
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
- 'setLeverage': false,
84
- 'setMarginMode': false,
85
- 'transfer': false,
86
- 'withdraw': false,
87
- },
88
- 'comment': 'Mazdax SPOT Exchange',
89
- 'urls': {
90
- 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/mazdax/64x64.png',
91
- 'api': {
92
- 'public': 'https://api.mazdax.ir',
93
- },
94
- 'www': 'https://mazdax.ir',
95
- 'doc': [
96
- 'https://api.mazdax.ir',
97
- ],
98
- },
99
- 'timeframes': {
100
- '1m': '1m',
101
- '5m': '5m',
102
- '15m': '15m',
103
- '30m': '30m',
104
- '1h': '1h',
105
- '4h': '4h',
106
- '1d': '1d',
107
- '1w': '1w',
108
- },
109
- 'api': {
110
- 'public': {
111
- 'get': {
112
- 'market/symbols': 1,
113
- 'market/rollingprice': 1,
114
- 'market/candle': 1,
115
- 'market/order': 1,
116
- },
117
- },
118
- },
119
- 'fees': {
120
- 'trading': {
121
- 'tierBased': false,
122
- 'percentage': true,
123
- 'maker': this.parseNumber('0.001'),
124
- 'taker': this.parseNumber('0.001'),
125
- },
126
- },
127
- });
128
- }
129
- async fetchMarkets(params = {}) {
130
- /**
131
- * @method
132
- * @name mazdax#fetchMarkets
133
- * @description retrieves data on all markets for mazdax
134
- * @see https://api.mazdax.ir/market/symbols
135
- * @param {object} [params] extra parameters specific to the exchange API endpoint
136
- * @returns {object[]} an array of objects representing market data
137
- */
138
- const response = await this.publicGetMarketSymbols(params);
139
- // Response is an array of market objects:
140
- // [
141
- // {
142
- // "id": 67,
143
- // "createdAt": "2022-12-26T07:33:25Z",
144
- // "updatedAt": "2025-07-04T16:18:57Z",
145
- // "order": 2,
146
- // "symbol": "AHRM1IRR",
147
- // "baseAsset": "AHRM1",
148
- // "baseAssetTranslate": "AHRM1",
149
- // "baseAssetPrecision": 0,
150
- // "quoteAsset": "IRR",
151
- // "quoteAssetTranslate": "IRR",
152
- // "takerFee": "0.00116",
153
- // "makerFee": "0.001044",
154
- // "quoteAssetPrecision": 0,
155
- // "isTradable": true,
156
- // "isActive": true,
157
- // "isPublic": true,
158
- // "minimumOrderSize": "100000",
159
- // "maximumOrderSize": "0",
160
- // "minimumPrice": "0",
161
- // "maximumPrice": "0",
162
- // "marketCOV": "0.01",
163
- // "marketCap": "10",
164
- // "tickSize": "1",
165
- // "stepSize": "1",
166
- // ...
167
- // }
168
- // ]
169
- const result = [];
170
- for (let i = 0; i < response.length; i++) {
171
- const market = this.parseMarket(response[i]);
172
- result.push(market);
173
- }
174
- return result;
175
- }
176
- parseMarket(market) {
177
- // {
178
- // "id": 67,
179
- // "createdAt": "2022-12-26T07:33:25Z",
180
- // "updatedAt": "2025-07-04T16:18:57Z",
181
- // "order": 2,
182
- // "symbol": "AHRM1IRR",
183
- // "baseAsset": "AHRM1",
184
- // "baseAssetTranslate": "AHRM1",
185
- // "baseAssetPrecision": 0,
186
- // "quoteAsset": "IRR",
187
- // "quoteAssetTranslate": "IRR",
188
- // "takerFee": "0.00116",
189
- // "makerFee": "0.001044",
190
- // "quoteAssetPrecision": 0,
191
- // "isTradable": true,
192
- // "isActive": true,
193
- // "isPublic": true,
194
- // "minimumOrderSize": "100000",
195
- // "maximumOrderSize": "0",
196
- // "minimumPrice": "0",
197
- // "maximumPrice": "0",
198
- // "marketCOV": "0.01",
199
- // "marketCap": "10",
200
- // "tickSize": "1",
201
- // "stepSize": "1",
202
- // ...
203
- // }
204
- const id = this.safeString(market, 'symbol');
205
- let baseId = this.safeString(market, 'baseAsset');
206
- let quoteId = this.safeString(market, 'quoteAsset');
207
- const base = this.safeCurrencyCode(baseId);
208
- const quote = this.safeCurrencyCode(quoteId);
209
- baseId = baseId.toLowerCase();
210
- quoteId = quoteId.toLowerCase();
211
- const isActive = this.safeBool(market, 'isActive', false);
212
- const isTradable = this.safeBool(market, 'isTradable', false);
213
- const active = isActive && isTradable;
214
- return {
215
- 'id': id,
216
- 'symbol': base + '/' + quote,
217
- 'base': base,
218
- 'quote': quote,
219
- 'settle': undefined,
220
- 'baseId': baseId,
221
- 'quoteId': quoteId,
222
- 'settleId': undefined,
223
- 'type': 'spot',
224
- 'spot': false,
225
- 'margin': false,
226
- 'swap': false,
227
- 'future': false,
228
- 'option': false,
229
- 'active': active,
230
- 'contract': false,
231
- 'linear': undefined,
232
- 'inverse': undefined,
233
- 'contractSize': undefined,
234
- 'expiry': undefined,
235
- 'expiryDatetime': undefined,
236
- 'strike': undefined,
237
- 'optionType': undefined,
238
- 'precision': {
239
- 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'baseAssetPrecision'))),
240
- 'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'quoteAssetPrecision'))),
241
- },
242
- 'limits': {
243
- 'leverage': {
244
- 'min': undefined,
245
- 'max': undefined,
246
- },
247
- 'amount': {
248
- 'min': this.safeNumber(market, 'minimumOrderSize'),
249
- 'max': this.safeNumber(market, 'maximumOrderSize'),
250
- },
251
- 'price': {
252
- 'min': this.safeNumber(market, 'minimumPrice'),
253
- 'max': this.safeNumber(market, 'maximumPrice'),
254
- },
255
- 'cost': {
256
- 'min': undefined,
257
- 'max': undefined,
258
- },
259
- },
260
- 'created': this.parse8601(this.safeString(market, 'createdAt')),
261
- 'info': market,
262
- };
263
- }
264
- async fetchTickers(symbols = undefined, params = {}) {
265
- /**
266
- * @method
267
- * @name mazdax#fetchTickers
268
- * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
269
- * @see https://api.mazdax.ir/market/rollingprice
270
- * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
271
- * @param {object} [params] extra parameters specific to the exchange API endpoint
272
- * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
273
- */
274
- await this.loadMarkets();
275
- if (symbols !== undefined) {
276
- symbols = this.marketSymbols(symbols);
277
- }
278
- const markets = await this.fetchMarkets();
279
- const result = {};
280
- for (let i = 0; i < markets.length; i++) {
281
- const market = markets[i];
282
- const marketId = market['id'];
283
- const request = {
284
- 'from': 'mazdax',
285
- 'symbol': marketId,
286
- };
287
- try {
288
- const response = await this.publicGetMarketRollingprice(request);
289
- // {
290
- // "AHRM1IRR": {
291
- // "symbol": "AHRM1IRR",
292
- // "priceChange": "525",
293
- // "priceChangePercent": "2.077",
294
- // "weightedAvgPrice": "0",
295
- // "prevClosePrice": "0",
296
- // "lastPrice": "25800",
297
- // "lastQty": "14050",
298
- // "bidPrice": "0",
299
- // "askPrice": "0",
300
- // "openPrice": "25275",
301
- // "highPrice": "26200",
302
- // "lowPrice": "25274",
303
- // "volume": "1076873",
304
- // "valueIrr": "55104642690",
305
- // "openTime": 1760271737577,
306
- // "closeTime": 1760351215075,
307
- // "count": 348
308
- // }
309
- // }
310
- const tickerData = this.safeDict(response, marketId);
311
- if (tickerData !== undefined) {
312
- const ticker = this.parseTicker(tickerData, market);
313
- const symbol = ticker['symbol'];
314
- result[symbol] = ticker;
315
- }
316
- }
317
- catch (e) {
318
- // Skip markets that fail
319
- continue;
320
- }
321
- }
322
- return this.filterByArrayTickers(result, 'symbol', symbols);
323
- }
324
- async fetchTicker(symbol, params = {}) {
325
- /**
326
- * @method
327
- * @name mazdax#fetchTicker
328
- * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
329
- * @see https://api.mazdax.ir/market/rollingprice
330
- * @param {string} symbol unified symbol of the market to fetch the ticker for
331
- * @param {object} [params] extra parameters specific to the exchange API endpoint
332
- * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
333
- */
334
- await this.loadMarkets();
335
- const market = this.market(symbol);
336
- const request = {
337
- 'from': 'mazdax',
338
- 'symbol': market['id'],
339
- };
340
- const response = await this.publicGetMarketRollingprice(request);
341
- // {
342
- // "AHRM1IRR": {
343
- // "symbol": "AHRM1IRR",
344
- // "priceChange": "525",
345
- // "priceChangePercent": "2.077",
346
- // "weightedAvgPrice": "0",
347
- // "prevClosePrice": "0",
348
- // "lastPrice": "25800",
349
- // "lastQty": "14050",
350
- // "bidPrice": "0",
351
- // "askPrice": "0",
352
- // "openPrice": "25275",
353
- // "highPrice": "26200",
354
- // "lowPrice": "25274",
355
- // "volume": "1076873",
356
- // "valueIrr": "55104642690",
357
- // "openTime": 1760271737577,
358
- // "closeTime": 1760351215075,
359
- // "count": 348
360
- // }
361
- // }
362
- const tickerData = this.safeDict(response, market['id']);
363
- return this.parseTicker(tickerData, market);
364
- }
365
- parseTicker(ticker, market = undefined) {
366
- // {
367
- // "symbol": "AHRM1IRR",
368
- // "priceChange": "525",
369
- // "priceChangePercent": "2.077",
370
- // "weightedAvgPrice": "0",
371
- // "prevClosePrice": "0",
372
- // "lastPrice": "25800",
373
- // "lastQty": "14050",
374
- // "bidPrice": "0",
375
- // "askPrice": "0",
376
- // "openPrice": "25275",
377
- // "highPrice": "26200",
378
- // "lowPrice": "25274",
379
- // "volume": "1076873",
380
- // "valueIrr": "55104642690",
381
- // "openTime": 1760271737577,
382
- // "closeTime": 1760351215075,
383
- // "count": 348
384
- // }
385
- const marketType = 'spot';
386
- const marketId = this.safeString(ticker, 'symbol');
387
- const symbol = this.safeSymbol(marketId, market, undefined, marketType);
388
- const timestamp = this.safeInteger(ticker, 'closeTime');
389
- const high = this.safeString(ticker, 'highPrice');
390
- const low = this.safeString(ticker, 'lowPrice');
391
- const bid = this.safeString(ticker, 'bidPrice');
392
- const ask = this.safeString(ticker, 'askPrice');
393
- const last = this.safeString(ticker, 'lastPrice');
394
- const open = this.safeString(ticker, 'openPrice');
395
- const baseVolume = this.safeString(ticker, 'volume');
396
- const quoteVolume = this.safeString(ticker, 'valueIrr');
397
- const priceChange = this.safeString(ticker, 'priceChange');
398
- const percentage = this.safeString(ticker, 'priceChangePercent');
399
- return this.safeTicker({
400
- 'symbol': symbol,
401
- 'timestamp': timestamp,
402
- 'datetime': this.iso8601(timestamp),
403
- 'high': high,
404
- 'low': low,
405
- 'bid': bid,
406
- 'bidVolume': undefined,
407
- 'ask': ask,
408
- 'askVolume': undefined,
409
- 'vwap': undefined,
410
- 'open': open,
411
- 'close': last,
412
- 'last': last,
413
- 'previousClose': undefined,
414
- 'change': priceChange,
415
- 'percentage': percentage,
416
- 'average': undefined,
417
- 'baseVolume': baseVolume,
418
- 'quoteVolume': quoteVolume,
419
- 'info': ticker,
420
- }, market);
421
- }
422
- async fetchOHLCV(symbol, timeframe = '1d', since = undefined, limit = undefined, params = {}) {
423
- /**
424
- * @method
425
- * @name mazdax#fetchOHLCV
426
- * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
427
- * @see https://api.mazdax.ir/market/candle
428
- * @param {string} symbol unified symbol of the market to fetch OHLCV data for
429
- * @param {string} timeframe the length of time each candle represents
430
- * @param {int} [since] timestamp in ms of the earliest candle to fetch
431
- * @param {int} [limit] the maximum amount of candles to fetch
432
- * @param {object} [params] extra parameters specific to the exchange API endpoint
433
- * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
434
- */
435
- await this.loadMarkets();
436
- const market = this.market(symbol);
437
- const endTime = Date.now();
438
- const request = {
439
- 'from': 'binance',
440
- 'symbol': market['id'],
441
- 'interval': this.safeString(this.timeframes, timeframe, timeframe),
442
- 'limit': limit !== undefined ? limit : 1000,
443
- 'starttime': (endTime) - (30 * 24 * 60 * 60 * 1000),
444
- 'endtime': endTime,
445
- };
446
- if (since !== undefined) {
447
- request['starttime'] = since / 1000;
448
- }
449
- const response = await this.publicGetMarketCandle(request);
450
- // {
451
- // "Candles": [
452
- // {
453
- // "openTime": "2021-12-20T03:30:00+03:30",
454
- // "openPrice": "10000",
455
- // "highPrice": "10000",
456
- // "lowPrice": "10000",
457
- // "closePrice": "10000",
458
- // "volume": "490000000",
459
- // "closeTime": "2021-12-20T03:30:00+03:30",
460
- // "quoteAssetVolume": "0",
461
- // "numberOfTrades": 0,
462
- // "takerBuyBaseAssetVolume": "0",
463
- // "takerBuyQuoteAssetVolume": "0",
464
- // "ignore": "0"
465
- // },
466
- // ...
467
- // ]
468
- // }
469
- const candles = this.safeList(response, 'Candles', []);
470
- const ohlcvs = [];
471
- for (let i = 0; i < candles.length; i++) {
472
- const candle = candles[i];
473
- const timestamp = this.parse8601(this.safeString(candle, 'openTime'));
474
- const open = this.safeString(candle, 'openPrice');
475
- const high = this.safeString(candle, 'highPrice');
476
- const low = this.safeString(candle, 'lowPrice');
477
- const close = this.safeString(candle, 'closePrice');
478
- const volume = this.safeString(candle, 'volume');
479
- ohlcvs.push([
480
- timestamp,
481
- open,
482
- high,
483
- low,
484
- close,
485
- volume,
486
- ]);
487
- }
488
- return this.parseOHLCVs(ohlcvs, market, timeframe, since, limit);
489
- }
490
- async fetchOrderBook(symbol, limit = undefined, params = {}) {
491
- /**
492
- * @method
493
- * @name mazdax#fetchOrderBook
494
- * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
495
- * @see https://api.mazdax.ir/market/order
496
- * @param {string} symbol unified symbol of the market to fetch the order book for
497
- * @param {int} [limit] the maximum amount of order book entries to return
498
- * @param {object} [params] extra parameters specific to the exchange API endpoint
499
- * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
500
- */
501
- await this.loadMarkets();
502
- const market = this.market(symbol);
503
- const request = {
504
- 'from': 'mazdax',
505
- 'symbol': market['id'],
506
- 'limit': limit !== undefined ? limit : 25,
507
- };
508
- const response = await this.publicGetMarketOrder(request);
509
- // {
510
- // "timestamp": "0001-01-01T00:00:00Z",
511
- // "bids": [
512
- // ["25321", "9344"],
513
- // ["25320", "15000"],
514
- // ...
515
- // ],
516
- // "asks": [
517
- // ["26190", "5341"],
518
- // ["26195", "2310"],
519
- // ...
520
- // ]
521
- // }
522
- const timestamp = this.parse8601(this.safeString(response, 'timestamp'));
523
- return this.parseOrderBook(response, symbol, timestamp, 'bids', 'asks', 0, 1);
524
- }
525
- sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
526
- const query = this.omit(params, this.extractParams(path));
527
- let url = this.urls['api']['public'] + '/' + path;
528
- if (Object.keys(query).length) {
529
- url = url + '?' + this.urlencode(query);
530
- }
531
- headers = { 'Content-Type': 'application/json' };
532
- return { 'url': url, 'method': method, 'body': body, 'headers': headers };
533
- }
534
- }
7
+ // ---------------------------------------------------------------------------
8
+ import Exchange from './abstract/mazdax.js';
9
+ // ---------------------------------------------------------------------------
10
+ /**
11
+ * @class mazdax
12
+ * @augments Exchange
13
+ * @description Mazdax SPOT exchange implementation
14
+ */
15
+ export default class mazdax extends Exchange {
16
+ describe() {
17
+ return this.deepExtend(super.describe(), {
18
+ 'id': 'mazdax',
19
+ 'name': 'Mazdax',
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': true,
68
+ 'fetchOpenInterestHistory': false,
69
+ 'fetchOpenOrders': false,
70
+ 'fetchOrder': false,
71
+ 'fetchOrderBook': true,
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
+ 'setLeverage': false,
84
+ 'setMarginMode': false,
85
+ 'transfer': false,
86
+ 'withdraw': false,
87
+ },
88
+ 'comment': 'Mazdax SPOT Exchange',
89
+ 'urls': {
90
+ 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/mazdax/64x64.png',
91
+ 'api': {
92
+ 'public': 'https://api.mazdax.ir',
93
+ },
94
+ 'www': 'https://mazdax.ir',
95
+ 'doc': [
96
+ 'https://api.mazdax.ir',
97
+ ],
98
+ },
99
+ 'timeframes': {
100
+ '1m': '1m',
101
+ '5m': '5m',
102
+ '15m': '15m',
103
+ '30m': '30m',
104
+ '1h': '1h',
105
+ '4h': '4h',
106
+ '1d': '1d',
107
+ '1w': '1w',
108
+ },
109
+ 'api': {
110
+ 'public': {
111
+ 'get': {
112
+ 'market/symbols': 1,
113
+ 'market/rollingprice': 1,
114
+ 'market/candle': 1,
115
+ 'market/order': 1,
116
+ },
117
+ },
118
+ },
119
+ 'fees': {
120
+ 'trading': {
121
+ 'tierBased': false,
122
+ 'percentage': true,
123
+ 'maker': this.parseNumber('0.001'),
124
+ 'taker': this.parseNumber('0.001'),
125
+ },
126
+ },
127
+ });
128
+ }
129
+ async fetchMarkets(params = {}) {
130
+ /**
131
+ * @method
132
+ * @name mazdax#fetchMarkets
133
+ * @description retrieves data on all markets for mazdax
134
+ * @see https://api.mazdax.ir/market/symbols
135
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
136
+ * @returns {object[]} an array of objects representing market data
137
+ */
138
+ const response = await this.publicGetMarketSymbols(params);
139
+ // Response is an array of market objects:
140
+ // [
141
+ // {
142
+ // "id": 67,
143
+ // "createdAt": "2022-12-26T07:33:25Z",
144
+ // "updatedAt": "2025-07-04T16:18:57Z",
145
+ // "order": 2,
146
+ // "symbol": "AHRM1IRR",
147
+ // "baseAsset": "AHRM1",
148
+ // "baseAssetTranslate": "AHRM1",
149
+ // "baseAssetPrecision": 0,
150
+ // "quoteAsset": "IRR",
151
+ // "quoteAssetTranslate": "IRR",
152
+ // "takerFee": "0.00116",
153
+ // "makerFee": "0.001044",
154
+ // "quoteAssetPrecision": 0,
155
+ // "isTradable": true,
156
+ // "isActive": true,
157
+ // "isPublic": true,
158
+ // "minimumOrderSize": "100000",
159
+ // "maximumOrderSize": "0",
160
+ // "minimumPrice": "0",
161
+ // "maximumPrice": "0",
162
+ // "marketCOV": "0.01",
163
+ // "marketCap": "10",
164
+ // "tickSize": "1",
165
+ // "stepSize": "1",
166
+ // ...
167
+ // }
168
+ // ]
169
+ const result = [];
170
+ for (let i = 0; i < response.length; i++) {
171
+ const market = this.parseMarket(response[i]);
172
+ result.push(market);
173
+ }
174
+ return result;
175
+ }
176
+ parseMarket(market) {
177
+ // {
178
+ // "id": 67,
179
+ // "createdAt": "2022-12-26T07:33:25Z",
180
+ // "updatedAt": "2025-07-04T16:18:57Z",
181
+ // "order": 2,
182
+ // "symbol": "AHRM1IRR",
183
+ // "baseAsset": "AHRM1",
184
+ // "baseAssetTranslate": "AHRM1",
185
+ // "baseAssetPrecision": 0,
186
+ // "quoteAsset": "IRR",
187
+ // "quoteAssetTranslate": "IRR",
188
+ // "takerFee": "0.00116",
189
+ // "makerFee": "0.001044",
190
+ // "quoteAssetPrecision": 0,
191
+ // "isTradable": true,
192
+ // "isActive": true,
193
+ // "isPublic": true,
194
+ // "minimumOrderSize": "100000",
195
+ // "maximumOrderSize": "0",
196
+ // "minimumPrice": "0",
197
+ // "maximumPrice": "0",
198
+ // "marketCOV": "0.01",
199
+ // "marketCap": "10",
200
+ // "tickSize": "1",
201
+ // "stepSize": "1",
202
+ // ...
203
+ // }
204
+ const id = this.safeString(market, 'symbol');
205
+ let baseId = this.safeString(market, 'baseAsset');
206
+ let quoteId = this.safeString(market, 'quoteAsset');
207
+ const base = this.safeCurrencyCode(baseId);
208
+ const quote = this.safeCurrencyCode(quoteId);
209
+ baseId = baseId.toLowerCase();
210
+ quoteId = quoteId.toLowerCase();
211
+ const isActive = this.safeBool(market, 'isActive', false);
212
+ const isTradable = this.safeBool(market, 'isTradable', false);
213
+ const active = isActive && isTradable;
214
+ return {
215
+ 'id': id,
216
+ 'symbol': base + '/' + quote,
217
+ 'base': base,
218
+ 'quote': quote,
219
+ 'settle': undefined,
220
+ 'baseId': baseId,
221
+ 'quoteId': quoteId,
222
+ 'settleId': undefined,
223
+ 'type': 'spot',
224
+ 'spot': false,
225
+ 'margin': false,
226
+ 'swap': false,
227
+ 'future': false,
228
+ 'option': false,
229
+ 'active': active,
230
+ 'contract': false,
231
+ 'linear': undefined,
232
+ 'inverse': undefined,
233
+ 'contractSize': undefined,
234
+ 'expiry': undefined,
235
+ 'expiryDatetime': undefined,
236
+ 'strike': undefined,
237
+ 'optionType': undefined,
238
+ 'precision': {
239
+ 'amount': this.parseNumber(this.parsePrecision(this.safeString(market, 'baseAssetPrecision'))),
240
+ 'price': this.parseNumber(this.parsePrecision(this.safeString(market, 'quoteAssetPrecision'))),
241
+ },
242
+ 'limits': {
243
+ 'leverage': {
244
+ 'min': undefined,
245
+ 'max': undefined,
246
+ },
247
+ 'amount': {
248
+ 'min': this.safeNumber(market, 'minimumOrderSize'),
249
+ 'max': this.safeNumber(market, 'maximumOrderSize'),
250
+ },
251
+ 'price': {
252
+ 'min': this.safeNumber(market, 'minimumPrice'),
253
+ 'max': this.safeNumber(market, 'maximumPrice'),
254
+ },
255
+ 'cost': {
256
+ 'min': undefined,
257
+ 'max': undefined,
258
+ },
259
+ },
260
+ 'created': this.parse8601(this.safeString(market, 'createdAt')),
261
+ 'info': market,
262
+ };
263
+ }
264
+ async fetchTickers(symbols = undefined, params = {}) {
265
+ /**
266
+ * @method
267
+ * @name mazdax#fetchTickers
268
+ * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
269
+ * @see https://api.mazdax.ir/market/rollingprice
270
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
271
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
272
+ * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
273
+ */
274
+ await this.loadMarkets();
275
+ if (symbols !== undefined) {
276
+ symbols = this.marketSymbols(symbols);
277
+ }
278
+ const markets = await this.fetchMarkets();
279
+ const result = {};
280
+ for (let i = 0; i < markets.length; i++) {
281
+ const market = markets[i];
282
+ const marketId = market['id'];
283
+ const request = {
284
+ 'from': 'mazdax',
285
+ 'symbol': marketId,
286
+ };
287
+ try {
288
+ const response = await this.publicGetMarketRollingprice(request);
289
+ // {
290
+ // "AHRM1IRR": {
291
+ // "symbol": "AHRM1IRR",
292
+ // "priceChange": "525",
293
+ // "priceChangePercent": "2.077",
294
+ // "weightedAvgPrice": "0",
295
+ // "prevClosePrice": "0",
296
+ // "lastPrice": "25800",
297
+ // "lastQty": "14050",
298
+ // "bidPrice": "0",
299
+ // "askPrice": "0",
300
+ // "openPrice": "25275",
301
+ // "highPrice": "26200",
302
+ // "lowPrice": "25274",
303
+ // "volume": "1076873",
304
+ // "valueIrr": "55104642690",
305
+ // "openTime": 1760271737577,
306
+ // "closeTime": 1760351215075,
307
+ // "count": 348
308
+ // }
309
+ // }
310
+ const tickerData = this.safeDict(response, marketId);
311
+ if (tickerData !== undefined) {
312
+ const ticker = this.parseTicker(tickerData, market);
313
+ const symbol = ticker['symbol'];
314
+ result[symbol] = ticker;
315
+ }
316
+ }
317
+ catch (e) {
318
+ // Skip markets that fail
319
+ continue;
320
+ }
321
+ }
322
+ return this.filterByArrayTickers(result, 'symbol', symbols);
323
+ }
324
+ async fetchTicker(symbol, params = {}) {
325
+ /**
326
+ * @method
327
+ * @name mazdax#fetchTicker
328
+ * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
329
+ * @see https://api.mazdax.ir/market/rollingprice
330
+ * @param {string} symbol unified symbol of the market to fetch the ticker for
331
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
332
+ * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
333
+ */
334
+ await this.loadMarkets();
335
+ const market = this.market(symbol);
336
+ const request = {
337
+ 'from': 'mazdax',
338
+ 'symbol': market['id'],
339
+ };
340
+ const response = await this.publicGetMarketRollingprice(request);
341
+ // {
342
+ // "AHRM1IRR": {
343
+ // "symbol": "AHRM1IRR",
344
+ // "priceChange": "525",
345
+ // "priceChangePercent": "2.077",
346
+ // "weightedAvgPrice": "0",
347
+ // "prevClosePrice": "0",
348
+ // "lastPrice": "25800",
349
+ // "lastQty": "14050",
350
+ // "bidPrice": "0",
351
+ // "askPrice": "0",
352
+ // "openPrice": "25275",
353
+ // "highPrice": "26200",
354
+ // "lowPrice": "25274",
355
+ // "volume": "1076873",
356
+ // "valueIrr": "55104642690",
357
+ // "openTime": 1760271737577,
358
+ // "closeTime": 1760351215075,
359
+ // "count": 348
360
+ // }
361
+ // }
362
+ const tickerData = this.safeDict(response, market['id']);
363
+ return this.parseTicker(tickerData, market);
364
+ }
365
+ parseTicker(ticker, market = undefined) {
366
+ // {
367
+ // "symbol": "AHRM1IRR",
368
+ // "priceChange": "525",
369
+ // "priceChangePercent": "2.077",
370
+ // "weightedAvgPrice": "0",
371
+ // "prevClosePrice": "0",
372
+ // "lastPrice": "25800",
373
+ // "lastQty": "14050",
374
+ // "bidPrice": "0",
375
+ // "askPrice": "0",
376
+ // "openPrice": "25275",
377
+ // "highPrice": "26200",
378
+ // "lowPrice": "25274",
379
+ // "volume": "1076873",
380
+ // "valueIrr": "55104642690",
381
+ // "openTime": 1760271737577,
382
+ // "closeTime": 1760351215075,
383
+ // "count": 348
384
+ // }
385
+ const marketType = 'spot';
386
+ const marketId = this.safeString(ticker, 'symbol');
387
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
388
+ const timestamp = this.safeInteger(ticker, 'closeTime');
389
+ const high = this.safeString(ticker, 'highPrice');
390
+ const low = this.safeString(ticker, 'lowPrice');
391
+ const bid = this.safeString(ticker, 'bidPrice');
392
+ const ask = this.safeString(ticker, 'askPrice');
393
+ const last = this.safeString(ticker, 'lastPrice');
394
+ const open = this.safeString(ticker, 'openPrice');
395
+ const baseVolume = this.safeString(ticker, 'volume');
396
+ const quoteVolume = this.safeString(ticker, 'valueIrr');
397
+ const priceChange = this.safeString(ticker, 'priceChange');
398
+ const percentage = this.safeString(ticker, 'priceChangePercent');
399
+ return this.safeTicker({
400
+ 'symbol': symbol,
401
+ 'timestamp': timestamp,
402
+ 'datetime': this.iso8601(timestamp),
403
+ 'high': high,
404
+ 'low': low,
405
+ 'bid': bid,
406
+ 'bidVolume': undefined,
407
+ 'ask': ask,
408
+ 'askVolume': undefined,
409
+ 'vwap': undefined,
410
+ 'open': open,
411
+ 'close': last,
412
+ 'last': last,
413
+ 'previousClose': undefined,
414
+ 'change': priceChange,
415
+ 'percentage': percentage,
416
+ 'average': undefined,
417
+ 'baseVolume': baseVolume,
418
+ 'quoteVolume': quoteVolume,
419
+ 'info': ticker,
420
+ }, market);
421
+ }
422
+ async fetchOHLCV(symbol, timeframe = '1d', since = undefined, limit = undefined, params = {}) {
423
+ /**
424
+ * @method
425
+ * @name mazdax#fetchOHLCV
426
+ * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
427
+ * @see https://api.mazdax.ir/market/candle
428
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
429
+ * @param {string} timeframe the length of time each candle represents
430
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
431
+ * @param {int} [limit] the maximum amount of candles to fetch
432
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
433
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
434
+ */
435
+ await this.loadMarkets();
436
+ const market = this.market(symbol);
437
+ const endTime = Date.now();
438
+ const request = {
439
+ 'from': 'binance',
440
+ 'symbol': market['id'],
441
+ 'interval': this.safeString(this.timeframes, timeframe, timeframe),
442
+ 'limit': limit !== undefined ? limit : 1000,
443
+ 'starttime': (endTime) - (30 * 24 * 60 * 60 * 1000),
444
+ 'endtime': endTime,
445
+ };
446
+ if (since !== undefined) {
447
+ request['starttime'] = since / 1000;
448
+ }
449
+ const response = await this.publicGetMarketCandle(request);
450
+ // {
451
+ // "Candles": [
452
+ // {
453
+ // "openTime": "2021-12-20T03:30:00+03:30",
454
+ // "openPrice": "10000",
455
+ // "highPrice": "10000",
456
+ // "lowPrice": "10000",
457
+ // "closePrice": "10000",
458
+ // "volume": "490000000",
459
+ // "closeTime": "2021-12-20T03:30:00+03:30",
460
+ // "quoteAssetVolume": "0",
461
+ // "numberOfTrades": 0,
462
+ // "takerBuyBaseAssetVolume": "0",
463
+ // "takerBuyQuoteAssetVolume": "0",
464
+ // "ignore": "0"
465
+ // },
466
+ // ...
467
+ // ]
468
+ // }
469
+ const candles = this.safeList(response, 'Candles', []);
470
+ const ohlcvs = [];
471
+ for (let i = 0; i < candles.length; i++) {
472
+ const candle = candles[i];
473
+ const timestamp = this.parse8601(this.safeString(candle, 'openTime'));
474
+ const open = this.safeString(candle, 'openPrice');
475
+ const high = this.safeString(candle, 'highPrice');
476
+ const low = this.safeString(candle, 'lowPrice');
477
+ const close = this.safeString(candle, 'closePrice');
478
+ const volume = this.safeString(candle, 'volume');
479
+ ohlcvs.push([
480
+ timestamp,
481
+ open,
482
+ high,
483
+ low,
484
+ close,
485
+ volume,
486
+ ]);
487
+ }
488
+ return this.parseOHLCVs(ohlcvs, market, timeframe, since, limit);
489
+ }
490
+ async fetchOrderBook(symbol, limit = undefined, params = {}) {
491
+ /**
492
+ * @method
493
+ * @name mazdax#fetchOrderBook
494
+ * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
495
+ * @see https://api.mazdax.ir/market/order
496
+ * @param {string} symbol unified symbol of the market to fetch the order book for
497
+ * @param {int} [limit] the maximum amount of order book entries to return
498
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
499
+ * @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
500
+ */
501
+ await this.loadMarkets();
502
+ const market = this.market(symbol);
503
+ const request = {
504
+ 'from': 'mazdax',
505
+ 'symbol': market['id'],
506
+ 'limit': limit !== undefined ? limit : 25,
507
+ };
508
+ const response = await this.publicGetMarketOrder(request);
509
+ // {
510
+ // "timestamp": "0001-01-01T00:00:00Z",
511
+ // "bids": [
512
+ // ["25321", "9344"],
513
+ // ["25320", "15000"],
514
+ // ...
515
+ // ],
516
+ // "asks": [
517
+ // ["26190", "5341"],
518
+ // ["26195", "2310"],
519
+ // ...
520
+ // ]
521
+ // }
522
+ const timestamp = this.parse8601(this.safeString(response, 'timestamp'));
523
+ return this.parseOrderBook(response, symbol, timestamp, 'bids', 'asks', 0, 1);
524
+ }
525
+ sign(path, api = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
526
+ const query = this.omit(params, this.extractParams(path));
527
+ let url = this.urls['api']['public'] + '/' + path;
528
+ if (Object.keys(query).length) {
529
+ url = url + '?' + this.urlencode(query);
530
+ }
531
+ headers = { 'Content-Type': 'application/json' };
532
+ return { 'url': url, 'method': method, 'body': body, 'headers': headers };
533
+ }
534
+ }