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,426 @@
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.pingi import ImplicitAPI
8
+ from ccxt.base.types import Any, Int, Market, Strings, Ticker, Tickers
9
+ from typing import List
10
+
11
+
12
+ class pingi(Exchange, ImplicitAPI):
13
+
14
+ def describe(self) -> Any:
15
+ return self.deep_extend(super(pingi, self).describe(), {
16
+ 'id': 'pingi',
17
+ 'name': 'Pingi',
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': False,
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': 'Pingi OTC Exchange',
88
+ 'urls': {
89
+ 'logo': 'https://cdn.arz.digital/cr-odin/img/exchanges/pingi/64x64.png',
90
+ 'api': {
91
+ 'public': 'https://api5.pingi.co/trading',
92
+ },
93
+ 'www': 'https://pingi.co',
94
+ 'doc': [
95
+ 'https://pingi.co',
96
+ ],
97
+ },
98
+ 'timeframes': {
99
+ '1m': '1',
100
+ '5m': '5',
101
+ '15m': '15',
102
+ '30m': '30',
103
+ '1h': '60',
104
+ '4h': '240',
105
+ '1d': '1D',
106
+ '1w': '1W',
107
+ },
108
+ 'api': {
109
+ 'public': {
110
+ 'get': {
111
+ 'market/prices': 1,
112
+ 'udf/history': 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
+ async def fetch_markets(self, params={}) -> List[Market]:
127
+ """
128
+ retrieves data on all markets for pingi
129
+ https://api5.pingi.co/trading/market/prices/
130
+ :param dict [params]: extra parameters specific to the exchange API endpoint
131
+ :returns dict[]: an array of objects representing market data
132
+ """
133
+ response = await self.publicGetMarketPrices(params)
134
+ # Response structure:
135
+ # {
136
+ # "statusCode": 200,
137
+ # "ok": True,
138
+ # "data": {
139
+ # "ETH_USDT": {
140
+ # "market": "ETH_USDT",
141
+ # "marketId": 6,
142
+ # "marketVolume": "128889.02937760774364521500000000",
143
+ # "currentPrice": "4083.7744580000000",
144
+ # "maxPrice": "4218.0241700000000",
145
+ # "minPrice": "3786.9124050000000",
146
+ # "startPrice": "3830.5800220000000",
147
+ # "marketPlatform": 0
148
+ # },
149
+ # "BTC_IRT": {
150
+ # "market": "BTC_IRT",
151
+ # "marketId": 8,
152
+ # "marketVolume": "27140908320.17800246693400000000000000",
153
+ # "currentPrice": "12909088630.0000000000000",
154
+ # "maxPrice": "13213902170.0000000000000",
155
+ # "minPrice": "12000000000.0000000000000",
156
+ # "startPrice": "12752332240.0000000000000",
157
+ # "marketPlatform": 0
158
+ # },
159
+ # ...
160
+ # }
161
+ # }
162
+ data = self.safe_dict(response, 'data', {})
163
+ marketKeys = list(data.keys())
164
+ result = []
165
+ for i in range(0, len(marketKeys)):
166
+ marketId = marketKeys[i]
167
+ marketData = data[marketId]
168
+ market = self.parse_market(marketData)
169
+ result.append(market)
170
+ return result
171
+
172
+ def parse_market(self, market) -> Market:
173
+ # {
174
+ # "market": "BTC_IRT",
175
+ # "marketId": 8,
176
+ # "marketVolume": "27140908320.17800246693400000000000000",
177
+ # "currentPrice": "12909088630.0000000000000",
178
+ # "maxPrice": "13213902170.0000000000000",
179
+ # "minPrice": "12000000000.0000000000000",
180
+ # "startPrice": "12752332240.0000000000000",
181
+ # "marketPlatform": 0
182
+ # }
183
+ id = self.safe_string(market, 'market')
184
+ parts = id.split('_')
185
+ baseId = self.safe_string(parts, 0)
186
+ quoteId = self.safe_string(parts, 1)
187
+ base = self.safe_currency_code(baseId)
188
+ quote = self.safe_currency_code(quoteId)
189
+ baseId = baseId.lower()
190
+ quoteId = quoteId.lower()
191
+ return {
192
+ 'id': id,
193
+ 'symbol': base + '/' + quote,
194
+ 'base': base,
195
+ 'quote': quote,
196
+ 'settle': None,
197
+ 'baseId': baseId,
198
+ 'quoteId': quoteId,
199
+ 'settleId': None,
200
+ 'type': 'otc',
201
+ 'spot': False,
202
+ 'margin': False,
203
+ 'swap': False,
204
+ 'future': False,
205
+ 'option': False,
206
+ 'active': True,
207
+ 'contract': False,
208
+ 'linear': None,
209
+ 'inverse': None,
210
+ 'contractSize': None,
211
+ 'expiry': None,
212
+ 'expiryDatetime': None,
213
+ 'strike': None,
214
+ 'optionType': None,
215
+ 'precision': {
216
+ 'amount': None,
217
+ 'price': None,
218
+ },
219
+ 'limits': {
220
+ 'leverage': {
221
+ 'min': None,
222
+ 'max': None,
223
+ },
224
+ 'amount': {
225
+ 'min': None,
226
+ 'max': None,
227
+ },
228
+ 'price': {
229
+ 'min': None,
230
+ 'max': None,
231
+ },
232
+ 'cost': {
233
+ 'min': None,
234
+ 'max': None,
235
+ },
236
+ },
237
+ 'created': None,
238
+ 'info': market,
239
+ }
240
+
241
+ async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
242
+ """
243
+ fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
244
+ https://api5.pingi.co/trading/market/prices/
245
+ :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
246
+ :param dict [params]: extra parameters specific to the exchange API endpoint
247
+ :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
248
+ """
249
+ await self.load_markets()
250
+ if symbols is not None:
251
+ symbols = self.market_symbols(symbols)
252
+ response = await self.publicGetMarketPrices(params)
253
+ # Response structure:
254
+ # {
255
+ # "statusCode": 200,
256
+ # "ok": True,
257
+ # "data": {
258
+ # "ETH_USDT": {
259
+ # "market": "ETH_USDT",
260
+ # "marketId": 6,
261
+ # "marketVolume": "128889.02937760774364521500000000",
262
+ # "currentPrice": "4083.7744580000000",
263
+ # "maxPrice": "4218.0241700000000",
264
+ # "minPrice": "3786.9124050000000",
265
+ # "startPrice": "3830.5800220000000",
266
+ # "marketPlatform": 0
267
+ # },
268
+ # ...
269
+ # }
270
+ # }
271
+ data = self.safe_dict(response, 'data', {})
272
+ marketKeys = list(data.keys())
273
+ result = {}
274
+ for i in range(0, len(marketKeys)):
275
+ marketId = marketKeys[i]
276
+ marketData = data[marketId]
277
+ ticker = self.parse_ticker(marketData)
278
+ symbol = ticker['symbol']
279
+ result[symbol] = ticker
280
+ return self.filter_by_array_tickers(result, 'symbol', symbols)
281
+
282
+ async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
283
+ """
284
+ fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
285
+ https://api5.pingi.co/trading/market/prices/
286
+ :param str symbol: unified symbol of the market to fetch the ticker for
287
+ :param dict [params]: extra parameters specific to the exchange API endpoint
288
+ :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
289
+ """
290
+ await self.load_markets()
291
+ market = self.market(symbol)
292
+ response = await self.publicGetMarketPrices(params)
293
+ # Response structure:
294
+ # {
295
+ # "statusCode": 200,
296
+ # "ok": True,
297
+ # "data": {
298
+ # "BTC_IRT": {
299
+ # "market": "BTC_IRT",
300
+ # "marketId": 8,
301
+ # "marketVolume": "27140908320.17800246693400000000000000",
302
+ # "currentPrice": "12909088630.0000000000000",
303
+ # "maxPrice": "13213902170.0000000000000",
304
+ # "minPrice": "12000000000.0000000000000",
305
+ # "startPrice": "12752332240.0000000000000",
306
+ # "marketPlatform": 0
307
+ # },
308
+ # ...
309
+ # }
310
+ # }
311
+ data = self.safe_dict(response, 'data', {})
312
+ tickerData = self.safe_dict(data, market['id'])
313
+ return self.parse_ticker(tickerData, market)
314
+
315
+ def parse_ticker(self, ticker, market: Market = None) -> Ticker:
316
+ # {
317
+ # "market": "BTC_IRT",
318
+ # "marketId": 8,
319
+ # "marketVolume": "27140908320.17800246693400000000000000",
320
+ # "currentPrice": "12909088630.0000000000000",
321
+ # "maxPrice": "13213902170.0000000000000",
322
+ # "minPrice": "12000000000.0000000000000",
323
+ # "startPrice": "12752332240.0000000000000",
324
+ # "marketPlatform": 0
325
+ # }
326
+ marketType = 'otc'
327
+ marketId = self.safe_string(ticker, 'market')
328
+ symbol = self.safe_symbol(marketId, market, '_', marketType)
329
+ last = self.safe_string(ticker, 'currentPrice')
330
+ high = self.safe_string(ticker, 'maxPrice')
331
+ low = self.safe_string(ticker, 'minPrice')
332
+ open = self.safe_string(ticker, 'startPrice')
333
+ baseVolume = self.safe_string(ticker, 'marketVolume')
334
+ # Calculate change and percentage
335
+ change = None
336
+ percentage = None
337
+ if open is not None and last is not None:
338
+ openNum = self.parse_number(open)
339
+ lastNum = self.parse_number(last)
340
+ if openNum is not None and lastNum is not None and openNum > 0:
341
+ change = self.parse_number(self.number_to_string(lastNum - openNum))
342
+ percentage = self.parse_number(self.number_to_string((lastNum - openNum) / openNum * 100))
343
+ return self.safe_ticker({
344
+ 'symbol': symbol,
345
+ 'timestamp': None,
346
+ 'datetime': None,
347
+ 'high': high,
348
+ 'low': low,
349
+ 'bid': None,
350
+ 'bidVolume': None,
351
+ 'ask': None,
352
+ 'askVolume': None,
353
+ 'vwap': None,
354
+ 'open': open,
355
+ 'close': last,
356
+ 'last': last,
357
+ 'previousClose': None,
358
+ 'change': change,
359
+ 'percentage': percentage,
360
+ 'average': None,
361
+ 'baseVolume': baseVolume,
362
+ 'quoteVolume': None,
363
+ 'info': ticker,
364
+ }, market)
365
+
366
+ async def fetch_ohlcv(self, symbol: str, timeframe='1d', since: Int = None, limit: Int = None, params={}) -> List[list]:
367
+ """
368
+ fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
369
+ https://api5.pingi.co/trading/udf/history/
370
+ :param str symbol: unified symbol of the market to fetch OHLCV data for
371
+ :param str timeframe: the length of time each candle represents
372
+ :param int [since]: timestamp in ms of the earliest candle to fetch
373
+ :param int [limit]: the maximum amount of candles to fetch
374
+ :param dict [params]: extra parameters specific to the exchange API endpoint
375
+ :returns int[][]: A list of candles ordered, open, high, low, close, volume
376
+ """
377
+ await self.load_markets()
378
+ market = self.market(symbol)
379
+ endTime = Date.now()
380
+ request = {
381
+ 'symbol': market['base'] + '/' + market['quote'],
382
+ 'resolution': self.safe_string(self.timeframes, timeframe, timeframe),
383
+ 'from': (endTime / 1000) - (30 * 24 * 60 * 60), # 30 days ago
384
+ 'to': endTime / 1000,
385
+ }
386
+ if since is not None:
387
+ request['from'] = since / 1000
388
+ request['from'] = self.safe_integer(request, 'from')
389
+ request['to'] = self.safe_integer(request, 'to')
390
+ response = await self.publicGetUdfHistory(request)
391
+ # Response structure:
392
+ # {
393
+ # "c": [12710726290.0, 12732737270.0, ...], # close prices
394
+ # "v": [0.015461630724, 0.024055443184, ...], # volumes
395
+ # "l": [12702815580.0, 12689256670.0, ...], # low prices
396
+ # "h": [12723701120.0, 12752332240.0, ...], # high prices
397
+ # "o": [12752332240.0, 12710726290.0, ...], # open prices
398
+ # "t": [1760271600, 1760272500, ...] # timestamps
399
+ # }
400
+ closeList = self.safe_list(response, 'c', [])
401
+ volumeList = self.safe_list(response, 'v', [])
402
+ lowList = self.safe_list(response, 'l', [])
403
+ highList = self.safe_list(response, 'h', [])
404
+ openList = self.safe_list(response, 'o', [])
405
+ timestampList = self.safe_list(response, 't', [])
406
+ ohlcvs = []
407
+ for i in range(0, len(openList)):
408
+ ohlcvs.append([
409
+ self.safe_timestamp(timestampList, i),
410
+ self.safe_number(openList, i),
411
+ self.safe_number(highList, i),
412
+ self.safe_number(lowList, i),
413
+ self.safe_number(closeList, i),
414
+ self.safe_number(volumeList, i),
415
+ ])
416
+ return self.parse_ohlcvs(ohlcvs, market, timeframe, since, limit)
417
+
418
+ def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
419
+ query = self.omit(params, self.extract_params(path))
420
+ url = self.urls['api']['public'] + '/' + path
421
+ if path == 'market/prices':
422
+ url = url + '/'
423
+ if path == 'udf/history':
424
+ url = url + '/?' + self.urlencode(query)
425
+ headers = {'Content-Type': 'application/json'}
426
+ return {'url': url, 'method': method, 'body': body, 'headers': headers}