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,406 @@
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.bydfi import ImplicitAPI
8
+ from ccxt.base.types import Any, Int, Market, OrderBook, Strings, Ticker, Tickers
9
+ from typing import List
10
+
11
+
12
+ class bydfi(Exchange, ImplicitAPI):
13
+
14
+ def describe(self) -> Any:
15
+ return self.deep_extend(super(bydfi, self).describe(), {
16
+ 'id': 'bydfi',
17
+ 'name': 'Bydfi',
18
+ 'countries': ['SC'], # Seychelles
19
+ 'rateLimit': 1000,
20
+ 'version': '1',
21
+ 'certified': False,
22
+ 'pro': False,
23
+ 'has': {
24
+ 'CORS': None,
25
+ 'spot': True,
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
+ 'setLeverage': False,
82
+ 'setMarginMode': False,
83
+ 'transfer': False,
84
+ 'withdraw': False,
85
+ },
86
+ 'comment': 'This comment is optional',
87
+ 'urls': {
88
+ 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/bydfi/64x64.png',
89
+ 'api': {
90
+ 'public': 'https://www.bydfi.com',
91
+ 'quote': 'https://quote.bydfi.pro',
92
+ },
93
+ 'www': 'https://www.bydfi.com/',
94
+ 'doc': [
95
+ 'https://www.bydfi.com/',
96
+ ],
97
+ },
98
+ 'timeframes': {
99
+ '1m': '1',
100
+ '5m': '5',
101
+ '15m': '15',
102
+ '30m': '30',
103
+ '1h': '60',
104
+ '4h': '240',
105
+ '1d': 'D',
106
+ '1w': 'W',
107
+ '1M': 'M',
108
+ },
109
+ 'api': {
110
+ 'public': {
111
+ 'get': {
112
+ 'api/spot/product/list': 1,
113
+ 'api/tv/tradingView/history': 1,
114
+ },
115
+ },
116
+ 'quote': {
117
+ 'get': {
118
+ 'tickers': 1,
119
+ 'mkpai/depth-v2': 1,
120
+ },
121
+ },
122
+ },
123
+ 'fees': {
124
+ 'trading': {
125
+ 'tierBased': False,
126
+ 'percentage': True,
127
+ 'maker': self.parse_number('0.001'),
128
+ 'taker': self.parse_number('0.001'),
129
+ },
130
+ },
131
+ })
132
+
133
+ async def fetch_markets(self, params={}) -> List[Market]:
134
+ """
135
+ retrieves data on all markets for bydfi
136
+ https://www.bydfi.com/api/spot/product/list
137
+ :param dict [params]: extra parameters specific to the exchange API endpoint
138
+ :returns dict[]: an array of objects representing market data
139
+ """
140
+ response = await self.publicGetApiSpotProductList(params)
141
+ data = self.safe_list(response, 'data', [])
142
+ result = []
143
+ for i in range(0, len(data)):
144
+ market = self.parse_market(data[i])
145
+ result.append(market)
146
+ return result
147
+
148
+ def parse_market(self, market) -> Market:
149
+ # {
150
+ # "symbol": "BTC_USDT",
151
+ # "alias": "BTC/USDT",
152
+ # "baseCoin": "BTC",
153
+ # "quoteCoin": "USDT",
154
+ # "icon": "https://...",
155
+ # "type": 1,
156
+ # "tags": "hot",
157
+ # "visible": True,
158
+ # "anonymous": False,
159
+ # "canBuy": True,
160
+ # "canSell": True,
161
+ # "canGrid": True,
162
+ # "depth": "0.01,0.1,1",
163
+ # "matchMode": 1,
164
+ # "priceScale": 2,
165
+ # "volumeScale": 6,
166
+ # "amountScale": 2,
167
+ # "makerRate": 0.001,
168
+ # "takerRate": 0.001,
169
+ # "feeCoin": "USDT",
170
+ # "volumeMin": 0.000001,
171
+ # "amountMin": 5
172
+ # }
173
+ id = self.safe_string(market, 'symbol')
174
+ baseId = self.safe_string(market, 'baseCoin')
175
+ quoteId = self.safe_string(market, 'quoteCoin')
176
+ base = self.safe_currency_code(baseId)
177
+ quote = self.safe_currency_code(quoteId)
178
+ visible = self.safe_bool(market, 'visible', True)
179
+ canBuy = self.safe_bool(market, 'canBuy', True)
180
+ canSell = self.safe_bool(market, 'canSell', True)
181
+ active = visible and canBuy and canSell
182
+ return {
183
+ 'id': id,
184
+ 'symbol': base + '/' + quote,
185
+ 'base': base,
186
+ 'quote': quote,
187
+ 'settle': None,
188
+ 'baseId': baseId,
189
+ 'quoteId': quoteId,
190
+ 'settleId': None,
191
+ 'type': 'spot',
192
+ 'spot': True,
193
+ 'margin': False,
194
+ 'swap': False,
195
+ 'future': False,
196
+ 'option': False,
197
+ 'active': active,
198
+ 'contract': False,
199
+ 'linear': None,
200
+ 'inverse': None,
201
+ 'contractSize': None,
202
+ 'expiry': None,
203
+ 'expiryDatetime': None,
204
+ 'strike': None,
205
+ 'optionType': None,
206
+ 'precision': {
207
+ 'amount': self.safe_integer(market, 'volumeScale'),
208
+ 'price': self.safe_integer(market, 'priceScale'),
209
+ },
210
+ 'limits': {
211
+ 'leverage': {
212
+ 'min': None,
213
+ 'max': None,
214
+ },
215
+ 'amount': {
216
+ 'min': self.safe_number(market, 'volumeMin'),
217
+ 'max': None,
218
+ },
219
+ 'price': {
220
+ 'min': None,
221
+ 'max': None,
222
+ },
223
+ 'cost': {
224
+ 'min': self.safe_number(market, 'amountMin'),
225
+ 'max': None,
226
+ },
227
+ },
228
+ 'created': None,
229
+ 'info': market,
230
+ }
231
+
232
+ async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
233
+ """
234
+ fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
235
+ https://quote.bydfi.pro/tickers?preHour=24
236
+ :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
237
+ :param dict [params]: extra parameters specific to the exchange API endpoint
238
+ :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
239
+ """
240
+ await self.load_markets()
241
+ if symbols is not None:
242
+ symbols = self.market_symbols(symbols)
243
+ request = {
244
+ 'preHour': 24,
245
+ }
246
+ response = await self.quoteGetTickers(self.extend(request, params))
247
+ data = self.safe_string(response, 'data', '')
248
+ # Parse the CSV-like response(cast to string for safety)
249
+ tickers = str(data).split(';')
250
+ result = {}
251
+ for i in range(0, len(tickers)):
252
+ tickerStr = tickers[i].strip()
253
+ if len(tickerStr) == 0:
254
+ continue
255
+ ticker = self.parse_ticker(tickerStr)
256
+ symbol = ticker['symbol']
257
+ result[symbol] = ticker
258
+ return self.filter_by_array_tickers(result, 'symbol', symbols)
259
+
260
+ async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
261
+ """
262
+ fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
263
+ https://quote.bydfi.pro/tickers?preHour=24
264
+ :param str symbol: unified symbol of the market to fetch the ticker for
265
+ :param dict [params]: extra parameters specific to the exchange API endpoint
266
+ :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
267
+ """
268
+ await self.load_markets()
269
+ tickers = await self.fetch_tickers([symbol], params)
270
+ return tickers[symbol]
271
+
272
+ def parse_ticker(self, ticker, market: Market = None) -> Ticker:
273
+ # BTC_USDT, -1, 112148.56000, 121452.59000, 0.00000, 0.00000, 0.00000, 0.0000, 122518.22000, 102403.50000, 2935.7203
274
+ # Fields:
275
+ # 0: symbol(BTC_USDT)
276
+ # 1: trend indicator(-1 = down, 0 = neutral, 1 = up)
277
+ # 2: last price
278
+ # 3: 24h high
279
+ # 4: 24h low
280
+ # 5: price change
281
+ # 6: base volume(BTC)
282
+ # 7: price change percentage
283
+ # 8: bid price
284
+ # 9: ask price
285
+ # 10: 24h quote volume(USDT)
286
+ parts = []
287
+ if isinstance(ticker, str):
288
+ parts = ticker.split(',')
289
+ else:
290
+ return self.safe_ticker({}, market)
291
+ if len(parts) < 11:
292
+ return self.safe_ticker({}, market)
293
+ marketType = 'spot'
294
+ marketId = parts[0].strip()
295
+ symbol = self.safe_symbol(marketId, market, '_', marketType)
296
+ last = self.safe_float(parts, 2)
297
+ high = self.safe_float(parts, 3)
298
+ low = self.safe_float(parts, 4)
299
+ change = self.safe_float(parts, 5)
300
+ baseVolume = self.safe_float(parts, 6)
301
+ percentage = self.safe_float(parts, 7)
302
+ bid = self.safe_float(parts, 8)
303
+ ask = self.safe_float(parts, 9)
304
+ quoteVolume = self.safe_float(parts, 10)
305
+ return self.safe_ticker({
306
+ 'symbol': symbol,
307
+ 'timestamp': None,
308
+ 'datetime': None,
309
+ 'high': high,
310
+ 'low': low,
311
+ 'bid': bid,
312
+ 'bidVolume': None,
313
+ 'ask': ask,
314
+ 'askVolume': None,
315
+ 'vwap': None,
316
+ 'open': None,
317
+ 'close': last,
318
+ 'last': last,
319
+ 'previousClose': None,
320
+ 'change': change,
321
+ 'percentage': percentage,
322
+ 'average': None,
323
+ 'baseVolume': baseVolume,
324
+ 'quoteVolume': quoteVolume,
325
+ 'info': ticker,
326
+ }, market)
327
+
328
+ async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
329
+ """
330
+ fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
331
+ https://www.bydfi.com/api/tv/tradingView/history
332
+ :param str symbol: unified symbol of the market to fetch OHLCV data for
333
+ :param str timeframe: the length of time each candle represents
334
+ :param int [since]: timestamp in ms of the earliest candle to fetch
335
+ :param int [limit]: the maximum amount of candles to fetch
336
+ :param dict [params]: extra parameters specific to the exchange API endpoint
337
+ :returns int[][]: A list of candles ordered, open, high, low, close, volume
338
+ """
339
+ await self.load_markets()
340
+ market = self.market(symbol)
341
+ endTime = Date.now()
342
+ request = {
343
+ 'symbol': market['id'],
344
+ 'from': (endTime / 1000) - (24 * 60 * 60),
345
+ 'to': endTime / 1000,
346
+ 'resolution': self.safe_string(self.timeframes, timeframe, timeframe),
347
+ }
348
+ if since is not None:
349
+ request['from'] = since / 1000
350
+ request['from'] = self.safe_integer(request, 'from')
351
+ request['to'] = self.safe_integer(request, 'to')
352
+ if timeframe is not None:
353
+ request['resolution'] = self.safe_string(self.timeframes, timeframe, timeframe)
354
+ response = await self.publicGetApiTvTradingViewHistory(request)
355
+ openList = self.safe_list(response, 'o', [])
356
+ highList = self.safe_list(response, 'h', [])
357
+ lowList = self.safe_list(response, 'l', [])
358
+ closeList = self.safe_list(response, 'c', [])
359
+ volumeList = self.safe_list(response, 'v', [])
360
+ timestampList = self.safe_list(response, 't', [])
361
+ ohlcvs = []
362
+ for i in range(0, len(openList)):
363
+ ohlcvs.append([
364
+ self.safe_integer(timestampList, i),
365
+ self.safe_float(openList, i),
366
+ self.safe_float(highList, i),
367
+ self.safe_float(lowList, i),
368
+ self.safe_float(closeList, i),
369
+ self.safe_float(volumeList, i),
370
+ ])
371
+ return self.parse_ohlcvs(ohlcvs, market, timeframe, since, limit)
372
+
373
+ async def fetch_order_book(self, symbol: str, limit: Int = 1, params={}) -> OrderBook:
374
+ """
375
+ fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
376
+ https://quote.bydfi.pro/mkpai/depth-v2
377
+ :param str symbol: unified symbol of the market to fetch the order book for
378
+ :param int [limit]: the maximum amount of order book entries to return
379
+ :param dict [params]: extra parameters specific to the exchange API endpoint
380
+ :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
381
+ """
382
+ await self.load_markets()
383
+ market = self.market(symbol)
384
+ request = {
385
+ 'businessType': market['id'],
386
+ 'dType': 0,
387
+ }
388
+ if limit is not None:
389
+ request['size'] = limit
390
+ response = await self.quoteGetMkpaiDepthV2(request)
391
+ data = self.safe_dict(response, 'data', {})
392
+ timestamp = Date.now()
393
+ orderbook = self.parse_order_book(data, symbol, timestamp, 'bids', 'asks', 'price', 'amount')
394
+ return orderbook
395
+
396
+ def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
397
+ query = self.omit(params, self.extract_params(path))
398
+ url = ''
399
+ if api == 'quote':
400
+ url = self.urls['api']['quote'] + '/' + path
401
+ else:
402
+ url = self.urls['api']['public'] + '/' + path
403
+ if query:
404
+ url += '?' + self.urlencode(query)
405
+ headers = {'Content-Type': 'application/json'}
406
+ return {'url': url, 'method': method, 'body': body, 'headers': headers}