ccxt 4.3.4__py2.py3-none-any.whl → 4.3.5__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.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

ccxt/kucoin.py CHANGED
@@ -533,7 +533,7 @@ class kucoin(Exchange, ImplicitAPI):
533
533
  '400006': AuthenticationError,
534
534
  '400007': AuthenticationError,
535
535
  '400008': NotSupported,
536
- '400100': InsufficientFunds, # {"msg":"account.available.amount","code":"400100"}
536
+ '400100': InsufficientFunds, # {"msg":"account.available.amount","code":"400100"} or {"msg":"Withdrawal amount is below the minimum requirement.","code":"400100"}
537
537
  '400200': InvalidOrder, # {"code":"400200","msg":"Forbidden to place an order"}
538
538
  '400350': InvalidOrder, # {"code":"400350","msg":"Upper limit for holding: 10,000USDT, you can still buy 10,000USDT worth of coin."}
539
539
  '400370': InvalidOrder, # {"code":"400370","msg":"Max. price: 0.02500000000000000000"}
@@ -1158,8 +1158,10 @@ class kucoin(Exchange, ImplicitAPI):
1158
1158
  # "chains":[
1159
1159
  # {
1160
1160
  # "chainName":"ERC20",
1161
- # "chain":"eth",
1161
+ # "chainId": "eth"
1162
1162
  # "withdrawalMinSize":"2999",
1163
+ # "depositMinSize":null,
1164
+ # "withdrawFeeRate":"0",
1163
1165
  # "withdrawalMinFee":"2999",
1164
1166
  # "isWithdrawEnabled":false,
1165
1167
  # "isDepositEnabled":false,
@@ -1262,7 +1264,7 @@ class kucoin(Exchange, ImplicitAPI):
1262
1264
  'max': None,
1263
1265
  },
1264
1266
  'deposit': {
1265
- 'min': self.safe_number(chainExtraData, 'depositMinSize'),
1267
+ 'min': self.safe_number(chain, 'depositMinSize'),
1266
1268
  'max': None,
1267
1269
  },
1268
1270
  },
@@ -3019,7 +3021,6 @@ class kucoin(Exchange, ImplicitAPI):
3019
3021
  request = {
3020
3022
  'currency': currency['id'],
3021
3023
  'address': address,
3022
- 'amount': amount,
3023
3024
  # 'memo': tag,
3024
3025
  # 'isInner': False, # internal transfer or external withdrawal
3025
3026
  # 'remark': 'optional',
@@ -3031,6 +3032,8 @@ class kucoin(Exchange, ImplicitAPI):
3031
3032
  networkCode, params = self.handle_network_code_and_params(params)
3032
3033
  if networkCode is not None:
3033
3034
  request['chain'] = self.network_code_to_id(networkCode).lower()
3035
+ self.load_currency_precision(currency, networkCode)
3036
+ request['amount'] = self.currency_to_precision(code, amount, networkCode)
3034
3037
  includeFee = None
3035
3038
  includeFee, params = self.handle_option_and_params(params, 'withdraw', 'includeFee', False)
3036
3039
  if includeFee:
@@ -3049,6 +3052,51 @@ class kucoin(Exchange, ImplicitAPI):
3049
3052
  data = self.safe_dict(response, 'data', {})
3050
3053
  return self.parse_transaction(data, currency)
3051
3054
 
3055
+ def load_currency_precision(self, currency, networkCode: Str = None):
3056
+ # might not have network specific precisions defined in fetchCurrencies(because of webapi failure)
3057
+ # we should check and refetch precision once-per-instance for that specific currency & network
3058
+ # so avoids thorwing exceptions and burden to users
3059
+ # Note: self needs to be executed only if networkCode was provided
3060
+ if networkCode is not None:
3061
+ networks = currency['networks']
3062
+ network = self.safe_dict(networks, networkCode)
3063
+ if self.safe_number(network, 'precision') is not None:
3064
+ # if precision exists, no need to refetch
3065
+ return
3066
+ # otherwise try to fetch and store in instance
3067
+ request = {
3068
+ 'currency': currency['id'],
3069
+ 'chain': self.network_code_to_id(networkCode).lower(),
3070
+ }
3071
+ response = self.privateGetWithdrawalsQuotas(request)
3072
+ #
3073
+ # {
3074
+ # "code": "200000",
3075
+ # "data": {
3076
+ # "currency": "USDT",
3077
+ # "limitBTCAmount": "14.24094850",
3078
+ # "usedBTCAmount": "0.00000000",
3079
+ # "quotaCurrency": "USDT",
3080
+ # "limitQuotaCurrencyAmount": "999999.00000000",
3081
+ # "usedQuotaCurrencyAmount": "0",
3082
+ # "remainAmount": "999999.0000",
3083
+ # "availableAmount": "10.77545071",
3084
+ # "withdrawMinFee": "1",
3085
+ # "innerWithdrawMinFee": "0",
3086
+ # "withdrawMinSize": "10",
3087
+ # "isWithdrawEnabled": True,
3088
+ # "precision": 4,
3089
+ # "chain": "EOS",
3090
+ # "reason": null,
3091
+ # "lockedAmount": "0"
3092
+ # }
3093
+ # }
3094
+ #
3095
+ data = self.safe_dict(response, 'data', {})
3096
+ precision = self.parse_number(self.parse_precision(self.safe_string(data, 'precision')))
3097
+ code = currency['code']
3098
+ self.currencies[code]['networks'][networkCode]['precision'] = precision
3099
+
3052
3100
  def parse_transaction_status(self, status):
3053
3101
  statuses = {
3054
3102
  'SUCCESS': 'ok',
ccxt/pro/__init__.py CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  # ----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.3.4'
7
+ __version__ = '4.3.5'
8
8
 
9
9
  # ----------------------------------------------------------------------------
10
10