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
@@ -22,7 +22,7 @@ class afratether(Exchange, ImplicitAPI):
22
22
  'pro': False,
23
23
  'has': {
24
24
  'CORS': None,
25
- 'spot': True,
25
+ 'spot': False,
26
26
  'margin': False,
27
27
  'swap': False,
28
28
  'future': False,
@@ -78,6 +78,7 @@ class afratether(Exchange, ImplicitAPI):
78
78
  'fetchTradingFee': False,
79
79
  'fetchTradingFees': False,
80
80
  'fetchWithdrawals': False,
81
+ 'otc': True,
81
82
  'setLeverage': False,
82
83
  'setMarginMode': False,
83
84
  'transfer': False,
@@ -134,21 +135,43 @@ class afratether(Exchange, ImplicitAPI):
134
135
 
135
136
  def parse_market(self, market) -> Market:
136
137
  # {
137
- # "currencyAbb": "BTC",
138
- # "nameEn": "Bitcoin",
139
- # "nameFa": "بیت کوین",
140
- # "icon": "/assets/crypto/BTC.png",
141
- # "currency": "BTC",
142
- # "prices": [
143
- # {
144
- # "currency": "USDT",
145
- # "price": "67797.1"
138
+ # "currencyAbb": "USDT",
139
+ # "nameEn": "Tether",
140
+ # "nameFa": "تتر",
141
+ # "icon": "/assets/crypto/usdt.png",
142
+ # "round": 1000000,
143
+ # "currency": "USDT",
144
+ # "changeRate24h": "-0.0065",
145
+ # "Klines": [
146
+ # [
147
+ # "1760227200000",
148
+ # "1147500",
149
+ # "1140000",
150
+ # "1145500",
151
+ # "1125000",
152
+ # "0",
153
+ # "0"
154
+ # ],
155
+ # ],
156
+ # "info": {
157
+ # "birth_date": 1412553600000,
158
+ # "open_24h": 1,
159
+ # "open_1w": 1,
160
+ # "open_3M": 1,
161
+ # "open_1y": 1
162
+ # },
163
+ # "prices": {
164
+ # "USDT": {
165
+ # "price": "1"
166
+ # },
167
+ # "IRR": {
168
+ # "price_sell": 1135000,
169
+ # "price_buy": 1123000
146
170
  # }
147
- # ]
148
- # },
149
- details = self.safe_list(market, 'prices')
171
+ # }
172
+ # }
150
173
  baseId = self.safe_string(market, 'currency')
151
- quoteId = self.safe_string(details[0], 'currency')
174
+ quoteId = 'IRR'
152
175
  base = self.safe_currency_code(baseId)
153
176
  quote = self.safe_currency_code(quoteId)
154
177
  id = base + quote
@@ -163,8 +186,8 @@ class afratether(Exchange, ImplicitAPI):
163
186
  'baseId': baseId,
164
187
  'quoteId': quoteId,
165
188
  'settleId': None,
166
- 'type': 'spot',
167
- 'spot': True,
189
+ 'type': 'otc',
190
+ 'spot': False,
168
191
  'margin': False,
169
192
  'swap': False,
170
193
  'future': False,
@@ -241,41 +264,66 @@ class afratether(Exchange, ImplicitAPI):
241
264
 
242
265
  def parse_ticker(self, ticker, market: Market = None) -> Ticker:
243
266
  # {
244
- # "currencyAbb": "BTC",
245
- # "nameEn": "Bitcoin",
246
- # "nameFa": "بیت کوین",
247
- # "icon": "/assets/crypto/BTC.png",
248
- # "currency": "BTC",
249
- # "prices": [
250
- # {
251
- # "currency": "USDT",
252
- # "price": "67797.1"
267
+ # "currencyAbb": "USDT",
268
+ # "nameEn": "Tether",
269
+ # "nameFa": "تتر",
270
+ # "icon": "/assets/crypto/usdt.png",
271
+ # "round": 1000000,
272
+ # "currency": "USDT",
273
+ # "changeRate24h": "-0.0065",
274
+ # "Klines": [
275
+ # [
276
+ # "1760227200000",
277
+ # "1147500",
278
+ # "1140000",
279
+ # "1145500",
280
+ # "1125000",
281
+ # "0",
282
+ # "0"
283
+ # ],
284
+ # ],
285
+ # "info": {
286
+ # "birth_date": 1412553600000,
287
+ # "open_24h": 1,
288
+ # "open_1w": 1,
289
+ # "open_3M": 1,
290
+ # "open_1y": 1
291
+ # },
292
+ # "prices": {
293
+ # "USDT": {
294
+ # "price": "1"
295
+ # },
296
+ # "IRR": {
297
+ # "price_sell": 1135000,
298
+ # "price_buy": 1123000
253
299
  # }
254
- # ]
255
- # },
300
+ # }
301
+ # }
256
302
  marketType = 'otc'
257
- details = self.safe_list(ticker, 'prices')
258
303
  base = self.safe_string(ticker, 'currency')
259
- quote = self.safe_string(details[0], 'currency')
260
- marketId = base + quote
304
+ quote = 'IRR'
305
+ marketId = base + '/' + quote
261
306
  symbol = self.safe_symbol(marketId, market, None, marketType)
262
- last = self.safe_float(details[0], 'price', 0)
307
+ prices = self.safe_dict(ticker, 'prices', {})
308
+ irrPrices = self.safe_dict(prices, 'IRR', {})
309
+ sell = self.safe_float(irrPrices, 'price_sell', 0)
310
+ buy = self.safe_float(irrPrices, 'price_buy', 0)
263
311
  return self.safe_ticker({
264
312
  'symbol': symbol,
265
313
  'timestamp': None,
266
314
  'datetime': None,
267
315
  'high': None,
268
316
  'low': None,
269
- 'bid': None,
317
+ 'bid': sell,
270
318
  'bidVolume': None,
271
- 'ask': None,
319
+ 'ask': buy,
272
320
  'askVolume': None,
273
321
  'vwap': None,
274
322
  'open': None,
275
- 'close': last,
276
- 'last': last,
323
+ 'close': buy,
324
+ 'last': buy,
277
325
  'previousClose': None,
278
- 'change': None,
326
+ 'change': self.safe_float(ticker, 'changeRate24h', None),
279
327
  'percentage': None,
280
328
  'average': None,
281
329
  'baseVolume': None,
@@ -5,7 +5,7 @@
5
5
 
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.arzplus import ImplicitAPI
8
- from ccxt.base.types import Any, Int, Market, OrderBook, Strings, Ticker, Tickers
8
+ from ccxt.base.types import Any, Int, Market, MarketType, OrderBook, Strings, Ticker, Tickers
9
9
  from typing import List
10
10
 
11
11
 
@@ -103,6 +103,7 @@ class arzplus(Exchange, ImplicitAPI):
103
103
  'api/v1/market/symbols': 1,
104
104
  'api/v1/market/tradingview/ohlcv': 1,
105
105
  'api/v1/market/depth': 1,
106
+ 'api/v1/market/irt/info': 1,
106
107
  },
107
108
  },
108
109
  },
