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