kucoin-api 0.0.79__py3-none-any.whl → 0.0.81__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/async_support/base/exchange.py +4 -1
- kucoin/ccxt/async_support/kucoin.py +2 -1
- kucoin/ccxt/base/decimal_to_precision.py +16 -10
- kucoin/ccxt/base/exchange.py +54 -14
- kucoin/ccxt/kucoin.py +2 -1
- {kucoin_api-0.0.79.dist-info → kucoin_api-0.0.81.dist-info}/METADATA +1 -1
- {kucoin_api-0.0.79.dist-info → kucoin_api-0.0.81.dist-info}/RECORD +8 -8
- {kucoin_api-0.0.79.dist-info → kucoin_api-0.0.81.dist-info}/WHEEL +0 -0
@@ -670,6 +670,9 @@ class Exchange(BaseExchange):
|
|
670
670
|
async def un_watch_order_book_for_symbols(self, symbols: List[str], params={}):
|
671
671
|
raise NotSupported(self.id + ' unWatchOrderBookForSymbols() is not supported yet')
|
672
672
|
|
673
|
+
async def un_watch_positions(self, symbols: Strings = None, params={}):
|
674
|
+
raise NotSupported(self.id + ' unWatchPositions() is not supported yet')
|
675
|
+
|
673
676
|
async def fetch_deposit_addresses(self, codes: Strings = None, params={}):
|
674
677
|
raise NotSupported(self.id + ' fetchDepositAddresses() is not supported yet')
|
675
678
|
|
@@ -1894,7 +1897,7 @@ class Exchange(BaseExchange):
|
|
1894
1897
|
calls = 0
|
1895
1898
|
result = []
|
1896
1899
|
errors = 0
|
1897
|
-
until = self.
|
1900
|
+
until = self.safe_integer_n(params, ['until', 'untill', 'till']) # do not omit it from params here
|
1898
1901
|
maxEntriesPerRequest, params = self.handle_max_entries_per_request_and_params(method, maxEntriesPerRequest, params)
|
1899
1902
|
if (paginationDirection == 'forward'):
|
1900
1903
|
if since is None:
|
@@ -812,7 +812,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
812
812
|
'TLOS': 'tlos', # tlosevm is different
|
813
813
|
'CFX': 'cfx',
|
814
814
|
'ACA': 'aca',
|
815
|
-
'
|
815
|
+
'OPTIMISM': 'optimism',
|
816
816
|
'ONT': 'ont',
|
817
817
|
'GLMR': 'glmr',
|
818
818
|
'CSPR': 'cspr',
|
@@ -932,6 +932,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
932
932
|
'CS': 'cs',
|
933
933
|
'ORAI': 'orai',
|
934
934
|
'BASE': 'base',
|
935
|
+
'TARA': 'tara',
|
935
936
|
# below will be uncommented after consensus
|
936
937
|
# 'BITCOINDIAMON': 'bcd',
|
937
938
|
# 'BITCOINGOLD': 'btg',
|
@@ -33,18 +33,24 @@ NO_PADDING = 5
|
|
33
33
|
PAD_WITH_ZERO = 6
|
34
34
|
|
35
35
|
|
36
|
-
def decimal_to_precision(n, rounding_mode=ROUND,
|
37
|
-
assert
|
36
|
+
def decimal_to_precision(n, rounding_mode=ROUND, numPrecisionDigits=None, counting_mode=DECIMAL_PLACES, padding_mode=NO_PADDING):
|
37
|
+
assert numPrecisionDigits is not None, 'numPrecisionDigits should not be None'
|
38
|
+
|
39
|
+
if isinstance(numPrecisionDigits, str):
|
40
|
+
numPrecisionDigits = float(numPrecisionDigits)
|
41
|
+
assert isinstance(numPrecisionDigits, float) or isinstance(numPrecisionDigits, decimal.Decimal) or isinstance(numPrecisionDigits, numbers.Integral), 'numPrecisionDigits has an invalid number'
|
42
|
+
|
38
43
|
if counting_mode == TICK_SIZE:
|
39
|
-
assert
|
44
|
+
assert numPrecisionDigits > 0, 'negative or zero numPrecisionDigits can not be used with TICK_SIZE precisionMode'
|
40
45
|
else:
|
41
|
-
assert
|
46
|
+
assert isinstance(numPrecisionDigits, numbers.Integral)
|
47
|
+
|
42
48
|
assert rounding_mode in [TRUNCATE, ROUND]
|
43
49
|
assert counting_mode in [DECIMAL_PLACES, SIGNIFICANT_DIGITS, TICK_SIZE]
|
44
50
|
assert padding_mode in [NO_PADDING, PAD_WITH_ZERO]
|
51
|
+
# end of checks
|
45
52
|
|
46
|
-
|
47
|
-
precision = float(precision)
|
53
|
+
precision = numPrecisionDigits # "precision" variable name was in signature, but to make function signature similar to php/js, I had to change the argument name to "numPrecisionDigits". however, the below codes use "precision" variable name, so we have to assign that name here (you can change the usage of 'precision' variable name below everywhere, but i've refrained to do that to avoid many changes)
|
48
54
|
|
49
55
|
context = decimal.getcontext()
|
50
56
|
|
@@ -78,12 +84,12 @@ def decimal_to_precision(n, rounding_mode=ROUND, precision=None, counting_mode=D
|
|
78
84
|
if missing != 0:
|
79
85
|
if rounding_mode == ROUND:
|
80
86
|
if dec > 0:
|
81
|
-
if missing >=
|
87
|
+
if missing >= precision_dec / 2:
|
82
88
|
dec = dec - missing + precision_dec
|
83
89
|
else:
|
84
90
|
dec = dec - missing
|
85
91
|
else:
|
86
|
-
if missing >=
|
92
|
+
if missing >= precision_dec / 2:
|
87
93
|
dec = dec + missing - precision_dec
|
88
94
|
else:
|
89
95
|
dec = dec + missing
|
@@ -117,7 +123,7 @@ def decimal_to_precision(n, rounding_mode=ROUND, precision=None, counting_mode=D
|
|
117
123
|
precise = '{:f}'.format(min((below, above), key=lambda x: abs(x - dec)))
|
118
124
|
else:
|
119
125
|
precise = '{:f}'.format(dec.quantize(sigfig))
|
120
|
-
if precise
|
126
|
+
if precise.startswith('-0') and all(c in '0.' for c in precise[1:]):
|
121
127
|
precise = precise[1:]
|
122
128
|
|
123
129
|
elif rounding_mode == TRUNCATE:
|
@@ -138,7 +144,7 @@ def decimal_to_precision(n, rounding_mode=ROUND, precision=None, counting_mode=D
|
|
138
144
|
precise = string
|
139
145
|
else:
|
140
146
|
precise = string[:end].ljust(dot, '0')
|
141
|
-
if precise
|
147
|
+
if precise.startswith('-0') and all(c in '0.' for c in precise[1:]):
|
142
148
|
precise = precise[1:]
|
143
149
|
precise = precise.rstrip('.')
|
144
150
|
|
kucoin/ccxt/base/exchange.py
CHANGED
@@ -2133,6 +2133,17 @@ class Exchange(object):
|
|
2133
2133
|
'watchLiquidations': None,
|
2134
2134
|
'watchLiquidationsForSymbols': None,
|
2135
2135
|
'watchMyLiquidations': None,
|
2136
|
+
'unWatchOrders': None,
|
2137
|
+
'unWatchTrades': None,
|
2138
|
+
'unWatchTradesForSymbols': None,
|
2139
|
+
'unWatchOHLCVForSymbols': None,
|
2140
|
+
'unWatchOrderBookForSymbols': None,
|
2141
|
+
'unWatchPositions': None,
|
2142
|
+
'unWatchOrderBook': None,
|
2143
|
+
'unWatchTickers': None,
|
2144
|
+
'unWatchMyTrades': None,
|
2145
|
+
'unWatchTicker': None,
|
2146
|
+
'unWatchOHLCV': None,
|
2136
2147
|
'watchMyLiquidationsForSymbols': None,
|
2137
2148
|
'withdraw': None,
|
2138
2149
|
'ws': None,
|
@@ -2619,6 +2630,9 @@ class Exchange(object):
|
|
2619
2630
|
def un_watch_order_book_for_symbols(self, symbols: List[str], params={}):
|
2620
2631
|
raise NotSupported(self.id + ' unWatchOrderBookForSymbols() is not supported yet')
|
2621
2632
|
|
2633
|
+
def un_watch_positions(self, symbols: Strings = None, params={}):
|
2634
|
+
raise NotSupported(self.id + ' unWatchPositions() is not supported yet')
|
2635
|
+
|
2622
2636
|
def fetch_deposit_addresses(self, codes: Strings = None, params={}):
|
2623
2637
|
raise NotSupported(self.id + ' fetchDepositAddresses() is not supported yet')
|
2624
2638
|
|
@@ -3587,18 +3601,7 @@ class Exchange(object):
|
|
3587
3601
|
symbol = market['symbol'] if (market is not None) else None
|
3588
3602
|
return self.filter_by_symbol_since_limit(results, symbol, since, limit)
|
3589
3603
|
|
3590
|
-
def
|
3591
|
-
"""
|
3592
|
-
calculates the presumptive fee that would be charged for an order
|
3593
|
-
:param str symbol: unified market symbol
|
3594
|
-
:param str type: 'market' or 'limit'
|
3595
|
-
:param str side: 'buy' or 'sell'
|
3596
|
-
:param float amount: how much you want to trade, in units of the base currency on most exchanges, or number of contracts
|
3597
|
-
:param float price: the price for the order to be filled at, in units of the quote currency
|
3598
|
-
:param str takerOrMaker: 'taker' or 'maker'
|
3599
|
-
:param dict params:
|
3600
|
-
:returns dict: contains the rate, the percentage multiplied to the order amount to obtain the fee amount, and cost, the total value of the fee in units of the quote currency, for the order
|
3601
|
-
"""
|
3604
|
+
def calculate_fee_with_rate(self, symbol: str, type: str, side: str, amount: float, price: float, takerOrMaker='taker', feeRate: Num = None, params={}):
|
3602
3605
|
if type == 'market' and takerOrMaker == 'maker':
|
3603
3606
|
raise ArgumentsRequired(self.id + ' calculateFee() - you have provided incompatible arguments - "market" type order can not be "maker". Change either the "type" or the "takerOrMaker" argument to calculate the fee.')
|
3604
3607
|
market = self.markets[symbol]
|
@@ -3627,7 +3630,7 @@ class Exchange(object):
|
|
3627
3630
|
# even if `takerOrMaker` argument was set to 'maker', for 'market' orders we should forcefully override it to 'taker'
|
3628
3631
|
if type == 'market':
|
3629
3632
|
takerOrMaker = 'taker'
|
3630
|
-
rate = self.safe_string(market, takerOrMaker)
|
3633
|
+
rate = self.number_to_string(feeRate) if (feeRate is not None) else self.safe_string(market, takerOrMaker)
|
3631
3634
|
cost = Precise.string_mul(cost, rate)
|
3632
3635
|
return {
|
3633
3636
|
'type': takerOrMaker,
|
@@ -3636,6 +3639,20 @@ class Exchange(object):
|
|
3636
3639
|
'cost': self.parse_number(cost),
|
3637
3640
|
}
|
3638
3641
|
|
3642
|
+
def calculate_fee(self, symbol: str, type: str, side: str, amount: float, price: float, takerOrMaker='taker', params={}):
|
3643
|
+
"""
|
3644
|
+
calculates the presumptive fee that would be charged for an order
|
3645
|
+
:param str symbol: unified market symbol
|
3646
|
+
:param str type: 'market' or 'limit'
|
3647
|
+
:param str side: 'buy' or 'sell'
|
3648
|
+
:param float amount: how much you want to trade, in units of the base currency on most exchanges, or number of contracts
|
3649
|
+
:param float price: the price for the order to be filled at, in units of the quote currency
|
3650
|
+
:param str takerOrMaker: 'taker' or 'maker'
|
3651
|
+
:param dict params:
|
3652
|
+
:returns dict: contains the rate, the percentage multiplied to the order amount to obtain the fee amount, and cost, the total value of the fee in units of the quote currency, for the order
|
3653
|
+
"""
|
3654
|
+
return self.calculate_fee_with_rate(symbol, type, side, amount, price, takerOrMaker, None, params)
|
3655
|
+
|
3639
3656
|
def safe_liquidation(self, liquidation: dict, market: Market = None):
|
3640
3657
|
contracts = self.safe_string(liquidation, 'contracts')
|
3641
3658
|
contractSize = self.safe_string(market, 'contractSize')
|
@@ -3675,6 +3692,21 @@ class Exchange(object):
|
|
3675
3692
|
trade['cost'] = self.parse_number(cost)
|
3676
3693
|
return trade
|
3677
3694
|
|
3695
|
+
def create_ccxt_trade_id(self, timestamp=None, side=None, amount=None, price=None, takerOrMaker=None):
|
3696
|
+
# self approach is being used by multiple exchanges(mexc, woo, coinsbit, dydx, ...)
|
3697
|
+
id = None
|
3698
|
+
if timestamp is not None:
|
3699
|
+
id = self.number_to_string(timestamp)
|
3700
|
+
if side is not None:
|
3701
|
+
id += '-' + side
|
3702
|
+
if amount is not None:
|
3703
|
+
id += '-' + self.number_to_string(amount)
|
3704
|
+
if price is not None:
|
3705
|
+
id += '-' + self.number_to_string(price)
|
3706
|
+
if takerOrMaker is not None:
|
3707
|
+
id += '-' + takerOrMaker
|
3708
|
+
return id
|
3709
|
+
|
3678
3710
|
def parsed_fee_and_fees(self, container: Any):
|
3679
3711
|
fee = self.safe_dict(container, 'fee')
|
3680
3712
|
fees = self.safe_list(container, 'fees')
|
@@ -6429,7 +6461,7 @@ class Exchange(object):
|
|
6429
6461
|
calls = 0
|
6430
6462
|
result = []
|
6431
6463
|
errors = 0
|
6432
|
-
until = self.
|
6464
|
+
until = self.safe_integer_n(params, ['until', 'untill', 'till']) # do not omit it from params here
|
6433
6465
|
maxEntriesPerRequest, params = self.handle_max_entries_per_request_and_params(method, maxEntriesPerRequest, params)
|
6434
6466
|
if (paginationDirection == 'forward'):
|
6435
6467
|
if since is None:
|
@@ -6991,6 +7023,14 @@ class Exchange(object):
|
|
6991
7023
|
self.myTrades = None
|
6992
7024
|
elif topic == 'orders' and (self.orders is not None):
|
6993
7025
|
self.orders = None
|
7026
|
+
elif topic == 'positions' and (self.positions is not None):
|
7027
|
+
self.positions = None
|
7028
|
+
clients = list(self.clients.values())
|
7029
|
+
for i in range(0, len(clients)):
|
7030
|
+
client = clients[i]
|
7031
|
+
futures = self.safe_dict(client, 'futures')
|
7032
|
+
if (futures is not None) and ('fetchPositionsSnapshot' in futures):
|
7033
|
+
del futures['fetchPositionsSnapshot']
|
6994
7034
|
elif topic == 'ticker' and (self.tickers is not None):
|
6995
7035
|
tickerSymbols = list(self.tickers.keys())
|
6996
7036
|
for i in range(0, len(tickerSymbols)):
|
kucoin/ccxt/kucoin.py
CHANGED
@@ -811,7 +811,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
811
811
|
'TLOS': 'tlos', # tlosevm is different
|
812
812
|
'CFX': 'cfx',
|
813
813
|
'ACA': 'aca',
|
814
|
-
'
|
814
|
+
'OPTIMISM': 'optimism',
|
815
815
|
'ONT': 'ont',
|
816
816
|
'GLMR': 'glmr',
|
817
817
|
'CSPR': 'cspr',
|
@@ -931,6 +931,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
931
931
|
'CS': 'cs',
|
932
932
|
'ORAI': 'orai',
|
933
933
|
'BASE': 'base',
|
934
|
+
'TARA': 'tara',
|
934
935
|
# below will be uncommented after consensus
|
935
936
|
# 'BITCOINDIAMON': 'bcd',
|
936
937
|
# 'BITCOINGOLD': 'btg',
|
@@ -1,11 +1,11 @@
|
|
1
1
|
kucoin/__init__.py,sha256=J1NNMLktlkCZKV82j8CFTVES3O3TCVk3so0ROi4E52o,246
|
2
2
|
kucoin/ccxt/__init__.py,sha256=GWGEm4bjn7EwuDiNfqhvOCar1kh4IOKsVgvnGP-cXfE,6048
|
3
|
-
kucoin/ccxt/kucoin.py,sha256=
|
3
|
+
kucoin/ccxt/kucoin.py,sha256=5JXt4spzkgIaSpIyVZ0jNXrY2R8xxHUpau76jCaOswA,232479
|
4
4
|
kucoin/ccxt/abstract/kucoin.py,sha256=kVrVEXiigc36arfbSS8lDUMnG7uFdKgUKHIhVb0Am_8,28626
|
5
5
|
kucoin/ccxt/async_support/__init__.py,sha256=LxqgyF_ElKfy-NUZZbjIjGxsvEc2haq0fb9UJlBBzMI,4781
|
6
|
-
kucoin/ccxt/async_support/kucoin.py,sha256=
|
6
|
+
kucoin/ccxt/async_support/kucoin.py,sha256=R6FQ5LGhNiruAO831oj0UjTTmRYhL96MHivzQ8891pY,233629
|
7
7
|
kucoin/ccxt/async_support/base/__init__.py,sha256=aVYSsFi--b4InRs9zDN_wtCpj8odosAB726JdUHavrk,67
|
8
|
-
kucoin/ccxt/async_support/base/exchange.py,sha256=
|
8
|
+
kucoin/ccxt/async_support/base/exchange.py,sha256=5YrTOaoiX9ws39WT_JWs_g3anZAMiPSc1eXiD56Sh0Q,119773
|
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
|
@@ -15,9 +15,9 @@ kucoin/ccxt/async_support/base/ws/future.py,sha256=hjdQ42zkfju5nar0GpTLJ4zXQBtgB
|
|
15
15
|
kucoin/ccxt/async_support/base/ws/order_book.py,sha256=uBUaIHhzMRykpmo4BCsdJ-t_HozS6VxhEs8x-Kbj-NI,2894
|
16
16
|
kucoin/ccxt/async_support/base/ws/order_book_side.py,sha256=GhnGUt78pJ-AYL_Dq9produGjmBJLCI5FHIRdMz1O-g,6551
|
17
17
|
kucoin/ccxt/base/__init__.py,sha256=eTx1OE3HJjspFUQjGm6LBhaQiMKJnXjkdP-JUXknyQ0,1320
|
18
|
-
kucoin/ccxt/base/decimal_to_precision.py,sha256=
|
18
|
+
kucoin/ccxt/base/decimal_to_precision.py,sha256=XQNziSPUz4UqhIvNx0aDx6-3wSSgZBTsMX57rM7WGPM,7330
|
19
19
|
kucoin/ccxt/base/errors.py,sha256=MvCrL_sAM3de616T6RE0PSxiF2xV6Qqz5b1y1ghidbk,4888
|
20
|
-
kucoin/ccxt/base/exchange.py,sha256=
|
20
|
+
kucoin/ccxt/base/exchange.py,sha256=3LI4McirkCUEz1090jMfedqTtOae-Gqcl94_oeNf23c,333932
|
21
21
|
kucoin/ccxt/base/precise.py,sha256=koce64Yrp6vFbGijJtUt-QQ6XhJgeGTCksZ871FPp_A,8886
|
22
22
|
kucoin/ccxt/base/types.py,sha256=vMQfFDVntED4YHrRJt0Q98YaM7OtGhK-DkbkqXFTYHc,11485
|
23
23
|
kucoin/ccxt/pro/__init__.py,sha256=sw1CfqnHy9D7GwnQT7iENG76AG2vqKo5q61JkZbLybY,4095
|
@@ -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.
|
285
|
-
kucoin_api-0.0.
|
286
|
-
kucoin_api-0.0.
|
284
|
+
kucoin_api-0.0.81.dist-info/METADATA,sha256=YnvES_2YaxHFy6UhVW2O4vCiNbKVnCL8AjeZXhlcoV4,18571
|
285
|
+
kucoin_api-0.0.81.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
286
|
+
kucoin_api-0.0.81.dist-info/RECORD,,
|
File without changes
|