@@ -127,14 +128,31 @@ class arzplus(Exchange, ImplicitAPI):
127
128
  'stats': '1',
128
129
  'enable': 'true',
129
130
  }
130
- response = await self.publicGetApiV1MarketSymbols(request)
131
+ typedRequest = self.safe_string(params, 'type', 'spot')
132
+ response = []
133
+ otcMarkets = []
134
+ if typedRequest == 'otc':
135
+ otcMarkets = await self.publicGetApiV1MarketIrtInfo(request)
136
+ else:
137
+ response = await self.publicGetApiV1MarketSymbols(request)
131
138
  result = []
132
139
  for i in range(0, len(response)):
133
140
  market = self.parse_market(response[i])
134
141
  result.append(market)
142
+ for i in range(0, len(otcMarkets)):
143
+ marketdata = otcMarkets[i]
144
+ marketdata['quote'] = 'IRT'
145
+ marketdata['id'] = 'OTC_' + marketdata['symbol'] + marketdata['quote']
146
+ parsedMarket = self.parse_otc_markets(marketdata)
147
+ result.append(parsedMarket)
135
148
  return result
136
149
 
137
- def parse_market(self, market) -> Market:
150
+ def parse_market(self, market, type: MarketType = 'spot') -> Market:
151
+ if type == 'otc':
152
+ return self.parse_otc_markets(market)
153
+ return self.parse_spot_market(market)
154
+
155
+ def parse_spot_market(self, market) -> Market:
138
156
  # {
