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/__init__.py
CHANGED
ccxt/abstract/krakenfutures.py
CHANGED
@@ -18,6 +18,8 @@ class ImplicitAPI:
|
|
18
18
|
private_get_transfers = privateGetTransfers = Entry('transfers', 'private', 'GET', {})
|
19
19
|
private_get_leveragepreferences = privateGetLeveragepreferences = Entry('leveragepreferences', 'private', 'GET', {})
|
20
20
|
private_get_pnlpreferences = privateGetPnlpreferences = Entry('pnlpreferences', 'private', 'GET', {})
|
21
|
+
private_get_assignmentprogram_current = privateGetAssignmentprogramCurrent = Entry('assignmentprogram/current', 'private', 'GET', {})
|
22
|
+
private_get_assignmentprogram_history = privateGetAssignmentprogramHistory = Entry('assignmentprogram/history', 'private', 'GET', {})
|
21
23
|
private_post_sendorder = privatePostSendorder = Entry('sendorder', 'private', 'POST', {})
|
22
24
|
private_post_editorder = privatePostEditorder = Entry('editorder', 'private', 'POST', {})
|
23
25
|
private_post_cancelorder = privatePostCancelorder = Entry('cancelorder', 'private', 'POST', {})
|
@@ -26,6 +28,8 @@ class ImplicitAPI:
|
|
26
28
|
private_post_cancelallorders = privatePostCancelallorders = Entry('cancelallorders', 'private', 'POST', {})
|
27
29
|
private_post_cancelallordersafter = privatePostCancelallordersafter = Entry('cancelallordersafter', 'private', 'POST', {})
|
28
30
|
private_post_withdrawal = privatePostWithdrawal = Entry('withdrawal', 'private', 'POST', {})
|
31
|
+
private_post_assignmentprogram_add = privatePostAssignmentprogramAdd = Entry('assignmentprogram/add', 'private', 'POST', {})
|
32
|
+
private_post_assignmentprogram_delete = privatePostAssignmentprogramDelete = Entry('assignmentprogram/delete', 'private', 'POST', {})
|
29
33
|
private_put_leveragepreferences = privatePutLeveragepreferences = Entry('leveragepreferences', 'private', 'PUT', {})
|
30
34
|
private_put_pnlpreferences = privatePutPnlpreferences = Entry('pnlpreferences', 'private', 'PUT', {})
|
31
35
|
charts_get_price_type_symbol_interval = chartsGetPriceTypeSymbolInterval = Entry('{price_type}/{symbol}/{interval}', 'charts', 'GET', {})
|
ccxt/ace.py
CHANGED
@@ -977,13 +977,11 @@ class ace(Exchange, ImplicitAPI):
|
|
977
977
|
auth = 'ACE_SIGN' + self.secret
|
978
978
|
data = self.extend({
|
979
979
|
'apiKey': self.apiKey,
|
980
|
-
'timeStamp': nonce,
|
980
|
+
'timeStamp': self.number_to_string(nonce),
|
981
981
|
}, params)
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
key = sortedDataKeys[i]
|
986
|
-
auth += self.safe_string(data, key)
|
982
|
+
sortedData = self.keysort(data)
|
983
|
+
values = list(sortedData.values())
|
984
|
+
auth += ''.join(values)
|
987
985
|
signature = self.hash(self.encode(auth), 'sha256', 'hex')
|
988
986
|
data['signKey'] = signature
|
989
987
|
headers = {
|
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/ace.py
CHANGED
@@ -977,13 +977,11 @@ class ace(Exchange, ImplicitAPI):
|
|
977
977
|
auth = 'ACE_SIGN' + self.secret
|
978
978
|
data = self.extend({
|
979
979
|
'apiKey': self.apiKey,
|
980
|
-
'timeStamp': nonce,
|
980
|
+
'timeStamp': self.number_to_string(nonce),
|
981
981
|
}, params)
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
key = sortedDataKeys[i]
|
986
|
-
auth += self.safe_string(data, key)
|
982
|
+
sortedData = self.keysort(data)
|
983
|
+
values = list(sortedData.values())
|
984
|
+
auth += ''.join(values)
|
987
985
|
signature = self.hash(self.encode(auth), 'sha256', 'hex')
|
988
986
|
data['signKey'] = signature
|
989
987
|
headers = {
|
ccxt/async_support/binance.py
CHANGED
@@ -34,7 +34,7 @@ from ccxt.base.errors import OnMaintenance
|
|
34
34
|
from ccxt.base.errors import InvalidNonce
|
35
35
|
from ccxt.base.errors import RequestTimeout
|
36
36
|
from ccxt.base.decimal_to_precision import TRUNCATE
|
37
|
-
from ccxt.base.decimal_to_precision import
|
37
|
+
from ccxt.base.decimal_to_precision import TICK_SIZE
|
38
38
|
from ccxt.base.precise import Precise
|
39
39
|
|
40
40
|
|
@@ -1204,7 +1204,7 @@ class binance(Exchange, ImplicitAPI):
|
|
1204
1204
|
'BCC': 'BCC', # kept for backward-compatibility https://github.com/ccxt/ccxt/issues/4848
|
1205
1205
|
'YOYO': 'YOYOW',
|
1206
1206
|
},
|
1207
|
-
'precisionMode':
|
1207
|
+
'precisionMode': TICK_SIZE,
|
1208
1208
|
# exchange-specific options
|
1209
1209
|
'options': {
|
1210
1210
|
'sandboxMode': False,
|
@@ -2771,7 +2771,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2771
2771
|
'deposit': depositEnable,
|
2772
2772
|
'withdraw': withdrawEnable,
|
2773
2773
|
'fee': self.parse_number(fee),
|
2774
|
-
'precision':
|
2774
|
+
'precision': self.parse_number(precisionTick),
|
2775
2775
|
'limits': {
|
2776
2776
|
'withdraw': {
|
2777
2777
|
'min': self.safe_number(networkItem, 'withdrawMin'),
|
@@ -2785,14 +2785,11 @@ class binance(Exchange, ImplicitAPI):
|
|
2785
2785
|
}
|
2786
2786
|
trading = self.safe_bool(entry, 'trading')
|
2787
2787
|
active = (isWithdrawEnabled and isDepositEnabled and trading)
|
2788
|
-
maxDecimalPlaces = None
|
2789
|
-
if minPrecision is not None:
|
2790
|
-
maxDecimalPlaces = int(self.number_to_string(self.precision_from_string(minPrecision)))
|
2791
2788
|
result[code] = {
|
2792
2789
|
'id': id,
|
2793
2790
|
'name': name,
|
2794
2791
|
'code': code,
|
2795
|
-
'precision':
|
2792
|
+
'precision': self.parse_number(minPrecision),
|
2796
2793
|
'info': entry,
|
2797
2794
|
'active': active,
|
2798
2795
|
'deposit': isDepositEnabled,
|
@@ -3148,10 +3145,10 @@ class binance(Exchange, ImplicitAPI):
|
|
3148
3145
|
'strike': parsedStrike,
|
3149
3146
|
'optionType': self.safe_string_lower(market, 'side'),
|
3150
3147
|
'precision': {
|
3151
|
-
'amount': self.
|
3152
|
-
'price': self.
|
3153
|
-
'base': self.
|
3154
|
-
'quote': self.
|
3148
|
+
'amount': self.parse_number(self.parse_precision(self.safe_string_2(market, 'quantityPrecision', 'quantityScale'))),
|
3149
|
+
'price': self.parse_number(self.parse_precision(self.safe_string_2(market, 'pricePrecision', 'priceScale'))),
|
3150
|
+
'base': self.parse_number(self.parse_precision(self.safe_string(market, 'baseAssetPrecision'))),
|
3151
|
+
'quote': self.parse_number(self.parse_precision(self.safe_string(market, 'quotePrecision'))),
|
3155
3152
|
},
|
3156
3153
|
'limits': {
|
3157
3154
|
'leverage': {
|
@@ -3184,11 +3181,10 @@ class binance(Exchange, ImplicitAPI):
|
|
3184
3181
|
'min': self.safe_number(filter, 'minPrice'),
|
3185
3182
|
'max': self.safe_number(filter, 'maxPrice'),
|
3186
3183
|
}
|
3187
|
-
entry['precision']['price'] = self.
|
3184
|
+
entry['precision']['price'] = self.safe_number(filter, 'tickSize')
|
3188
3185
|
if 'LOT_SIZE' in filtersByType:
|
3189
3186
|
filter = self.safe_dict(filtersByType, 'LOT_SIZE', {})
|
3190
|
-
|
3191
|
-
entry['precision']['amount'] = self.precision_from_string(stepSize)
|
3187
|
+
entry['precision']['amount'] = self.safe_number(filter, 'stepSize')
|
3192
3188
|
entry['limits']['amount'] = {
|
3193
3189
|
'min': self.safe_number(filter, 'minQty'),
|
3194
3190
|
'max': self.safe_number(filter, 'maxQty'),
|
@@ -5837,7 +5833,7 @@ class binance(Exchange, ImplicitAPI):
|
|
5837
5833
|
market = self.market(symbol)
|
5838
5834
|
if not market['spot']:
|
5839
5835
|
raise NotSupported(self.id + ' createMarketOrderWithCost() supports spot orders only')
|
5840
|
-
params['
|
5836
|
+
params['cost'] = cost
|
5841
5837
|
return await self.create_order(symbol, 'market', side, cost, None, params)
|
5842
5838
|
|
5843
5839
|
async def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
|
@@ -5853,7 +5849,7 @@ class binance(Exchange, ImplicitAPI):
|
|
5853
5849
|
market = self.market(symbol)
|
5854
5850
|
if not market['spot']:
|
5855
5851
|
raise NotSupported(self.id + ' createMarketBuyOrderWithCost() supports spot orders only')
|
5856
|
-
params['
|
5852
|
+
params['cost'] = cost
|
5857
5853
|
return await self.create_order(symbol, 'market', 'buy', cost, None, params)
|
5858
5854
|
|
5859
5855
|
async def create_market_sell_order_with_cost(self, symbol: str, cost: float, params={}):
|
@@ -7377,6 +7373,8 @@ class binance(Exchange, ImplicitAPI):
|
|
7377
7373
|
return self.parse_transactions(response, currency, since, limit)
|
7378
7374
|
|
7379
7375
|
def parse_transaction_status_by_type(self, status, type=None):
|
7376
|
+
if type is None:
|
7377
|
+
return status
|
7380
7378
|
statusesByType: dict = {
|
7381
7379
|
'deposit': {
|
7382
7380
|
'0': 'pending',
|
@@ -8201,7 +8199,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8201
8199
|
request: dict = {
|
8202
8200
|
'coin': currency['id'],
|
8203
8201
|
'address': address,
|
8204
|
-
'amount': amount,
|
8202
|
+
'amount': self.currency_to_precision(code, amount),
|
8205
8203
|
# https://binance-docs.github.io/apidocs/spot/en/#withdraw-sapi
|
8206
8204
|
# issue sapiGetCapitalConfigGetall() to get networks for withdrawing USDT ERC20 vs USDT Omni
|
8207
8205
|
# 'network': 'ETH', # 'BTC', 'TRX', etc, optional
|
@@ -8901,7 +8899,7 @@ class binance(Exchange, ImplicitAPI):
|
|
8901
8899
|
leftSide = Precise.string_mul(size, onePlusMaintenanceMarginPercentageString)
|
8902
8900
|
rightSide = Precise.string_sub(Precise.string_mul(Precise.string_div('1', entryPriceSignString), size), walletBalance)
|
8903
8901
|
liquidationPriceStringRaw = Precise.string_div(leftSide, rightSide)
|
8904
|
-
pricePrecision = market['precision']
|
8902
|
+
pricePrecision = self.precision_from_string(self.safe_string(market['precision'], 'price'))
|
8905
8903
|
pricePrecisionPlusOne = pricePrecision + 1
|
8906
8904
|
pricePrecisionPlusOneString = str(pricePrecisionPlusOne)
|
8907
8905
|
# round half up
|
@@ -9066,8 +9064,7 @@ class binance(Exchange, ImplicitAPI):
|
|
9066
9064
|
onePlusMaintenanceMarginPercentageString = Precise.string_add('-1', maintenanceMarginPercentageString)
|
9067
9065
|
inner = Precise.string_mul(liquidationPriceString, onePlusMaintenanceMarginPercentageString)
|
9068
9066
|
leftSide = Precise.string_add(inner, entryPriceSignString)
|
9069
|
-
|
9070
|
-
quotePrecision = self.safe_integer(precision, 'quote', pricePrecision)
|
9067
|
+
quotePrecision = self.precision_from_string(self.safe_string_2(precision, 'quote', 'price'))
|
9071
9068
|
if quotePrecision is not None:
|
9072
9069
|
collateralString = Precise.string_div(Precise.string_mul(leftSide, contractsAbs), '1', quotePrecision)
|
9073
9070
|
else:
|
@@ -9081,7 +9078,7 @@ class binance(Exchange, ImplicitAPI):
|
|
9081
9078
|
entryPriceSignString = Precise.string_mul('-1', entryPriceSignString)
|
9082
9079
|
leftSide = Precise.string_mul(contractsAbs, contractSizeString)
|
9083
9080
|
rightSide = Precise.string_sub(Precise.string_div('1', entryPriceSignString), Precise.string_div(onePlusMaintenanceMarginPercentageString, liquidationPriceString))
|
9084
|
-
basePrecision = self.
|
9081
|
+
basePrecision = self.precision_from_string(self.safe_string(precision, 'base'))
|
9085
9082
|
if basePrecision is not None:
|
9086
9083
|
collateralString = Precise.string_div(Precise.string_mul(leftSide, rightSide), '1', basePrecision)
|
9087
9084
|
else:
|
@@ -11888,7 +11885,7 @@ class binance(Exchange, ImplicitAPI):
|
|
11888
11885
|
'deposit': None,
|
11889
11886
|
'withdraw': None,
|
11890
11887
|
'fee': None,
|
11891
|
-
'precision': self.
|
11888
|
+
'precision': self.parse_number(self.parse_precision(self.safe_string(entry, 'fraction'))),
|
11892
11889
|
'limits': {
|
11893
11890
|
'amount': {
|
11894
11891
|
'min': None,
|
ccxt/async_support/bitso.py
CHANGED
@@ -962,7 +962,19 @@ class bitso(Exchange, ImplicitAPI):
|
|
962
962
|
request: dict = {
|
963
963
|
'oid': id,
|
964
964
|
}
|
965
|
-
|
965
|
+
response = await 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
|
async def cancel_orders(self, ids, symbol: Str = None, params={}):
|
968
980
|
"""
|
ccxt/async_support/gate.py
CHANGED
@@ -798,6 +798,7 @@ class gate(Exchange, ImplicitAPI):
|
|
798
798
|
'NOT_ACCEPTABLE': BadRequest,
|
799
799
|
'METHOD_NOT_ALLOWED': BadRequest,
|
800
800
|
'NOT_FOUND': ExchangeError,
|
801
|
+
'AUTHENTICATION_FAILED': AuthenticationError,
|
801
802
|
'INVALID_CREDENTIALS': AuthenticationError,
|
802
803
|
'INVALID_KEY': AuthenticationError,
|
803
804
|
'IP_FORBIDDEN': AuthenticationError,
|
@@ -3669,17 +3670,14 @@ class gate(Exchange, ImplicitAPI):
|
|
3669
3670
|
#
|
3670
3671
|
return self.parse_order(response, market)
|
3671
3672
|
|
3672
|
-
|
3673
|
-
"""
|
3674
|
-
create a list of trade orders
|
3675
|
-
:see: https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-2
|
3676
|
-
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-orders
|
3677
|
-
: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
|
3678
|
-
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3679
|
-
"""
|
3680
|
-
await self.load_markets()
|
3673
|
+
def create_orders_request(self, orders: List[OrderRequest], params={}):
|
3681
3674
|
ordersRequests = []
|
3682
3675
|
orderSymbols = []
|
3676
|
+
ordersLength = len(orders)
|
3677
|
+
if ordersLength == 0:
|
3678
|
+
raise BadRequest(self.id + ' createOrders() requires at least one order')
|
3679
|
+
if ordersLength > 10:
|
3680
|
+
raise BadRequest(self.id + ' createOrders() accepts a maximum of 10 orders at a time')
|
3683
3681
|
for i in range(0, len(orders)):
|
3684
3682
|
rawOrder = orders[i]
|
3685
3683
|
marketId = self.safe_string(rawOrder, 'symbol')
|
@@ -3700,6 +3698,21 @@ class gate(Exchange, ImplicitAPI):
|
|
3700
3698
|
market = self.market(symbols[0])
|
3701
3699
|
if market['future'] or market['option']:
|
3702
3700
|
raise NotSupported(self.id + ' createOrders() does not support futures or options markets')
|
3701
|
+
return ordersRequests
|
3702
|
+
|
3703
|
+
async def create_orders(self, orders: List[OrderRequest], params={}):
|
3704
|
+
"""
|
3705
|
+
create a list of trade orders
|
3706
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#get-a-single-order-2
|
3707
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-orders
|
3708
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#create-a-batch-of-futures-orders
|
3709
|
+
: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
|
3710
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3711
|
+
"""
|
3712
|
+
await self.load_markets()
|
3713
|
+
ordersRequests = self.create_orders_request(orders, params)
|
3714
|
+
firstOrder = orders[0]
|
3715
|
+
market = self.market(firstOrder['symbol'])
|
3703
3716
|
response = None
|
3704
3717
|
if market['spot']:
|
3705
3718
|
response = await self.privateSpotPostBatchOrders(ordersRequests)
|
@@ -3930,21 +3943,7 @@ class gate(Exchange, ImplicitAPI):
|
|
3930
3943
|
params['createMarketBuyOrderRequiresPrice'] = False
|
3931
3944
|
return await self.create_order(symbol, 'market', 'buy', cost, None, params)
|
3932
3945
|
|
3933
|
-
|
3934
|
-
"""
|
3935
|
-
edit a trade order, gate currently only supports the modification of the price or amount fields
|
3936
|
-
:see: https://www.gate.io/docs/developers/apiv4/en/#amend-an-order
|
3937
|
-
:see: https://www.gate.io/docs/developers/apiv4/en/#amend-an-order-2
|
3938
|
-
:param str id: order id
|
3939
|
-
:param str symbol: unified symbol of the market to create an order in
|
3940
|
-
:param str type: 'market' or 'limit'
|
3941
|
-
:param str side: 'buy' or 'sell'
|
3942
|
-
:param float amount: how much of the currency you want to trade in units of the base currency
|
3943
|
-
:param float [price]: the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
3944
|
-
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3945
|
-
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3946
|
-
"""
|
3947
|
-
await self.load_markets()
|
3946
|
+
def edit_order_request(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
3948
3947
|
market = self.market(symbol)
|
3949
3948
|
marketType, query = self.handle_market_type_and_params('editOrder', market, params)
|
3950
3949
|
account = self.convert_type_to_account(marketType)
|
@@ -3954,7 +3953,7 @@ class gate(Exchange, ImplicitAPI):
|
|
3954
3953
|
# exchange doesn't have market orders for spot
|
3955
3954
|
raise InvalidOrder(self.id + ' editOrder() does not support ' + type + ' orders for ' + marketType + ' markets')
|
3956
3955
|
request: dict = {
|
3957
|
-
'order_id': id,
|
3956
|
+
'order_id': str(id),
|
3958
3957
|
'currency_pair': market['id'],
|
3959
3958
|
'account': account,
|
3960
3959
|
}
|
@@ -3968,12 +3967,32 @@ class gate(Exchange, ImplicitAPI):
|
|
3968
3967
|
request['size'] = self.amount_to_precision(symbol, amount)
|
3969
3968
|
if price is not None:
|
3970
3969
|
request['price'] = self.price_to_precision(symbol, price)
|
3970
|
+
if not market['spot']:
|
3971
|
+
request['settle'] = market['settleId']
|
3972
|
+
return self.extend(request, query)
|
3973
|
+
|
3974
|
+
async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
3975
|
+
"""
|
3976
|
+
edit a trade order, gate currently only supports the modification of the price or amount fields
|
3977
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#amend-an-order
|
3978
|
+
:see: https://www.gate.io/docs/developers/apiv4/en/#amend-an-order-2
|
3979
|
+
:param str id: order id
|
3980
|
+
:param str symbol: unified symbol of the market to create an order in
|
3981
|
+
:param str type: 'market' or 'limit'
|
3982
|
+
:param str side: 'buy' or 'sell'
|
3983
|
+
:param float amount: how much of the currency you want to trade in units of the base currency
|
3984
|
+
:param float [price]: the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
3985
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3986
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3987
|
+
"""
|
3988
|
+
await self.load_markets()
|
3989
|
+
market = self.market(symbol)
|
3990
|
+
extendedRequest = self.edit_order_request(id, symbol, type, side, amount, price, params)
|
3971
3991
|
response = None
|
3972
3992
|
if market['spot']:
|
3973
|
-
response = await self.privateSpotPatchOrdersOrderId(
|
3993
|
+
response = await self.privateSpotPatchOrdersOrderId(extendedRequest)
|
3974
3994
|
else:
|
3975
|
-
|
3976
|
-
response = await self.privateFuturesPutSettleOrdersOrderId(self.extend(request, query))
|
3995
|
+
response = await self.privateFuturesPutSettleOrdersOrderId(extendedRequest)
|
3977
3996
|
#
|
3978
3997
|
# {
|
3979
3998
|
# "id": "243233276443",
|
@@ -4274,6 +4293,23 @@ class gate(Exchange, ImplicitAPI):
|
|
4274
4293
|
'info': order,
|
4275
4294
|
}, market)
|
4276
4295
|
|
4296
|
+
def fetch_order_request(self, id: str, symbol: Str = None, params={}):
|
4297
|
+
market = None if (symbol is None) else self.market(symbol)
|
4298
|
+
stop = self.safe_bool_n(params, ['trigger', 'is_stop_order', 'stop'], False)
|
4299
|
+
params = self.omit(params, ['is_stop_order', 'stop', 'trigger'])
|
4300
|
+
clientOrderId = self.safe_string_2(params, 'text', 'clientOrderId')
|
4301
|
+
orderId = id
|
4302
|
+
if clientOrderId is not None:
|
4303
|
+
params = self.omit(params, ['text', 'clientOrderId'])
|
4304
|
+
if clientOrderId[0] != 't':
|
4305
|
+
clientOrderId = 't-' + clientOrderId
|
4306
|
+
orderId = clientOrderId
|
4307
|
+
type, query = self.handle_market_type_and_params('fetchOrder', market, params)
|
4308
|
+
contract = (type == 'swap') or (type == 'future') or (type == 'option')
|
4309
|
+
request, requestParams = self.prepare_request(market, type, query) if contract else self.spot_order_prepare_request(market, stop, query)
|
4310
|
+
request['order_id'] = str(orderId)
|
4311
|
+
return [request, requestParams]
|
4312
|
+
|
4277
4313
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
4278
4314
|
"""
|
4279
4315
|
Retrieves information on an order
|
@@ -4284,27 +4320,18 @@ class gate(Exchange, ImplicitAPI):
|
|
4284
4320
|
:param str id: Order id
|
4285
4321
|
:param str symbol: Unified market symbol, *required for spot and margin*
|
4286
4322
|
:param dict [params]: Parameters specified by the exchange api
|
4287
|
-
:param bool [params.
|
4323
|
+
:param bool [params.trigger]: True if the order being fetched is a trigger order
|
4288
4324
|
:param str [params.marginMode]: 'cross' or 'isolated' - marginMode for margin trading if not provided self.options['defaultMarginMode'] is used
|
4289
4325
|
:param str [params.type]: 'spot', 'swap', or 'future', if not provided self.options['defaultMarginMode'] is used
|
4290
4326
|
: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
|
4291
4327
|
:returns: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
4292
4328
|
"""
|
4293
4329
|
await self.load_markets()
|
4294
|
-
stop = self.safe_value_2(params, 'is_stop_order', 'stop', False)
|
4295
|
-
params = self.omit(params, ['is_stop_order', 'stop'])
|
4296
|
-
clientOrderId = self.safe_string_2(params, 'text', 'clientOrderId')
|
4297
|
-
orderId = id
|
4298
|
-
if clientOrderId is not None:
|
4299
|
-
params = self.omit(params, ['text', 'clientOrderId'])
|
4300
|
-
if clientOrderId[0] != 't':
|
4301
|
-
clientOrderId = 't-' + clientOrderId
|
4302
|
-
orderId = clientOrderId
|
4303
4330
|
market = None if (symbol is None) else self.market(symbol)
|
4304
|
-
|
4305
|
-
|
4306
|
-
|
4307
|
-
request
|
4331
|
+
result = self.handle_market_type_and_params('fetchOrder', market, params)
|
4332
|
+
type = self.safe_string(result, 0)
|
4333
|
+
stop = self.safe_bool_n(params, ['trigger', 'is_stop_order', 'stop'], False)
|
4334
|
+
request, requestParams = self.fetch_order_request(id, symbol, params)
|
4308
4335
|
response = None
|
4309
4336
|
if type == 'spot' or type == 'margin':
|
4310
4337
|
if stop:
|
@@ -4363,14 +4390,13 @@ class gate(Exchange, ImplicitAPI):
|
|
4363
4390
|
"""
|
4364
4391
|
return await self.fetch_orders_by_status('finished', symbol, since, limit, params)
|
4365
4392
|
|
4366
|
-
|
4367
|
-
await self.load_markets()
|
4393
|
+
def fetch_orders_by_status_request(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
4368
4394
|
market = None
|
4369
4395
|
if symbol is not None:
|
4370
4396
|
market = self.market(symbol)
|
4371
4397
|
symbol = market['symbol']
|
4372
|
-
stop = self.
|
4373
|
-
params = self.omit(params, 'stop')
|
4398
|
+
stop = self.safe_bool_2(params, 'stop', 'trigger')
|
4399
|
+
params = self.omit(params, ['stop', 'trigger'])
|
4374
4400
|
type, query = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
|
4375
4401
|
spot = (type == 'spot') or (type == 'margin')
|
4376
4402
|
request, requestParams = self.multi_order_spot_prepare_request(market, stop, query) if spot else self.prepare_request(market, type, query)
|
@@ -4381,6 +4407,24 @@ class gate(Exchange, ImplicitAPI):
|
|
4381
4407
|
request['limit'] = limit
|
4382
4408
|
if since is not None and spot:
|
4383
4409
|
request['from'] = self.parse_to_int(since / 1000)
|
4410
|
+
lastId, finalParams = self.handle_param_string_2(requestParams, 'lastId', 'last_id')
|
4411
|
+
if lastId is not None:
|
4412
|
+
request['last_id'] = lastId
|
4413
|
+
return [request, finalParams]
|
4414
|
+
|
4415
|
+
async def fetch_orders_by_status(self, status, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
4416
|
+
await self.load_markets()
|
4417
|
+
market = None
|
4418
|
+
if symbol is not None:
|
4419
|
+
market = self.market(symbol)
|
4420
|
+
symbol = market['symbol']
|
4421
|
+
stop = self.safe_bool_2(params, 'stop', 'trigger')
|
4422
|
+
params = self.omit(params, ['trigger', 'stop'])
|
4423
|
+
res = self.handle_market_type_and_params('fetchOrdersByStatus', market, params)
|
4424
|
+
type = self.safe_string(res, 0)
|
4425
|
+
params['type'] = type
|
4426
|
+
request, requestParams = self.fetch_orders_by_status_request(status, symbol, since, limit, params)
|
4427
|
+
spot = (type == 'spot') or (type == 'margin')
|
4384
4428
|
openSpotOrders = spot and (status == 'open') and not stop
|
4385
4429
|
response = None
|
4386
4430
|
if type == 'spot' or type == 'margin':
|
@@ -4574,8 +4618,8 @@ class gate(Exchange, ImplicitAPI):
|
|
4574
4618
|
"""
|
4575
4619
|
await self.load_markets()
|
4576
4620
|
market = None if (symbol is None) else self.market(symbol)
|
4577
|
-
stop = self.
|
4578
|
-
params = self.omit(params, ['is_stop_order', 'stop'])
|
4621
|
+
stop = self.safe_bool_n(params, ['is_stop_order', 'stop', 'trigger'], False)
|
4622
|
+
params = self.omit(params, ['is_stop_order', 'stop', 'trigger'])
|
4579
4623
|
type, query = self.handle_market_type_and_params('cancelOrder', market, params)
|
4580
4624
|
request, requestParams = self.spot_order_prepare_request(market, stop, query) if (type == 'spot' or type == 'margin') else self.prepare_request(market, type, query)
|
4581
4625
|
request['order_id'] = id
|
@@ -1170,7 +1170,8 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1170
1170
|
:param str [params.vaultAddress]: the vault address for order
|
1171
1171
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1172
1172
|
"""
|
1173
|
-
|
1173
|
+
orders = await self.cancel_orders([id], symbol, params)
|
1174
|
+
return self.safe_dict(orders, 0)
|
1174
1175
|
|
1175
1176
|
async def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
|
1176
1177
|
"""
|
@@ -1240,7 +1241,17 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1240
1241
|
# }
|
1241
1242
|
# }
|
1242
1243
|
#
|
1243
|
-
|
1244
|
+
innerResponse = self.safe_dict(response, 'response')
|
1245
|
+
data = self.safe_dict(innerResponse, 'data')
|
1246
|
+
statuses = self.safe_list(data, 'statuses')
|
1247
|
+
orders = []
|
1248
|
+
for i in range(0, len(statuses)):
|
1249
|
+
status = statuses[i]
|
1250
|
+
orders.append(self.safe_order({
|
1251
|
+
'info': status,
|
1252
|
+
'status': status,
|
1253
|
+
}))
|
1254
|
+
return orders
|
1244
1255
|
|
1245
1256
|
async def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
|
1246
1257
|
"""
|
ccxt/async_support/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
|
async 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
|
async 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
|
async 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>`
|
@@ -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/async_support/woo.py
CHANGED
@@ -2361,6 +2361,10 @@ class woo(Exchange, ImplicitAPI):
|
|
2361
2361
|
url += access + '/' + pathWithParams
|
2362
2362
|
if params:
|
2363
2363
|
url += '?' + self.urlencode(params)
|
2364
|
+
elif access == 'pub':
|
2365
|
+
url += pathWithParams
|
2366
|
+
if params:
|
2367
|
+
url += '?' + self.urlencode(params)
|
2364
2368
|
else:
|
2365
2369
|
self.check_required_credentials()
|
2366
2370
|
if method == 'POST' and (path == 'algo/order' or path == 'order'):
|