ccxt 4.2.63__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/krakenfutures.py +1 -0
- ccxt/abstract/kucoin.py +10 -0
- ccxt/abstract/kucoinfutures.py +10 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +2 -2
- ccxt/async_support/binance.py +32 -13
- ccxt/async_support/bingx.py +56 -49
- ccxt/async_support/bitget.py +66 -2
- ccxt/async_support/bitmex.py +2 -1
- ccxt/async_support/blofin.py +45 -12
- ccxt/async_support/btcmarkets.py +9 -0
- ccxt/async_support/bybit.py +90 -6
- ccxt/async_support/coinbase.py +9 -2
- ccxt/async_support/delta.py +92 -2
- ccxt/async_support/gate.py +1 -1
- ccxt/async_support/gemini.py +9 -5
- ccxt/async_support/hitbtc.py +1 -1
- ccxt/async_support/krakenfutures.py +1 -0
- ccxt/async_support/kucoin.py +85 -61
- ccxt/async_support/okx.py +1 -1
- ccxt/async_support/woo.py +1 -1
- ccxt/async_support/yobit.py +15 -15
- ccxt/base/exchange.py +14 -3
- ccxt/binance.py +32 -13
- ccxt/bingx.py +56 -49
- ccxt/bitget.py +66 -2
- ccxt/bitmex.py +2 -1
- ccxt/blofin.py +45 -12
- ccxt/btcmarkets.py +9 -0
- ccxt/bybit.py +90 -6
- ccxt/coinbase.py +9 -2
- ccxt/delta.py +92 -2
- ccxt/gate.py +1 -1
- ccxt/gemini.py +9 -5
- ccxt/hitbtc.py +1 -1
- ccxt/krakenfutures.py +1 -0
- ccxt/kucoin.py +85 -61
- ccxt/okx.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitget.py +4 -3
- ccxt/pro/coinex.py +4 -4
- ccxt/pro/currencycom.py +1 -1
- ccxt/pro/lbank.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/test/test_async.py +13 -1
- ccxt/test/test_sync.py +13 -1
- ccxt/woo.py +1 -1
- ccxt/yobit.py +15 -15
- {ccxt-4.2.63.dist-info → ccxt-4.2.65.dist-info}/METADATA +4 -4
- {ccxt-4.2.63.dist-info → ccxt-4.2.65.dist-info}/RECORD +56 -59
- ccxt/static_dependencies/ethereum/utils/__json/eth_networks.json +0 -1
- ccxt/static_dependencies/ethereum/utils/network.py +0 -88
- ccxt-4.2.63.data/data/ccxt/eth_networks.json +0 -1
- {ccxt-4.2.63.dist-info → ccxt-4.2.65.dist-info}/WHEEL +0 -0
- {ccxt-4.2.63.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,8 @@ 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
|
253
|
+
'broker/api/rebase/download': 3,
|
251
254
|
},
|
252
255
|
'post': {
|
253
256
|
# account
|
@@ -393,6 +396,23 @@ class kucoin(Exchange, ImplicitAPI):
|
|
393
396
|
'currency/currency/chain-info': 1, # self is temporary from webApi
|
394
397
|
},
|
395
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
|
+
},
|
396
416
|
},
|
397
417
|
'timeframes': {
|
398
418
|
'1m': '1min',
|
@@ -906,7 +926,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
906
926
|
# }
|
907
927
|
# }
|
908
928
|
#
|
909
|
-
data = self.
|
929
|
+
data = self.safe_dict(response, 'data', {})
|
910
930
|
status = self.safe_string(data, 'status')
|
911
931
|
return {
|
912
932
|
'status': 'ok' if (status == 'open') else 'maintenance',
|
@@ -950,8 +970,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
950
970
|
# ]
|
951
971
|
# }
|
952
972
|
#
|
953
|
-
data = self.
|
954
|
-
options = self.
|
973
|
+
data = self.safe_list(response, 'data')
|
974
|
+
options = self.safe_dict(self.options, 'fetchMarkets', {})
|
955
975
|
fetchTickersFees = self.safe_bool(options, 'fetchTickersFees', True)
|
956
976
|
tickersResponse = {}
|
957
977
|
if fetchTickersFees:
|
@@ -984,8 +1004,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
984
1004
|
# }
|
985
1005
|
# }
|
986
1006
|
#
|
987
|
-
tickersData = self.
|
988
|
-
tickers = self.
|
1007
|
+
tickersData = self.safe_dict(tickersResponse, 'data', {})
|
1008
|
+
tickers = self.safe_list(tickersData, 'ticker', [])
|
989
1009
|
tickersByMarketId = self.index_by(tickers, 'symbol')
|
990
1010
|
result = []
|
991
1011
|
for i in range(0, len(data)):
|
@@ -995,7 +1015,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
995
1015
|
base = self.safe_currency_code(baseId)
|
996
1016
|
quote = self.safe_currency_code(quoteId)
|
997
1017
|
# quoteIncrement = self.safe_number(market, 'quoteIncrement')
|
998
|
-
ticker = self.
|
1018
|
+
ticker = self.safe_dict(tickersByMarketId, id, {})
|
999
1019
|
makerFeeRate = self.safe_string(ticker, 'makerFeeRate')
|
1000
1020
|
takerFeeRate = self.safe_string(ticker, 'takerFeeRate')
|
1001
1021
|
makerCoefficient = self.safe_string(ticker, 'makerCoefficient')
|
@@ -1011,11 +1031,11 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1011
1031
|
'settleId': None,
|
1012
1032
|
'type': 'spot',
|
1013
1033
|
'spot': True,
|
1014
|
-
'margin': self.
|
1034
|
+
'margin': self.safe_bool(market, 'isMarginEnabled'),
|
1015
1035
|
'swap': False,
|
1016
1036
|
'future': False,
|
1017
1037
|
'option': False,
|
1018
|
-
'active': self.
|
1038
|
+
'active': self.safe_bool(market, 'enableTrading'),
|
1019
1039
|
'contract': False,
|
1020
1040
|
'linear': None,
|
1021
1041
|
'inverse': None,
|
@@ -1142,7 +1162,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1142
1162
|
isWithdrawEnabled = None
|
1143
1163
|
isDepositEnabled = None
|
1144
1164
|
networks = {}
|
1145
|
-
chains = self.
|
1165
|
+
chains = self.safe_list(entry, 'chains', [])
|
1146
1166
|
extraChainsData = self.index_by(self.safe_value(additionalDataGrouped, id, []), 'chain')
|
1147
1167
|
rawPrecision = self.safe_string(entry, 'precision')
|
1148
1168
|
precision = self.parse_number(self.parse_precision(rawPrecision))
|
@@ -1165,7 +1185,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1165
1185
|
isDepositEnabled = chainDepositEnabled
|
1166
1186
|
else:
|
1167
1187
|
isDepositEnabled = isDepositEnabled or chainDepositEnabled
|
1168
|
-
chainExtraData = self.
|
1188
|
+
chainExtraData = self.safe_dict(extraChainsData, chainId, {})
|
1169
1189
|
networks[networkCode] = {
|
1170
1190
|
'info': chain,
|
1171
1191
|
'id': chainId,
|
@@ -1236,7 +1256,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1236
1256
|
# ]
|
1237
1257
|
# }
|
1238
1258
|
#
|
1239
|
-
data = self.
|
1259
|
+
data = self.safe_list(response, 'data', [])
|
1240
1260
|
result = []
|
1241
1261
|
for i in range(0, len(data)):
|
1242
1262
|
account = data[i]
|
@@ -1317,7 +1337,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1317
1337
|
# }
|
1318
1338
|
# }
|
1319
1339
|
#
|
1320
|
-
data = self.
|
1340
|
+
data = self.safe_dict(response, 'data')
|
1321
1341
|
return self.parse_deposit_withdraw_fee(data, currency)
|
1322
1342
|
|
1323
1343
|
def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
|
@@ -1348,7 +1368,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1348
1368
|
},
|
1349
1369
|
'networks': {},
|
1350
1370
|
}
|
1351
|
-
isWithdrawEnabled = self.
|
1371
|
+
isWithdrawEnabled = self.safe_bool(fee, 'isWithdrawEnabled')
|
1352
1372
|
if isWithdrawEnabled:
|
1353
1373
|
result['withdraw']['fee'] = self.safe_number_2(fee, 'withdrawalMinFee', 'withdrawMinFee')
|
1354
1374
|
result['withdraw']['percentage'] = False
|
@@ -1373,7 +1393,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1373
1393
|
#
|
1374
1394
|
defaultType = self.safe_string_2(self.options, methodName, 'defaultType', 'trade')
|
1375
1395
|
requestedType = self.safe_string(params, 'type', defaultType)
|
1376
|
-
accountsByType = self.
|
1396
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType')
|
1377
1397
|
type = self.safe_string(accountsByType, requestedType)
|
1378
1398
|
if type is None:
|
1379
1399
|
keys = list(accountsByType.keys())
|
@@ -1510,8 +1530,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1510
1530
|
# }
|
1511
1531
|
# }
|
1512
1532
|
#
|
1513
|
-
data = self.
|
1514
|
-
tickers = self.
|
1533
|
+
data = self.safe_dict(response, 'data', {})
|
1534
|
+
tickers = self.safe_list(data, 'ticker', [])
|
1515
1535
|
time = self.safe_integer(data, 'time')
|
1516
1536
|
result = {}
|
1517
1537
|
for i in range(0, len(tickers)):
|
@@ -1631,7 +1651,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1631
1651
|
# ]
|
1632
1652
|
# }
|
1633
1653
|
#
|
1634
|
-
data = self.
|
1654
|
+
data = self.safe_list(response, 'data', [])
|
1635
1655
|
return self.parse_ohlcvs(data, market, timeframe, since, limit)
|
1636
1656
|
|
1637
1657
|
def create_deposit_address(self, code: str, params={}):
|
@@ -1656,7 +1676,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1656
1676
|
# {"code":"260000","msg":"Deposit address already exists."}
|
1657
1677
|
# BCH {"code":"200000","data":{"address":"bitcoincash:qza3m4nj9rx7l9r0cdadfqxts6f92shvhvr5ls4q7z","memo":""}}
|
1658
1678
|
# BTC {"code":"200000","data":{"address":"36SjucKqQpQSvsak9A7h6qzFjrVXpRNZhE","memo":""}}
|
1659
|
-
data = self.
|
1679
|
+
data = self.safe_dict(response, 'data', {})
|
1660
1680
|
return self.parse_deposit_address(data, currency)
|
1661
1681
|
|
1662
1682
|
def fetch_deposit_address(self, code: str, params={}):
|
@@ -1742,7 +1762,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1742
1762
|
# }
|
1743
1763
|
#
|
1744
1764
|
self.options['versions']['private']['GET']['deposit-addresses'] = version
|
1745
|
-
chains = self.
|
1765
|
+
chains = self.safe_list(response, 'data', [])
|
1746
1766
|
parsed = self.parse_deposit_addresses(chains, [currency['code']], False, {
|
1747
1767
|
'currency': currency['id'],
|
1748
1768
|
})
|
@@ -1807,7 +1827,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1807
1827
|
# ]
|
1808
1828
|
# }
|
1809
1829
|
#
|
1810
|
-
data = self.
|
1830
|
+
data = self.safe_dict(response, 'data', {})
|
1811
1831
|
timestamp = self.safe_integer(data, 'time')
|
1812
1832
|
orderbook = self.parse_order_book(data, market['symbol'], timestamp, 'bids', 'asks', level - 2, level - 1)
|
1813
1833
|
orderbook['nonce'] = self.safe_integer(data, 'sequence')
|
@@ -1899,7 +1919,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1899
1919
|
# }
|
1900
1920
|
# }
|
1901
1921
|
#
|
1902
|
-
data = self.
|
1922
|
+
data = self.safe_dict(response, 'data', {})
|
1903
1923
|
return self.parse_order(data, market)
|
1904
1924
|
|
1905
1925
|
def create_market_order_with_cost(self, symbol: str, side: OrderSide, cost: float, params={}):
|
@@ -2012,8 +2032,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2012
2032
|
# },
|
2013
2033
|
# }
|
2014
2034
|
#
|
2015
|
-
data = self.
|
2016
|
-
data = self.
|
2035
|
+
data = self.safe_dict(response, 'data', {})
|
2036
|
+
data = self.safe_list(data, 'data', [])
|
2017
2037
|
return self.parse_orders(data)
|
2018
2038
|
|
2019
2039
|
def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: float = None, params={}):
|
@@ -2110,7 +2130,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2110
2130
|
# }
|
2111
2131
|
# }
|
2112
2132
|
#
|
2113
|
-
data = self.
|
2133
|
+
data = self.safe_dict(response, 'data', {})
|
2114
2134
|
return self.parse_order(data, market)
|
2115
2135
|
|
2116
2136
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
@@ -2132,7 +2152,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2132
2152
|
self.load_markets()
|
2133
2153
|
request = {}
|
2134
2154
|
clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId')
|
2135
|
-
stop = self.
|
2155
|
+
stop = self.safe_bool_2(params, 'stop', 'trigger', False)
|
2136
2156
|
hf = self.safe_bool(params, 'hf', False)
|
2137
2157
|
if hf:
|
2138
2158
|
if symbol is None:
|
@@ -2299,7 +2319,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2299
2319
|
# ]
|
2300
2320
|
# }
|
2301
2321
|
# }
|
2302
|
-
responseData = self.
|
2322
|
+
responseData = self.safe_dict(response, 'data', {})
|
2303
2323
|
orders = self.safe_value(responseData, 'items', responseData)
|
2304
2324
|
return self.parse_orders(orders, market, since, limit)
|
2305
2325
|
|
@@ -2414,7 +2434,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2414
2434
|
response = self.privateGetHfOrdersOrderId(self.extend(request, params))
|
2415
2435
|
else:
|
2416
2436
|
response = self.privateGetOrdersOrderId(self.extend(request, params))
|
2417
|
-
responseData = self.
|
2437
|
+
responseData = self.safe_dict(response, 'data', {})
|
2418
2438
|
if isinstance(responseData, list):
|
2419
2439
|
responseData = self.safe_value(responseData, 0)
|
2420
2440
|
return self.parse_order(responseData, market)
|
@@ -2548,7 +2568,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2548
2568
|
responseStop = self.safe_string(order, 'stop')
|
2549
2569
|
stop = responseStop is not None
|
2550
2570
|
stopTriggered = self.safe_bool(order, 'stopTriggered', False)
|
2551
|
-
isActive = self.
|
2571
|
+
isActive = self.safe_bool_2(order, 'isActive', 'active')
|
2552
2572
|
responseStatus = self.safe_string(order, 'status')
|
2553
2573
|
status = None
|
2554
2574
|
if isActive is not None:
|
@@ -2573,7 +2593,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2573
2593
|
'symbol': self.safe_symbol(marketId, market, '-'),
|
2574
2594
|
'type': self.safe_string(order, 'type'),
|
2575
2595
|
'timeInForce': self.safe_string(order, 'timeInForce'),
|
2576
|
-
'postOnly': self.
|
2596
|
+
'postOnly': self.safe_bool(order, 'postOnly'),
|
2577
2597
|
'side': self.safe_string(order, 'side'),
|
2578
2598
|
'amount': self.safe_string(order, 'size'),
|
2579
2599
|
'price': self.safe_string(order, 'price'), # price is zero for market order, omitZero is called in safeOrder2
|
@@ -2700,12 +2720,12 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2700
2720
|
# ]
|
2701
2721
|
# }
|
2702
2722
|
#
|
2703
|
-
data = self.
|
2723
|
+
data = self.safe_dict(response, 'data', {})
|
2704
2724
|
trades = None
|
2705
2725
|
if parseResponseData:
|
2706
2726
|
trades = data
|
2707
2727
|
else:
|
2708
|
-
trades = self.
|
2728
|
+
trades = self.safe_list(data, 'items', [])
|
2709
2729
|
return self.parse_trades(trades, market, since, limit)
|
2710
2730
|
|
2711
2731
|
def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
@@ -2745,7 +2765,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2745
2765
|
# ]
|
2746
2766
|
# }
|
2747
2767
|
#
|
2748
|
-
trades = self.
|
2768
|
+
trades = self.safe_list(response, 'data', [])
|
2749
2769
|
return self.parse_trades(trades, market, since, limit)
|
2750
2770
|
|
2751
2771
|
def parse_trade(self, trade, market: Market = None) -> Trade:
|
@@ -2899,8 +2919,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2899
2919
|
# ]
|
2900
2920
|
# }
|
2901
2921
|
#
|
2902
|
-
data = self.
|
2903
|
-
first = self.
|
2922
|
+
data = self.safe_list(response, 'data', [])
|
2923
|
+
first = self.safe_dict(data, 0)
|
2904
2924
|
marketId = self.safe_string(first, 'symbol')
|
2905
2925
|
return {
|
2906
2926
|
'info': response,
|
@@ -2956,7 +2976,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2956
2976
|
# }
|
2957
2977
|
# }
|
2958
2978
|
#
|
2959
|
-
data = self.
|
2979
|
+
data = self.safe_dict(response, 'data', {})
|
2960
2980
|
return self.parse_transaction(data, currency)
|
2961
2981
|
|
2962
2982
|
def parse_transaction_status(self, status):
|
@@ -3047,7 +3067,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3047
3067
|
timestamp = timestamp * 1000
|
3048
3068
|
if updated is not None:
|
3049
3069
|
updated = updated * 1000
|
3050
|
-
internal = self.
|
3070
|
+
internal = self.safe_bool(transaction, 'isInner')
|
3051
3071
|
tag = self.safe_string(transaction, 'memo')
|
3052
3072
|
return {
|
3053
3073
|
'info': transaction,
|
@@ -3254,7 +3274,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3254
3274
|
currency = self.currency(code)
|
3255
3275
|
defaultType = self.safe_string_2(self.options, 'fetchBalance', 'defaultType', 'spot')
|
3256
3276
|
requestedType = self.safe_string(params, 'type', defaultType)
|
3257
|
-
accountsByType = self.
|
3277
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType')
|
3258
3278
|
type = self.safe_string(accountsByType, requestedType, requestedType)
|
3259
3279
|
params = self.omit(params, 'type')
|
3260
3280
|
isHf = self.safe_bool(params, 'hf', False)
|
@@ -3330,7 +3350,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3330
3350
|
# }
|
3331
3351
|
# }
|
3332
3352
|
#
|
3333
|
-
data = self.
|
3353
|
+
data = self.safe_list(response, 'data', [])
|
3334
3354
|
result = {
|
3335
3355
|
'info': response,
|
3336
3356
|
'timestamp': None,
|
@@ -3342,8 +3362,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3342
3362
|
entry = assets[i]
|
3343
3363
|
marketId = self.safe_string(entry, 'symbol')
|
3344
3364
|
symbol = self.safe_symbol(marketId, None, '_')
|
3345
|
-
base = self.
|
3346
|
-
quote = self.
|
3365
|
+
base = self.safe_dict(entry, 'baseAsset', {})
|
3366
|
+
quote = self.safe_dict(entry, 'quoteAsset', {})
|
3347
3367
|
baseCode = self.safe_currency_code(self.safe_string(base, 'currency'))
|
3348
3368
|
quoteCode = self.safe_currency_code(self.safe_string(quote, 'currency'))
|
3349
3369
|
subResult = {}
|
@@ -3351,7 +3371,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3351
3371
|
subResult[quoteCode] = self.parse_balance_helper(quote)
|
3352
3372
|
result[symbol] = self.safe_balance(subResult)
|
3353
3373
|
elif cross:
|
3354
|
-
accounts = self.
|
3374
|
+
accounts = self.safe_list(data, 'accounts', [])
|
3355
3375
|
for i in range(0, len(accounts)):
|
3356
3376
|
balance = accounts[i]
|
3357
3377
|
currencyId = self.safe_string(balance, 'currency')
|
@@ -3427,7 +3447,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3427
3447
|
# }
|
3428
3448
|
# }
|
3429
3449
|
#
|
3430
|
-
data = self.
|
3450
|
+
data = self.safe_dict(response, 'data')
|
3431
3451
|
return self.parse_transfer(data, currency)
|
3432
3452
|
else:
|
3433
3453
|
request = {
|
@@ -3454,7 +3474,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3454
3474
|
# }
|
3455
3475
|
# }
|
3456
3476
|
#
|
3457
|
-
data = self.
|
3477
|
+
data = self.safe_dict(response, 'data')
|
3458
3478
|
return self.parse_transfer(data, currency)
|
3459
3479
|
|
3460
3480
|
def parse_transfer(self, transfer, currency: Currency = None):
|
@@ -3497,7 +3517,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3497
3517
|
rawStatus = self.safe_string(transfer, 'status')
|
3498
3518
|
accountFromRaw = self.safe_string_lower(transfer, 'payAccountType')
|
3499
3519
|
accountToRaw = self.safe_string_lower(transfer, 'recAccountType')
|
3500
|
-
accountsByType = self.
|
3520
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType')
|
3501
3521
|
accountFrom = self.safe_string(accountsByType, accountFromRaw, accountFromRaw)
|
3502
3522
|
accountTo = self.safe_string(accountsByType, accountToRaw, accountToRaw)
|
3503
3523
|
return {
|
@@ -3659,7 +3679,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3659
3679
|
self.load_accounts()
|
3660
3680
|
paginate = False
|
3661
3681
|
paginate, params = self.handle_option_and_params(params, 'fetchLedger', 'paginate')
|
3662
|
-
isHf = self.
|
3682
|
+
isHf = self.safe_bool(params, 'hf')
|
3663
3683
|
params = self.omit(params, 'hf')
|
3664
3684
|
if paginate:
|
3665
3685
|
return self.fetch_paginated_call_dynamic('fetchLedger', code, since, limit, params)
|
@@ -3733,9 +3753,9 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3733
3753
|
return self.parse_ledger(items, currency, since, limit)
|
3734
3754
|
|
3735
3755
|
def calculate_rate_limiter_cost(self, api, method, path, params, config={}):
|
3736
|
-
versions = self.
|
3737
|
-
apiVersions = self.
|
3738
|
-
methodVersions = self.
|
3756
|
+
versions = self.safe_dict(self.options, 'versions', {})
|
3757
|
+
apiVersions = self.safe_dict(versions, api, {})
|
3758
|
+
methodVersions = self.safe_dict(apiVersions, method, {})
|
3739
3759
|
defaultVersion = self.safe_string(methodVersions, path, self.options['version'])
|
3740
3760
|
version = self.safe_string(params, 'version', defaultVersion)
|
3741
3761
|
if version == 'v3' and ('v3' in config):
|
@@ -3869,8 +3889,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3869
3889
|
# }
|
3870
3890
|
# }
|
3871
3891
|
#
|
3872
|
-
data = self.
|
3873
|
-
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', [])
|
3874
3894
|
return self.parse_borrow_interests(assets, None)
|
3875
3895
|
|
3876
3896
|
def parse_borrow_interest(self, info, market: Market = None):
|
@@ -3923,7 +3943,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3923
3943
|
market = self.safe_market(marketId, market)
|
3924
3944
|
symbol = self.safe_string(market, 'symbol')
|
3925
3945
|
timestamp = self.safe_integer(info, 'createdAt')
|
3926
|
-
isolatedBase = self.
|
3946
|
+
isolatedBase = self.safe_dict(info, 'baseAsset', {})
|
3927
3947
|
amountBorrowed = None
|
3928
3948
|
interest = None
|
3929
3949
|
currencyId = None
|
@@ -3977,7 +3997,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3977
3997
|
# }
|
3978
3998
|
# }
|
3979
3999
|
#
|
3980
|
-
data = self.
|
4000
|
+
data = self.safe_dict(response, 'data', {})
|
3981
4001
|
return self.parse_margin_loan(data, currency)
|
3982
4002
|
|
3983
4003
|
def borrow_isolated_margin(self, symbol: str, code: str, amount: float, params={}):
|
@@ -4014,7 +4034,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4014
4034
|
# }
|
4015
4035
|
# }
|
4016
4036
|
#
|
4017
|
-
data = self.
|
4037
|
+
data = self.safe_dict(response, 'data', {})
|
4018
4038
|
return self.parse_margin_loan(data, currency)
|
4019
4039
|
|
4020
4040
|
def repay_cross_margin(self, code: str, amount, params={}):
|
@@ -4045,7 +4065,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4045
4065
|
# }
|
4046
4066
|
# }
|
4047
4067
|
#
|
4048
|
-
data = self.
|
4068
|
+
data = self.safe_dict(response, 'data', {})
|
4049
4069
|
return self.parse_margin_loan(data, currency)
|
4050
4070
|
|
4051
4071
|
def repay_isolated_margin(self, symbol: str, code: str, amount, params={}):
|
@@ -4080,7 +4100,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4080
4100
|
# }
|
4081
4101
|
# }
|
4082
4102
|
#
|
4083
|
-
data = self.
|
4103
|
+
data = self.safe_dict(response, 'data', {})
|
4084
4104
|
return self.parse_margin_loan(data, currency)
|
4085
4105
|
|
4086
4106
|
def parse_margin_loan(self, info, currency: Currency = None):
|
@@ -4130,7 +4150,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4130
4150
|
# },
|
4131
4151
|
# ]
|
4132
4152
|
#
|
4133
|
-
data = self.
|
4153
|
+
data = self.safe_list(response, 'data', [])
|
4134
4154
|
return self.parse_deposit_withdraw_fees(data, codes, 'currency')
|
4135
4155
|
|
4136
4156
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
@@ -4139,9 +4159,9 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4139
4159
|
# ↑ ↑
|
4140
4160
|
# ↑ ↑
|
4141
4161
|
#
|
4142
|
-
versions = self.
|
4143
|
-
apiVersions = self.
|
4144
|
-
methodVersions = self.
|
4162
|
+
versions = self.safe_dict(self.options, 'versions', {})
|
4163
|
+
apiVersions = self.safe_dict(versions, api, {})
|
4164
|
+
methodVersions = self.safe_dict(apiVersions, method, {})
|
4145
4165
|
defaultVersion = self.safe_string(methodVersions, path, self.options['version'])
|
4146
4166
|
version = self.safe_string(params, 'version', defaultVersion)
|
4147
4167
|
params = self.omit(params, 'version')
|
@@ -4162,7 +4182,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4162
4182
|
url = url + endpoint
|
4163
4183
|
isFuturePrivate = (api == 'futuresPrivate')
|
4164
4184
|
isPrivate = (api == 'private')
|
4165
|
-
|
4185
|
+
isBroker = (api == 'private')
|
4186
|
+
if isPrivate or isFuturePrivate or isBroker:
|
4166
4187
|
self.check_required_credentials()
|
4167
4188
|
timestamp = str(self.nonce())
|
4168
4189
|
headers = self.extend({
|
@@ -4179,7 +4200,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4179
4200
|
payload = timestamp + method + endpoint + endpart
|
4180
4201
|
signature = self.hmac(self.encode(payload), self.encode(self.secret), hashlib.sha256, 'base64')
|
4181
4202
|
headers['KC-API-SIGN'] = signature
|
4182
|
-
partner = self.
|
4203
|
+
partner = self.safe_dict(self.options, 'partner', {})
|
4183
4204
|
partner = self.safe_value(partner, 'future', partner) if isFuturePrivate else self.safe_value(partner, 'spot', partner)
|
4184
4205
|
partnerId = self.safe_string(partner, 'id')
|
4185
4206
|
partnerSecret = self.safe_string_2(partner, 'secret', 'key')
|
@@ -4188,6 +4209,9 @@ class kucoin(Exchange, ImplicitAPI):
|
|
4188
4209
|
partnerSignature = self.hmac(self.encode(partnerPayload), self.encode(partnerSecret), hashlib.sha256, 'base64')
|
4189
4210
|
headers['KC-API-PARTNER-SIGN'] = partnerSignature
|
4190
4211
|
headers['KC-API-PARTNER'] = partnerId
|
4212
|
+
if isBroker:
|
4213
|
+
brokerName = self.safe_string(partner, 'name')
|
4214
|
+
headers['KC-BROKER-NAME'] = brokerName
|
4191
4215
|
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
4192
4216
|
|
4193
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/bitget.py
CHANGED
@@ -1227,7 +1227,7 @@ class bitget(ccxt.async_support.bitget):
|
|
1227
1227
|
if feeAmount is not None:
|
1228
1228
|
feeCurrency = self.safe_string(fee, 'feeCoin')
|
1229
1229
|
feeObject = {
|
1230
|
-
'cost': Precise.string_abs(feeAmount),
|
1230
|
+
'cost': self.parse_number(Precise.string_abs(feeAmount)),
|
1231
1231
|
'currency': self.safe_currency_code(feeCurrency),
|
1232
1232
|
}
|
1233
1233
|
triggerPrice = self.safe_number(order, 'triggerPrice')
|
@@ -1239,8 +1239,9 @@ class bitget(ccxt.async_support.bitget):
|
|
1239
1239
|
if side == 'buy' and market['spot'] and (type == 'market'):
|
1240
1240
|
cost = self.safe_string(order, 'newSize', cost)
|
1241
1241
|
filled = self.safe_string_2(order, 'accBaseVolume', 'baseVolume')
|
1242
|
-
if market['spot'] and (rawStatus != 'live'):
|
1243
|
-
|
1242
|
+
# if market['spot'] and (rawStatus != 'live'):
|
1243
|
+
# filled = Precise.string_div(cost, avgPrice)
|
1244
|
+
# }
|
1244
1245
|
amount = self.safe_string(order, 'baseVolume')
|
1245
1246
|
if not market['spot'] or not (side == 'buy' and type == 'market'):
|
1246
1247
|
amount = self.safe_string(order, 'newSize', amount)
|
ccxt/pro/coinex.py
CHANGED
@@ -1008,7 +1008,7 @@ class coinex(ccxt.async_support.coinex):
|
|
1008
1008
|
messageHash = 'authenticated:spot'
|
1009
1009
|
future = self.safe_value(client.subscriptions, messageHash)
|
1010
1010
|
if future is not None:
|
1011
|
-
return future
|
1011
|
+
return await future
|
1012
1012
|
requestId = self.request_id()
|
1013
1013
|
subscribe = {
|
1014
1014
|
'id': requestId,
|
@@ -1027,12 +1027,12 @@ class coinex(ccxt.async_support.coinex):
|
|
1027
1027
|
}
|
1028
1028
|
future = self.watch(url, messageHash, request, requestId, subscribe)
|
1029
1029
|
client.subscriptions[messageHash] = future
|
1030
|
-
return future
|
1030
|
+
return await future
|
1031
1031
|
else:
|
1032
1032
|
messageHash = 'authenticated:swap'
|
1033
1033
|
future = self.safe_value(client.subscriptions, messageHash)
|
1034
1034
|
if future is not None:
|
1035
|
-
return future
|
1035
|
+
return await future
|
1036
1036
|
requestId = self.request_id()
|
1037
1037
|
subscribe = {
|
1038
1038
|
'id': requestId,
|
@@ -1051,4 +1051,4 @@ class coinex(ccxt.async_support.coinex):
|
|
1051
1051
|
}
|
1052
1052
|
future = self.watch(url, messageHash, request, requestId, subscribe)
|
1053
1053
|
client.subscriptions[messageHash] = future
|
1054
|
-
return future
|
1054
|
+
return await future
|
ccxt/pro/currencycom.py
CHANGED
ccxt/pro/lbank.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:
|