139
157
  # 'name': 'USDTIRT',
140
158
  # 'asset': {
@@ -230,6 +248,72 @@ class arzplus(Exchange, ImplicitAPI):
230
248
  'info': market,
231
249
  }
232
250
 
251
+ def parse_otc_markets(self, market) -> Market:
252
+ # {
253
+ # symbol: "BTC",
254
+ # ask: "13877900000",
255
+ # bid: "13860999995",
256
+ # name: "bitcoin"
257
+ # qoute: "IRT",
258
+ # id: "OTC_BTCIRT"
259
+ # },
260
+ baseAsset = self.safe_string(market, 'symbol')
261
+ quoteAsset = self.safe_string(market, 'quote')
262
+ baseId = baseAsset
263
+ quoteId = quoteAsset
264
+ base = self.safe_currency_code(baseId)
265
+ quote = self.safe_currency_code(quoteId)
266
+ id = self.safe_string(market, 'id')
267
+ return {
268
+ 'id': id,
269
+ 'symbol': base + '/' + quote,
270
+ 'base': base,
271
+ 'quote': quote,
272
+ 'settle': None,
273
+ 'baseId': baseId,
274
+ 'quoteId': quoteId,
275
+ 'settleId': None,
276
+ 'type': 'otc',
277
+ 'spot': False,
278
+ 'margin': False,
279
+ 'swap': False,
280
+ 'future': False,
281
+ 'option': False,
282
+ 'active': True,
283
+ 'contract': False,
284
+ 'linear': None,
285
+ 'inverse': None,
286
+ 'contractSize': None,
287
+ 'expiry': None,
288
+ 'expiryDatetime': None,
289
+ 'strike': None,
290
+ 'optionType': None,
291
+ 'precision': {
292
+ 'amount': None,
293
+ 'price': None,
294
+ },
295
+ 'limits': {
296
+ 'leverage': {
297
+ 'min': None,
298
+ 'max': None,
299
+ },
300
+ 'amount': {
301
+ 'min': None,
302
+ 'max': None,
303
+ },
304
+ 'price': {
305
+ 'min': None,
306
+ 'max': None,
307
+ },
308
+ 'cost': {
309
+ 'min': None,
310
+ 'max': None,
311
+ },
312
+ },
313
+ 'created': None,
314
+ 'info': market,
315
+ }
316
+
233
317
  async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
234
318
  """
235
319
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
@@ -238,11 +322,22 @@ class arzplus(Exchange, ImplicitAPI):
238
322
  :param dict [params]: extra parameters specific to the exchange API endpoint
239
323
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
240
324
  """
241
- await self.load_markets()
325
+ marketType = self.safe_string(params, 'type', 'spot')
326
+ await self.load_markets(False, {'type': marketType})
242
327
  if symbols is not None:
243
328
  symbols = self.market_symbols(symbols)
244
- response = await self.publicGetApiV1MarketSymbols(params)
245
329
  result = {}
