kucoin-api 0.0.75__py3-none-any.whl → 0.0.76__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.
kucoin/ccxt/__init__.py CHANGED
@@ -26,7 +26,7 @@ sys.modules['ccxt'] = ccxt_module
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
29
- __version__ = '4.4.92'
29
+ __version__ = '4.4.93'
30
30
 
31
31
  # ----------------------------------------------------------------------------
32
32
 
@@ -8,7 +8,7 @@ sys.modules['ccxt'] = ccxt_module
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
11
- __version__ = '4.4.92'
11
+ __version__ = '4.4.93'
12
12
 
13
13
  # -----------------------------------------------------------------------------
14
14
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.4.92'
5
+ __version__ = '4.4.93'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -1573,6 +1573,9 @@ class Exchange(BaseExchange):
1573
1573
  async def fetch_greeks(self, symbol: str, params={}):
1574
1574
  raise NotSupported(self.id + ' fetchGreeks() is not supported yet')
1575
1575
 
1576
+ async def fetch_all_greeks(self, symbols: Strings = None, params={}):
1577
+ raise NotSupported(self.id + ' fetchAllGreeks() is not supported yet')
1578
+
1576
1579
  async def fetch_option_chain(self, code: str, params={}):
1577
1580
  raise NotSupported(self.id + ' fetchOptionChain() is not supported yet')
1578
1581
 
@@ -137,6 +137,9 @@ class Client(object):
137
137
  self.reject(error)
138
138
 
139
139
  task.add_done_callback(after_interrupt)
140
+ else:
141
+ # connection got terminated after the connection was made and before the receive loop ran
142
+ self.on_close(1006)
140
143
 
141
144
  async def open(self, session, backoff_delay=0):
142
145
  # exponential backoff for consequent connections if necessary
@@ -1397,35 +1397,31 @@ class kucoin(Exchange, ImplicitAPI):
1397
1397
  # }
1398
1398
  #
1399
1399
  currenciesData = self.safe_list(response, 'data', [])
1400
+ brokenCurrencies = self.safe_list(self.options, 'brokenCurrencies', ['00', 'OPEN_ERROR', 'HUF', 'BDT'])
1401
+ otherFiats = self.safe_list(self.options, 'fiats', ['KWD', 'IRR', 'PKR'])
1400
1402
  result: dict = {}
1401
1403
  for i in range(0, len(currenciesData)):
1402
1404
  entry = currenciesData[i]
1403
1405
  id = self.safe_string(entry, 'currency')
1404
- name = self.safe_string(entry, 'fullName')
1406
+ if self.in_array(id, brokenCurrencies):
1407
+ continue # skip buggy entries: https://t.me/KuCoin_API/217798
1405
1408
  code = self.safe_currency_code(id)
1406
1409
  networks: dict = {}
1407
1410
  chains = self.safe_list(entry, 'chains', [])
1408
- rawPrecision = self.safe_string(entry, 'precision')
1409
- precision = self.parse_number(self.parse_precision(rawPrecision))
1410
1411
  chainsLength = len(chains)
1411
- if not chainsLength:
1412
- # one buggy coin, which doesn't contain info https://t.me/KuCoin_API/173118
1413
- continue
1414
1412
  for j in range(0, chainsLength):
1415
1413
  chain = chains[j]
1416
1414
  chainId = self.safe_string(chain, 'chainId')
1417
1415
  networkCode = self.network_id_to_code(chainId, code)
