ccxt-ir 4.9.2__py2.py3-none-any.whl → 4.9.10__py2.py3-none-any.whl

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 (46) hide show
  1. ccxt/__init__.py +17 -1
  2. ccxt/abantether.py +88 -69
  3. ccxt/abstract/abantether.py +1 -1
  4. ccxt/abstract/arzplus.py +1 -0
  5. ccxt/abstract/bitbarg.py +5 -0
  6. ccxt/abstract/bydfi.py +8 -0
  7. ccxt/abstract/cafearz.py +5 -0
  8. ccxt/abstract/hamtapay.py +6 -0
  9. ccxt/abstract/kifpoolme.py +6 -0
  10. ccxt/abstract/mazdax.py +8 -0
  11. ccxt/abstract/pingi.py +6 -0
  12. ccxt/abstract/pooleno.py +5 -0
  13. ccxt/afratether.py +84 -36
  14. ccxt/arzplus.py +144 -8
  15. ccxt/async_support/__init__.py +17 -1
  16. ccxt/async_support/abantether.py +88 -69
  17. ccxt/async_support/afratether.py +84 -36
  18. ccxt/async_support/arzplus.py +144 -8
  19. ccxt/async_support/base/exchange.py +1 -1
  20. ccxt/async_support/bitbarg.py +298 -0
  21. ccxt/async_support/bydfi.py +406 -0
  22. ccxt/async_support/cafearz.py +333 -0
  23. ccxt/async_support/hamtapay.py +285 -0
  24. ccxt/async_support/kifpoolme.py +385 -0
  25. ccxt/async_support/mazdax.py +512 -0
  26. ccxt/async_support/pingi.py +426 -0
  27. ccxt/async_support/pooleno.py +331 -0
  28. ccxt/async_support/tetherland.py +4 -4
  29. ccxt/async_support/twox.py +52 -28
  30. ccxt/base/exchange.py +1 -1
  31. ccxt/bitbarg.py +298 -0
  32. ccxt/bydfi.py +406 -0
  33. ccxt/cafearz.py +333 -0
  34. ccxt/hamtapay.py +285 -0
  35. ccxt/kifpoolme.py +385 -0
  36. ccxt/mazdax.py +512 -0
  37. ccxt/pingi.py +426 -0
  38. ccxt/pooleno.py +331 -0
  39. ccxt/pro/__init__.py +1 -1
  40. ccxt/tetherland.py +4 -4
  41. ccxt/twox.py +52 -28
  42. {ccxt_ir-4.9.2.dist-info → ccxt_ir-4.9.10.dist-info}/METADATA +8 -8
  43. {ccxt_ir-4.9.2.dist-info → ccxt_ir-4.9.10.dist-info}/RECORD +46 -22
  44. {ccxt_ir-4.9.2.dist-info → ccxt_ir-4.9.10.dist-info}/WHEEL +0 -0
  45. {ccxt_ir-4.9.2.dist-info → ccxt_ir-4.9.10.dist-info}/licenses/LICENSE.txt +0 -0
  46. {ccxt_ir-4.9.2.dist-info → ccxt_ir-4.9.10.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,512 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
4
+ # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
5
+
6
+ from ccxt.async_support.base.exchange import Exchange
7
+ from ccxt.abstract.mazdax import ImplicitAPI
8
+ from ccxt.base.types import Any, Int, Market, OrderBook, Strings, Ticker, Tickers
9
+ from typing import List
10
+
11
+
12
+ class mazdax(Exchange, ImplicitAPI):
13
+
14
+ def describe(self) -> Any:
15
+ return self.deep_extend(super(mazdax, self).describe(), {
16
+ 'id': 'mazdax',
17
+ 'name': 'Mazdax',
18
+ 'countries': ['IR'],
19
+ 'rateLimit': 1000,
20
+ 'version': '1',
21
+ 'certified': False,
22
+ 'pro': False,
23
+ 'has': {
24
+ 'CORS': None,
25
+ 'spot': False,
26
+ 'margin': False,
27
+ 'swap': False,
28
+ 'future': False,
29
+ 'option': False,
30
+ 'addMargin': False,
31
+ 'cancelAllOrders': False,
32
+ 'cancelOrder': False,
33
+ 'cancelOrders': False,
34
+ 'createDepositAddress': False,
35
+ 'createOrder': False,
36
+ 'createStopLimitOrder': False,
37
+ 'createStopMarketOrder': False,
38
+ 'createStopOrder': False,
39
+ 'editOrder': False,
40
+ 'fetchBalance': False,
41
+ 'fetchBorrowInterest': False,
42
+ 'fetchBorrowRateHistories': False,
43
+ 'fetchBorrowRateHistory': False,
44
+ 'fetchClosedOrders': False,
45
+ 'fetchCrossBorrowRate': False,
46
+ 'fetchCrossBorrowRates': False,
47
+ 'fetchCurrencies': False,
48
+ 'fetchDepositAddress': False,
49
+ 'fetchDeposits': False,
50
+ 'fetchFundingHistory': False,
51
+ 'fetchFundingRate': False,
52
+ 'fetchFundingRateHistory': False,
53
+ 'fetchFundingRates': False,
54
+ 'fetchIndexOHLCV': False,
55
+ 'fetchIsolatedBorrowRate': False,
56
+ 'fetchIsolatedBorrowRates': False,
57
+ 'fetchL2OrderBook': False,
58
+ 'fetchL3OrderBook': False,
59
+ 'fetchLedger': False,
60
+ 'fetchLedgerEntry': False,
61
+ 'fetchLeverageTiers': False,
62
+ 'fetchMarkets': True,
63
+ 'fetchMarkOHLCV': False,
64
+ 'fetchMyTrades': False,
65
+ 'fetchOHLCV': True,
66
+ 'fetchOpenInterestHistory': False,
67
+ 'fetchOpenOrders': False,
68
+ 'fetchOrder': False,
69
+ 'fetchOrderBook': True,
70
+ 'fetchOrders': False,
71
+ 'fetchOrderTrades': 'emulated',
72
+ 'fetchPositions': False,
73
+ 'fetchPremiumIndexOHLCV': False,
74
+ 'fetchTicker': True,
75
+ 'fetchTickers': True,
76
+ 'fetchTime': False,
77
+ 'fetchTrades': False,
78
+ 'fetchTradingFee': False,
79
+ 'fetchTradingFees': False,
80
+ 'fetchWithdrawals': False,
81
+ 'otc': True,
82
+ 'setLeverage': False,
83
+ 'setMarginMode': False,
84
+ 'transfer': False,
85
+ 'withdraw': False,
86
+ },
87
+ 'comment': 'Mazdax OTC 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': self.parse_number('0.001'),
123
+ 'taker': self.parse_number('0.001'),
124
+ },
125
+ },
126
+ })
127
+
128
+ async def fetch_markets(self, params={}) -> List[Market]:
129
+ """
130
+ retrieves data on all markets for mazdax
131
+ https://api.mazdax.ir/market/symbols
132
+ :param dict [params]: extra parameters specific to the exchange API endpoint
133
+ :returns dict[]: an array of objects representing market data
134
+ """
135
+ response = await self.publicGetMarketSymbols(params)
136
+ # Response is an array of market objects:
137
+ # [
138
+ # {
139
+ # "id": 67,
140
+ # "createdAt": "2022-12-26T07:33:25Z",
141
+ # "updatedAt": "2025-07-04T16:18:57Z",
142
+ # "order": 2,
143
+ # "symbol": "AHRM1IRR",
144
+ # "baseAsset": "AHRM1",
145
+ # "baseAssetTranslate": "AHRM1",
146
+ # "baseAssetPrecision": 0,
147
+ # "quoteAsset": "IRR",
148
+ # "quoteAssetTranslate": "IRR",
149
+ # "takerFee": "0.00116",
150
+ # "makerFee": "0.001044",
151
+ # "quoteAssetPrecision": 0,
152
+ # "isTradable": True,
153
+ # "isActive": True,
154
+ # "isPublic": True,
155
+ # "minimumOrderSize": "100000",
156
+ # "maximumOrderSize": "0",
157
+ # "minimumPrice": "0",
158
+ # "maximumPrice": "0",
159
+ # "marketCOV": "0.01",
160
+ # "marketCap": "10",
161
+ # "tickSize": "1",
162
+ # "stepSize": "1",
163
+ # ...
164
+ # }
165
+ # ]
166
+ result = []
167
+ for i in range(0, len(response)):
168
+ market = self.parse_market(response[i])
169
+ result.append(market)
170
+ return result
171
+
172
+ def parse_market(self, market) -> Market:
173
+ # {
174
+ # "id": 67,
175
+ # "createdAt": "2022-12-26T07:33:25Z",
176
+ # "updatedAt": "2025-07-04T16:18:57Z",
177
+ # "order": 2,
178
+ # "symbol": "AHRM1IRR",
179
+ # "baseAsset": "AHRM1",
180
+ # "baseAssetTranslate": "AHRM1",
181
+ # "baseAssetPrecision": 0,
182
+ # "quoteAsset": "IRR",
183
+ # "quoteAssetTranslate": "IRR",
184
+ # "takerFee": "0.00116",
185
+ # "makerFee": "0.001044",
186
+ # "quoteAssetPrecision": 0,
187
+ # "isTradable": True,
188
+ # "isActive": True,
189
+ # "isPublic": True,
190
+ # "minimumOrderSize": "100000",
191
+ # "maximumOrderSize": "0",
192
+ # "minimumPrice": "0",
193
+ # "maximumPrice": "0",
194
+ # "marketCOV": "0.01",
195
+ # "marketCap": "10",
196
+ # "tickSize": "1",
197
+ # "stepSize": "1",
198
+ # ...
199
+ # }
200
+ id = self.safe_string(market, 'symbol')
201
+ baseId = self.safe_string(market, 'baseAsset')
202
+ quoteId = self.safe_string(market, 'quoteAsset')
203
+ base = self.safe_currency_code(baseId)
204
+ quote = self.safe_currency_code(quoteId)
205
+ baseId = baseId.lower()
206
+ quoteId = quoteId.lower()
207
+ isActive = self.safe_bool(market, 'isActive', False)
208
+ isTradable = self.safe_bool(market, 'isTradable', False)
209
+ active = isActive and isTradable
210
+ return {
211
+ 'id': id,
212
+ 'symbol': base + '/' + quote,
213
+ 'base': base,
214
+ 'quote': quote,
215
+ 'settle': None,
216
+ 'baseId': baseId,
217
+ 'quoteId': quoteId,
218
+ 'settleId': None,
219
+ 'type': 'otc',
220
+ 'spot': False,
221
+ 'margin': False,
222
+ 'swap': False,
223
+ 'future': False,
224
+ 'option': False,
225
+ 'active': active,
226
+ 'contract': False,
227
+ 'linear': None,
228
+ 'inverse': None,
229
+ 'contractSize': None,
230
+ 'expiry': None,
231
+ 'expiryDatetime': None,
232
+ 'strike': None,
233
+ 'optionType': None,
234
+ 'precision': {
235
+ 'amount': self.parse_number(self.parse_precision(self.safe_string(market, 'baseAssetPrecision'))),
236
+ 'price': self.parse_number(self.parse_precision(self.safe_string(market, 'quoteAssetPrecision'))),
237
+ },
238
+ 'limits': {
239
+ 'leverage': {
240
+ 'min': None,
241
+ 'max': None,
242
+ },
243
+ 'amount': {
244
+ 'min': self.safe_number(market, 'minimumOrderSize'),
245
+ 'max': self.safe_number(market, 'maximumOrderSize'),
246
+ },
247
+ 'price': {
248
+ 'min': self.safe_number(market, 'minimumPrice'),
249
+ 'max': self.safe_number(market, 'maximumPrice'),
250
+ },
251
+ 'cost': {
252
+ 'min': None,
253
+ 'max': None,
254
+ },
255
+ },
256
+ 'created': self.parse8601(self.safe_string(market, 'createdAt')),
257
+ 'info': market,
258
+ }
259
+
260
+ async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
261
+ """
262
+ fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
263
+ https://api.mazdax.ir/market/rollingprice
264
+ :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
265
+ :param dict [params]: extra parameters specific to the exchange API endpoint
266
+ :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
267
+ """
268
+ await self.load_markets()
269
+ if symbols is not None:
270
+ symbols = self.market_symbols(symbols)
271
+ markets = await self.fetch_markets()
272
+ result = {}
273
+ for i in range(0, len(markets)):
274
+ market = markets[i]
275
+ marketId = market['id']
276
+ request = {
277
+ 'from': 'mazdax',
278
+ 'symbol': marketId,
279
+ }
280
+ try:
281
+ response = await self.publicGetMarketRollingprice(request)
282
+ # {
283
+ # "AHRM1IRR": {
284
+ # "symbol": "AHRM1IRR",
285
+ # "priceChange": "525",
286
+ # "priceChangePercent": "2.077",
287
+ # "weightedAvgPrice": "0",
288
+ # "prevClosePrice": "0",
289
+ # "lastPrice": "25800",
290
+ # "lastQty": "14050",
291
+ # "bidPrice": "0",
292
+ # "askPrice": "0",
293
+ # "openPrice": "25275",
294
+ # "highPrice": "26200",
295
+ # "lowPrice": "25274",
296
+ # "volume": "1076873",
297
+ # "valueIrr": "55104642690",
298
+ # "openTime": 1760271737577,
299
+ # "closeTime": 1760351215075,
300
+ # "count": 348
301
+ # }
302
+ # }
303
+ tickerData = self.safe_dict(response, marketId)
304
+ if tickerData is not None:
305
+ ticker = self.parse_ticker(tickerData, market)
306
+ symbol = ticker['symbol']
307
+ result[symbol] = ticker
308
+ except Exception as e:
309
+ # Skip markets that fail
310
+ continue
311
+ return self.filter_by_array_tickers(result, 'symbol', symbols)
312
+
313
+ async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
314
+ """
315
+ fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
316
+ https://api.mazdax.ir/market/rollingprice
317
+ :param str symbol: unified symbol of the market to fetch the ticker for
318
+ :param dict [params]: extra parameters specific to the exchange API endpoint
319
+ :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
320
+ """
321
+ await self.load_markets()
322
+ market = self.market(symbol)
323
+ request = {
324
+ 'from': 'mazdax',
325
+ 'symbol': market['id'],
326
+ }
327
+ response = await self.publicGetMarketRollingprice(request)
328
+ # {
329
+ # "AHRM1IRR": {
330
+ # "symbol": "AHRM1IRR",
331
+ # "priceChange": "525",
332
+ # "priceChangePercent": "2.077",
333
+ # "weightedAvgPrice": "0",
334
+ # "prevClosePrice": "0",
335
+ # "lastPrice": "25800",
336
+ # "lastQty": "14050",
337
+ # "bidPrice": "0",
338
+ # "askPrice": "0",
339
+ # "openPrice": "25275",
340
+ # "highPrice": "26200",
341
+ # "lowPrice": "25274",
342
+ # "volume": "1076873",
343
+ # "valueIrr": "55104642690",
344
+ # "openTime": 1760271737577,
345
+ # "closeTime": 1760351215075,
346
+ # "count": 348
347
+ # }
348
+ # }
349
+ tickerData = self.safe_dict(response, market['id'])
350
+ return self.parse_ticker(tickerData, market)
351
+
352
+ def parse_ticker(self, ticker, market: Market = None) -> Ticker:
353
+ # {
354
+ # "symbol": "AHRM1IRR",
355
+ # "priceChange": "525",
356
+ # "priceChangePercent": "2.077",
357
+ # "weightedAvgPrice": "0",
358
+ # "prevClosePrice": "0",
359
+ # "lastPrice": "25800",
360
+ # "lastQty": "14050",
361
+ # "bidPrice": "0",
362
+ # "askPrice": "0",
363
+ # "openPrice": "25275",
364
+ # "highPrice": "26200",
365
+ # "lowPrice": "25274",
366
+ # "volume": "1076873",
367
+ # "valueIrr": "55104642690",
368
+ # "openTime": 1760271737577,
369
+ # "closeTime": 1760351215075,
370
+ # "count": 348
371
+ # }
372
+ marketType = 'otc'
373
+ marketId = self.safe_string(ticker, 'symbol')
374
+ symbol = self.safe_symbol(marketId, market, None, marketType)
375
+ timestamp = self.safe_integer(ticker, 'closeTime')
376
+ high = self.safe_string(ticker, 'highPrice')
377
+ low = self.safe_string(ticker, 'lowPrice')
378
+ bid = self.safe_string(ticker, 'bidPrice')
379
+ ask = self.safe_string(ticker, 'askPrice')
380
+ last = self.safe_string(ticker, 'lastPrice')
381
+ open = self.safe_string(ticker, 'openPrice')
382
+ baseVolume = self.safe_string(ticker, 'volume')
383
+ quoteVolume = self.safe_string(ticker, 'valueIrr')
384
+ priceChange = self.safe_string(ticker, 'priceChange')
385
+ percentage = self.safe_string(ticker, 'priceChangePercent')
386
+ return self.safe_ticker({
387
+ 'symbol': symbol,
388
+ 'timestamp': timestamp,
389
+ 'datetime': self.iso8601(timestamp),
390
+ 'high': high,
391
+ 'low': low,
392
+ 'bid': bid,
393
+ 'bidVolume': None,
394
+ 'ask': ask,
395
+ 'askVolume': None,
396
+ 'vwap': None,
397
+ 'open': open,
398
+ 'close': last,
399
+ 'last': last,
400
+ 'previousClose': None,
401
+ 'change': priceChange,
402
+ 'percentage': percentage,
403
+ 'average': None,
404
+ 'baseVolume': baseVolume,
405
+ 'quoteVolume': quoteVolume,
406
+ 'info': ticker,
407
+ }, market)
408
+
409
+ async def fetch_ohlcv(self, symbol: str, timeframe='1d', since: Int = None, limit: Int = None, params={}) -> List[list]:
410
+ """
411
+ fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
412
+ https://api.mazdax.ir/market/candle
413
+ :param str symbol: unified symbol of the market to fetch OHLCV data for
414
+ :param str timeframe: the length of time each candle represents
415
+ :param int [since]: timestamp in ms of the earliest candle to fetch
416
+ :param int [limit]: the maximum amount of candles to fetch
417
+ :param dict [params]: extra parameters specific to the exchange API endpoint
418
+ :returns int[][]: A list of candles ordered, open, high, low, close, volume
419
+ """
420
+ await self.load_markets()
421
+ market = self.market(symbol)
422
+ endTime = Date.now()
423
+ request = {
424
+ 'from': 'binance',
425
+ 'symbol': market['id'],
426
+ 'interval': self.safe_string(self.timeframes, timeframe, timeframe),
427
+ 'limit': limit is not limit if None else 1000,
428
+ 'starttime': (endTime) - (30 * 24 * 60 * 60 * 1000), # 30 days ago
429
+ 'endtime': endTime,
430
+ }
431
+ if since is not None:
432
+ request['starttime'] = since / 1000
433
+ response = await self.publicGetMarketCandle(request)
434
+ # {
435
+ # "Candles": [
436
+ # {
437
+ # "openTime": "2021-12-20T03:30:00+03:30",
438
+ # "openPrice": "10000",
439
+ # "highPrice": "10000",
440
+ # "lowPrice": "10000",
441
+ # "closePrice": "10000",
442
+ # "volume": "490000000",
443
+ # "closeTime": "2021-12-20T03:30:00+03:30",
444
+ # "quoteAssetVolume": "0",
445
+ # "numberOfTrades": 0,
446
+ # "takerBuyBaseAssetVolume": "0",
447
+ # "takerBuyQuoteAssetVolume": "0",
448
+ # "ignore": "0"
449
+ # },
450
+ # ...
451
+ # ]
452
+ # }
453
+ candles = self.safe_list(response, 'Candles', [])
454
+ ohlcvs = []
455
+ for i in range(0, len(candles)):
456
+ candle = candles[i]
457
+ timestamp = self.parse8601(self.safe_string(candle, 'openTime'))
458
+ open = self.safe_string(candle, 'openPrice')
459
+ high = self.safe_string(candle, 'highPrice')
460
+ low = self.safe_string(candle, 'lowPrice')
461
+ close = self.safe_string(candle, 'closePrice')
462
+ volume = self.safe_string(candle, 'volume')
463
+ ohlcvs.append([
464
+ timestamp,
465
+ open,
466
+ high,
467
+ low,
468
+ close,
469
+ volume,
470
+ ])
471
+ return self.parse_ohlcvs(ohlcvs, market, timeframe, since, limit)
472
+
473
+ async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
474
+ """
475
+ fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
476
+ https://api.mazdax.ir/market/order
477
+ :param str symbol: unified symbol of the market to fetch the order book for
478
+ :param int [limit]: the maximum amount of order book entries to return
479
+ :param dict [params]: extra parameters specific to the exchange API endpoint
480
+ :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
481
+ """
482
+ await self.load_markets()
483
+ market = self.market(symbol)
484
+ request = {
485
+ 'from': 'mazdax',
486
+ 'symbol': market['id'],
487
+ 'limit': limit is not limit if None else 25,
488
+ }
489
+ response = await self.publicGetMarketOrder(request)
490
+ # {
491
+ # "timestamp": "0001-01-01T00:00:00Z",
492
+ # "bids": [
493
+ # ["25321", "9344"],
494
+ # ["25320", "15000"],
495
+ # ...
496
+ # ],
497
+ # "asks": [
498
+ # ["26190", "5341"],
499
+ # ["26195", "2310"],
500
+ # ...
501
+ # ]
502
+ # }
503
+ timestamp = self.parse8601(self.safe_string(response, 'timestamp'))
504
+ return self.parse_order_book(response, symbol, timestamp, 'bids', 'asks', 0, 1)
505
+
506
+ def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
507
+ query = self.omit(params, self.extract_params(path))
508
+ url = self.urls['api']['public'] + '/' + path
509
+ if query:
510
+ url = url + '?' + self.urlencode(query)
511
+ headers = {'Content-Type': 'application/json'}
512
+ return {'url': url, 'method': method, 'body': body, 'headers': headers}