ccxt-ir 4.6.1__py2.py3-none-any.whl → 4.9.0__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.
ccxt/__init__.py CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.6.1'
25
+ __version__ = '4.9.0'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
@@ -117,6 +117,7 @@ from ccxt.bitso import bitso # noqa: F4
117
117
  from ccxt.bitstamp import bitstamp # noqa: F401
118
118
  from ccxt.bitteam import bitteam # noqa: F401
119
119
  from ccxt.bittrade import bittrade # noqa: F401
120
+ from ccxt.bitunix import bitunix # noqa: F401
120
121
  from ccxt.bitvavo import bitvavo # noqa: F401
121
122
  from ccxt.blockchaincom import blockchaincom # noqa: F401
122
123
  from ccxt.blofin import blofin # noqa: F401
@@ -168,6 +169,7 @@ from ccxt.hyperliquid import hyperliquid # noqa: F4
168
169
  from ccxt.independentreserve import independentreserve # noqa: F401
169
170
  from ccxt.indodax import indodax # noqa: F401
170
171
  from ccxt.jibitex import jibitex # noqa: F401
172
+ from ccxt.kcex import kcex # noqa: F401
171
173
  from ccxt.kraken import kraken # noqa: F401
172
174
  from ccxt.krakenfutures import krakenfutures # noqa: F401
173
175
  from ccxt.kucoin import kucoin # noqa: F401
@@ -203,6 +205,7 @@ from ccxt.tabdeal import tabdeal # noqa: F4
203
205
  from ccxt.tetherland import tetherland # noqa: F401
204
206
  from ccxt.timex import timex # noqa: F401
205
207
  from ccxt.tokocrypto import tokocrypto # noqa: F401
208
+ from ccxt.toobit import toobit # noqa: F401
206
209
  from ccxt.tradeogre import tradeogre # noqa: F401
207
210
  from ccxt.twox import twox # noqa: F401
208
211
  from ccxt.ubitex import ubitex # noqa: F401