1418
- chainWithdrawEnabled = self.safe_bool(chain, 'isWithdrawEnabled', False)
1419
- chainDepositEnabled = self.safe_bool(chain, 'isDepositEnabled', False)
1420
1416
  networks[networkCode] = {
1421
1417
  'info': chain,
1422
1418
  'id': chainId,
1423
1419
  'name': self.safe_string(chain, 'chainName'),
1424
1420
  'code': networkCode,
1425
- 'active': chainWithdrawEnabled and chainDepositEnabled,
1421
+ 'active': None,
1426
1422
  'fee': self.safe_number(chain, 'withdrawalMinFee'),
1427
- 'deposit': chainDepositEnabled,
1428
- 'withdraw': chainWithdrawEnabled,
1423
+ 'deposit': self.safe_bool(chain, 'isDepositEnabled'),
1424
+ 'withdraw': self.safe_bool(chain, 'isWithdrawEnabled'),
1429
1425
  'precision': self.parse_number(self.parse_precision(self.safe_string(chain, 'withdrawPrecision'))),
1430
1426
  'limits': {
1431
1427
  'withdraw': {
@@ -1439,10 +1435,12 @@ class kucoin(Exchange, ImplicitAPI):
1439
1435
  },
1440
1436
  }
1441
1437
  # kucoin has determined 'fiat' currencies with below logic
1442
- isFiat = (rawPrecision == '2') and (chainsLength == 0)
1438
+ rawPrecision = self.safe_string(entry, 'precision')
1439
+ precision = self.parse_number(self.parse_precision(rawPrecision))
1440
+ isFiat = self.in_array(id, otherFiats) or ((rawPrecision == '2') and (chainsLength == 0))
1443
1441
  result[code] = self.safe_currency_structure({
1444
1442
  'id': id,
1445
- 'name': name,
1443
+ 'name': self.safe_string(entry, 'fullName'),
1446
1444
  'code': code,
1447
1445
  'type': 'fiat' if isFiat else 'crypto',
1448
1446
  'precision': precision,
@@ -2628,7 +2626,7 @@ class kucoin(Exchange, ImplicitAPI):
2628
2626
  """
2629
2627
  await self.load_markets()
2630
2628
  request: dict = {}
2631
- trigger = self.safe_bool(params, 'stop', False)
2629
+ trigger = self.safe_bool_2(params, 'trigger', 'stop', False)
2632
2630
  hf = None
2633
2631
  hf, params = self.handle_hf_and_params(params)
2634
2632
  params = self.omit(params, 'stop')
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.4.92'
7
+ __version__ = '4.4.93'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -4229,7 +4229,7 @@ class Exchange(object):
4229
4229
  return self.filter_by_since_limit(sorted, since, limit, 0, tail)
4230
4230
 
4231
4231
  def parse_leverage_tiers(self, response: Any, symbols: List[str] = None, marketIdKey=None):
4232
- # marketIdKey should only be None when response is a dictionary
4232
+ # marketIdKey should only be None when response is a dictionary.
4233
4233
  symbols = self.market_symbols(symbols)
4234
4234
  tiers = {}
4235
4235
  symbolsLength = 0
@@ -5450,6 +5450,9 @@ class Exchange(object):
5450
5450
  def fetch_greeks(self, symbol: str, params={}):
5451
5451
  raise NotSupported(self.id + ' fetchGreeks() is not supported yet')
5452
5452
 
5453
+ def fetch_all_greeks(self, symbols: Strings = None, params={}):
5454
+ raise NotSupported(self.id + ' fetchAllGreeks() is not supported yet')
5455
+
5453
5456
  def fetch_option_chain(self, code: str, params={}):
5454
5457
  raise NotSupported(self.id + ' fetchOptionChain() is not supported yet')
5455
5458
 
@@ -5703,10 +5706,16 @@ class Exchange(object):
5703
5706
  precisionNumber = int(precision)
5704
5707
  if precisionNumber == 0:
5705
5708
  return '1'
5706
- parsedPrecision = '0.'
5707
- for i in range(0, precisionNumber - 1):
5708
- parsedPrecision = parsedPrecision + '0'
5709
- return parsedPrecision + '1'
5709
+ if precisionNumber > 0:
5710
+ parsedPrecision = '0.'
5711
+ for i in range(0, precisionNumber - 1):
5712
+ parsedPrecision = parsedPrecision + '0'
5713
+ return parsedPrecision + '1'
5714
+ else:
5715
+ parsedPrecision = '1'
5716
+ for i in range(0, precisionNumber * -1 - 1):
5717
+ parsedPrecision = parsedPrecision + '0'
5718
+ return parsedPrecision + '0'
5710
5719
 
5711
5720
  def integer_precision_to_amount(self, precision: Str):
5712
5721
  """
@@ -6682,6 +6691,27 @@ class Exchange(object):
6682
6691
  def parse_greeks(self, greeks: dict, market: Market = None):
6683
6692
  raise NotSupported(self.id + ' parseGreeks() is not supported yet')
6684
6693
 
6694
+ def parse_all_greeks(self, greeks, symbols: Strings = None, params={}):
6695
+ #
6696
+ # the value of greeks is either a dict or a list
6697
+ #
6698
+ results = []
6699
+ if isinstance(greeks, list):
6700
+ for i in range(0, len(greeks)):
6701
+ parsedTicker = self.parse_greeks(greeks[i])
6702
+ greek = self.extend(parsedTicker, params)
6703
+ results.append(greek)
6704
+ else:
6705
+ marketIds = list(greeks.keys())
6706
+ for i in range(0, len(marketIds)):
6707
+ marketId = marketIds[i]
6708
+ market = self.safe_market(marketId)
6709
+ parsed = self.parse_greeks(greeks[marketId], market)
6710
+ greek = self.extend(parsed, params)
6711
+ results.append(greek)
6712
+ symbols = self.market_symbols(symbols)
6713
+ return self.filter_by_array(results, 'symbol', symbols)
6714
+
6685
6715
  def parse_option(self, chain: dict, currency: Currency = None, market: Market = None):
6686
6716
  raise NotSupported(self.id + ' parseOption() is not supported yet')
6687
6717
 
@@ -6883,14 +6913,27 @@ class Exchange(object):
6883
6913
  """
6884
6914
  raise NotSupported(self.id + ' fetchTransfers() is not supported yet')
6885
6915
 
6886
- def clean_unsubscription(self, client, subHash: str, unsubHash: str):
6916
+ def clean_unsubscription(self, client, subHash: str, unsubHash: str, subHashIsPrefix=False):
6887
6917
  if unsubHash in client.subscriptions:
6888
6918
  del client.subscriptions[unsubHash]
6889
- if subHash in client.subscriptions:
6890
- del client.subscriptions[subHash]
6891
- if subHash in client.futures:
6892
- error = UnsubscribeError(self.id + ' ' + subHash)
6893
- client.reject(error, subHash)
6919
+ if not subHashIsPrefix:
6920
+ if subHash in client.subscriptions:
6921
+ del client.subscriptions[subHash]
6922
+ if subHash in client.futures:
6923
+ error = UnsubscribeError(self.id + ' ' + subHash)
6924
+ client.reject(error, subHash)
6925
+ else:
6926
+ clientSubscriptions = list(client.subscriptions.keys())
6927
+ for i in range(0, len(clientSubscriptions)):
6928
+ sub = clientSubscriptions[i]
6929
+ if sub.startswith(subHash):
6930
+ del client.subscriptions[sub]
6931
+ clientFutures = list(client.futures.keys())
6932
+ for i in range(0, len(clientFutures)):
6933
+ future = clientFutures[i]
6934
+ if future.startswith(subHash):
6935
+ error = UnsubscribeError(self.id + ' ' + future)
6936
+ client.reject(error, future)
6894
6937
  client.resolve(True, unsubHash)
6895
6938
 
6896
6939
  def clean_cache(self, subscription: dict):
kucoin/ccxt/kucoin.py CHANGED
@@ -1396,35 +1396,31 @@ class kucoin(Exchange, ImplicitAPI):
1396
1396
  # }
1397
1397
  #
1398
1398
  currenciesData = self.safe_list(response, 'data', [])
1399
+ brokenCurrencies = self.safe_list(self.options, 'brokenCurrencies', ['00', 'OPEN_ERROR', 'HUF', 'BDT'])
1400
+ otherFiats = self.safe_list(self.options, 'fiats', ['KWD', 'IRR', 'PKR'])
1399
1401
  result: dict = {}
1400
1402
  for i in range(0, len(currenciesData)):
1401
1403
  entry = currenciesData[i]
1402
1404
  id = self.safe_string(entry, 'currency')
1403
- name = self.safe_string(entry, 'fullName')
1405
+ if self.in_array(id, brokenCurrencies):
1406
+ continue # skip buggy entries: https://t.me/KuCoin_API/217798
1404
1407
  code = self.safe_currency_code(id)
1405
1408
  networks: dict = {}
1406
1409
  chains = self.safe_list(entry, 'chains', [])
1407
- rawPrecision = self.safe_string(entry, 'precision')
1408
- precision = self.parse_number(self.parse_precision(rawPrecision))
1409
1410
  chainsLength = len(chains)
1410
- if not chainsLength:
1411
- # one buggy coin, which doesn't contain info https://t.me/KuCoin_API/173118
1412
- continue
1413
1411
  for j in range(0, chainsLength):
1414
1412
  chain = chains[j]
1415
1413
  chainId = self.safe_string(chain, 'chainId')
1416
1414
  networkCode = self.network_id_to_code(chainId, code)
1417
- chainWithdrawEnabled = self.safe_bool(chain, 'isWithdrawEnabled', False)
1418
- chainDepositEnabled = self.safe_bool(chain, 'isDepositEnabled', False)
1419
1415
  networks[networkCode] = {
1420
1416
  'info': chain,
1421
1417
  'id': chainId,
1422
1418
  'name': self.safe_string(chain, 'chainName'),
1423
1419
  'code': networkCode,
1424
- 'active': chainWithdrawEnabled and chainDepositEnabled,
1420
+ 'active': None,
1425
1421
  'fee': self.safe_number(chain, 'withdrawalMinFee'),
1426
- 'deposit': chainDepositEnabled,
1427
- 'withdraw': chainWithdrawEnabled,
1422
+ 'deposit': self.safe_bool(chain, 'isDepositEnabled'),
1423
+ 'withdraw': self.safe_bool(chain, 'isWithdrawEnabled'),
1428
1424
  'precision': self.parse_number(self.parse_precision(self.safe_string(chain, 'withdrawPrecision'))),
1429
1425
  'limits': {
1430
1426
  'withdraw': {
@@ -1438,10 +1434,12 @@ class kucoin(Exchange, ImplicitAPI):
1438
1434
  },
1439
1435
  }
1440
1436
  # kucoin has determined 'fiat' currencies with below logic
1441
- isFiat = (rawPrecision == '2') and (chainsLength == 0)
1437
+ rawPrecision = self.safe_string(entry, 'precision')
1438
+ precision = self.parse_number(self.parse_precision(rawPrecision))
1439
+ isFiat = self.in_array(id, otherFiats) or ((rawPrecision == '2') and (chainsLength == 0))
1442
1440
  result[code] = self.safe_currency_structure({
1443
1441
  'id': id,
1444
- 'name': name,
1442
+ 'name': self.safe_string(entry, 'fullName'),
1445
1443
  'code': code,
1446
1444
  'type': 'fiat' if isFiat else 'crypto',
1447
1445
  'precision': precision,
@@ -2627,7 +2625,7 @@ class kucoin(Exchange, ImplicitAPI):
2627
2625
  """
2628
2626
  self.load_markets()
2629
2627
  request: dict = {}
2630
- trigger = self.safe_bool(params, 'stop', False)
2628
+ trigger = self.safe_bool_2(params, 'trigger', 'stop', False)
2631
2629
  hf = None
2632
2630
  hf, params = self.handle_hf_and_params(params)
2633
2631
  params = self.omit(params, 'stop')
@@ -8,7 +8,7 @@ sys.modules['ccxt'] = ccxt_module
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10
 
11
- __version__ = '4.4.92'
11
+ __version__ = '4.4.93'
12
12
 
13
13
  # ----------------------------------------------------------------------------
14
14
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: kucoin-api
3
- Version: 0.0.75
3
+ Version: 0.0.76
4
4
  Summary: kucoin crypto exchange api client
5
5
  Project-URL: Homepage, https://github.com/ccxt/ccxt
6
6
  Project-URL: Issues, https://github.com/ccxt/ccxt
@@ -1,15 +1,15 @@
1
1
  kucoin/__init__.py,sha256=J1NNMLktlkCZKV82j8CFTVES3O3TCVk3so0ROi4E52o,246
2
- kucoin/ccxt/__init__.py,sha256=N_WRftY_XCcsE1xciolFxqlXlBjlvi81qLzIZ4dNAY0,6048
3
- kucoin/ccxt/kucoin.py,sha256=OycntB0gK0mI4ZfDDMmHip8n2S-AxgKX2jG9XjFeJ5A,232381
2
+ kucoin/ccxt/__init__.py,sha256=OhpR6lO7DmkrdpShW_5JwKgPg70kJ1m-wZ_CyABR6f0,6048
3
+ kucoin/ccxt/kucoin.py,sha256=K21dkk9MqfRi3PmJuyJ0J7FxwQYrppVtCG0EMEUj-WY,232408
4
4
  kucoin/ccxt/abstract/kucoin.py,sha256=kVrVEXiigc36arfbSS8lDUMnG7uFdKgUKHIhVb0Am_8,28626
5
- kucoin/ccxt/async_support/__init__.py,sha256=sn8ej5qMJMVI9QnrJ-22yusNN2oq8z8_v73nZEhB3xU,4781
6
- kucoin/ccxt/async_support/kucoin.py,sha256=kUz1hYpOU364piOa-psqtxTm11f6KlXS0HErk9_J-xk,233531
5
+ kucoin/ccxt/async_support/__init__.py,sha256=pe-hAUBYdzmG83VknkhbP4ogzGHiZopdjBQpGolTiPM,4781
6
+ kucoin/ccxt/async_support/kucoin.py,sha256=7yF38unXPmQ7YYd0qpgcUOw5rFwzexP9p1anSAhQlak,233558
7
7
  kucoin/ccxt/async_support/base/__init__.py,sha256=aVYSsFi--b4InRs9zDN_wtCpj8odosAB726JdUHavrk,67
8
- kucoin/ccxt/async_support/base/exchange.py,sha256=FQynGv0nHLJXfqiWThG1GFXUYqFMvMBdRkMYAxVGrqY,119286
8
+ kucoin/ccxt/async_support/base/exchange.py,sha256=WRCIHpPMqJ4UpcL4x534QQWA1Bo4RFS1xJitRjKFViw,119440
9
9
  kucoin/ccxt/async_support/base/throttler.py,sha256=tvDVcdRUVYi8fZRlEcnqtgzcgB_KMUMRs5Pu8tuU-tU,1847
10
10
  kucoin/ccxt/async_support/base/ws/__init__.py,sha256=uockzpLuwntKGZbs5EOWFe-Zg-k6Cj7GhNJLc_RX0so,1791
11
11
  kucoin/ccxt/async_support/base/ws/cache.py,sha256=xf2VOtfUwloxSlIQ39M1RGZHWQzyS9IGhB5NX6cDcAc,8370
12
- kucoin/ccxt/async_support/base/ws/client.py,sha256=1N_ji0ekjViecIHdcT7a8DVbq8aB-ZVgjK6ccJZntMU,13476
12
+ kucoin/ccxt/async_support/base/ws/client.py,sha256=ekIN5HNgeQgMG3tLZMsE889Aoxs960DLwQnwkTGhdi8,13624
13
13
  kucoin/ccxt/async_support/base/ws/functions.py,sha256=qwvEnjtINWL5ZU-dbbeIunjyBxzFqbGWHfVhxqAcKug,1499
14
14
  kucoin/ccxt/async_support/base/ws/future.py,sha256=9yFyxqT7cl-7ZFM6LM4b6UPXyO2FGIbAhs5uoJ3-Smo,1271
15
15
  kucoin/ccxt/async_support/base/ws/order_book.py,sha256=uBUaIHhzMRykpmo4BCsdJ-t_HozS6VxhEs8x-Kbj-NI,2894
@@ -17,10 +17,10 @@ kucoin/ccxt/async_support/base/ws/order_book_side.py,sha256=GhnGUt78pJ-AYL_Dq9pr
17
17
  kucoin/ccxt/base/__init__.py,sha256=eTx1OE3HJjspFUQjGm6LBhaQiMKJnXjkdP-JUXknyQ0,1320
18
18
  kucoin/ccxt/base/decimal_to_precision.py,sha256=fgWRBzRTtsf3r2INyS4f7WHlzgjB5YM1ekiwqD21aac,6634
19
19
  kucoin/ccxt/base/errors.py,sha256=MvCrL_sAM3de616T6RE0PSxiF2xV6Qqz5b1y1ghidbk,4888
20
- kucoin/ccxt/base/exchange.py,sha256=_2FOqAIq1yfzBic5QI4JMQseWYPIesZpubuSde7jxYk,328428
20
+ kucoin/ccxt/base/exchange.py,sha256=64LNTmAxXu8gUG6n4pwCNjTmVZmV0otj7ceWXRB3G6o,330373
21
21
  kucoin/ccxt/base/precise.py,sha256=koce64Yrp6vFbGijJtUt-QQ6XhJgeGTCksZ871FPp_A,8886
22
22
  kucoin/ccxt/base/types.py,sha256=vMQfFDVntED4YHrRJt0Q98YaM7OtGhK-DkbkqXFTYHc,11485
23
- kucoin/ccxt/pro/__init__.py,sha256=z8bMPeanFwFZ23YZZlCCGv72kLV1-K8Q7yhnTqRZ0v4,4095
23
+ kucoin/ccxt/pro/__init__.py,sha256=N8LQHT7CLXa4Lybh3AwcCrGnyDOhSLTv2g7DaA1xLGA,4095
24
24
  kucoin/ccxt/pro/kucoin.py,sha256=598XsFeIFOOAOlY2fuEenBT-pPFjoOKiqPP8lP7dzD4,60794
25
25
  kucoin/ccxt/static_dependencies/README.md,sha256=3TCvhhn09_Cqf9BDDpao1V7EfKHDpQ6k9oWRsLFixpU,18
26
26
  kucoin/ccxt/static_dependencies/__init__.py,sha256=tzFje8cloqmiIE6kola3EaYC0SnD1izWnri69hzHsSw,168
@@ -281,6 +281,6 @@ kucoin/ccxt/static_dependencies/toolz/curried/exceptions.py,sha256=gKFOHDIayAWnX
281
281
  kucoin/ccxt/static_dependencies/toolz/curried/operator.py,sha256=ML92mknkAwzBl2NCm-4werSUmJEtSHNY9NSzhseNM9s,525
282
282
  kucoin/ccxt/static_dependencies/typing_inspect/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
283
283
  kucoin/ccxt/static_dependencies/typing_inspect/typing_inspect.py,sha256=5gIWomLPfuDpgd3gX1GlnX0MuXM3VorR4j2W2qXORiQ,28269
284
- kucoin_api-0.0.75.dist-info/METADATA,sha256=HUnYKT0YMN43IPqtHkh8cukSQUnjSLKHHLF54lgdqc8,18571
285
- kucoin_api-0.0.75.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
286
- kucoin_api-0.0.75.dist-info/RECORD,,
284
+ kucoin_api-0.0.76.dist-info/METADATA,sha256=vKqt574zFpZnAK1BaCaY2G7AcQ0hLwyHErMs2jVryeM,18571
285
+ kucoin_api-0.0.76.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
286
+ kucoin_api-0.0.76.dist-info/RECORD,,