ccxt 4.2.64__py2.py3-none-any.whl → 4.2.65__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/__init__.py +1 -1
- ccxt/abstract/blofin.py +1 -0
- ccxt/abstract/kucoin.py +9 -0
- ccxt/abstract/kucoinfutures.py +9 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +2 -2
- ccxt/async_support/binance.py +26 -4
- ccxt/async_support/bingx.py +11 -4
- ccxt/async_support/bitmex.py +2 -1
- ccxt/async_support/blofin.py +34 -1
- ccxt/async_support/btcmarkets.py +9 -0
- ccxt/async_support/coinbase.py +9 -2
- ccxt/async_support/delta.py +92 -2
- ccxt/async_support/gate.py +1 -1
- ccxt/async_support/kucoin.py +84 -61
- ccxt/async_support/okx.py +1 -1
- ccxt/async_support/woo.py +1 -1
- ccxt/base/exchange.py +14 -3
- ccxt/binance.py +26 -4
- ccxt/bingx.py +11 -4
- ccxt/bitmex.py +2 -1
- ccxt/blofin.py +34 -1
- ccxt/btcmarkets.py +9 -0
- ccxt/coinbase.py +9 -2
- ccxt/delta.py +92 -2
- ccxt/gate.py +1 -1
- ccxt/kucoin.py +84 -61
- ccxt/okx.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/currencycom.py +1 -1
- ccxt/static_dependencies/ethereum/utils/__init__.py +0 -6
- ccxt/static_dependencies/ethereum/utils/curried/__init__.py +0 -4
- ccxt/test/base/test_shared_methods.py +1 -1
- ccxt/woo.py +1 -1
- {ccxt-4.2.64.dist-info → ccxt-4.2.65.dist-info}/METADATA +4 -4
- {ccxt-4.2.64.dist-info → ccxt-4.2.65.dist-info}/RECORD +38 -41
- ccxt/static_dependencies/ethereum/utils/__json/eth_networks.json +0 -1
- ccxt/static_dependencies/ethereum/utils/network.py +0 -88
- ccxt-4.2.64.data/data/ccxt/eth_networks.json +0 -1
- {ccxt-4.2.64.dist-info → ccxt-4.2.65.dist-info}/WHEEL +0 -0
- {ccxt-4.2.64.dist-info → ccxt-4.2.65.dist-info}/top_level.txt +0 -0
ccxt/kucoin.py
CHANGED
@@ -135,6 +135,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
135
135
|
'futuresPrivate': 'https://api-futures.kucoin.com',
|
136
136
|
'futuresPublic': 'https://api-futures.kucoin.com',
|
137
137
|
'webExchange': 'https://kucoin.com/_api',
|
138
|
+
'broker': 'https://api-broker.kucoin.com',
|
138
139
|
},
|
139
140
|
'www': 'https://www.kucoin.com',
|
140
141
|
'doc': [
|
@@ -248,6 +249,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
248
249
|
'project/marketInterestRate': 7.5, # 5PW
|
249
250
|
'redeem/orders': 10, # 10SW
|
250
251
|
'purchase/orders': 10, # 10SW
|
252
|
+
# broker
|
251
253
|
'broker/api/rebase/download': 3,
|
252
254
|
},
|
253
255
|
'post': {
|
@@ -394,6 +396,23 @@ class kucoin(Exchange, ImplicitAPI):
|
|
394
396
|
'currency/currency/chain-info': 1, # self is temporary from webApi
|
395
397
|
},
|
396
398
|
},
|
399
|
+
'broker': {
|
400
|
+
'get': {
|
401
|
+
'broker/nd/info': 2,
|
402
|
+
'broker/nd/account': 2,
|
403
|
+
'broker/nd/account/apikey': 2,
|
404
|
+
'broker/nd/rebase/download': 3,
|
405
|
+
},
|
406
|
+
'post': {
|
407
|
+
'broker/nd/transfer': 1,
|
408
|
+
'broker/nd/account': 3,
|
409
|
+
'broker/nd/account/apikey': 3,
|
410
|
+
'broker/nd/account/update-apikey': 3,
|
411
|
+
},
|
412
|
+
'delete': {
|
413
|
+
'broker/nd/account/apikey': 3,
|
414
|
+
},
|
415
|
+
},
|
397
416
|
},
|
398
417
|
'timeframes': {
|
399
418
|
'1m': '1min',
|
@@ -907,7 +926,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
907
926
|
# }
|
908
927
|
# }
|
909
928
|
#
|
910
|
-
data = self.
|
929
|
+
data = self.safe_dict(response, 'data', {})
|
911
930
|
status = self.safe_string(data, 'status')
|
912
931
|
return {
|
913
932
|
'status': 'ok' if (status == 'open') else 'maintenance',
|
@@ -951,8 +970,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
951
970
|
# ]
|
952
971
|
# }
|
953
972
|
#
|
954
|
-
data = self.
|
955
|
-
options = self.
|
973
|
+
data = self.safe_list(response, 'data')
|
974
|
+
options = self.safe_dict(self.options, 'fetchMarkets', {})
|
956
975
|
fetchTickersFees = self.safe_bool(options, 'fetchTickersFees', True)
|
957
976
|
tickersResponse = {}
|
958
977
|
if fetchTickersFees:
|
@@ -985,8 +1004,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
985
1004
|
# }
|
986
1005
|
# }
|
987
1006
|
#
|
988
|
-
tickersData = self.
|
989
|
-
tickers = self.
|
1007
|
+
tickersData = self.safe_dict(tickersResponse, 'data', {})
|
1008
|
+
tickers = self.safe_list(tickersData, 'ticker', [])
|
990
1009
|
tickersByMarketId = self.index_by(tickers, 'symbol')
|
991
1010
|
result = []
|
992
1011
|
for i in range(0, len(data)):
|
@@ -996,7 +1015,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
996
1015
|
base = self.safe_currency_code(baseId)
|
997
1016
|
quote = self.safe_currency_code(quoteId)
|
998
1017
|
# quoteIncrement = self.safe_number(market, 'quoteIncrement')
|
999
|
-
ticker = self.
|
1018
|
+
ticker = self.safe_dict(tickersByMarketId, id, {})
|
1000
1019
|
makerFeeRate = self.safe_string(ticker, 'makerFeeRate')
|
1001
1020
|
takerFeeRate = self.safe_string(ticker, 'takerFeeRate')
|
1002
1021
|
makerCoefficient = self.safe_string(ticker, 'makerCoefficient')
|
@@ -1012,11 +1031,11 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1012
1031
|
'settleId': None,
|
1013
1032
|
'type': 'spot',
|
1014
1033
|
'spot': True,
|
1015
|
-
'margin': self.
|
1034
|
+
'margin': self.safe_bool(market, 'isMarginEnabled'),
|
1016
1035
|
'swap': False,
|
1017
1036
|
'future': False,
|
1018
1037
|
'option': False,
|
1019
|
-
'active': self.
|
1038
|
+
'active': self.safe_bool(market, 'enableTrading'),
|
1020
1039
|
'contract': False,
|
1021
1040
|
'linear': None,
|
1022
1041
|
'inverse': None,
|
@@ -1143,7 +1162,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1143
1162
|
isWithdrawEnabled = None
|
1144
1163
|
isDepositEnabled = None
|
1145
1164
|
networks = {}
|
1146
|
-
chains = self.
|
1165
|
+
chains = self.safe_list(entry, 'chains', [])
|
1147
1166
|
extraChainsData = self.index_by(self.safe_value(additionalDataGrouped, id, []), 'chain')
|
1148
1167
|
rawPrecision = self.safe_string(entry, 'precision')
|
1149
1168
|
precision = self.parse_number(self.parse_precision(rawPrecision))
|
@@ -1166,7 +1185,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1166
1185
|
isDepositEnabled = chainDepositEnabled
|
1167
1186
|
else:
|
1168
1187
|
isDepositEnabled = isDepositEnabled or chainDepositEnabled
|
1169
|
-
chainExtraData = self.
|
1188
|
+
chainExtraData = self.safe_dict(extraChainsData, chainId, {})
|
1170
1189
|
networks[networkCode] = {
|
1171
1190
|
'info': chain,
|
1172
1191
|
'id': chainId,
|
@@ -1237,7 +1256,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1237
1256
|
# ]
|
1238
1257
|
# }
|
1239
1258
|
#
|
1240
|
-
data = self.
|
1259
|
+
data = self.safe_list(response, 'data', [])
|
1241
1260
|
result = []
|
1242
1261
|
for i in range(0, len(data)):
|
1243
1262
|
account = data[i]
|
@@ -1318,7 +1337,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1318
1337
|
# }
|
1319
1338
|
# }
|
1320
1339
|
#
|
1321
|
-
data = self.
|
1340
|
+
data = self.safe_dict(response, 'data')
|
1322
1341
|
return self.parse_deposit_withdraw_fee(data, currency)
|
1323
1342
|
|
1324
1343
|
def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
|
@@ -1349,7 +1368,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1349
1368
|
},
|
1350
1369
|
'networks': {},
|
1351
1370
|
}
|
1352
|
-
isWithdrawEnabled = self.
|
1371
|
+
isWithdrawEnabled = self.safe_bool(fee, 'isWithdrawEnabled')
|
1353
1372
|
if isWithdrawEnabled:
|
1354
1373
|
result['withdraw']['fee'] = self.safe_number_2(fee, 'withdrawalMinFee', 'withdrawMinFee')
|
1355
1374
|
result['withdraw']['percentage'] = False
|
@@ -1374,7 +1393,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1374
1393
|
#
|
1375
1394
|
defaultType = self.safe_string_2(self.options, methodName, 'defaultType', 'trade')
|
1376
1395
|
requestedType = self.safe_string(params, 'type', defaultType)
|
1377
|
-
accountsByType = self.
|
1396
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType')
|
1378
1397
|
type = self.safe_string(accountsByType, requestedType)
|
1379
1398
|
if type is None:
|
1380
1399
|
keys = list(accountsByType.keys())
|
@@ -1511,8 +1530,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1511
1530
|
# }
|
1512
1531
|
# }
|
1513
1532
|
#
|
1514
|
-
data = self.
|
1515
|
-
tickers = self.
|
1533
|
+
data = self.safe_dict(response, 'data', {})
|
1534
|
+
tickers = self.safe_list(data, 'ticker', [])
|
1516
1535
|
time = self.safe_integer(data, 'time')
|
1517
1536
|
result = {}
|
1518
1537
|
for i in range(0, len(tickers)):
|
@@ -1632,7 +1651,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1632
1651
|
# ]
|
1633
1652
|
# }
|
1634
1653
|
#
|
1635
|
-
data = self.
|
1654
|
+
data = self.safe_list(response, 'data', [])
|
1636
1655
|
return self.parse_ohlcvs(data, market, timeframe, since, limit)
|
1637
1656
|
|
1638
1657
|
def create_deposit_address(self, code: str, params={}):
|
@@ -1657,7 +1676,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1657
1676
|
# {"code":"260000","msg":"Deposit address already exists."}
|
1658
1677
|
# BCH {"code":"200000","data":{"address":"bitcoincash:qza3m4nj9rx7l9r0cdadfqxts6f92shvhvr5ls4q7z","memo":""}}
|
1659
1678
|
# BTC {"code":"200000","data":{"address":"36SjucKqQpQSvsak9A7h6qzFjrVXpRNZhE","memo":""}}
|
1660
|
-
data = self.
|
1679
|
+
data = self.safe_dict(response, 'data', {})
|
1661
1680
|
return self.parse_deposit_address(data, currency)
|
1662
1681
|
|
1663
1682
|
def fetch_deposit_address(self, code: str, params={}):
|
@@ -1743,7 +1762,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1743
1762
|
# }
|
1744
1763
|
#
|
1745
1764
|
self.options['versions']['private']['GET']['deposit-addresses'] = version
|
1746
|
-
chains = self.
|
1765
|
+
chains = self.safe_list(response, 'data', [])
|
1747
1766
|
parsed = self.parse_deposit_addresses(chains, [currency['code']], False, {
|
1748
1767
|
'currency': currency['id'],
|
1749
1768
|
})
|
@@ -1808,7 +1827,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1808
1827
|
# ]
|
1809
1828
|
# }
|
1810
1829
|
#
|
1811
|
-
data = self.
|
1830
|
+
data = self.safe_dict(response, 'data', {})
|
1812
1831
|
timestamp = self.safe_integer(data, 'time')
|
1813
1832
|
orderbook = self.parse_order_book(data, market['symbol'], timestamp, 'bids', 'asks', level - 2, level - 1)
|
1814
1833
|
orderbook['nonce'] = self.safe_integer(data, 'sequence')
|
@@ -1900,7 +1919,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1900
1919
|
# }
|
1901
1920
|
# }
|
1902
1921
|
#
|
1903
|
-
data = self.
|
1922
|
+
data = self.safe_dict(response, 'data', {})
|
1904
1923
|
return self.parse_order(data, market)
|
1905
1924
|
|
1906
1925
|
def create_market_order_with_cost(self, symbol: str, side: OrderSide, cost: float, params={}):
|
@@ -2013,8 +2032,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2013
2032
|
# },
|
2014
2033
|
# }
|
2015
2034
|
#
|
2016
|
-
data = self.
|
2017
|
-
data = self.
|
2035
|
+
data = self.safe_dict(response, 'data', {})
|
2036
|
+
data = self.safe_list(data, 'data', [])
|
2018
2037
|
return self.parse_orders(data)
|
2019
2038
|
|
2020
2039
|
def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: float = None, params={}):
|
@@ -2111,7 +2130,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2111
2130
|
# }
|
2112
2131
|
# }
|
2113
2132
|
#
|
2114
|
-
data = self.
|
2133
|
+
data = self.safe_dict(response, 'data', {})
|
2115
2134
|
return self.parse_order(data, market)
|
2116
2135
|
|
2117
2136
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
@@ -2133,7 +2152,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2133
2152
|
self.load_markets()
|
2134
2153
|
request = {}
|
2135
2154
|
clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId')
|
2136
|
-
stop = self.
|
2155
|
+
stop = self.safe_bool_2(params, 'stop', 'trigger', False)
|
2137
2156
|
hf = self.safe_bool(params, 'hf', False)
|
2138
2157
|
if hf:
|
2139
2158
|
if symbol is None:
|
@@ -2300,7 +2319,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2300
2319
|
# ]
|
2301
2320
|
# }
|
2302
2321
|
# }
|
2303
|
-
responseData = self.
|
2322
|
+
responseData = self.safe_dict(response, 'data', {})
|
2304
2323
|
orders = self.safe_value(responseData, 'items', responseData)
|
2305
2324
|
return self.parse_orders(orders, market, since, limit)
|
2306
2325
|
|
@@ -2415,7 +2434,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2415
2434
|
response = self.privateGetHfOrdersOrderId(self.extend(request, params))
|
2416
2435
|
else:
|
2417
2436
|
response = self.privateGetOrdersOrderId(self.extend(request, params))
|
2418
|
-
responseData = self.
|
2437
|
+
responseData = self.safe_dict(response, 'data', {})
|
2419
2438
|
if isinstance(responseData, list):
|
2420
2439
|
responseData = self.safe_value(responseData, 0)
|
2421
2440
|
return self.parse_order(responseData, market)
|
@@ -2549,7 +2568,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2549
2568
|
responseStop = self.safe_string(order, 'stop')
|
2550
2569
|
stop = responseStop is not None
|
2551
2570
|
stopTriggered = self.safe_bool(order, 'stopTriggered', False)
|
2552
|
-
isActive = self.
|
2571
|
+
isActive = self.safe_bool_2(order, 'isActive', 'active')
|
2553
2572
|
responseStatus = self.safe_string(order, 'status')
|
2554
2573
|
status = None
|
2555
2574
|
if isActive is not None:
|
@@ -2574,7 +2593,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2574
2593
|
'symbol': self.safe_symbol(marketId, market, '-'),
|
2575
2594
|
'type': self.safe_string(order, 'type'),
|
2576
2595
|
'timeInForce': self.safe_string(order, 'timeInForce'),
|
2577
|
-
'postOnly': self.
|
2596
|
+
'postOnly': self.safe_bool(order, 'postOnly'),
|
2578
2597
|
'side': self.safe_string(order, 'side'),
|
2579
2598
|
'amount': self.safe_string(order, 'size'),
|
2580
2599
|
'price': self.safe_string(order, 'price'), # price is zero for market order, omitZero is called in safeOrder2
|
@@ -2701,12 +2720,12 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2701
2720
|
# ]
|
2702
2721
|
# }
|
2703
2722
|
#
|
2704
|
-
data = self.
|
2723
|
+
data = self.safe_dict(response, 'data', {})
|
2705
2724
|
trades = None
|
2706
2725
|
if parseResponseData:
|
2707
2726
|
trades = data
|
2708
2727
|
else:
|
2709
|
-
trades = self.
|
2728
|
+
trades = self.safe_list(data, 'items', [])
|
2710
2729
|
return self.parse_trades(trades, market, since, limit)
|
2711
2730
|
|
2712
2731
|
def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
@@ -2746,7 +2765,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2746
2765
|
# ]
|
2747
2766
|
# }
|
2748
2767
|
#
|
2749
|
-
trades = self.
|
2768
|
+
trades = self.safe_list(response, 'data', [])
|
2750
2769
|
return self.parse_trades(trades, market, since, limit)
|
2751
2770
|
|
2752
2771
|
def parse_trade(self, trade, market: Market = None) -> Trade:
|
@@ -2900,8 +2919,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2900
2919
|
# ]
|
2901
2920
|
# }
|
2902
2921
|
#
|
2903
|
-
data = self.
|
2904
|
-
first = self.
|
2922
|
+
data = self.safe_list(response, 'data', [])
|
2923
|
+
first = self.safe_dict(data, 0)
|
2905
2924
|
marketId = self.safe_string(first, 'symbol')
|
2906
2925
|
return {
|
2907
2926
|
'info': response,
|
@@ -2957,7 +2976,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2957
2976
|
# }
|
2958
2977
|
# }
|
2959
2978
|
#
|
2960
|
-
data = self.
|
2979
|
+
data = self.safe_dict(response, 'data', {})
|
2961
2980
|
return self.parse_transaction(data, currency)
|
2962
2981
|
|
2963
2982
|
def parse_transaction_status(self, status):
|
@@ -3048,7 +3067,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3048
3067
|
timestamp = timestamp * 1000
|
3049
3068
|
if updated is not None:
|
3050
3069
|
updated = updated * 1000
|
3051
|
-
internal = self.
|
3070
|
+
internal = self.safe_bool(transaction, 'isInner')
|
3052
3071
|
tag = self.safe_string(transaction, 'memo')
|
3053
3072
|
return {
|
3054
3073
|
'info': transaction,
|
@@ -3255,7 +3274,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3255
3274
|
currency = self.currency(code)
|
3256
3275
|
defaultType = self.safe_string_2(self.options, 'fetchBalance', 'defaultType', 'spot')
|
3257
3276
|
requestedType = self.safe_string(params, 'type', defaultType)
|
3258
|
-
accountsByType = self.
|
3277
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType')
|
3259
3278
|
type = self.safe_string(accountsByType, requestedType, requestedType)
|
3260
3279
|
params = self.omit(params, 'type')
|
3261
3280
|
isHf = self.safe_bool(params, 'hf', False)
|
@@ -3331,7 +3350,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3331
3350
|
# }
|
3332
3351
|
# }
|
3333
3352
|
#
|
3334
|
-
data = self.
|
3353
|
+
data = self.safe_list(response, 'data', [])
|
3335
3354
|
result = {
|
3336
3355
|
'info': response,
|
3337
3356
|
'timestamp': None,
|
@@ -3343,8 +3362,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3343
3362
|
entry = assets[i]
|
3344
3363
|
marketId = self.safe_string(entry, 'symbol')
|
3345
3364
|
symbol = self.safe_symbol(marketId, None, '_')
|
3346
|
-
base = self.
|
3347
|
-
quote = self.
|
3365
|
+
base = self.safe_dict(entry, 'baseAsset', {})
|
3366
|
+
quote = self.safe_dict(entry, 'quoteAsset', {})
|
3348
3367
|
baseCode = self.safe_currency_code(self.safe_string(base, 'currency'))
|
3349
3368
|
quoteCode = self.safe_currency_code(self.safe_string(quote, 'currency'))
|
3350
3369
|
subResult = {}
|
@@ -3352,7 +3371,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3352
3371
|
subResult[quoteCode] = self.parse_balance_helper(quote)
|
3353
3372
|
result[symbol] = self.safe_balance(subResult)
|
3354
3373
|
elif cross:
|
3355
|
-
accounts = self.
|
3374
|
+
accounts = self.safe_list(data, 'accounts', [])
|
3356
3375
|
for i in range(0, len(accounts)):
|
3357
3376
|
balance = accounts[i]
|
3358
3377
|
currencyId = self.safe_string(balance, 'currency')
|
@@ -3428,7 +3447,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3428
3447
|
# }
|
3429
3448
|
# }
|
3430
3449
|
#
|
3431
|
-
data = self.
|
3450
|
+
data = self.safe_dict(response, 'data')
|
3432
3451
|
return self.parse_transfer(data, currency)
|
3433
3452
|
else:
|
3434
3453
|
request = {
|
@@ -3455,7 +3474,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3455
3474
|
# }
|
3456
3475
|
# }
|
3457
3476
|
#
|
3458
|
-
data = self.
|
3477
|
+
data = self.safe_dict(response, 'data')
|
3459
3478
|
return self.parse_transfer(data, currency)
|
3460
3479
|
|
3461
3480
|
def parse_transfer(self, transfer, currency: Currency = None):
|
@@ -3498,7 +3517,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3498
3517
|
rawStatus = self.safe_string(transfer, 'status')
|
3499
3518
|
accountFromRaw = self.safe_string_lower(transfer, 'payAccountType')
|
3500
3519
|
accountToRaw = self.safe_string_lower(transfer, 'recAccountType')
|
3501
|
-
accountsByType = self.
|
3520
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType')
|
3502
3521
|
accountFrom = self.safe_string(accountsByType, accountFromRaw, accountFromRaw)
|
3503
3522
|
accountTo = self.safe_string(accountsByType, accountToRaw, accountToRaw)
|
3504
3523
|
return {
|
@@ -3660,7 +3679,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3660
3679
|
self.load_accounts()
|
3661
3680
|
paginate = False
|
3662
3681
|
paginate, params = self.handle_option_and_params(params, 'fetchLedger', 'paginate')
|
3663
|
-
isHf = self.
|
3682
|
+
isHf = self.safe_bool(params, 'hf')
|
3664
3683
|
params = self.omit(params, 'hf')
|
3665
3684
|
if paginate:
|
3666
3685
|
return self.fetch_paginated_call_dynamic('fetchLedger', code, since, limit, params)
|
@@ -3734,9 +3753,9 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3734
3753
|
return self.parse_ledger(items, currency, since, limit)
|
3735
3754
|
|
3736
3755
|
def calculate_rate_limiter_cost(self, api, method, path, params, config={}):
|
3737
|
-
versions = self.
|
3738
|
-
apiVersions = self.
|
3739
|
-
methodVersions = self.
|
3756
|
+
versions = self.safe_dict(self.options, 'versions', {})
|
3757
|
+
apiVersions = self.safe_dict(versions, api, {})
|
3758
|
+
methodVersions = self.safe_dict(apiVersions, method, {})
|
3740
3759
|
defaultVersion = self.safe_string(methodVersions, path, self.options['version'])
|
3741
3760
|
version = self.safe_string(params, 'version', defaultVersion)
|
3742
3761
|
if version == 'v3' and ('v3' in config):
|
@@ -3870,8 +3889,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3870
3889
|
# }
|
3871
3890
|
# }
|
3872
3891
|
#
|
3873
|
-
data = self.
|
3874
|
-
assets = self.
|
3892
|
+
data = self.safe_dict(response, 'data', {})
|
3893
|
+
assets = self.safe_list(data, 'assets', []) if (marginMode == 'isolated') else self.safe_list(data, 'accounts', [])
|
3875
3894
|
return self.parse_borrow_interests(assets, None)
|
3876
3895
|
|
3877
3896
|
def parse_borrow_interest(self, info, market: Market = None):
|
@@ -3924,7 +3943,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3924
3943
|
market = self.safe_market(marketId, market)
|
3925
3944
|
symbol = self.safe_string(market, 'symbol')
|
3926
3945
|
timestamp = self.safe_integer(info, 'createdAt')
|
3927
|
-
isolatedBase = self.
|
3946
|
+
isolatedBase = self.safe_dict(info, 'baseAsset', {})
|
3928
3947
|
amountBorrowed = None
|
3929
3948
|
interest = None
|
3930
3949
|
currencyId = None
|
@@ -3978,7 +3997,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3978
3997
|
# }
|
3979
3998
|
# }
|
3980
3999
|
#
|
3981
|
-
data = self.
|
4000
|
+
data = self.safe_dict(response, 'data', {})
|
3982
4001
|
return self.parse_margin_loan(data, currency)
|
3983
4002
|
|
3984
4003
|
def borrow_isolated_margin(self, symbol: str, code: str, amount: float, params={}):
|
@@ -4015,7 +4034,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4015
4034
|
# }
|
4016
4035
|
# }
|
4017
4036
|
#
|
4018
|
-
data = self.
|
4037
|
+
data = self.safe_dict(response, 'data', {})
|
4019
4038
|
return self.parse_margin_loan(data, currency)
|
4020
4039
|
|
4021
4040
|
def repay_cross_margin(self, code: str, amount, params={}):
|
@@ -4046,7 +4065,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4046
4065
|
# }
|
4047
4066
|
# }
|
4048
4067
|
#
|
4049
|
-
data = self.
|
4068
|
+
data = self.safe_dict(response, 'data', {})
|
4050
4069
|
return self.parse_margin_loan(data, currency)
|
4051
4070
|
|
4052
4071
|
def repay_isolated_margin(self, symbol: str, code: str, amount, params={}):
|
@@ -4081,7 +4100,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4081
4100
|
# }
|
4082
4101
|
# }
|
4083
4102
|
#
|
4084
|
-
data = self.
|
4103
|
+
data = self.safe_dict(response, 'data', {})
|
4085
4104
|
return self.parse_margin_loan(data, currency)
|
4086
4105
|
|
4087
4106
|
def parse_margin_loan(self, info, currency: Currency = None):
|
@@ -4131,7 +4150,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4131
4150
|
# },
|
4132
4151
|
# ]
|
4133
4152
|
#
|
4134
|
-
data = self.
|
4153
|
+
data = self.safe_list(response, 'data', [])
|
4135
4154
|
return self.parse_deposit_withdraw_fees(data, codes, 'currency')
|
4136
4155
|
|
4137
4156
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
@@ -4140,9 +4159,9 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4140
4159
|
# ↑ ↑
|
4141
4160
|
# ↑ ↑
|
4142
4161
|
#
|
4143
|
-
versions = self.
|
4144
|
-
apiVersions = self.
|
4145
|
-
methodVersions = self.
|
4162
|
+
versions = self.safe_dict(self.options, 'versions', {})
|
4163
|
+
apiVersions = self.safe_dict(versions, api, {})
|
4164
|
+
methodVersions = self.safe_dict(apiVersions, method, {})
|
4146
4165
|
defaultVersion = self.safe_string(methodVersions, path, self.options['version'])
|
4147
4166
|
version = self.safe_string(params, 'version', defaultVersion)
|
4148
4167
|
params = self.omit(params, 'version')
|
@@ -4163,7 +4182,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4163
4182
|
url = url + endpoint
|
4164
4183
|
isFuturePrivate = (api == 'futuresPrivate')
|
4165
4184
|
isPrivate = (api == 'private')
|
4166
|
-
|
4185
|
+
isBroker = (api == 'private')
|
4186
|
+
if isPrivate or isFuturePrivate or isBroker:
|
4167
4187
|
self.check_required_credentials()
|
4168
4188
|
timestamp = str(self.nonce())
|
4169
4189
|
headers = self.extend({
|
@@ -4180,7 +4200,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4180
4200
|
payload = timestamp + method + endpoint + endpart
|
4181
4201
|
signature = self.hmac(self.encode(payload), self.encode(self.secret), hashlib.sha256, 'base64')
|
4182
4202
|
headers['KC-API-SIGN'] = signature
|
4183
|
-
partner = self.
|
4203
|
+
partner = self.safe_dict(self.options, 'partner', {})
|
4184
4204
|
partner = self.safe_value(partner, 'future', partner) if isFuturePrivate else self.safe_value(partner, 'spot', partner)
|
4185
4205
|
partnerId = self.safe_string(partner, 'id')
|
4186
4206
|
partnerSecret = self.safe_string_2(partner, 'secret', 'key')
|
@@ -4189,6 +4209,9 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4189
4209
|
partnerSignature = self.hmac(self.encode(partnerPayload), self.encode(partnerSecret), hashlib.sha256, 'base64')
|
4190
4210
|
headers['KC-API-PARTNER-SIGN'] = partnerSignature
|
4191
4211
|
headers['KC-API-PARTNER'] = partnerId
|
4212
|
+
if isBroker:
|
4213
|
+
brokerName = self.safe_string(partner, 'name')
|
4214
|
+
headers['KC-BROKER-NAME'] = brokerName
|
4192
4215
|
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
4193
4216
|
|
4194
4217
|
def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
|
ccxt/okx.py
CHANGED
@@ -6496,7 +6496,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6496
6496
|
'info': interest,
|
6497
6497
|
}, market)
|
6498
6498
|
|
6499
|
-
def set_sandbox_mode(self, enable):
|
6499
|
+
def set_sandbox_mode(self, enable: bool):
|
6500
6500
|
super(okx, self).set_sandbox_mode(enable)
|
6501
6501
|
self.options['sandboxMode'] = enable
|
6502
6502
|
if enable:
|
ccxt/pro/__init__.py
CHANGED
ccxt/pro/currencycom.py
CHANGED
@@ -97,12 +97,6 @@ from .logging import (
|
|
97
97
|
from .module_loading import (
|
98
98
|
import_string,
|
99
99
|
)
|
100
|
-
from .network import (
|
101
|
-
Network,
|
102
|
-
name_from_chain_id,
|
103
|
-
network_from_chain_id,
|
104
|
-
short_name_from_chain_id,
|
105
|
-
)
|
106
100
|
from .numeric import (
|
107
101
|
clamp,
|
108
102
|
)
|
@@ -17,7 +17,6 @@ from .. import (
|
|
17
17
|
HasExtendedDebugLoggerMeta,
|
18
18
|
HasLogger,
|
19
19
|
HasLoggerMeta,
|
20
|
-
Network,
|
21
20
|
ValidationError,
|
22
21
|
add_0x_prefix,
|
23
22
|
apply_formatter_at_index,
|
@@ -75,13 +74,10 @@ from .. import (
|
|
75
74
|
is_text,
|
76
75
|
is_tuple,
|
77
76
|
# keccak,
|
78
|
-
name_from_chain_id,
|
79
|
-
network_from_chain_id,
|
80
77
|
remove_0x_prefix,
|
81
78
|
replace_exceptions,
|
82
79
|
reversed_return,
|
83
80
|
setup_DEBUG2_logging,
|
84
|
-
short_name_from_chain_id,
|
85
81
|
sort_return,
|
86
82
|
text_if_str as non_curried_text_if_str,
|
87
83
|
to_bytes,
|
@@ -117,7 +117,7 @@ def assert_timestamp(exchange, skipped_properties, method, entry, now_to_check=N
|
|
117
117
|
assert isinstance(ts, numbers.Real), 'timestamp is not numeric' + log_text
|
118
118
|
assert isinstance(ts, int), 'timestamp should be an integer' + log_text
|
119
119
|
min_ts = 1230940800000 # 03 Jan 2009 - first block
|
120
|
-
max_ts = 2147483648000 #
|
120
|
+
max_ts = 2147483648000 # 19 Jan 2038 - max int
|
121
121
|
assert ts > min_ts, 'timestamp is impossible to be before ' + str(min_ts) + ' (03.01.2009)' + log_text # 03 Jan 2009 - first block
|
122
122
|
assert ts < max_ts, 'timestamp more than ' + str(max_ts) + ' (19.01.2038)' + log_text # 19 Jan 2038 - int32 overflows # 7258118400000 -> Jan 1 2200
|
123
123
|
if now_to_check is not None:
|
ccxt/woo.py
CHANGED
@@ -2732,6 +2732,6 @@ class woo(Exchange, ImplicitAPI):
|
|
2732
2732
|
# if it was not returned according to above options, then return the first network of currency
|
2733
2733
|
return self.safe_value(networkKeys, 0)
|
2734
2734
|
|
2735
|
-
def set_sandbox_mode(self, enable):
|
2735
|
+
def set_sandbox_mode(self, enable: bool):
|
2736
2736
|
super(woo, self).set_sandbox_mode(enable)
|
2737
2737
|
self.options['sandboxMode'] = enable
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ccxt
|
3
|
-
Version: 4.2.
|
3
|
+
Version: 4.2.65
|
4
4
|
Summary: A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges
|
5
5
|
Home-page: https://ccxt.com
|
6
6
|
Author: Igor Kroitor
|
@@ -259,13 +259,13 @@ console.log(version, Object.keys(exchanges));
|
|
259
259
|
|
260
260
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
261
261
|
|
262
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
263
|
-
* unpkg: https://unpkg.com/ccxt@4.2.
|
262
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.65/dist/ccxt.browser.js
|
263
|
+
* unpkg: https://unpkg.com/ccxt@4.2.65/dist/ccxt.browser.js
|
264
264
|
|
265
265
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
266
266
|
|
267
267
|
```HTML
|
268
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
268
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.65/dist/ccxt.browser.js"></script>
|
269
269
|
```
|
270
270
|
|
271
271
|
Creates a global `ccxt` object:
|