330
+ if marketType == 'otc':
331
+ otcMarkets = await self.publicGetApiV1MarketIrtInfo(params)
332
+ for i in range(0, len(otcMarkets)):
333
+ marketdata = otcMarkets[i]
334
+ marketdata['quote'] = 'IRT'
335
+ marketdata['id'] = 'OTC_' + marketdata['symbol'] + marketdata['quote']
336
+ parsedMarket = self.parse_otc_ticker(marketdata)
337
+ symbol = parsedMarket['symbol']
338
+ result[symbol] = parsedMarket
339
+ return self.filter_by_array_tickers(result, 'symbol', symbols)
340
+ response = await self.publicGetApiV1MarketSymbols(params)
246
341
  for i in range(0, len(response)):
247
342
  request = {
248
343
  'symbol': response[i]['name'],
@@ -261,7 +356,10 @@ class arzplus(Exchange, ImplicitAPI):
261
356
  :param dict [params]: extra parameters specific to the exchange API endpoint
262
357
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
263
358
  """
264
- await self.load_markets()
359
+ marketType = self.safe_string(params, 'type', 'spot')
360
+ if marketType == 'otc':
361
+ raise Error('OTC markets are not supported')
362
+ await self.load_markets(False, {'type': marketType})
265
363
  market = self.market(symbol)
266
364
  request = {
267
365
  'symbol': market['id'],
@@ -339,6 +437,44 @@ class arzplus(Exchange, ImplicitAPI):
339
437
  'info': ticker,
340
438
  }, market)
341
439
 
440
+ def parse_otc_ticker(self, ticker, market: Market = None) -> Ticker:
441
+ # {
442
+ # id: "BTCUSDT",
443
+ # symbol: "BTC",
444
+ # ask: "13877900000",
445
+ # bid: "13860999995",
446
+ # name: "bitcoin"
447
+ # quote: "IRT"
448
+ # }
449
+ marketType = 'otc'
450
+ marketId = self.safe_string(ticker, 'id')
451
+ symbol = self.safe_symbol(marketId, market, None, marketType)
452
+ bid = self.safe_float(ticker, 'bid', 0)
453
+ ask = self.safe_float(ticker, 'ask', 0)
454
+ last = self.safe_float(ticker, 'ask', 0)
455
+ return self.safe_ticker({
456
+ 'symbol': symbol,
457
+ 'timestamp': None,
458
+ 'datetime': None,
459
+ 'high': None,
460
+ 'low': None,
461
+ 'bid': bid,
462
+ 'bidVolume': None,
463
+ 'ask': ask,
464
+ 'askVolume': None,
465
+ 'vwap': None,
466
+ 'open': last,
467
+ 'close': last,
468
+ 'last': last,
469
+ 'previousClose': None,
470
+ 'change': None,
471
+ 'percentage': None,
472
+ 'average': None,
473
+ 'baseVolume': None,
474
+ 'quoteVolume': None,
475
+ 'info': ticker,
476
+ }, market)
477
+
342
478
  async def fetch_ohlcv(self, symbol: str, timeframe='1h', since: Int = None, limit: Int = None, params={}) -> List[list]:
343
479
  """
344
480
  fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
@@ -350,7 +486,7 @@ class arzplus(Exchange, ImplicitAPI):
350
486
  :param dict [params]: extra parameters specific to the exchange API endpoint
351
487
  :returns int[][]: A list of candles ordered, open, high, low, close, volume
352
488
  """
353
- await self.load_markets()
489
+ await self.load_markets(False, {'type': 'otc'})
354
490
  market = self.market(symbol)
355
491
  endTime = Date.now()
356
492
  request = {
@@ -390,7 +526,7 @@ class arzplus(Exchange, ImplicitAPI):
390
526
  :param dict [params]: extra parameters specific to the exchange API endpoint
391
527
  :returns dict: a dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbol
392
528
  """
393
- await self.load_markets()
529
+ await self.load_markets(False, {'type': 'otc'})
394
530
  market = self.market(symbol)
395
531
  request = {
396
532
  'symbol': market['id'],
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.9.2'
5
+ __version__ = '4.9.10'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8