ccxt-ir 4.9.4__py2.py3-none-any.whl → 4.9.11__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 (44) hide show
  1. ccxt/__init__.py +15 -1
  2. ccxt/abantether.py +88 -69
  3. ccxt/abstract/abantether.py +1 -1
  4. ccxt/abstract/bitbarg.py +5 -0
  5. ccxt/abstract/bydfi.py +8 -0
  6. ccxt/abstract/cafearz.py +5 -0
  7. ccxt/abstract/kifpoolme.py +6 -0
  8. ccxt/abstract/mazdax.py +8 -0
  9. ccxt/abstract/pingi.py +6 -0
  10. ccxt/abstract/pooleno.py +5 -0
  11. ccxt/afratether.py +84 -36
  12. ccxt/arzplus.py +31 -17
  13. ccxt/async_support/__init__.py +15 -1
  14. ccxt/async_support/abantether.py +88 -69
  15. ccxt/async_support/afratether.py +84 -36
  16. ccxt/async_support/arzplus.py +31 -17
  17. ccxt/async_support/base/exchange.py +1 -1
  18. ccxt/async_support/bitbarg.py +298 -0
  19. ccxt/async_support/bydfi.py +406 -0
  20. ccxt/async_support/cafearz.py +333 -0
  21. ccxt/async_support/hamtapay.py +3 -2
  22. ccxt/async_support/kifpoolme.py +385 -0
  23. ccxt/async_support/mazdax.py +512 -0
  24. ccxt/async_support/pingi.py +426 -0
  25. ccxt/async_support/pooleno.py +331 -0
  26. ccxt/async_support/tetherland.py +4 -4
  27. ccxt/async_support/twox.py +53 -29
  28. ccxt/base/exchange.py +1 -1
  29. ccxt/bitbarg.py +298 -0
  30. ccxt/bydfi.py +406 -0
  31. ccxt/cafearz.py +333 -0
  32. ccxt/hamtapay.py +3 -2
  33. ccxt/kifpoolme.py +385 -0
  34. ccxt/mazdax.py +512 -0
  35. ccxt/pingi.py +426 -0
  36. ccxt/pooleno.py +331 -0
  37. ccxt/pro/__init__.py +1 -1
  38. ccxt/tetherland.py +4 -4
  39. ccxt/twox.py +53 -29
  40. {ccxt_ir-4.9.4.dist-info → ccxt_ir-4.9.11.dist-info}/METADATA +8 -8
  41. {ccxt_ir-4.9.4.dist-info → ccxt_ir-4.9.11.dist-info}/RECORD +44 -23
  42. {ccxt_ir-4.9.4.dist-info → ccxt_ir-4.9.11.dist-info}/WHEEL +0 -0
  43. {ccxt_ir-4.9.4.dist-info → ccxt_ir-4.9.11.dist-info}/licenses/LICENSE.txt +0 -0
  44. {ccxt_ir-4.9.4.dist-info → ccxt_ir-4.9.11.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,385 @@
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.kifpoolme import ImplicitAPI
8
+ import math
9
+ from ccxt.base.types import Any, Int, Market, Strings, Ticker, Tickers
10
+ from typing import List
11
+
12
+
13
+ class kifpoolme(Exchange, ImplicitAPI):
14
+
15
+ def describe(self) -> Any:
16
+ return self.deep_extend(super(kifpoolme, self).describe(), {
17
+ 'id': 'kifpoolme',
18
+ 'name': 'Kifpool',
19
+ 'countries': ['IR'],
20
+ 'rateLimit': 1000,
21
+ 'version': '1',
22
+ 'certified': False,
23
+ 'pro': False,
24
+ 'has': {
25
+ 'CORS': None,
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': False,
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': 'This comment is optional',
88
+ 'urls': {
89
+ 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/kifpoolme/64x64.png',
90
+ 'api': {
91
+ 'public': 'https://api.kifpool.app',
92
+ },
93
+ 'www': 'https://kifpool.me/',
94
+ 'doc': [
95
+ 'https://kifpool.me/',
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
+ 'api/spot/price': 1,
112
+ 'api/spot/tickers/1m': 1,
113
+ },
114
+ },
115
+ },
116
+ 'fees': {
117
+ 'trading': {
118
+ 'tierBased': False,
119
+ 'percentage': True,
120
+ 'maker': self.parse_number('0.001'),
121
+ 'taker': self.parse_number('0.001'),
122
+ },
123
+ },
124
+ })
125
+
126
+ def parse_market(self, market) -> Market:
127
+ # {
128
+ # "symbol": "BTC",
129
+ # "faName": "بیت کوین",
130
+ # "name": "Bitcoin",
131
+ # "smallImage": "https://kifpool.me/uploads/coin-new-images/bitcoin.png",
132
+ # "price": 115430,
133
+ # "priceBuyIRT": 13043590000,
134
+ # "priceSellIRT": 13135934000,
135
+ # "volume": 1700068128.9919832,
136
+ # "priceChangePercent": 3.4799999999999995,
137
+ # "high": 115968.8,
138
+ # "low": 111145.4,
139
+ # "slug": "bitcoin-BTC"
140
+ # }
141
+ baseId = self.safe_string(market, 'symbol')
142
+ quoteId = self.safe_string(market, 'quoteId', 'USDT')
143
+ base = self.safe_currency_code(baseId)
144
+ quote = self.safe_currency_code(quoteId)
145
+ id = baseId + '/' + quoteId
146
+ return {
147
+ 'id': id,
148
+ 'symbol': base + '/' + quote,
149
+ 'base': base,
150
+ 'quote': quote,
151
+ 'settle': None,
152
+ 'baseId': baseId,
153
+ 'quoteId': quoteId,
154
+ 'settleId': None,
155
+ 'type': 'spot',
156
+ 'spot': True,
157
+ 'margin': False,
158
+ 'swap': False,
159
+ 'future': False,
160
+ 'option': False,
161
+ 'active': True,
162
+ 'contract': False,
163
+ 'linear': None,
164
+ 'inverse': None,
165
+ 'contractSize': None,
166
+ 'expiry': None,
167
+ 'expiryDatetime': None,
168
+ 'strike': None,
169
+ 'optionType': None,
170
+ 'precision': {
171
+ 'amount': None,
172
+ 'price': None,
173
+ },
174
+ 'limits': {
175
+ 'leverage': {
176
+ 'min': None,
177
+ 'max': None,
178
+ },
179
+ 'amount': {
180
+ 'min': None,
181
+ 'max': None,
182
+ },
183
+ 'price': {
184
+ 'min': None,
185
+ 'max': None,
186
+ },
187
+ 'cost': {
188
+ 'min': None,
189
+ 'max': None,
190
+ },
191
+ },
192
+ 'created': None,
193
+ 'info': market,
194
+ }
195
+
196
+ async def fetch_markets(self, params={}) -> List[Market]:
197
+ """
198
+ retrieves data on all markets for kifpoolme
199
+ https://api.kifpool.app/api/spot/price
200
+ :param dict [params]: extra parameters specific to the exchange API endpoint
201
+ :returns dict[]: an array of objects representing market data
202
+ """
203
+ response = await self.publicGetApiSpotPrice(params)
204
+ result = []
205
+ # Response is an array of coin objects
206
+ for i in range(0, len(response)):
207
+ item = response[i]
208
+ # Create markets for both USDT and IRT quotes
209
+ quotes = ['USDT', 'IRT']
210
+ for j in range(0, len(quotes)):
211
+ quoteId = quotes[j]
212
+ marketData = self.extend(item, {
213
+ 'quoteId': quoteId,
214
+ })
215
+ market = self.parse_market(marketData)
216
+ result.append(market)
217
+ return result
218
+
219
+ async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
220
+ """
221
+ fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
222
+ https://api.kifpool.app/api/spot/price
223
+ :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
224
+ :param dict [params]: extra parameters specific to the exchange API endpoint
225
+ :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
226
+ """
227
+ await self.load_markets()
228
+ if symbols is not None:
229
+ symbols = self.market_symbols(symbols)
230
+ # Extract base symbols from the requested symbols
231
+ symbolsParam = None
232
+ if symbols is not None and len(symbols) > 0:
233
+ baseSymbols = []
234
+ for i in range(0, len(symbols)):
235
+ market = self.market(symbols[i])
236
+ if not (market['baseId'] in baseSymbols):
237
+ baseSymbols.append(market['baseId'])
238
+ symbolsParam = ','.join(baseSymbols)
239
+ request = {}
240
+ if symbolsParam is not None:
241
+ request['symbol'] = symbolsParam
242
+ response = await self.publicGetApiSpotPrice(self.extend(request))
243
+ result = {}
244
+ for i in range(0, len(response)):
245
+ item = response[i]
246
+ baseId = self.safe_string(item, 'symbol')
247
+ # Create tickers for both USDT and IRT quotes
248
+ quotes = ['USDT', 'IRT']
249
+ for j in range(0, len(quotes)):
250
+ quoteId = quotes[j]
251
+ base = self.safe_currency_code(baseId)
252
+ quote = self.safe_currency_code(quoteId)
253
+ symbol = base + '/' + quote
254
+ ticker = self.extend(item, {
255
+ 'quoteId': quoteId,
256
+ 'marketId': baseId + '/' + quoteId,
257
+ })
258
+ result[symbol] = self.parse_ticker(ticker)
259
+ return self.filter_by_array_tickers(result, 'symbol', symbols)
260
+
261
+ async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
262
+ """
263
+ fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
264
+ https://api.kifpool.app/api/spot/price
265
+ :param str symbol: unified symbol of the market to fetch the ticker for
266
+ :param dict [params]: extra parameters specific to the exchange API endpoint
267
+ :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
268
+ """
269
+ ticker = await self.fetch_tickers([symbol], params)
270
+ return ticker[symbol]
271
+
272
+ def parse_ticker(self, ticker, market: Market = None) -> Ticker:
273
+ # {
274
+ # "symbol": "BTC",
275
+ # "faName": "بیت کوین",
276
+ # "name": "Bitcoin",
277
+ # "smallImage": "https://kifpool.me/uploads/coin-new-images/bitcoin.png",
278
+ # "price": 115430, # USDT price
279
+ # "priceBuyIRT": 13043590000, # IRT buy price
280
+ # "priceSellIRT": 13135934000, # IRT sell price
281
+ # "volume": 1700068128.9919832,
282
+ # "priceChangePercent": 3.48,
283
+ # "high": 115968.8,
284
+ # "low": 111145.4,
285
+ # "slug": "bitcoin-BTC",
286
+ # "quoteId": "USDT" or "IRT"
287
+ # }
288
+ marketType = 'spot'
289
+ marketId = self.safe_string(ticker, 'marketId')
290
+ symbol = self.safe_symbol(marketId, market, None, marketType)
291
+ quoteId = self.safe_string(ticker, 'quoteId', 'USDT')
292
+ last = None
293
+ bid = None
294
+ ask = None
295
+ if quoteId == 'IRT':
296
+ # For IRT: priceSellIRT is the sell price(bid), priceBuyIRT is the buy price(ask)
297
+ bid = self.safe_number(ticker, 'priceSellIRT')
298
+ ask = self.safe_number(ticker, 'priceBuyIRT')
299
+ last = ask
300
+ else:
301
+ # For USDT: price is in USDT
302
+ price = self.safe_number(ticker, 'price')
303
+ last = price
304
+ bid = price
305
+ ask = price
306
+ high = self.safe_number(ticker, 'high')
307
+ low = self.safe_number(ticker, 'low')
308
+ percentage = self.safe_number(ticker, 'priceChangePercent')
309
+ baseVolume = self.safe_number(ticker, 'volume')
310
+ return self.safe_ticker({
311
+ 'symbol': symbol,
312
+ 'timestamp': None,
313
+ 'datetime': None,
314
+ 'high': high,
315
+ 'low': low,
316
+ 'bid': bid,
317
+ 'bidVolume': None,
318
+ 'ask': ask,
319
+ 'askVolume': None,
320
+ 'vwap': None,
321
+ 'open': None,
322
+ 'close': last,
323
+ 'last': last,
324
+ 'previousClose': None,
325
+ 'change': None,
326
+ 'percentage': percentage,
327
+ 'average': None,
328
+ 'baseVolume': baseVolume,
329
+ 'quoteVolume': None,
330
+ 'info': ticker,
331
+ }, market)
332
+
333
+ async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
334
+ """
335
+ fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
336
+ https://api.kifpool.app/api/spot/tickers/1m
337
+ :param str symbol: unified symbol of the market to fetch OHLCV data for
338
+ :param str timeframe: the length of time each candle represents
339
+ :param int [since]: timestamp in ms of the earliest candle to fetch
340
+ :param int [limit]: the maximum amount of candles to fetch
341
+ :param dict [params]: extra parameters specific to the exchange API endpoint
342
+ :returns int[][]: A list of candles ordered, open, high, low, close, volume
343
+ """
344
+ await self.load_markets()
345
+ market = self.market(symbol)
346
+ endTime = Date.now()
347
+ request = {
348
+ 'symbol': market['baseId'],
349
+ 'currency': market['quoteId'],
350
+ 'fromTs': int(math.floor((endTime / 1000)) - (24 * 60 * 60)),
351
+ 'toTs': int(math.floor(endTime / 1000)),
352
+ }
353
+ if since is not None:
354
+ request['fromTs'] = int(math.floor(since / 1000))
355
+ if limit is not None:
356
+ request['limit'] = limit
357
+ response = await self.publicGetApiSpotTickers1m(request)
358
+ return self.parse_ohlcvs(response, market, timeframe, since, limit)
359
+
360
+ def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
361
+ # {
362
+ # "data_captured_datetime": 1760169720,
363
+ # "open": 110419.9,
364
+ # "high": 110468.4,
365
+ # "low": 110330.7,
366
+ # "close": 110330.7,
367
+ # "volume": 3356941116.288925,
368
+ # "changePercentage": -0.0808
369
+ # }
370
+ return [
371
+ self.safe_timestamp(ohlcv, 'data_captured_datetime'),
372
+ self.safe_number(ohlcv, 'open'),
373
+ self.safe_number(ohlcv, 'high'),
374
+ self.safe_number(ohlcv, 'low'),
375
+ self.safe_number(ohlcv, 'close'),
376
+ self.safe_number(ohlcv, 'volume'),
377
+ ]
378
+
379
+ def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
380
+ query = self.omit(params, self.extract_params(path))
381
+ url = self.urls['api']['public'] + '/' + path
382
+ if query:
383
+ url += '?' + self.urlencode(query)
384
+ headers = {'Content-Type': 'application/json'}
385
+ return {'url': url, 'method': method, 'body': body, 'headers': headers}