@@ -252,6 +255,7 @@ exchanges = [
252
255
  'bitstamp',
253
256
  'bitteam',
254
257
  'bittrade',
258
+ 'bitunix',
255
259
  'bitvavo',
256
260
  'blockchaincom',
257
261
  'blofin',
@@ -303,6 +307,7 @@ exchanges = [
303
307
  'independentreserve',
304
308
  'indodax',
305
309
  'jibitex',
310
+ 'kcex',
306
311
  'kraken',
307
312
  'krakenfutures',
308
313
  'kucoin',
@@ -338,6 +343,7 @@ exchanges = [
338
343
  'tetherland',
339
344
  'timex',
340
345
  'tokocrypto',
346
+ 'toobit',
341
347
  'tradeogre',
342
348
  'twox',
343
349
  'ubitex',
@@ -0,0 +1,6 @@
1
+ from ccxt.base.types import Entry
2
+
3
+
4
+ class ImplicitAPI:
5
+ public_get_api_spot_v1_common_coin_pair_list = publicGetApiSpotV1CommonCoinPairList = Entry('api/spot/v1/common/coin_pair/list/', 'public', 'GET', {'cost': 1})
6
+ public_get_web_api_v1_common_tickers = publicGetWebApiV1CommonTickers = Entry('web/api/v1/common/tickers/', 'public', 'GET', {'cost': 1})
ccxt/abstract/kcex.py ADDED
@@ -0,0 +1,7 @@
1
+ from ccxt.base.types import Entry
2
+
3
+
4
+ class ImplicitAPI:
5
+ public_get_market_2_spot_market_v2_web_symbols = publicGetMarket2SpotMarketV2WebSymbols = Entry('market-2/spot/market/v2/web/symbols', 'public', 'GET', {'cost': 1})
6
+ public_get_market_2_spot_market_v2_web_tickers = publicGetMarket2SpotMarketV2WebTickers = Entry('market-2/spot/market/v2/web/tickers', 'public', 'GET', {'cost': 1})
7
+ public_get_market_2_spot_market_v2_web_symbol_ticker = publicGetMarket2SpotMarketV2WebSymbolTicker = Entry('market-2/spot/market/v2/web/symbol/ticker', 'public', 'GET', {'cost': 1})
@@ -0,0 +1,6 @@
1
+ from ccxt.base.types import Entry
2
+
3
+
4
+ class ImplicitAPI:
5
+ public_get_quote_v1_ticker_24hr = publicGetQuoteV1Ticker24hr = Entry('quote/v1/ticker/24hr', 'public', 'GET', {'cost': 1})
6
+ public_get_quote_v1_klines = publicGetQuoteV1Klines = Entry('quote/v1/klines', 'public', 'GET', {'cost': 1})
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.6.1'
7
+ __version__ = '4.9.0'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -97,6 +97,7 @@ from ccxt.async_support.bitso import bitso
97
97
  from ccxt.async_support.bitstamp import bitstamp # noqa: F401
98
98
  from ccxt.async_support.bitteam import bitteam # noqa: F401
99
99
  from ccxt.async_support.bittrade import bittrade # noqa: F401
100
+ from ccxt.async_support.bitunix import bitunix # noqa: F401
100
101
  from ccxt.async_support.bitvavo import bitvavo # noqa: F401
101
102
  from ccxt.async_support.blockchaincom import blockchaincom # noqa: F401
102
103
  from ccxt.async_support.blofin import blofin # noqa: F401
@@ -148,6 +149,7 @@ from ccxt.async_support.hyperliquid import hyperliquid
148
149
  from ccxt.async_support.independentreserve import independentreserve # noqa: F401
149
150
  from ccxt.async_support.indodax import indodax # noqa: F401
150
151
  from ccxt.async_support.jibitex import jibitex # noqa: F401
152
+ from ccxt.async_support.kcex import kcex # noqa: F401
151
153
  from ccxt.async_support.kraken import kraken # noqa: F401
152
154
  from ccxt.async_support.krakenfutures import krakenfutures # noqa: F401
153
155
  from ccxt.async_support.kucoin import kucoin # noqa: F401
@@ -183,6 +185,7 @@ from ccxt.async_support.tabdeal import tabdeal
183
185
  from ccxt.async_support.tetherland import tetherland # noqa: F401
184
186
  from ccxt.async_support.timex import timex # noqa: F401
185
187
  from ccxt.async_support.tokocrypto import tokocrypto # noqa: F401
188
+ from ccxt.async_support.toobit import toobit # noqa: F401
186
189
  from ccxt.async_support.tradeogre import tradeogre # noqa: F401
187
190
  from ccxt.async_support.twox import twox # noqa: F401
188
191
  from ccxt.async_support.ubitex import ubitex # noqa: F401
@@ -232,6 +235,7 @@ exchanges = [
232
235
  'bitstamp',
233
236
  'bitteam',
234
237
  'bittrade',
238
+ 'bitunix',
235
239
  'bitvavo',
236
240
  'blockchaincom',
237
241
  'blofin',
@@ -283,6 +287,7 @@ exchanges = [
283
287
  'independentreserve',
284
288
  'indodax',
285
289
  'jibitex',
290
+ 'kcex',
286
291
  'kraken',
287
292
  'krakenfutures',
288
293
  'kucoin',
@@ -318,6 +323,7 @@ exchanges = [
318
323
  'tetherland',
319
324
  'timex',
320
325
  'tokocrypto',
326
+ 'toobit',
321
327
  'tradeogre',
322
328
  'twox',
323
329
  'ubitex',
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.6.1'
5
+ __version__ = '4.9.0'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -367,8 +367,6 @@ class bit24(Exchange, ImplicitAPI):
367
367
  def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
368
368
  query = self.omit(params, self.extract_params(path))
369
369
  url = self.urls['api'][api] + '/' + self.implode_params(path, params)
370
- if query > 0:
371
- queryString = self.urlencode(query)
372
- url += '?' + queryString
370
+ url = url + '?' + self.urlencode(query)
373
371
  headers = {'Content-Type': 'application/json'}
374
372
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
@@ -0,0 +1,311 @@
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.bitunix import ImplicitAPI
8
+ from ccxt.base.types import Any, Market, Strings, Ticker, Tickers
9
+ from typing import List
10
+
11
+
12
+ class bitunix(Exchange, ImplicitAPI):
13
+
14
+ def describe(self) -> Any:
15
+ return self.deep_extend(super(bitunix, self).describe(), {
16
+ 'id': 'bitunix',
17
+ 'name': 'bitunix',
18
+ 'countries': ['IR'],
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': True,
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/bitunix/64x64.png',
89
+ 'api': {
90
+ 'market': 'https://openapi.bitunix.com/',
91
+ 'tickers': 'https://api.bitunix.com/',
92
+ },
93
+ 'www': 'https://www.bitunix.com/',
94
+ 'doc': [
95
+ 'https://openapidoc.bitunix.com/',
96
+ ],
97
+ },
98
+ 'timeframes': {
99
+ '1m': '1',
100
+ '5m': '5',
101
+ '15m': '15',
102
+ '30m': '30',
103
+ '1h': '60',
104
+ '3h': '180',
105
+ '4h': '240',
106
+ '12h': '720',
107
+ '1d': '1D',
108
+ '1w': '1W',
109
+ },
110
+ 'api': {
111
+ 'public': {
112
+ 'get': {
113
+ 'api/spot/v1/common/coin_pair/list/': 1,
114
+ 'web/api/v1/common/tickers/': 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 bitunix
131
+ https://api-docs.bitunix.ir/#be8d9c51a2
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.publicGetApiSpotV1CommonCoinPairList(params)
136
+ markets = self.safe_list(response, 'data')
137
+ result = []
138
+ for i in range(0, len(markets)):
139
+ market = self.parse_market(markets[i])
140
+ result.append(market)
141
+ return result
142
+
143
+ def parse_market(self, market) -> Market:
144
+ # {
145
+ # id: 1,
146
+ # symbol: "btcusdt",
147
+ # base: "BTC",
148
+ # baseIcon: "https://img.bitunix.com/config/kv/228408.png",
149
+ # quote: "USDT",
150
+ # quoteIcon: "https://img.bitunix.com/config/coin/USDT.png",
151
+ # basePrecision: 5,
152
+ # quotePrecision: 2,
153
+ # minPrice: "10.0000000000000000",
154
+ # minVolume: "0.0000500000000000",
155
+ # maxAmount: "500000.0000000000000000",
156
+ # minAmount: "0.0000000000000000",
157
+ # maxLimitOrderAmount: "1500000.0000000000000000",
158
+ # maxMarketOrderAmount: "2000000.0000000000000000",
159
+ # maxSlippage: "0.0500",
160
+ # premiumFactor: "0.0500",
161
+ # minBuyPriceOffset: "-0.8000",
162
+ # maxSellPriceOffset: "50.0000",
163
+ # isOpen: 1,
164
+ # isHot: 1,
165
+ # isRecommend: 1,
166
+ # isShow: 1,
167
+ # tradeArea: "USDT",
168
+ # sort: 1,
169
+ # openTime: null,
170
+ # ctime: "2023-05-12T18:03:08Z",
171
+ # precisions: [
172
+ # "0.0100000000000000",
173
+ # "0.1000000000000000",
174
+ # "1.0000000000000000",
175
+ # "10.0000000000000000",
176
+ # "100.0000000000000000"
177
+ # ]
178
+ # }
179
+ baseId = self.safe_string(market, 'base')
180
+ quoteId = self.safe_string(market, 'quote')
181
+ base = self.safe_currency_code(baseId)
182
+ quote = self.safe_currency_code(quoteId)
183
+ id = (base + quote)
184
+ return {
185
+ 'id': id,
186
+ 'symbol': base + '/' + quote,
187
+ 'base': base,
188
+ 'quote': quote,
189
+ 'settle': None,
190
+ 'baseId': baseId,
191
+ 'quoteId': quoteId,
192
+ 'settleId': None,
193
+ 'type': 'spot',
194
+ 'spot': True,
195
+ 'margin': False,
196
+ 'swap': False,
197
+ 'future': False,
198
+ 'option': False,
199
+ 'active': True,
200
+ 'contract': False,
201
+ 'linear': None,
202
+ 'inverse': None,
203
+ 'contractSize': None,
204
+ 'expiry': None,
205
+ 'expiryDatetime': None,
206
+ 'strike': None,
207
+ 'optionType': None,
208
+ 'precision': {
209
+ 'amount': None,
210
+ 'price': None,
211
+ },
212
+ 'limits': {
213
+ 'leverage': {
214
+ 'min': None,
215
+ 'max': None,
216
+ },
217
+ 'amount': {
218
+ 'min': None,
219
+ 'max': None,
220
+ },
221
+ 'price': {
222
+ 'min': None,
223
+ 'max': None,
224
+ },
225
+ 'cost': {
226
+ 'min': None,
227
+ 'max': None,
228
+ },
229
+ },
230
+ 'created': None,
231
+ 'info': market,
232
+ }
233
+
234
+ async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
235
+ """
236
+ fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
237
+ https://api-docs.bitunix.ir/#be8d9c51a2
238
+ :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
239
+ :param dict [params]: extra parameters specific to the exchange API endpoint
240
+ :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
241
+ """
242
+ await self.load_markets()
243
+ if symbols is not None:
244
+ symbols = self.market_symbols(symbols)
245
+ response = await self.publicGetWebApiV1CommonTickers()
246
+ markets = self.safe_list(response, 'data')
247
+ result = {}
248
+ for i in range(0, len(markets)):
249
+ ticker = self.parse_ticker(markets[i])
250
+ symbol = ticker['symbol']
251
+ result[symbol] = ticker
252
+ return self.filter_by_array_tickers(result, 'symbol', symbols)
253
+
254
+ async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
255
+ """
256
+ fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
257
+ https://api-docs.bitunix.ir/#be8d9c51a2
258
+ :param str symbol: unified symbol of the market to fetch the ticker for
259
+ :param dict [params]: extra parameters specific to the exchange API endpoint
260
+ :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
261
+ """
262
+ ticker = await self.fetch_tickers([symbol])
263
+ return ticker[symbol]
264
+
265
+ def parse_ticker(self, ticker, market: Market = None) -> Ticker:
266
+ # {
267
+ # symbol: "BTCUSDT",
268
+ # base: "BTC",
269
+ # quote: "USDT",
270
+ # close: "112832.34",
271
+ # rose24h: "0.2276416293",
272
+ # volume: "228310106.7861019"
273
+ # },
274
+ marketType = 'spot'
275
+ marketId = self.safe_string(ticker, 'symbol')
276
+ symbol = self.safe_symbol(marketId, market, None, marketType)
277
+ last = self.safe_float(ticker, 'close', 0)
278
+ change = self.safe_float(ticker, 'rose24h', 0)
279
+ quoteVolume = self.safe_float(ticker, 'volume', 0)
280
+ baseVolume = 0
281
+ if last != 0:
282
+ baseVolume = quoteVolume / last
283
+ return self.safe_ticker({
284
+ 'symbol': symbol,
285
+ 'timestamp': None,
286
+ 'datetime': None,
287
+ 'high': None,
288
+ 'low': None,
289
+ 'bid': None,
290
+ 'bidVolume': None,
291
+ 'ask': None,
292
+ 'askVolume': None,
293
+ 'vwap': None,
294
+ 'open': None,
295
+ 'close': last,
296
+ 'last': last,
297
+ 'previousClose': None,
298
+ 'change': change,
299
+ 'percentage': change,
300
+ 'average': None,
301
+ 'baseVolume': baseVolume,
302
+ 'quoteVolume': quoteVolume,
303
+ 'info': ticker,
304
+ }, market)
305
+
306
+ def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
307
+ url = self.urls['api']['market'] + '/' + path
308
+ if path == 'web/api/v1/common/tickers/':
309
+ url = self.urls['api']['tickers'] + '/' + path
310
+ headers = {'Content-Type': 'application/json'}
311
+ return {'url': url, 'method': method, 'body': body, 'headers': headers}
@@ -250,7 +250,6 @@ class exir(Exchange, ImplicitAPI):
250
250
  }
251
251
  response = await self.publicGetV2Ticker(request)
252
252
  response['symbol'] = market['id']
253
- response['time'] = response['timestamp']
254
253
  ticker = self.parse_ticker(response)
255
254
  return ticker
256
255