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/bingx.py
CHANGED
@@ -1035,8 +1035,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1035
1035
|
|
1036
1036
|
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
1037
1037
|
#
|
1038
|
-
# spot
|
1039
|
-
# fetchTrades
|
1038
|
+
# spot fetchTrades
|
1040
1039
|
#
|
1041
1040
|
# {
|
1042
1041
|
# "id": 43148253,
|
@@ -1046,8 +1045,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
1046
1045
|
# "buyerMaker": False
|
1047
1046
|
# }
|
1048
1047
|
#
|
1049
|
-
# spot
|
1050
|
-
#
|
1048
|
+
# spot fetchMyTrades
|
1049
|
+
#
|
1051
1050
|
# {
|
1052
1051
|
# "symbol": "LTC-USDT",
|
1053
1052
|
# "id": 36237072,
|
@@ -1062,8 +1061,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1062
1061
|
# "isMaker": False
|
1063
1062
|
# }
|
1064
1063
|
#
|
1065
|
-
# swap
|
1066
|
-
# fetchTrades
|
1064
|
+
# swap fetchTrades
|
1067
1065
|
#
|
1068
1066
|
# {
|
1069
1067
|
# "time": 1672025549368,
|
@@ -1073,8 +1071,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1073
1071
|
# "quoteQty": "55723.87"
|
1074
1072
|
# }
|
1075
1073
|
#
|
1076
|
-
# swap
|
1077
|
-
# fetchMyTrades
|
1074
|
+
# swap fetchMyTrades
|
1078
1075
|
#
|
1079
1076
|
# {
|
1080
1077
|
# "volume": "0.1",
|
@@ -1088,10 +1085,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1088
1085
|
# "filledTime": "2023-07-04T20:56:01.000+0800"
|
1089
1086
|
# }
|
1090
1087
|
#
|
1091
|
-
#
|
1092
|
-
# ws
|
1093
|
-
#
|
1094
|
-
# spot
|
1088
|
+
# ws spot
|
1095
1089
|
#
|
1096
1090
|
# {
|
1097
1091
|
# "E": 1690214529432,
|
@@ -1104,7 +1098,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1104
1098
|
# "t": "57903921"
|
1105
1099
|
# }
|
1106
1100
|
#
|
1107
|
-
# swap
|
1101
|
+
# ws linear swap
|
1108
1102
|
#
|
1109
1103
|
# {
|
1110
1104
|
# "q": "0.0421",
|
@@ -1114,6 +1108,19 @@ class bingx(Exchange, ImplicitAPI):
|
|
1114
1108
|
# "s": "BTC-USDT"
|
1115
1109
|
# }
|
1116
1110
|
#
|
1111
|
+
# ws inverse swap
|
1112
|
+
#
|
1113
|
+
# {
|
1114
|
+
# "e": "trade",
|
1115
|
+
# "E": 1722920589665,
|
1116
|
+
# "s": "BTC-USD",
|
1117
|
+
# "t": "39125001",
|
1118
|
+
# "p": "55360.0",
|
1119
|
+
# "q": "1",
|
1120
|
+
# "T": 1722920589582,
|
1121
|
+
# "m": False
|
1122
|
+
# }
|
1123
|
+
#
|
1117
1124
|
# inverse swap fetchMyTrades
|
1118
1125
|
#
|
1119
1126
|
# {
|
@@ -2398,13 +2405,17 @@ class bingx(Exchange, ImplicitAPI):
|
|
2398
2405
|
tpRequest['quantity'] = self.parse_to_numeric(self.amount_to_precision(symbol, tkQuantity))
|
2399
2406
|
request['takeProfit'] = self.json(tpRequest)
|
2400
2407
|
positionSide = None
|
2401
|
-
|
2402
|
-
|
2408
|
+
hedged = self.safe_bool(params, 'hedged', False)
|
2409
|
+
if hedged:
|
2410
|
+
if reduceOnly:
|
2411
|
+
positionSide = 'SHORT' if (side == 'buy') else 'LONG'
|
2412
|
+
else:
|
2413
|
+
positionSide = 'LONG' if (side == 'buy') else 'SHORT'
|
2403
2414
|
else:
|
2404
|
-
positionSide = '
|
2415
|
+
positionSide = 'BOTH'
|
2405
2416
|
request['positionSide'] = positionSide
|
2406
2417
|
request['quantity'] = amount if (market['inverse']) else self.parse_to_numeric(self.amount_to_precision(symbol, amount)) # precision not available for inverse contracts
|
2407
|
-
params = self.omit(params, ['reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId'])
|
2418
|
+
params = self.omit(params, ['hedged', 'reduceOnly', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingType', 'takeProfit', 'stopLoss', 'clientOrderId'])
|
2408
2419
|
return self.extend(request, params)
|
2409
2420
|
|
2410
2421
|
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
@@ -2434,6 +2445,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2434
2445
|
:param dict [params.stopLoss]: *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
|
2435
2446
|
:param float [params.stopLoss.triggerPrice]: stop loss trigger price
|
2436
2447
|
:param boolean [params.test]: *swap only* whether to use the test endpoint or not, default is False
|
2448
|
+
:param boolean [params.hedged]: *swap only* whether the order is in hedged mode or one way mode
|
2437
2449
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2438
2450
|
"""
|
2439
2451
|
self.load_markets()
|
ccxt/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
|
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/bitget.py
CHANGED
@@ -3846,7 +3846,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3846
3846
|
if feeCostString is not None:
|
3847
3847
|
# swap
|
3848
3848
|
fee = {
|
3849
|
-
'cost': self.parse_number(Precise.
|
3849
|
+
'cost': self.parse_number(Precise.string_neg(feeCostString)),
|
3850
3850
|
'currency': market['settle'],
|
3851
3851
|
}
|
3852
3852
|
feeDetail = self.safe_value(order, 'feeDetail')
|
@@ -3860,7 +3860,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
3860
3860
|
feeObject = feeValue
|
3861
3861
|
break
|
3862
3862
|
fee = {
|
3863
|
-
'cost': self.parse_number(Precise.
|
3863
|
+
'cost': self.parse_number(Precise.string_neg(self.safe_string(feeObject, 'totalFee'))),
|
3864
3864
|
'currency': self.safe_currency_code(self.safe_string(feeObject, 'feeCoinCode')),
|
3865
3865
|
}
|
3866
3866
|
postOnly = None
|
ccxt/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
|
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
3230
3226
|
"""
|
3231
3227
|
make a withdrawal
|
ccxt/coinbaseinternational.py
CHANGED
@@ -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/coinex.py
CHANGED
@@ -3558,24 +3558,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
3558
3558
|
options = self.safe_dict(self.options, 'fetchDepositAddress', {})
|
3559
3559
|
fillResponseFromRequest = self.safe_bool(options, 'fillResponseFromRequest', True)
|
3560
3560
|
if fillResponseFromRequest:
|
3561
|
-
depositAddress['network'] = self.
|
3561
|
+
depositAddress['network'] = self.network_id_to_code(network, currency).upper()
|
3562
3562
|
return depositAddress
|
3563
3563
|
|
3564
|
-
def safe_network(self, networkId, currency: Currency = None):
|
3565
|
-
networks = self.safe_value(currency, 'networks', {})
|
3566
|
-
networksCodes = list(networks.keys())
|
3567
|
-
networksCodesLength = len(networksCodes)
|
3568
|
-
if networkId is None and networksCodesLength == 1:
|
3569
|
-
return networks[networksCodes[0]]
|
3570
|
-
return {
|
3571
|
-
'id': networkId,
|
3572
|
-
'network': None if (networkId is None) else networkId.upper(),
|
3573
|
-
}
|
3574
|
-
|
3575
|
-
def safe_network_code(self, networkId, currency: Currency = None):
|
3576
|
-
network = self.safe_network(networkId, currency)
|
3577
|
-
return network['network']
|
3578
|
-
|
3579
3564
|
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
3580
3565
|
#
|
3581
3566
|
# {
|
ccxt/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/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/kucoin.py
CHANGED
@@ -8,7 +8,7 @@ from ccxt.abstract.kucoin import ImplicitAPI
|
|
8
8
|
import hashlib
|
9
9
|
import math
|
10
10
|
import json
|
11
|
-
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
|
11
|
+
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
|
12
12
|
from typing import List
|
13
13
|
from ccxt.base.errors import ExchangeError
|
14
14
|
from ccxt.base.errors import AuthenticationError
|
@@ -260,6 +260,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
260
260
|
'purchase/orders': 10, # 10SW
|
261
261
|
# broker
|
262
262
|
'broker/api/rebase/download': 3,
|
263
|
+
'migrate/user/account/status': 3,
|
263
264
|
# affiliate
|
264
265
|
'affiliate/inviter/statistics': 30,
|
265
266
|
},
|
@@ -704,6 +705,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
704
705
|
'project/marketInterestRate': 'v3',
|
705
706
|
'redeem/orders': 'v3',
|
706
707
|
'purchase/orders': 'v3',
|
708
|
+
'migrate/user/account/status': 'v3',
|
707
709
|
'margin/symbols': 'v3',
|
708
710
|
'affiliate/inviter/statistics': 'v2',
|
709
711
|
'asset/ndbroker/deposit/list': 'v1',
|
@@ -1218,6 +1220,26 @@ class kucoin(Exchange, ImplicitAPI):
|
|
1218
1220
|
})
|
1219
1221
|
return result
|
1220
1222
|
|
1223
|
+
def load_migration_status(self, force: bool = False):
|
1224
|
+
if not ('hfMigrated' in self.options) or force:
|
1225
|
+
result: dict = self.privateGetMigrateUserAccountStatus()
|
1226
|
+
data: dict = self.safe_dict(result, 'data', {})
|
1227
|
+
status: Int = self.safe_integer(data, 'status')
|
1228
|
+
self.options['hfMigrated'] = (status == 2)
|
1229
|
+
|
1230
|
+
def handle_hf_and_params(self, params={}):
|
1231
|
+
self.load_migration_status()
|
1232
|
+
migrated: Bool = self.safe_bool(self.options, 'hfMigrated')
|
1233
|
+
loadedHf: Bool = None
|
1234
|
+
if migrated is not None:
|
1235
|
+
if migrated:
|
1236
|
+
loadedHf = True
|
1237
|
+
else:
|
1238
|
+
loadedHf = False
|
1239
|
+
hf: Bool = self.safe_bool(params, 'hf', loadedHf)
|
1240
|
+
params = self.omit(params, 'hf')
|
1241
|
+
return [hf, params]
|
1242
|
+
|
1221
1243
|
def fetch_currencies(self, params={}) -> Currencies:
|
1222
1244
|
"""
|
1223
1245
|
fetches all available currencies on an exchange
|
@@ -2041,7 +2063,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2041
2063
|
market = self.market(symbol)
|
2042
2064
|
testOrder = self.safe_bool(params, 'test', False)
|
2043
2065
|
params = self.omit(params, 'test')
|
2044
|
-
|
2066
|
+
hf = None
|
2067
|
+
hf, params = self.handle_hf_and_params(params)
|
2045
2068
|
triggerPrice, stopLossPrice, takeProfitPrice = self.handle_trigger_prices(params)
|
2046
2069
|
tradeType = self.safe_string(params, 'tradeType') # keep it for backward compatibility
|
2047
2070
|
isTriggerOrder = (triggerPrice or stopLossPrice or takeProfitPrice)
|
@@ -2054,14 +2077,16 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2054
2077
|
if testOrder:
|
2055
2078
|
if isMarginOrder:
|
2056
2079
|
response = self.privatePostMarginOrderTest(orderRequest)
|
2080
|
+
elif hf:
|
2081
|
+
response = self.privatePostHfOrdersTest(orderRequest)
|
2057
2082
|
else:
|
2058
2083
|
response = self.privatePostOrdersTest(orderRequest)
|
2059
|
-
elif isHf:
|
2060
|
-
response = self.privatePostHfOrders(orderRequest)
|
2061
2084
|
elif isTriggerOrder:
|
2062
2085
|
response = self.privatePostStopOrder(orderRequest)
|
2063
2086
|
elif isMarginOrder:
|
2064
2087
|
response = self.privatePostMarginOrder(orderRequest)
|
2088
|
+
elif hf:
|
2089
|
+
response = self.privatePostHfOrders(orderRequest)
|
2065
2090
|
else:
|
2066
2091
|
response = self.privatePostOrders(orderRequest)
|
2067
2092
|
#
|
@@ -2148,8 +2173,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2148
2173
|
'symbol': market['id'],
|
2149
2174
|
'orderList': ordersRequests,
|
2150
2175
|
}
|
2151
|
-
hf =
|
2152
|
-
params = self.
|
2176
|
+
hf = None
|
2177
|
+
hf, params = self.handle_hf_and_params(params)
|
2153
2178
|
response = None
|
2154
2179
|
if hf:
|
2155
2180
|
response = self.privatePostHfOrdersMulti(self.extend(request, params))
|
@@ -2313,14 +2338,15 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2313
2338
|
request: dict = {}
|
2314
2339
|
clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId')
|
2315
2340
|
stop = self.safe_bool_2(params, 'stop', 'trigger', False)
|
2316
|
-
hf =
|
2341
|
+
hf = None
|
2342
|
+
hf, params = self.handle_hf_and_params(params)
|
2317
2343
|
if hf:
|
2318
2344
|
if symbol is None:
|
2319
2345
|
raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol parameter for hf orders')
|
2320
2346
|
market = self.market(symbol)
|
2321
2347
|
request['symbol'] = market['id']
|
2322
2348
|
response = None
|
2323
|
-
params = self.omit(params, ['clientOid', 'clientOrderId', 'stop', '
|
2349
|
+
params = self.omit(params, ['clientOid', 'clientOrderId', 'stop', 'trigger'])
|
2324
2350
|
if clientOrderId is not None:
|
2325
2351
|
request['clientOid'] = clientOrderId
|
2326
2352
|
if stop:
|
@@ -2414,8 +2440,9 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2414
2440
|
self.load_markets()
|
2415
2441
|
request: dict = {}
|
2416
2442
|
stop = self.safe_bool(params, 'stop', False)
|
2417
|
-
hf =
|
2418
|
-
params = self.
|
2443
|
+
hf = None
|
2444
|
+
hf, params = self.handle_hf_and_params(params)
|
2445
|
+
params = self.omit(params, 'stop')
|
2419
2446
|
marginMode, query = self.handle_margin_mode_and_params('cancelAllOrders', params)
|
2420
2447
|
if symbol is not None:
|
2421
2448
|
request['symbol'] = self.market_id(symbol)
|
@@ -2462,8 +2489,11 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2462
2489
|
lowercaseStatus = status.lower()
|
2463
2490
|
until = self.safe_integer(params, 'until')
|
2464
2491
|
stop = self.safe_bool_2(params, 'stop', 'trigger', False)
|
2465
|
-
hf =
|
2466
|
-
params = self.
|
2492
|
+
hf = None
|
2493
|
+
hf, params = self.handle_hf_and_params(params)
|
2494
|
+
if hf and (symbol is None):
|
2495
|
+
raise ArgumentsRequired(self.id + ' fetchOrdersByStatus() requires a symbol parameter for hf orders')
|
2496
|
+
params = self.omit(params, ['stop', 'trigger', 'till', 'until'])
|
2467
2497
|
marginMode, query = self.handle_margin_mode_and_params('fetchOrdersByStatus', params)
|
2468
2498
|
if lowercaseStatus == 'open':
|
2469
2499
|
lowercaseStatus = 'active'
|
@@ -2621,7 +2651,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2621
2651
|
request: dict = {}
|
2622
2652
|
clientOrderId = self.safe_string_2(params, 'clientOid', 'clientOrderId')
|
2623
2653
|
stop = self.safe_bool_2(params, 'stop', 'trigger', False)
|
2624
|
-
hf =
|
2654
|
+
hf = None
|
2655
|
+
hf, params = self.handle_hf_and_params(params)
|
2625
2656
|
market = None
|
2626
2657
|
if symbol is not None:
|
2627
2658
|
market = self.market(symbol)
|
@@ -2629,7 +2660,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2629
2660
|
if symbol is None:
|
2630
2661
|
raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol parameter for hf orders')
|
2631
2662
|
request['symbol'] = market['id']
|
2632
|
-
params = self.omit(params, ['stop', '
|
2663
|
+
params = self.omit(params, ['stop', 'clientOid', 'clientOrderId', 'trigger'])
|
2633
2664
|
response = None
|
2634
2665
|
if clientOrderId is not None:
|
2635
2666
|
request['clientOid'] = clientOrderId
|
@@ -2871,7 +2902,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2871
2902
|
if paginate:
|
2872
2903
|
return self.fetch_paginated_call_dynamic('fetchMyTrades', symbol, since, limit, params)
|
2873
2904
|
request: dict = {}
|
2874
|
-
hf =
|
2905
|
+
hf = None
|
2906
|
+
hf, params = self.handle_hf_and_params(params)
|
2875
2907
|
if hf and symbol is None:
|
2876
2908
|
raise ArgumentsRequired(self.id + ' fetchMyTrades() requires a symbol parameter for hf orders')
|
2877
2909
|
market = None
|
@@ -3543,10 +3575,10 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3543
3575
|
accountsByType = self.safe_dict(self.options, 'accountsByType')
|
3544
3576
|
type = self.safe_string(accountsByType, requestedType, requestedType)
|
3545
3577
|
params = self.omit(params, 'type')
|
3546
|
-
|
3547
|
-
|
3578
|
+
hf = None
|
3579
|
+
hf, params = self.handle_hf_and_params(params)
|
3580
|
+
if hf:
|
3548
3581
|
type = 'trade_hf'
|
3549
|
-
params = self.omit(params, 'hf')
|
3550
3582
|
marginMode, query = self.handle_margin_mode_and_params('fetchBalance', params)
|
3551
3583
|
response = None
|
3552
3584
|
request: dict = {}
|
@@ -3972,8 +4004,8 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3972
4004
|
self.load_accounts()
|
3973
4005
|
paginate = False
|
3974
4006
|
paginate, params = self.handle_option_and_params(params, 'fetchLedger', 'paginate')
|
3975
|
-
|
3976
|
-
params = self.
|
4007
|
+
hf = None
|
4008
|
+
hf, params = self.handle_hf_and_params(params)
|
3977
4009
|
if paginate:
|
3978
4010
|
return self.fetch_paginated_call_dynamic('fetchLedger', code, since, limit, params)
|
3979
4011
|
request: dict = {
|
@@ -3994,7 +4026,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
3994
4026
|
marginMode = None
|
3995
4027
|
marginMode, params = self.handle_margin_mode_and_params('fetchLedger', params)
|
3996
4028
|
response = None
|
3997
|
-
if
|
4029
|
+
if hf:
|
3998
4030
|
if marginMode is not None:
|
3999
4031
|
response = self.privateGetHfMarginAccountLedgers(self.extend(request, params))
|
4000
4032
|
else:
|
ccxt/kucoinfutures.py
CHANGED
@@ -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
|
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 = self.futuresPublicGetAllTickers(params)
|
766
|
+
else:
|
767
|
+
response = 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
|
+
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 self.fetch_tickers(symbols, self.extend(request, params))
|
951
|
+
|
932
952
|
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/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/okx.py
CHANGED
@@ -1062,6 +1062,7 @@ class okx(Exchange, ImplicitAPI):
|
|
1062
1062
|
'ZEC': 'Zcash',
|
1063
1063
|
'ZIL': 'Zilliqa',
|
1064
1064
|
'ZKSYNC': 'ZKSYNC',
|
1065
|
+
'OMNI': 'Omni',
|
1065
1066
|
# 'NEON3': 'N3', # tbd
|
1066
1067
|
# undetermined : "CELO-TOKEN", "Digital Cash", Khala
|
1067
1068
|
# todo: uncomment below after consensus
|
@@ -1588,14 +1589,6 @@ class okx(Exchange, ImplicitAPI):
|
|
1588
1589
|
dataResponse = self.safe_list(response, 'data', [])
|
1589
1590
|
return self.parse_markets(dataResponse)
|
1590
1591
|
|
1591
|
-
def safe_network(self, networkId):
|
1592
|
-
networksById: dict = {
|
1593
|
-
'Bitcoin': 'BTC',
|
1594
|
-
'Omni': 'OMNI',
|
1595
|
-
'TRON': 'TRC20',
|
1596
|
-
}
|
1597
|
-
return self.safe_string(networksById, networkId, networkId)
|
1598
|
-
|
1599
1592
|
def fetch_currencies(self, params={}) -> Currencies:
|
1600
1593
|
"""
|
1601
1594
|
fetches all available currencies on an exchange
|