ccxt 4.3.89__py2.py3-none-any.whl → 4.3.91__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.
- ccxt/__init__.py +1 -1
- ccxt/abstract/binance.py +1 -1
- ccxt/abstract/binancecoinm.py +1 -1
- ccxt/abstract/binanceus.py +1 -1
- ccxt/abstract/binanceusdm.py +1 -1
- ccxt/abstract/kucoin.py +1 -0
- ccxt/abstract/kucoinfutures.py +1 -0
- ccxt/alpaca.py +2 -2
- ccxt/ascendex.py +95 -97
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/alpaca.py +2 -2
- ccxt/async_support/ascendex.py +95 -97
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +1 -1
- ccxt/async_support/bingx.py +29 -17
- ccxt/async_support/bitfinex2.py +21 -22
- ccxt/async_support/bitget.py +2 -2
- ccxt/async_support/bitmart.py +4 -8
- ccxt/async_support/coinbaseinternational.py +2 -1
- ccxt/async_support/coinex.py +1 -16
- ccxt/async_support/hitbtc.py +2 -0
- ccxt/async_support/huobijp.py +0 -8
- ccxt/async_support/kucoin.py +53 -21
- ccxt/async_support/kucoinfutures.py +22 -2
- ccxt/async_support/latoken.py +1 -0
- ccxt/async_support/okx.py +1 -8
- ccxt/async_support/whitebit.py +5 -3
- ccxt/async_support/woo.py +1 -1
- ccxt/base/exchange.py +1 -1
- ccxt/binance.py +1 -1
- ccxt/bingx.py +29 -17
- ccxt/bitfinex2.py +21 -22
- ccxt/bitget.py +2 -2
- ccxt/bitmart.py +4 -8
- ccxt/coinbaseinternational.py +2 -1
- ccxt/coinex.py +1 -16
- ccxt/hitbtc.py +2 -0
- ccxt/huobijp.py +0 -8
- ccxt/kucoin.py +53 -21
- ccxt/kucoinfutures.py +22 -2
- ccxt/latoken.py +1 -0
- ccxt/okx.py +1 -8
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +280 -0
- ccxt/pro/bingx.py +235 -85
- ccxt/pro/bithumb.py +4 -0
- ccxt/pro/bybit.py +1 -1
- ccxt/pro/coinex.py +941 -662
- ccxt/pro/lbank.py +1 -2
- ccxt/pro/okx.py +142 -2
- ccxt/whitebit.py +5 -3
- ccxt/woo.py +1 -1
- {ccxt-4.3.89.dist-info → ccxt-4.3.91.dist-info}/METADATA +4 -4
- {ccxt-4.3.89.dist-info → ccxt-4.3.91.dist-info}/RECORD +57 -57
- {ccxt-4.3.89.dist-info → ccxt-4.3.91.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.89.dist-info → ccxt-4.3.91.dist-info}/WHEEL +0 -0
- {ccxt-4.3.89.dist-info → ccxt-4.3.91.dist-info}/top_level.txt +0 -0
ccxt/async_support/bingx.py
CHANGED
@@ -1036,8 +1036,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1036
1036
|
|
1037
1037
|
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
1038
1038
|
#
|
1039
|
-
# spot
|
1040
|
-
# fetchTrades
|
1039
|
+
# spot fetchTrades
|
1041
1040
|
#
|
1042
1041
|
# {
|
1043
1042
|
# "id": 43148253,
|
@@ -1047,8 +1046,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
1047
1046
|
# "buyerMaker": False
|
1048
1047
|
# }
|
1049
1048
|
#
|
1050
|
-
# spot
|
1051
|
-
#
|
1049
|
+
# spot fetchMyTrades
|
1050
|
+
#
|
1052
1051
|
# {
|
1053
1052
|
# "symbol": "LTC-USDT",
|
1054
1053
|
# "id": 36237072,
|
@@ -1063,8 +1062,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1063
1062
|
# "isMaker": False
|
1064
1063
|
# }
|
1065
1064
|
#
|
1066
|
-
# swap
|
1067
|
-
# fetchTrades
|
1065
|
+
# swap fetchTrades
|
1068
1066
|
#
|
1069
1067
|
# {
|
1070
1068
|
# "time": 1672025549368,
|
@@ -1074,8 +1072,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1074
1072
|
# "quoteQty": "55723.87"
|
1075
1073
|
# }
|
1076
1074
|
#
|
1077
|
-
# swap
|
1078
|
-
# fetchMyTrades
|
1075
|
+
# swap fetchMyTrades
|
1079
1076
|
#
|
1080
1077
|
# {
|
1081
1078
|
# "volume": "0.1",
|
@@ -1089,10 +1086,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1089
1086
|
# "filledTime": "2023-07-04T20:56:01.000+0800"
|
1090
1087
|
# }
|
1091
1088
|
#
|
1092
|
-
#
|
1093
|
-
# ws
|
1094
|
-
#
|
1095
|
-
# spot
|
1089
|
+
# ws spot
|
1096
1090
|
#
|
1097
1091
|
# {
|
1098
1092
|
# "E": 1690214529432,
|
@@ -1105,7 +1099,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1105
1099
|
# "t": "57903921"
|
1106
1100
|
# }
|
1107
1101
|
#
|
1108
|
-
# swap
|
1102
|
+
# ws linear swap
|
1109
1103
|
#
|
1110
1104
|
# {
|
1111
1105
|
# "q": "0.0421",
|
@@ -1115,6 +1109,19 @@ class bingx(Exchange, ImplicitAPI):
|
|
1115
1109
|
# "s": "BTC-USDT"
|
1116
1110
|
# }
|
1117
1111
|
#
|
1112
|
+
# ws inverse swap
|
1113
|
+
#
|
1114
|
+
# {
|
1115
|
+
# "e": "trade",
|
1116
|
+
# "E": 1722920589665,
|
1117
|
+
# "s": "BTC-USD",
|
1118
|
+
# "t": "39125001",
|
1119
|
+
# "p": "55360.0",
|
1120
|
+
# "q": "1",
|
1121
|
+
# "T": 1722920589582,
|
1122
|
+
# "m": False
|
1123
|
+
# }
|
1124
|
+
#
|
1118
1125
|
# inverse swap fetchMyTrades
|
1119
1126
|
#
|
1120
1127
|
# {
|
@@ -2399,13 +2406,17 @@ class bingx(Exchange, ImplicitAPI):
|
|
2399
2406
|
tpRequest['quantity'] = self.parse_to_numeric(self.amount_to_precision(symbol, tkQuantity))
|
2400
2407
|
request['takeProfit'] = self.json(tpRequest)
|
2401
2408
|
positionSide = None
|
2402
|
-
|
2403
|
-
|
2409
|
+
hedged = self.safe_bool(params, 'hedged', False)
|
2410
|
+
if hedged:
|
2411
|
+
if reduceOnly:
|
2412
|
+
positionSide = 'SHORT' if (side == 'buy') else 'LONG'
|
2413
|
+
else:
|
2414
|
+
positionSide = 'LONG' if (side == 'buy') else 'SHORT'
|
2404
2415
|
else:
|
2405
|
-
positionSide = '
|
2416
|
+
positionSide = 'BOTH'
|
2406
2417
|
request['positionSide'] = positionSide
|
2407
2418
|
request['quantity'] = amount if (market['inverse']) else self.parse_to_numeric(self.amount_to_precision(symbol, amount)) # precision not available for inverse contracts
|
2408
|
-
params = self.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId'])
|
2419
|
+
params = self.omit(params, ['hedged', 'reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId'])
|
2409
2420
|
return self.extend(request, params)
|
2410
2421
|
|
2411
2422
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
@@ -2435,6 +2446,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2435
2446
|
:param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
2436
2447
|
:param float [params.stopLoss.triggerPrice]: stop loss trigger price
|
2437
2448
|
:param boolean [params.test]: *swap only* whether to use the test endpoint or not, default is False
|
2449
|
+
:param boolean [params.hedged]: *swap only* whether the order is in hedged mode or one way mode
|
2438
2450
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2439
2451
|
"""
|
2440
2452
|
await self.load_markets()
|
ccxt/async_support/bitfinex2.py
CHANGED
@@ -397,6 +397,25 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
397
397
|
'withdraw': {
|
398
398
|
'includeFee': False,
|
399
399
|
},
|
400
|
+
'networks': {
|
401
|
+
'BTC': 'BITCOIN',
|
402
|
+
'LTC': 'LITECOIN',
|
403
|
+
'ERC20': 'ETHEREUM',
|
404
|
+
'OMNI': 'TETHERUSO',
|
405
|
+
'LIQUID': 'TETHERUSL',
|
406
|
+
'TRC20': 'TETHERUSX',
|
407
|
+
'EOS': 'TETHERUSS',
|
408
|
+
'AVAX': 'TETHERUSDTAVAX',
|
409
|
+
'SOL': 'TETHERUSDTSOL',
|
410
|
+
'ALGO': 'TETHERUSDTALG',
|
411
|
+
'BCH': 'TETHERUSDTBCH',
|
412
|
+
'KSM': 'TETHERUSDTKSM',
|
413
|
+
'DVF': 'TETHERUSDTDVF',
|
414
|
+
'OMG': 'TETHERUSDTOMG',
|
415
|
+
},
|
416
|
+
'networksById': {
|
417
|
+
'TETHERUSE': 'ERC20',
|
418
|
+
},
|
400
419
|
},
|
401
420
|
'exceptions': {
|
402
421
|
'exact': {
|
@@ -791,7 +810,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
791
810
|
networkId = self.safe_string(pair, 0)
|
792
811
|
currencyId = self.safe_string(self.safe_value(pair, 1, []), 0)
|
793
812
|
if currencyId == cleanId:
|
794
|
-
network = self.
|
813
|
+
network = self.network_id_to_code(networkId)
|
795
814
|
networks[network] = {
|
796
815
|
'info': networkId,
|
797
816
|
'id': networkId.lower(),
|
@@ -814,26 +833,6 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
814
833
|
result[code]['networks'] = networks
|
815
834
|
return result
|
816
835
|
|
817
|
-
def safe_network(self, networkId):
|
818
|
-
networksById: dict = {
|
819
|
-
'BITCOIN': 'BTC',
|
820
|
-
'LITECOIN': 'LTC',
|
821
|
-
'ETHEREUM': 'ERC20',
|
822
|
-
'TETHERUSE': 'ERC20',
|
823
|
-
'TETHERUSO': 'OMNI',
|
824
|
-
'TETHERUSL': 'LIQUID',
|
825
|
-
'TETHERUSX': 'TRC20',
|
826
|
-
'TETHERUSS': 'EOS',
|
827
|
-
'TETHERUSDTAVAX': 'AVAX',
|
828
|
-
'TETHERUSDTSOL': 'SOL',
|
829
|
-
'TETHERUSDTALG': 'ALGO',
|
830
|
-
'TETHERUSDTBCH': 'BCH',
|
831
|
-
'TETHERUSDTKSM': 'KSM',
|
832
|
-
'TETHERUSDTDVF': 'DVF',
|
833
|
-
'TETHERUSDTOMG': 'OMG',
|
834
|
-
}
|
835
|
-
return self.safe_string(networksById, networkId, networkId)
|
836
|
-
|
837
836
|
async def fetch_balance(self, params={}) -> Balances:
|
838
837
|
"""
|
839
838
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
@@ -2249,7 +2248,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
2249
2248
|
currencyId = self.safe_string(transaction, 1)
|
2250
2249
|
code = self.safe_currency_code(currencyId, currency)
|
2251
2250
|
networkId = self.safe_string(transaction, 2)
|
2252
|
-
network = self.
|
2251
|
+
network = self.network_id_to_code(networkId)
|
2253
2252
|
timestamp = self.safe_integer(transaction, 5)
|
2254
2253
|
updated = self.safe_integer(transaction, 6)
|
2255
2254
|
status = self.parse_transaction_status(self.safe_string(transaction, 9))
|
ccxt/async_support/bitget.py
CHANGED
@@ -3847,7 +3847,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3847
3847
|
if feeCostString is not None:
|
3848
3848
|
# swap
|
3849
3849
|
fee = {
|
3850
|
-
'cost': self.parse_number(Precise.
|
3850
|
+
'cost': self.parse_number(Precise.string_neg(feeCostString)),
|
3851
3851
|
'currency': market['settle'],
|
3852
3852
|
}
|
3853
3853
|
feeDetail = self.safe_value(order, 'feeDetail')
|
@@ -3861,7 +3861,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3861
3861
|
feeObject = feeValue
|
3862
3862
|
break
|
3863
3863
|
fee = {
|
3864
|
-
'cost': self.parse_number(Precise.
|
3864
|
+
'cost': self.parse_number(Precise.string_neg(self.safe_string(feeObject, 'totalFee'))),
|
3865
3865
|
'currency': self.safe_currency_code(self.safe_string(feeObject, 'feeCoinCode')),
|
3866
3866
|
}
|
3867
3867
|
postOnly = None
|
ccxt/async_support/bitmart.py
CHANGED
@@ -3209,7 +3209,10 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3209
3209
|
parts = chain.split('-')
|
3210
3210
|
partsLength = len(parts)
|
3211
3211
|
networkId = self.safe_string(parts, partsLength - 1)
|
3212
|
-
|
3212
|
+
if networkId == self.safe_string(currency, 'name'):
|
3213
|
+
network = self.safe_string(currency, 'code')
|
3214
|
+
else:
|
3215
|
+
network = self.network_id_to_code(networkId)
|
3213
3216
|
self.check_address(address)
|
3214
3217
|
return {
|
3215
3218
|
'info': depositAddress,
|
@@ -3219,13 +3222,6 @@ class bitmart(Exchange, ImplicitAPI):
|
|
3219
3222
|
'network': network,
|
3220
3223
|
}
|
3221
3224
|
|
3222
|
-
def safe_network_code(self, networkId, currency=None):
|
3223
|
-
name = self.safe_string(currency, 'name')
|
3224
|
-
if networkId == name:
|
3225
|
-
code = self.safe_string(currency, 'code')
|
3226
|
-
return code
|
3227
|
-
return self.network_id_to_code(networkId)
|
3228
|
-
|
3229
3225
|
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
3230
3226
|
"""
|
3231
3227
|
make a withdrawal
|
@@ -754,11 +754,12 @@ class coinbaseinternational(Exchange, ImplicitAPI):
|
|
754
754
|
currencyId = self.safe_string(network, 'asset_name')
|
755
755
|
currencyCode = self.safe_currency_code(currencyId)
|
756
756
|
networkId = self.safe_string(network, 'network_arn_id')
|
757
|
+
networkIdForCode = self.safe_string_n(network, ['network_name', 'display_name', 'network_arn_id'], '')
|
757
758
|
return self.safe_network({
|
758
759
|
'info': network,
|
759
760
|
'id': networkId,
|
760
761
|
'name': self.safe_string(network, 'display_name'),
|
761
|
-
'network': self.network_id_to_code(
|
762
|
+
'network': self.network_id_to_code(networkIdForCode, currencyCode),
|
762
763
|
'active': None,
|
763
764
|
'deposit': None,
|
764
765
|
'withdraw': None,
|
ccxt/async_support/coinex.py
CHANGED
@@ -3559,24 +3559,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
3559
3559
|
options = self.safe_dict(self.options, 'fetchDepositAddress', {})
|
3560
3560
|
fillResponseFromRequest = self.safe_bool(options, 'fillResponseFromRequest', True)
|
3561
3561
|
if fillResponseFromRequest:
|
3562
|
-
depositAddress['network'] = self.
|
3562
|
+
depositAddress['network'] = self.network_id_to_code(network, currency).upper()
|
3563
3563
|
return depositAddress
|
3564
3564
|
|
3565
|
-
def safe_network(self, networkId, currency: Currency = None):
|
3566
|
-
networks = self.safe_value(currency, 'networks', {})
|
3567
|
-
networksCodes = list(networks.keys())
|
3568
|
-
networksCodesLength = len(networksCodes)
|
3569
|
-
if networkId is None and networksCodesLength == 1:
|
3570
|
-
return networks[networksCodes[0]]
|
3571
|
-
return {
|
3572
|
-
'id': networkId,
|
3573
|
-
'network': None if (networkId is None) else networkId.upper(),
|
3574
|
-
}
|
3575
|
-
|
3576
|
-
def safe_network_code(self, networkId, currency: Currency = None):
|
3577
|
-
network = self.safe_network(networkId, currency)
|
3578
|
-
return network['network']
|
3579
|
-
|
3580
3565
|
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
3581
3566
|
#
|
3582
3567
|
# {
|
ccxt/async_support/hitbtc.py
CHANGED
@@ -1369,8 +1369,10 @@ class hitbtc(Exchange, ImplicitAPI):
|
|
1369
1369
|
|
1370
1370
|
def parse_transaction_status(self, status: Str):
|
1371
1371
|
statuses: dict = {
|
1372
|
+
'CREATED': 'pending',
|
1372
1373
|
'PENDING': 'pending',
|
1373
1374
|
'FAILED': 'failed',
|
1375
|
+
'ROLLED_BACK': 'failed',
|
1374
1376
|
'SUCCESS': 'ok',
|
1375
1377
|
}
|
1376
1378
|
return self.safe_string(statuses, status, status)
|
ccxt/async_support/huobijp.py
CHANGED
@@ -1564,14 +1564,6 @@ class huobijp(Exchange, ImplicitAPI):
|
|
1564
1564
|
def currency_to_precision(self, code, fee, networkCode=None):
|
1565
1565
|
return self.decimal_to_precision(fee, 0, self.currencies[code]['precision'], self.precisionMode)
|
1566
1566
|
|
1567
|
-
def safe_network(self, networkId):
|
1568
|
-
lastCharacterIndex = len(networkId) - 1
|
1569
|
-
lastCharacter = networkId[lastCharacterIndex]
|
1570
|
-
if lastCharacter == '1':
|
1571
|
-
networkId = networkId[0:lastCharacterIndex]
|
1572
|
-
networksById: dict = {}
|
1573
|
-
return self.safe_string(networksById, networkId, networkId)
|
1574
|
-
|
1575
1567
|
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
1576
1568
|
#
|
1577
1569
|
# {
|
ccxt/async_support/kucoin.py
CHANGED
@@ -9,7 +9,7 @@ import asyncio
|
|
9
9
|
import hashlib
|
10
10
|
import math
|
11
11
|
import json
|
12
|
-
from ccxt.base.types import Account, Balances, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
12
|
+
from ccxt.base.types import Account, Balances, Bool, Currencies, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
13
13
|
from typing import List
|
14
14
|
from ccxt.base.errors import ExchangeError
|
15
15
|
from ccxt.base.errors import AuthenticationError
|
@@ -261,6 +261,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
261
261
|
'purchase/orders': 10, # 10SW
|
262
262
|
# broker
|
263
263
|
'broker/api/rebase/download': 3,
|
264
|
+
'migrate/user/account/status': 3,
|
264
265
|
# affiliate
|
265
266
|
'affiliate/inviter/statistics': 30,
|
266
267
|
},
|
@@ -705,6 +706,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
705
706
|
'project/marketInterestRate': 'v3',
|
706
707
|
'redeem/orders': 'v3',
|
707
708
|
'purchase/orders': 'v3',
|
709
|
+
'migrate/user/account/status': 'v3',
|
708
710
|
'margin/symbols': 'v3',
|
709
711
|
'affiliate/inviter/statistics': 'v2',
|
710
712
|
'asset/ndbroker/deposit/list': 'v1',
|
@@ -1219,6 +1221,26 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1219
1221
|
})
|
1220
1222
|
return result
|
1221
1223
|
|
1224
|
+
async def load_migration_status(self, force: bool = False):
|
1225
|
+
if not ('hfMigrated' in self.options) or force:
|
1226
|
+
result: dict = await self.privateGetMigrateUserAccountStatus()
|
1227
|
+
data: dict = self.safe_dict(result, 'data', {})
|
1228
|
+
status: Int = self.safe_integer(data, 'status')
|
1229
|
+
self.options['hfMigrated'] = (status == 2)
|
1230
|
+
|
1231
|
+
async def handle_hf_and_params(self, params={}):
|
1232
|
+
await self.load_migration_status()
|
1233
|
+
migrated: Bool = self.safe_bool(self.options, 'hfMigrated')
|
1234
|
+
loadedHf: Bool = None
|
1235
|
+
if migrated is not None:
|
1236
|
+
if migrated:
|
1237
|
+
loadedHf = True
|
1238
|
+
else:
|
1239
|
+
loadedHf = False
|
1240
|
+
hf: Bool = self.safe_bool(params, 'hf', loadedHf)
|
1241
|
+
params = self.omit(params, 'hf')
|
1242
|
+
return [hf, params]
|
1243
|
+
|
1222
1244
|
async def fetch_currencies(self, params={}) -> Currencies:
|
1223
1245
|
"""
|
1224
1246
|
fetches all available currencies on an exchange
|
@@ -2042,7 +2064,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2042
2064
|
market = self.market(symbol)
|
2043
2065
|
testOrder = self.safe_bool(params, 'test', False)
|
2044
2066
|
params = self.omit(params, 'test')
|
2045
|
-
|
2067
|
+
hf = None
|
2068
|
+
hf, params = await self.handle_hf_and_params(params)
|
2046
2069
|
triggerPrice, stopLossPrice, takeProfitPrice = self.handle_trigger_prices(params)
|
2047
2070
|
tradeType = self.safe_string(params, 'tradeType') # keep it for backward compatibility
|
2048
2071
|
isTriggerOrder = (triggerPrice or stopLossPrice or takeProfitPrice)
|
@@ -2055,14 +2078,16 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2055
2078
|
if testOrder:
|
2056
2079
|
if isMarginOrder:
|
2057
2080
|
response = await self.privatePostMarginOrderTest(orderRequest)
|
2081
|
+
elif hf:
|
2082
|
+
response = await self.privatePostHfOrdersTest(orderRequest)
|
2058
2083
|
else:
|
2059
2084
|
response = await self.privatePostOrdersTest(orderRequest)
|
2060
|
-
elif isHf:
|
2061
|
-
response = await self.privatePostHfOrders(orderRequest)
|
2062
2085
|
elif isTriggerOrder:
|
2063
2086
|
response = await self.privatePostStopOrder(orderRequest)
|
2064
2087
|
elif isMarginOrder:
|
2065
2088
|
response = await self.privatePostMarginOrder(orderRequest)
|
2089
|
+
elif hf:
|
2090
|
+
response = await self.privatePostHfOrders(orderRequest)
|
2066
2091
|
else:
|
2067
2092
|
response = await self.privatePostOrders(orderRequest)
|
2068
2093
|
#
|
@@ -2149,8 +2174,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2149
2174
|
'symbol': market['id'],
|
2150
2175
|
'orderList': ordersRequests,
|
2151
2176
|
}
|
2152
|
-
hf =
|
2153
|
-
params = self.
|
2177
|
+
hf = None
|
2178
|
+
hf, params = await self.handle_hf_and_params(params)
|
2154
2179
|
response = None
|
2155
2180
|
if hf:
|
2156
2181
|
response = await self.privatePostHfOrdersMulti(self.extend(request, params))
|
@@ -2314,14 +2339,15 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2314
2339
|
request: dict = {}
|
2315
2340
|
clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId')
|
2316
2341
|
stop = self.safe_bool_2(params, 'stop', 'trigger', False)
|
2317
|
-
hf =
|
2342
|
+
hf = None
|
2343
|
+
hf, params = await self.handle_hf_and_params(params)
|
2318
2344
|
if hf:
|
2319
2345
|
if symbol is None:
|
2320
2346
|
raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol parameter for hf orders')
|
2321
2347
|
market = self.market(symbol)
|
2322
2348
|
request['symbol'] = market['id']
|
2323
2349
|
response = None
|
2324
|
-
params = self.omit(params, ['clientOid', 'clientOrderId', 'stop', '
|
2350
|
+
params = self.omit(params, ['clientOid', 'clientOrderId', 'stop', 'trigger'])
|
2325
2351
|
if clientOrderId is not None:
|
2326
2352
|
request['clientOid'] = clientOrderId
|
2327
2353
|
if stop:
|
@@ -2415,8 +2441,9 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2415
2441
|
await self.load_markets()
|
2416
2442
|
request: dict = {}
|
2417
2443
|
stop = self.safe_bool(params, 'stop', False)
|
2418
|
-
hf =
|
2419
|
-
params = self.
|
2444
|
+
hf = None
|
2445
|
+
hf, params = await self.handle_hf_and_params(params)
|
2446
|
+
params = self.omit(params, 'stop')
|
2420
2447
|
marginMode, query = self.handle_margin_mode_and_params('cancelAllOrders', params)
|
2421
2448
|
if symbol is not None:
|
2422
2449
|
request['symbol'] = self.market_id(symbol)
|
@@ -2463,8 +2490,11 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2463
2490
|
lowercaseStatus = status.lower()
|
2464
2491
|
until = self.safe_integer(params, 'until')
|
2465
2492
|
stop = self.safe_bool_2(params, 'stop', 'trigger', False)
|
2466
|
-
hf =
|
2467
|
-
params = self.
|
2493
|
+
hf = None
|
2494
|
+
hf, params = await self.handle_hf_and_params(params)
|
2495
|
+
if hf and (symbol is None):
|
2496
|
+
raise ArgumentsRequired(self.id + ' fetchOrdersByStatus() requires a symbol parameter for hf orders')
|
2497
|
+
params = self.omit(params, ['stop', 'trigger', 'till', 'until'])
|
2468
2498
|
marginMode, query = self.handle_margin_mode_and_params('fetchOrdersByStatus', params)
|
2469
2499
|
if lowercaseStatus == 'open':
|
2470
2500
|
lowercaseStatus = 'active'
|
@@ -2622,7 +2652,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2622
2652
|
request: dict = {}
|
2623
2653
|
clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId')
|
2624
2654
|
stop = self.safe_bool_2(params, 'stop', 'trigger', False)
|
2625
|
-
hf =
|
2655
|
+
hf = None
|
2656
|
+
hf, params = await self.handle_hf_and_params(params)
|
2626
2657
|
market = None
|
2627
2658
|
if symbol is not None:
|
2628
2659
|
market = self.market(symbol)
|
@@ -2630,7 +2661,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2630
2661
|
if symbol is None:
|
2631
2662
|
raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol parameter for hf orders')
|
2632
2663
|
request['symbol'] = market['id']
|
2633
|
-
params = self.omit(params, ['stop', '
|
2664
|
+
params = self.omit(params, ['stop', 'clientOid', 'clientOrderId', 'trigger'])
|
2634
2665
|
response = None
|
2635
2666
|
if clientOrderId is not None:
|
2636
2667
|
request['clientOid'] = clientOrderId
|
@@ -2872,7 +2903,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2872
2903
|
if paginate:
|
2873
2904
|
return await self.fetch_paginated_call_dynamic('fetchMyTrades', symbol, since, limit, params)
|
2874
2905
|
request: dict = {}
|
2875
|
-
hf =
|
2906
|
+
hf = None
|
2907
|
+
hf, params = await self.handle_hf_and_params(params)
|
2876
2908
|
if hf and symbol is None:
|
2877
2909
|
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol parameter for hf orders')
|
2878
2910
|
market = None
|
@@ -3544,10 +3576,10 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3544
3576
|
accountsByType = self.safe_dict(self.options, 'accountsByType')
|
3545
3577
|
type = self.safe_string(accountsByType, requestedType, requestedType)
|
3546
3578
|
params = self.omit(params, 'type')
|
3547
|
-
|
3548
|
-
|
3579
|
+
hf = None
|
3580
|
+
hf, params = await self.handle_hf_and_params(params)
|
3581
|
+
if hf:
|
3549
3582
|
type = 'trade_hf'
|
3550
|
-
params = self.omit(params, 'hf')
|
3551
3583
|
marginMode, query = self.handle_margin_mode_and_params('fetchBalance', params)
|
3552
3584
|
response = None
|
3553
3585
|
request: dict = {}
|
@@ -3973,8 +4005,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3973
4005
|
await self.load_accounts()
|
3974
4006
|
paginate = False
|
3975
4007
|
paginate, params = self.handle_option_and_params(params, 'fetchLedger', 'paginate')
|
3976
|
-
|
3977
|
-
params = self.
|
4008
|
+
hf = None
|
4009
|
+
hf, params = await self.handle_hf_and_params(params)
|
3978
4010
|
if paginate:
|
3979
4011
|
return await self.fetch_paginated_call_dynamic('fetchLedger', code, since, limit, params)
|
3980
4012
|
request: dict = {
|
@@ -3995,7 +4027,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3995
4027
|
marginMode = None
|
3996
4028
|
marginMode, params = self.handle_margin_mode_and_params('fetchLedger', params)
|
3997
4029
|
response = None
|
3998
|
-
if
|
4030
|
+
if hf:
|
3999
4031
|
if marginMode is not None:
|
4000
4032
|
response = await self.privateGetHfMarginAccountLedgers(self.extend(request, params))
|
4001
4033
|
else:
|
@@ -61,6 +61,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
61
61
|
'createTriggerOrder': True,
|
62
62
|
'fetchAccounts': True,
|
63
63
|
'fetchBalance': True,
|
64
|
+
'fetchBidsAsks': True,
|
64
65
|
'fetchBorrowRateHistories': False,
|
65
66
|
'fetchBorrowRateHistory': False,
|
66
67
|
'fetchClosedOrders': True,
|
@@ -752,11 +753,18 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
752
753
|
:see: https://www.kucoin.com/docs/rest/futures-trading/market-data/get-symbols-list
|
753
754
|
:param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
754
755
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
756
|
+
:param str [params.method]: the method to use, futuresPublicGetAllTickers or futuresPublicGetContractsActive
|
755
757
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
756
758
|
"""
|
757
759
|
await self.load_markets()
|
758
760
|
symbols = self.market_symbols(symbols)
|
759
|
-
|
761
|
+
method = None
|
762
|
+
method, params = self.handle_option_and_params(params, 'fetchTickers', 'method', 'futuresPublicGetContractsActive')
|
763
|
+
response: dict = None
|
764
|
+
if method == 'futuresPublicGetAllTickers':
|
765
|
+
response = await self.futuresPublicGetAllTickers(params)
|
766
|
+
else:
|
767
|
+
response = await self.futuresPublicGetContractsActive(params)
|
760
768
|
#
|
761
769
|
# {
|
762
770
|
# "code": "200000",
|
@@ -819,7 +827,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
819
827
|
# }
|
820
828
|
# }
|
821
829
|
#
|
822
|
-
data = self.safe_list(response, 'data'
|
830
|
+
data = self.safe_list(response, 'data')
|
823
831
|
tickers = self.parse_tickers(data, symbols)
|
824
832
|
return self.filter_by_array_tickers(tickers, 'symbol', symbols)
|
825
833
|
|
@@ -929,6 +937,18 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
929
937
|
'info': ticker,
|
930
938
|
}, market)
|
931
939
|
|
940
|
+
async def fetch_bids_asks(self, symbols: Strings = None, params={}):
|
941
|
+
"""
|
942
|
+
fetches the bid and ask price and volume for multiple markets
|
943
|
+
:param str[] [symbols]: unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
|
944
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
945
|
+
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
946
|
+
"""
|
947
|
+
request = {
|
948
|
+
'method': 'futuresPublicGetAllTickers',
|
949
|
+
}
|
950
|
+
return await self.fetch_tickers(symbols, self.extend(request, params))
|
951
|
+
|
932
952
|
async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
933
953
|
"""
|
934
954
|
fetch the history of funding payments paid and received on self account
|
ccxt/async_support/latoken.py
CHANGED
@@ -1465,6 +1465,7 @@ class latoken(Exchange, ImplicitAPI):
|
|
1465
1465
|
statuses: dict = {
|
1466
1466
|
'TRANSACTION_STATUS_CONFIRMED': 'ok',
|
1467
1467
|
'TRANSACTION_STATUS_EXECUTED': 'ok',
|
1468
|
+
'TRANSACTION_STATUS_CHECKING': 'pending',
|
1468
1469
|
'TRANSACTION_STATUS_CANCELLED': 'canceled',
|
1469
1470
|
}
|
1470
1471
|
return self.safe_string(statuses, status, status)
|
ccxt/async_support/okx.py
CHANGED
@@ -1063,6 +1063,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1063
1063
|
'ZEC': 'Zcash',
|
1064
1064
|
'ZIL': 'Zilliqa',
|
1065
1065
|
'ZKSYNC': 'ZKSYNC',
|
1066
|
+
'OMNI': 'Omni',
|
1066
1067
|
# 'NEON3': 'N3', # tbd
|
1067
1068
|
# undetermined : "CELO-TOKEN", "Digital Cash", Khala
|
1068
1069
|
# todo: uncomment below after consensus
|
@@ -1589,14 +1590,6 @@ class okx(Exchange, ImplicitAPI):
|
|
1589
1590
|
dataResponse = self.safe_list(response, 'data', [])
|
1590
1591
|
return self.parse_markets(dataResponse)
|
1591
1592
|
|
1592
|
-
def safe_network(self, networkId):
|
1593
|
-
networksById: dict = {
|
1594
|
-
'Bitcoin': 'BTC',
|
1595
|
-
'Omni': 'OMNI',
|
1596
|
-
'TRON': 'TRC20',
|
1597
|
-
}
|
1598
|
-
return self.safe_string(networksById, networkId, networkId)
|
1599
|
-
|
1600
1593
|
async def fetch_currencies(self, params={}) -> Currencies:
|
1601
1594
|
"""
|
1602
1595
|
fetches all available currencies on an exchange
|
ccxt/async_support/whitebit.py
CHANGED
@@ -2472,9 +2472,11 @@ class whitebit(Exchange, ImplicitAPI):
|
|
2472
2472
|
if hasErrorStatus:
|
2473
2473
|
errorInfo = status
|
2474
2474
|
else:
|
2475
|
-
errorObject = self.
|
2476
|
-
|
2477
|
-
|
2475
|
+
errorObject = self.safe_dict(response, 'errors', {})
|
2476
|
+
errorKeys = list(errorObject.keys())
|
2477
|
+
errorsLength = len(errorKeys)
|
2478
|
+
if errorsLength > 0:
|
2479
|
+
errorKey = errorKeys[0]
|
2478
2480
|
errorMessageArray = self.safe_value(errorObject, errorKey, [])
|
2479
2481
|
errorMessageLength = len(errorMessageArray)
|
2480
2482
|
errorInfo = errorMessageArray[0] if (errorMessageLength > 0) else body
|
ccxt/async_support/woo.py
CHANGED
ccxt/base/exchange.py
CHANGED
ccxt/binance.py
CHANGED
@@ -353,7 +353,7 @@ class binance(Exchange, ImplicitAPI):
|
|
353
353
|
'capital/deposit/hisrec': 0.1,
|
354
354
|
'capital/deposit/subAddress': 0.1,
|
355
355
|
'capital/deposit/subHisrec': 0.1,
|
356
|
-
'capital/withdraw/history':
|
356
|
+
'capital/withdraw/history': 2, # Weight(UID): 18000 + (Additional: 10 requests per second => cost = ( 1000 / rateLimit ) / 10 = 2
|
357
357
|
'capital/withdraw/address/list': 10,
|
358
358
|
'capital/contract/convertible-coins': 4.0002, # Weight(UID): 600 => cost = 0.006667 * 600 = 4.0002
|
359
359
|
'convert/tradeFlow': 20.001, # Weight(UID): 3000 => cost = 0.006667 * 3000 = 20.001
|