ccxt 4.3.47__py2.py3-none-any.whl → 4.3.49__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/krakenfutures.py +4 -0
- ccxt/ace.py +4 -6
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ace.py +4 -6
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +19 -22
- ccxt/async_support/bitso.py +13 -1
- ccxt/async_support/gate.py +92 -48
- ccxt/async_support/hyperliquid.py +13 -2
- ccxt/async_support/kraken.py +4 -3
- ccxt/async_support/krakenfutures.py +5 -1
- ccxt/async_support/woo.py +4 -0
- ccxt/base/exchange.py +1 -1
- ccxt/binance.py +19 -22
- ccxt/bitso.py +13 -1
- ccxt/gate.py +92 -48
- ccxt/hyperliquid.py +13 -2
- ccxt/kraken.py +4 -3
- ccxt/krakenfutures.py +5 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bingx.py +5 -5
- ccxt/pro/coinbaseinternational.py +5 -0
- ccxt/pro/gate.py +342 -34
- ccxt/test/base/test_order_book.py +1 -1
- ccxt/woo.py +4 -0
- {ccxt-4.3.47.dist-info → ccxt-4.3.49.dist-info}/METADATA +4 -4
- {ccxt-4.3.47.dist-info → ccxt-4.3.49.dist-info}/RECORD +30 -30
- {ccxt-4.3.47.dist-info → ccxt-4.3.49.dist-info}/WHEEL +0 -0
- {ccxt-4.3.47.dist-info → ccxt-4.3.49.dist-info}/top_level.txt +0 -0
ccxt/binance.py
CHANGED
@@ -33,7 +33,7 @@ from ccxt.base.errors import OnMaintenance
|
|
33
33
|
from ccxt.base.errors import InvalidNonce
|
34
34
|
from ccxt.base.errors import RequestTimeout
|
35
35
|
from ccxt.base.decimal_to_precision import TRUNCATE
|
36
|
-
from ccxt.base.decimal_to_precision import
|
36
|
+
from ccxt.base.decimal_to_precision import TICK_SIZE
|
37
37
|
from ccxt.base.precise import Precise
|
38
38
|
|
39
39
|
|
@@ -1203,7 +1203,7 @@ class binance(Exchange, ImplicitAPI):
|
|
1203
1203
|
'BCC': 'BCC', # kept for backward-compatibility https://github.com/ccxt/ccxt/issues/4848
|
1204
1204
|
'YOYO': 'YOYOW',
|
1205
1205
|
},
|
1206
|
-
'precisionMode':
|
1206
|
+
'precisionMode': TICK_SIZE,
|
1207
1207
|
# exchange-specific options
|
1208
1208
|
'options': {
|
1209
1209
|
'sandboxMode': False,
|
@@ -2770,7 +2770,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2770
2770
|
'deposit': depositEnable,
|
2771
2771
|
'withdraw': withdrawEnable,
|
2772
2772
|
'fee': self.parse_number(fee),
|
2773
|
-
'precision':
|
2773
|
+
'precision': self.parse_number(precisionTick),
|
2774
2774
|
'limits': {
|
2775
2775
|
'withdraw': {
|
2776
2776
|
'min': self.safe_number(networkItem, 'withdrawMin'),
|
@@ -2784,14 +2784,11 @@ class binance(Exchange, ImplicitAPI):
|
|
2784
2784
|
}
|
2785
2785
|
trading = self.safe_bool(entry, 'trading')
|
2786
2786
|
active = (isWithdrawEnabled and isDepositEnabled and trading)
|
2787
|
-
maxDecimalPlaces = None
|
2788
|
-
if minPrecision is not None:
|
2789
|
-
maxDecimalPlaces = int(self.number_to_string(self.precision_from_string(minPrecision)))
|
2790
2787
|
result[code] = {
|
2791
2788
|
'id': id,
|
2792
2789
|
'name': name,
|
2793
2790
|
'code': code,
|
2794
|
-
'precision':
|
2791
|
+
'precision': self.parse_number(minPrecision),
|
2795
2792
|
'info': entry,
|
2796
2793
|
'active': active,
|
2797
2794
|
'deposit': isDepositEnabled,
|
@@ -3147,10 +3144,10 @@ class binance(Exchange, ImplicitAPI):
|
|
3147
3144
|
'strike': parsedStrike,
|
3148
3145
|
'optionType': self.safe_string_lower(market, 'side'),
|
3149
3146
|
'precision': {
|
3150
|
-
'amount': self.
|
3151
|
-
'price': self.
|
3152
|
-
'base': self.
|
3153
|
-
'quote': self.
|
3147
|
+
'amount': self.parse_number(self.parse_precision(self.safe_string_2(market, 'quantityPrecision', 'quantityScale'))),
|
3148
|
+
'price': self.parse_number(self.parse_precision(self.safe_string_2(market, 'pricePrecision', 'priceScale'))),
|
3149
|
+
'base': self.parse_number(self.parse_precision(self.safe_string(market, 'baseAssetPrecision'))),
|
3150
|
+
'quote': self.parse_number(self.parse_precision(self.safe_string(market, 'quotePrecision'))),
|
3154
3151
|
},
|
3155
3152
|
'limits': {
|
3156
3153
|
'leverage': {
|
@@ -3183,11 +3180,10 @@ class binance(Exchange, ImplicitAPI):
|
|
3183
3180
|
'min': self.safe_number(filter, 'minPrice'),
|
3184
3181
|
'max': self.safe_number(filter, 'maxPrice'),
|
3185
3182
|
}
|
3186
|
-
entry['precision']['price'] = self.
|
3183
|
+
entry['precision']['price'] = self.safe_number(filter, 'tickSize')
|
3187
3184
|
if 'LOT_SIZE' in filtersByType:
|
3188
3185
|
filter = self.safe_dict(filtersByType, 'LOT_SIZE', {})
|
3189
|
-
|
3190
|
-
entry['precision']['amount'] = self.precision_from_string(stepSize)
|
3186
|
+
entry['precision']['amount'] = self.safe_number(filter, 'stepSize')
|
3191
3187
|
entry['limits']['amount'] = {
|
3192
3188
|
'min': self.safe_number(filter, 'minQty'),
|
3193
3189
|
'max': self.safe_number(filter, 'maxQty'),
|
@@ -5836,7 +5832,7 @@ class binance(Exchange, ImplicitAPI):
|
|
5836
5832
|
market = self.market(symbol)
|
5837
5833
|
if not market['spot']:
|
5838
5834
|
raise NotSupported(self.id + ' createMarketOrderWithCost() supports spot orders only')
|
5839
|
-
params['
|
5835
|
+
params['cost'] = cost
|
5840
5836
|
return self.create_order(symbol, 'market', side, cost, None, params)
|
5841
5837
|
|
5842
5838
|
def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
|
@@ -5852,7 +5848,7 @@ class binance(Exchange, ImplicitAPI):
|
|
5852
5848
|
market = self.market(symbol)
|
5853
5849
|
if not market['spot']:
|
5854
5850
|
raise NotSupported(self.id + ' createMarketBuyOrderWithCost() supports spot orders only')
|
5855
|
-
params['
|
5851
|
+
params['cost'] = cost
|
5856
5852
|
return self.create_order(symbol, 'market', 'buy', cost, None, params)
|
5857
5853
|
|
5858
5854
|
def create_market_sell_order_with_cost(self, symbol: str, cost: float, params={}):
|
@@ -7376,6 +7372,8 @@ class binance(Exchange, ImplicitAPI):
|
|
7376
7372
|
return self.parse_transactions(response, currency, since, limit)
|
7377
7373
|
|
7378
7374
|
def parse_transaction_status_by_type(self, status, type=None):
|
7375
|
+
if type is None:
|
7376
|
+
return status
|
7379
7377
|
statusesByType: dict = {
|
7380
7378
|
'deposit': {
|
7381
7379
|
'0': 'pending',
|
@@ -8200,7 +8198,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8200
8198
|
request: dict = {
|
8201
8199
|
'coin': currency['id'],
|
8202
8200
|
'address': address,
|
8203
|
-
'amount': amount,
|
8201
|
+
'amount': self.currency_to_precision(code, amount),
|
8204
8202
|
# https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi
|
8205
8203
|
# issue sapiGetCapitalConfigGetall() to get networks for withdrawing USDT ERC20 vs USDT Omni
|
8206
8204
|
# 'network': 'ETH', # 'BTC', 'TRX', etc, optional
|
@@ -8900,7 +8898,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8900
8898
|
leftSide = Precise.string_mul(size, onePlusMaintenanceMarginPercentageString)
|
8901
8899
|
rightSide = Precise.string_sub(Precise.string_mul(Precise.string_div('1', entryPriceSignString), size), walletBalance)
|
8902
8900
|
liquidationPriceStringRaw = Precise.string_div(leftSide, rightSide)
|
8903
|
-
pricePrecision = market['precision']
|
8901
|
+
pricePrecision = self.precision_from_string(self.safe_string(market['precision'], 'price'))
|
8904
8902
|
pricePrecisionPlusOne = pricePrecision + 1
|
8905
8903
|
pricePrecisionPlusOneString = str(pricePrecisionPlusOne)
|
8906
8904
|
# round half up
|
@@ -9065,8 +9063,7 @@ class binance(Exchange, ImplicitAPI):
|
|
9065
9063
|
onePlusMaintenanceMarginPercentageString = Precise.string_add('-1', maintenanceMarginPercentageString)
|
9066
9064
|
inner = Precise.string_mul(liquidationPriceString, onePlusMaintenanceMarginPercentageString)
|
9067
9065
|
leftSide = Precise.string_add(inner, entryPriceSignString)
|
9068
|
-
|
9069
|
-
quotePrecision = self.safe_integer(precision, 'quote', pricePrecision)
|
9066
|
+
quotePrecision = self.precision_from_string(self.safe_string_2(precision, 'quote', 'price'))
|
9070
9067
|
if quotePrecision is not None:
|
9071
9068
|
collateralString = Precise.string_div(Precise.string_mul(leftSide, contractsAbs), '1', quotePrecision)
|
9072
9069
|
else:
|
@@ -9080,7 +9077,7 @@ class binance(Exchange, ImplicitAPI):
|
|
9080
9077
|
entryPriceSignString = Precise.string_mul('-1', entryPriceSignString)
|
9081
9078
|
leftSide = Precise.string_mul(contractsAbs, contractSizeString)
|
9082
9079
|
rightSide = Precise.string_sub(Precise.string_div('1', entryPriceSignString), Precise.string_div(onePlusMaintenanceMarginPercentageString, liquidationPriceString))
|
9083
|
-
basePrecision = self.
|
9080
|
+
basePrecision = self.precision_from_string(self.safe_string(precision, 'base'))
|
9084
9081
|
if basePrecision is not None:
|
9085
9082
|
collateralString = Precise.string_div(Precise.string_mul(leftSide, rightSide), '1', basePrecision)
|
9086
9083
|
else:
|
@@ -11887,7 +11884,7 @@ class binance(Exchange, ImplicitAPI):
|
|
11887
11884
|
'deposit': None,
|
11888
11885
|
'withdraw': None,
|
11889
11886
|
'fee': None,
|
11890
|
-
'precision': self.
|
11887
|
+
'precision': self.parse_number(self.parse_precision(self.safe_string(entry, 'fraction'))),
|
11891
11888
|
'limits': {
|
11892
11889
|
'amount': {
|
11893
11890
|
'min': None,
|
ccxt/bitso.py
CHANGED
@@ -962,7 +962,19 @@ class bitso(Exchange, ImplicitAPI):
|
|
962
962
|
request: dict = {
|
963
963
|
'oid': id,
|
964
964
|
}
|
965
|
-
|
965
|
+
response = self.privateDeleteOrdersOid(self.extend(request, params))
|
966
|
+
#
|
967
|
+
# {
|
968
|
+
# "success": True,
|
969
|
+
# "payload": ["yWTQGxDMZ0VimZgZ"]
|
970
|
+
# }
|
971
|
+
#
|
972
|
+
payload = self.safe_list(response, 'payload', [])
|
973
|
+
orderId = self.safe_string(payload, 0)
|
974
|
+
return self.safe_order({
|
975
|
+
'info': response,
|
976
|
+
'id': orderId,
|
977
|
+
})
|
966
978
|
|
967
979
|
def cancel_orders(self, ids, symbol: Str = None, params={}):
|
968
980
|
"""
|
ccxt/gate.py
CHANGED
@@ -797,6 +797,7 @@ class gate(Exchange, ImplicitAPI):
|
|
797
797
|
'NOT_ACCEPTABLE': BadRequest,
|
798
798
|
'METHOD_NOT_ALLOWED': BadRequest,
|
799
799
|
'NOT_FOUND': ExchangeError,
|
800
|
+
'AUTHENTICATION_FAILED': AuthenticationError,
|
800
801
|
'INVALID_CREDENTIALS': AuthenticationError,
|
801
802
|
'INVALID_KEY': AuthenticationError,
|
802
803
|
'IP_FORBIDDEN': AuthenticationError,
|
@@ -3668,17 +3669,14 @@ class gate(Exchange, ImplicitAPI):
|
|
3668
3669
|
#
|
3669
3670
|
return self.parse_order(response, market)
|
3670
3671
|
|
3671
|
-
def
|
3672
|
-
"""
|
3673
|
-
create a list of trade orders
|
3674
|
-
:see: https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-2
|
3675
|
-
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-orders
|
3676
|
-
:param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
3677
|
-
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3678
|
-
"""
|
3679
|
-
self.load_markets()
|
3672
|
+
def create_orders_request(self, orders: List[OrderRequest], params={}):
|
3680
3673
|
ordersRequests = []
|
3681
3674
|
orderSymbols = []
|
3675
|
+
ordersLength = len(orders)
|
3676
|
+
if ordersLength == 0:
|
3677
|
+
raise BadRequest(self.id + ' createOrders() requires at least one order')
|
3678
|
+
if ordersLength > 10:
|
3679
|
+
raise BadRequest(self.id + ' createOrders() accepts a maximum of 10 orders at a time')
|
3682
3680
|
for i in range(0, len(orders)):
|
3683
3681
|
rawOrder = orders[i]
|
3684
3682
|
marketId = self.safe_string(rawOrder, 'symbol')
|
@@ -3699,6 +3697,21 @@ class gate(Exchange, ImplicitAPI):
|
|
3699
3697
|
market = self.market(symbols[0])
|
3700
3698
|
if market['future'] or market['option']:
|
3701
3699
|
raise NotSupported(self.id + ' createOrders() does not support futures or options markets')
|
3700
|
+
return ordersRequests
|
3701
|
+
|
3702
|
+
def create_orders(self, orders: List[OrderRequest], params={}):
|
3703
|
+
"""
|
3704
|
+
create a list of trade orders
|
3705
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-2
|
3706
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-orders
|
3707
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-futures-orders
|
3708
|
+
:param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
3709
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3710
|
+
"""
|
3711
|
+
self.load_markets()
|
3712
|
+
ordersRequests = self.create_orders_request(orders, params)
|
3713
|
+
firstOrder = orders[0]
|
3714
|
+
market = self.market(firstOrder['symbol'])
|
3702
3715
|
response = None
|
3703
3716
|
if market['spot']:
|
3704
3717
|
response = self.privateSpotPostBatchOrders(ordersRequests)
|
@@ -3929,21 +3942,7 @@ class gate(Exchange, ImplicitAPI):
|
|
3929
3942
|
params['createMarketBuyOrderRequiresPrice'] = False
|
3930
3943
|
return self.create_order(symbol, 'market', 'buy', cost, None, params)
|
3931
3944
|
|
3932
|
-
def
|
3933
|
-
"""
|
3934
|
-
edit a trade order, gate currently only supports the modification of the price or amount fields
|
3935
|
-
:see: https://www.gate.io/docs/developers/apiv4/en/#amend-an-order
|
3936
|
-
:see: https://www.gate.io/docs/developers/apiv4/en/#amend-an-order-2
|
3937
|
-
:param str id: order id
|
3938
|
-
:param str symbol: unified symbol of the market to create an order in
|
3939
|
-
:param str type: 'market' or 'limit'
|
3940
|
-
:param str side: 'buy' or 'sell'
|
3941
|
-
:param float amount: how much of the currency you want to trade in units of the base currency
|
3942
|
-
:param float [price]: the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
3943
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3944
|
-
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3945
|
-
"""
|
3946
|
-
self.load_markets()
|
3945
|
+
def edit_order_request(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
3947
3946
|
market = self.market(symbol)
|
3948
3947
|
marketType, query = self.handle_market_type_and_params('editOrder', market, params)
|
3949
3948
|
account = self.convert_type_to_account(marketType)
|
@@ -3953,7 +3952,7 @@ class gate(Exchange, ImplicitAPI):
|
|
3953
3952
|
# exchange doesn't have market orders for spot
|
3954
3953
|
raise InvalidOrder(self.id + ' editOrder() does not support ' + type + ' orders for ' + marketType + ' markets')
|
3955
3954
|
request: dict = {
|
3956
|
-
'order_id': id,
|
3955
|
+
'order_id': str(id),
|
3957
3956
|
'currency_pair': market['id'],
|
3958
3957
|
'account': account,
|
3959
3958
|
}
|
@@ -3967,12 +3966,32 @@ class gate(Exchange, ImplicitAPI):
|
|
3967
3966
|
request['size'] = self.amount_to_precision(symbol, amount)
|
3968
3967
|
if price is not None:
|
3969
3968
|
request['price'] = self.price_to_precision(symbol, price)
|
3969
|
+
if not market['spot']:
|
3970
|
+
request['settle'] = market['settleId']
|
3971
|
+
return self.extend(request, query)
|
3972
|
+
|
3973
|
+
def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
3974
|
+
"""
|
3975
|
+
edit a trade order, gate currently only supports the modification of the price or amount fields
|
3976
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#amend-an-order
|
3977
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#amend-an-order-2
|
3978
|
+
:param str id: order id
|
3979
|
+
:param str symbol: unified symbol of the market to create an order in
|
3980
|
+
:param str type: 'market' or 'limit'
|
3981
|
+
:param str side: 'buy' or 'sell'
|
3982
|
+
:param float amount: how much of the currency you want to trade in units of the base currency
|
3983
|
+
:param float [price]: the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
3984
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3985
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3986
|
+
"""
|
3987
|
+
self.load_markets()
|
3988
|
+
market = self.market(symbol)
|
3989
|
+
extendedRequest = self.edit_order_request(id, symbol, type, side, amount, price, params)
|
3970
3990
|
response = None
|
3971
3991
|
if market['spot']:
|
3972
|
-
response = self.privateSpotPatchOrdersOrderId(
|
3992
|
+
response = self.privateSpotPatchOrdersOrderId(extendedRequest)
|
3973
3993
|
else:
|
3974
|
-
|
3975
|
-
response = self.privateFuturesPutSettleOrdersOrderId(self.extend(request, query))
|
3994
|
+
response = self.privateFuturesPutSettleOrdersOrderId(extendedRequest)
|
3976
3995
|
#
|
3977
3996
|
# {
|
3978
3997
|
# "id": "243233276443",
|
@@ -4273,6 +4292,23 @@ class gate(Exchange, ImplicitAPI):
|
|
4273
4292
|
'info': order,
|
4274
4293
|
}, market)
|
4275
4294
|
|
4295
|
+
def fetch_order_request(self, id: str, symbol: Str = None, params={}):
|
4296
|
+
market = None if (symbol is None) else self.market(symbol)
|
4297
|
+
stop = self.safe_bool_n(params, ['trigger', 'is_stop_order', 'stop'], False)
|
4298
|
+
params = self.omit(params, ['is_stop_order', 'stop', 'trigger'])
|
4299
|
+
clientOrderId = self.safe_string_2(params, 'text', 'clientOrderId')
|
4300
|
+
orderId = id
|
4301
|
+
if clientOrderId is not None:
|
4302
|
+
params = self.omit(params, ['text', 'clientOrderId'])
|
4303
|
+
if clientOrderId[0] != 't':
|
4304
|
+
clientOrderId = 't-' + clientOrderId
|
4305
|
+
orderId = clientOrderId
|
4306
|
+
type, query = self.handle_market_type_and_params('fetchOrder', market, params)
|
4307
|
+
contract = (type == 'swap') or (type == 'future') or (type == 'option')
|
4308
|
+
request, requestParams = self.prepare_request(market, type, query) if contract else self.spot_order_prepare_request(market, stop, query)
|
4309
|
+
request['order_id'] = str(orderId)
|
4310
|
+
return [request, requestParams]
|
4311
|
+
|
4276
4312
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
4277
4313
|
"""
|
4278
4314
|
Retrieves information on an order
|
@@ -4283,27 +4319,18 @@ class gate(Exchange, ImplicitAPI):
|
|
4283
4319
|
:param str id: Order id
|
4284
4320
|
:param str symbol: Unified market symbol, *required for spot and margin*
|
4285
4321
|
:param dict [params]: Parameters specified by the exchange api
|
4286
|
-
:param bool [params.
|
4322
|
+
:param bool [params.trigger]: True if the order being fetched is a trigger order
|
4287
4323
|
:param str [params.marginMode]: 'cross' or 'isolated' - marginMode for margin trading if not provided self.options['defaultMarginMode'] is used
|
4288
4324
|
:param str [params.type]: 'spot', 'swap', or 'future', if not provided self.options['defaultMarginMode'] is used
|
4289
4325
|
:param str [params.settle]: 'btc' or 'usdt' - settle currency for perpetual swap and future - market settle currency is used if symbol is not None, default="usdt" for swap and "btc" for future
|
4290
4326
|
:returns: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
4291
4327
|
"""
|
4292
4328
|
self.load_markets()
|
4293
|
-
stop = self.safe_value_2(params, 'is_stop_order', 'stop', False)
|
4294
|
-
params = self.omit(params, ['is_stop_order', 'stop'])
|
4295
|
-
clientOrderId = self.safe_string_2(params, 'text', 'clientOrderId')
|
4296
|
-
orderId = id
|
4297
|
-
if clientOrderId is not None:
|
4298
|
-
params = self.omit(params, ['text', 'clientOrderId'])
|
4299
|
-
if clientOrderId[0] != 't':
|
4300
|
-
clientOrderId = 't-' + clientOrderId
|
4301
|
-
orderId = clientOrderId
|
4302
4329
|
market = None if (symbol is None) else self.market(symbol)
|
4303
|
-
|
4304
|
-
|
4305
|
-
|
4306
|
-
request
|
4330
|
+
result = self.handle_market_type_and_params('fetchOrder', market, params)
|
4331
|
+
type = self.safe_string(result, 0)
|
4332
|
+
stop = self.safe_bool_n(params, ['trigger', 'is_stop_order', 'stop'], False)
|
4333
|
+
request, requestParams = self.fetch_order_request(id, symbol, params)
|
4307
4334
|
response = None
|
4308
4335
|
if type == 'spot' or type == 'margin':
|
4309
4336
|
if stop:
|
@@ -4362,14 +4389,13 @@ class gate(Exchange, ImplicitAPI):
|
|
4362
4389
|
"""
|
4363
4390
|
return self.fetch_orders_by_status('finished', symbol, since, limit, params)
|
4364
4391
|
|
4365
|
-
def
|
4366
|
-
self.load_markets()
|
4392
|
+
def fetch_orders_by_status_request(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
4367
4393
|
market = None
|
4368
4394
|
if symbol is not None:
|
4369
4395
|
market = self.market(symbol)
|
4370
4396
|
symbol = market['symbol']
|
4371
|
-
stop = self.
|
4372
|
-
params = self.omit(params, 'stop')
|
4397
|
+
stop = self.safe_bool_2(params, 'stop', 'trigger')
|
4398
|
+
params = self.omit(params, ['stop', 'trigger'])
|
4373
4399
|
type, query = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
|
4374
4400
|
spot = (type == 'spot') or (type == 'margin')
|
4375
4401
|
request, requestParams = self.multi_order_spot_prepare_request(market, stop, query) if spot else self.prepare_request(market, type, query)
|
@@ -4380,6 +4406,24 @@ class gate(Exchange, ImplicitAPI):
|
|
4380
4406
|
request['limit'] = limit
|
4381
4407
|
if since is not None and spot:
|
4382
4408
|
request['from'] = self.parse_to_int(since / 1000)
|
4409
|
+
lastId, finalParams = self.handle_param_string_2(requestParams, 'lastId', 'last_id')
|
4410
|
+
if lastId is not None:
|
4411
|
+
request['last_id'] = lastId
|
4412
|
+
return [request, finalParams]
|
4413
|
+
|
4414
|
+
def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
4415
|
+
self.load_markets()
|
4416
|
+
market = None
|
4417
|
+
if symbol is not None:
|
4418
|
+
market = self.market(symbol)
|
4419
|
+
symbol = market['symbol']
|
4420
|
+
stop = self.safe_bool_2(params, 'stop', 'trigger')
|
4421
|
+
params = self.omit(params, ['trigger', 'stop'])
|
4422
|
+
res = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
|
4423
|
+
type = self.safe_string(res, 0)
|
4424
|
+
params['type'] = type
|
4425
|
+
request, requestParams = self.fetch_orders_by_status_request(status, symbol, since, limit, params)
|
4426
|
+
spot = (type == 'spot') or (type == 'margin')
|
4383
4427
|
openSpotOrders = spot and (status == 'open') and not stop
|
4384
4428
|
response = None
|
4385
4429
|
if type == 'spot' or type == 'margin':
|
@@ -4573,8 +4617,8 @@ class gate(Exchange, ImplicitAPI):
|
|
4573
4617
|
"""
|
4574
4618
|
self.load_markets()
|
4575
4619
|
market = None if (symbol is None) else self.market(symbol)
|
4576
|
-
stop = self.
|
4577
|
-
params = self.omit(params, ['is_stop_order', 'stop'])
|
4620
|
+
stop = self.safe_bool_n(params, ['is_stop_order', 'stop', 'trigger'], False)
|
4621
|
+
params = self.omit(params, ['is_stop_order', 'stop', 'trigger'])
|
4578
4622
|
type, query = self.handle_market_type_and_params('cancelOrder', market, params)
|
4579
4623
|
request, requestParams = self.spot_order_prepare_request(market, stop, query) if (type == 'spot' or type == 'margin') else self.prepare_request(market, type, query)
|
4580
4624
|
request['order_id'] = id
|
ccxt/hyperliquid.py
CHANGED
@@ -1169,7 +1169,8 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1169
1169
|
:param str [params.vaultAddress]: the vault address for order
|
1170
1170
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1171
1171
|
"""
|
1172
|
-
|
1172
|
+
orders = self.cancel_orders([id], symbol, params)
|
1173
|
+
return self.safe_dict(orders, 0)
|
1173
1174
|
|
1174
1175
|
def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
|
1175
1176
|
"""
|
@@ -1239,7 +1240,17 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1239
1240
|
# }
|
1240
1241
|
# }
|
1241
1242
|
#
|
1242
|
-
|
1243
|
+
innerResponse = self.safe_dict(response, 'response')
|
1244
|
+
data = self.safe_dict(innerResponse, 'data')
|
1245
|
+
statuses = self.safe_list(data, 'statuses')
|
1246
|
+
orders = []
|
1247
|
+
for i in range(0, len(statuses)):
|
1248
|
+
status = statuses[i]
|
1249
|
+
orders.append(self.safe_order({
|
1250
|
+
'info': status,
|
1251
|
+
'status': status,
|
1252
|
+
}))
|
1253
|
+
return orders
|
1243
1254
|
|
1244
1255
|
def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
|
1245
1256
|
"""
|
ccxt/kraken.py
CHANGED
@@ -1639,6 +1639,7 @@ class kraken(Exchange, ImplicitAPI):
|
|
1639
1639
|
'filled': filled,
|
1640
1640
|
'average': average,
|
1641
1641
|
'remaining': None,
|
1642
|
+
'reduceOnly': self.safe_bool_2(order, 'reduceOnly', 'reduce_only'),
|
1642
1643
|
'fee': fee,
|
1643
1644
|
'trades': trades,
|
1644
1645
|
}, market)
|
@@ -1993,7 +1994,7 @@ class kraken(Exchange, ImplicitAPI):
|
|
1993
1994
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
1994
1995
|
"""
|
1995
1996
|
cancels an open order
|
1996
|
-
:see: https://docs.kraken.com/rest/#tag/Trading/operation/cancelOrder
|
1997
|
+
:see: https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelOrder
|
1997
1998
|
:param str id: order id
|
1998
1999
|
:param str symbol: unified symbol of the market the order was made in
|
1999
2000
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2028,7 +2029,7 @@ class kraken(Exchange, ImplicitAPI):
|
|
2028
2029
|
def cancel_orders(self, ids, symbol: Str = None, params={}):
|
2029
2030
|
"""
|
2030
2031
|
cancel multiple orders
|
2031
|
-
:see: https://docs.kraken.com/rest/#tag/Trading/operation/cancelOrderBatch
|
2032
|
+
:see: https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelOrderBatch
|
2032
2033
|
:param str[] ids: open orders transaction ID(txid) or user reference(userref)
|
2033
2034
|
:param str symbol: unified market symbol
|
2034
2035
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2055,7 +2056,7 @@ class kraken(Exchange, ImplicitAPI):
|
|
2055
2056
|
def cancel_all_orders(self, symbol: Str = None, params={}):
|
2056
2057
|
"""
|
2057
2058
|
cancel all open orders
|
2058
|
-
:see: https://docs.kraken.com/rest/#tag/Trading/operation/cancelAllOrders
|
2059
|
+
:see: https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelAllOrders
|
2059
2060
|
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
2060
2061
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2061
2062
|
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
ccxt/krakenfutures.py
CHANGED
@@ -136,6 +136,8 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
136
136
|
'transfers',
|
137
137
|
'leveragepreferences',
|
138
138
|
'pnlpreferences',
|
139
|
+
'assignmentprogram/current',
|
140
|
+
'assignmentprogram/history',
|
139
141
|
],
|
140
142
|
'post': [
|
141
143
|
'sendorder',
|
@@ -146,6 +148,8 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
146
148
|
'cancelallorders',
|
147
149
|
'cancelallordersafter',
|
148
150
|
'withdrawal', # for futures wallet -> kraken spot wallet
|
151
|
+
'assignmentprogram/add',
|
152
|
+
'assignmentprogram/delete',
|
149
153
|
],
|
150
154
|
'put': [
|
151
155
|
'leveragepreferences',
|
@@ -1758,7 +1762,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1758
1762
|
'type': self.parse_order_type(type),
|
1759
1763
|
'timeInForce': timeInForce,
|
1760
1764
|
'postOnly': type == 'post',
|
1761
|
-
'reduceOnly': self.
|
1765
|
+
'reduceOnly': self.safe_bool_2(details, 'reduceOnly', 'reduce_only'),
|
1762
1766
|
'side': self.safe_string(details, 'side'),
|
1763
1767
|
'price': price,
|
1764
1768
|
'stopPrice': self.safe_string(details, 'triggerPrice'),
|
ccxt/pro/__init__.py
CHANGED
ccxt/pro/bingx.py
CHANGED
@@ -693,14 +693,14 @@ class bingx(ccxt.async_support.bingx):
|
|
693
693
|
# ]
|
694
694
|
# }
|
695
695
|
#
|
696
|
-
|
696
|
+
isSwap = client.url.find('swap') >= 0
|
697
697
|
candles = None
|
698
|
-
if
|
699
|
-
candles = data
|
698
|
+
if isSwap:
|
699
|
+
candles = self.safe_list(message, 'data', [])
|
700
700
|
else:
|
701
|
-
|
701
|
+
data = self.safe_dict(message, 'data', {})
|
702
|
+
candles = [self.safe_dict(data, 'K', {})]
|
702
703
|
dataType = self.safe_string(message, 'dataType')
|
703
|
-
isSwap = client.url.find('swap') >= 0
|
704
704
|
parts = dataType.split('@')
|
705
705
|
firstPart = parts[0]
|
706
706
|
isAllEndpoint = (firstPart == 'all')
|
@@ -76,6 +76,7 @@ class coinbaseinternational(ccxt.async_support.coinbaseinternational):
|
|
76
76
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
77
77
|
:returns dict: subscription to a websocket channel
|
78
78
|
"""
|
79
|
+
await self.load_markets()
|
79
80
|
self.check_required_credentials()
|
80
81
|
market = None
|
81
82
|
messageHash = name
|
@@ -119,6 +120,7 @@ class coinbaseinternational(ccxt.async_support.coinbaseinternational):
|
|
119
120
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
120
121
|
:returns dict: subscription to a websocket channel
|
121
122
|
"""
|
123
|
+
await self.load_markets()
|
122
124
|
self.check_required_credentials()
|
123
125
|
if self.is_empty(symbols):
|
124
126
|
symbols = self.symbols
|
@@ -156,6 +158,7 @@ class coinbaseinternational(ccxt.async_support.coinbaseinternational):
|
|
156
158
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
157
159
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
158
160
|
"""
|
161
|
+
await self.load_markets()
|
159
162
|
return await self.subscribe('RISK', [symbol], params)
|
160
163
|
|
161
164
|
async def watch_funding_rates(self, symbols: List[str], params={}) -> FundingRates:
|
@@ -166,6 +169,7 @@ class coinbaseinternational(ccxt.async_support.coinbaseinternational):
|
|
166
169
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
167
170
|
:returns dict: a dictionary of `funding rates structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexe by market symbols
|
168
171
|
"""
|
172
|
+
await self.load_markets()
|
169
173
|
fundingRate = await self.subscribe_multiple('RISK', symbols, params)
|
170
174
|
symbol = self.safe_string(fundingRate, 'symbol')
|
171
175
|
if self.newUpdates:
|
@@ -182,6 +186,7 @@ class coinbaseinternational(ccxt.async_support.coinbaseinternational):
|
|
182
186
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
183
187
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
184
188
|
"""
|
189
|
+
await self.load_markets()
|
185
190
|
channel = None
|
186
191
|
channel, params = self.handle_option_and_params(params, 'watchTicker', 'channel', 'LEVEL1')
|
187
192
|
return await self.subscribe(channel, [symbol], params)
|