ccxt 4.4.82__py2.py3-none-any.whl → 4.4.85__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 -5
- ccxt/abstract/blofin.py +8 -0
- ccxt/abstract/btcbox.py +1 -0
- ccxt/apex.py +2 -1
- ccxt/async_support/__init__.py +1 -5
- ccxt/async_support/apex.py +2 -1
- ccxt/async_support/base/exchange.py +26 -3
- ccxt/async_support/base/ws/cache.py +6 -1
- ccxt/async_support/bitget.py +1 -2
- ccxt/async_support/bitrue.py +14 -32
- ccxt/async_support/bitso.py +33 -0
- ccxt/async_support/bitstamp.py +33 -0
- ccxt/async_support/blofin.py +145 -14
- ccxt/async_support/btcbox.py +25 -5
- ccxt/async_support/bybit.py +16 -37
- ccxt/async_support/cex.py +2 -4
- ccxt/async_support/coinbase.py +56 -42
- ccxt/async_support/coinbaseexchange.py +141 -32
- ccxt/async_support/coincatch.py +14 -67
- ccxt/async_support/coinex.py +28 -29
- ccxt/async_support/coinlist.py +17 -16
- ccxt/async_support/coinmetro.py +20 -11
- ccxt/async_support/coinone.py +8 -10
- ccxt/async_support/coinsph.py +124 -2
- ccxt/async_support/cryptocom.py +109 -2
- ccxt/async_support/cryptomus.py +42 -80
- ccxt/async_support/delta.py +75 -36
- ccxt/async_support/derive.py +46 -10
- ccxt/async_support/ellipx.py +175 -77
- ccxt/async_support/gate.py +1 -1
- ccxt/async_support/gemini.py +3 -4
- ccxt/async_support/hitbtc.py +56 -65
- ccxt/async_support/hyperliquid.py +2 -2
- ccxt/async_support/kraken.py +27 -23
- ccxt/async_support/kucoinfutures.py +5 -0
- ccxt/async_support/lbank.py +1 -1
- ccxt/async_support/paradex.py +120 -4
- ccxt/base/exchange.py +21 -2
- ccxt/base/types.py +3 -0
- ccxt/bitget.py +1 -2
- ccxt/bitrue.py +14 -32
- ccxt/bitso.py +33 -0
- ccxt/bitstamp.py +33 -0
- ccxt/blofin.py +145 -14
- ccxt/btcbox.py +24 -5
- ccxt/bybit.py +16 -37
- ccxt/cex.py +2 -4
- ccxt/coinbase.py +56 -42
- ccxt/coinbaseexchange.py +141 -32
- ccxt/coincatch.py +14 -67
- ccxt/coinex.py +28 -29
- ccxt/coinlist.py +17 -16
- ccxt/coinmetro.py +20 -11
- ccxt/coinone.py +8 -10
- ccxt/coinsph.py +124 -2
- ccxt/cryptocom.py +109 -2
- ccxt/cryptomus.py +42 -80
- ccxt/delta.py +75 -36
- ccxt/derive.py +46 -10
- ccxt/ellipx.py +175 -77
- ccxt/gate.py +1 -1
- ccxt/gemini.py +3 -4
- ccxt/hitbtc.py +56 -65
- ccxt/hyperliquid.py +2 -2
- ccxt/kraken.py +27 -23
- ccxt/kucoinfutures.py +5 -0
- ccxt/lbank.py +1 -1
- ccxt/paradex.py +120 -4
- ccxt/pro/__init__.py +69 -3
- ccxt/pro/binance.py +31 -33
- ccxt/pro/bithumb.py +5 -3
- ccxt/pro/kraken.py +249 -79
- ccxt/pro/mexc.py +252 -7
- ccxt/pro/poloniex.py +6 -2
- {ccxt-4.4.82.dist-info → ccxt-4.4.85.dist-info}/METADATA +7 -9
- {ccxt-4.4.82.dist-info → ccxt-4.4.85.dist-info}/RECORD +79 -87
- ccxt/abstract/bl3p.py +0 -19
- ccxt/abstract/idex.py +0 -26
- ccxt/async_support/base/ws/fast_client.py +0 -97
- ccxt/async_support/bl3p.py +0 -543
- ccxt/async_support/idex.py +0 -1889
- ccxt/bl3p.py +0 -543
- ccxt/idex.py +0 -1889
- ccxt/pro/idex.py +0 -687
- {ccxt-4.4.82.dist-info → ccxt-4.4.85.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.82.dist-info → ccxt-4.4.85.dist-info}/WHEEL +0 -0
- {ccxt-4.4.82.dist-info → ccxt-4.4.85.dist-info}/top_level.txt +0 -0
ccxt/pro/kraken.py
CHANGED
@@ -12,6 +12,7 @@ from ccxt.base.errors import ExchangeError
|
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
13
13
|
from ccxt.base.errors import PermissionDenied
|
14
14
|
from ccxt.base.errors import AccountSuspended
|
15
|
+
from ccxt.base.errors import ArgumentsRequired
|
15
16
|
from ccxt.base.errors import BadRequest
|
16
17
|
from ccxt.base.errors import BadSymbol
|
17
18
|
from ccxt.base.errors import InsufficientFunds
|
@@ -127,12 +128,133 @@ class kraken(ccxt.async_support.kraken):
|
|
127
128
|
},
|
128
129
|
})
|
129
130
|
|
131
|
+
def order_request_ws(self, method: str, symbol: str, type: str, request: dict, amount: Num, price: Num = None, params={}):
|
132
|
+
isLimitOrder = type.endswith('limit') # supporting limit, stop-loss-limit, take-profit-limit, etc
|
133
|
+
if isLimitOrder:
|
134
|
+
if price is None:
|
135
|
+
raise ArgumentsRequired(self.id + ' limit orders require a price argument')
|
136
|
+
request['params']['limit_price'] = self.parse_to_numeric(self.price_to_precision(symbol, price))
|
137
|
+
isMarket = (type == 'market')
|
138
|
+
postOnly = None
|
139
|
+
postOnly, params = self.handle_post_only(isMarket, False, params)
|
140
|
+
if postOnly:
|
141
|
+
request['params']['post_only'] = True
|
142
|
+
clientOrderId = self.safe_string(params, 'clientOrderId')
|
143
|
+
if clientOrderId is not None:
|
144
|
+
request['params']['cl_ord_id'] = clientOrderId
|
145
|
+
cost = self.safe_string(params, 'cost')
|
146
|
+
if cost is not None:
|
147
|
+
request['params']['order_qty'] = self.parse_to_numeric(self.cost_to_precision(symbol, cost))
|
148
|
+
stopLoss = self.safe_dict(params, 'stopLoss', {})
|
149
|
+
takeProfit = self.safe_dict(params, 'takeProfit', {})
|
150
|
+
presetStopLoss = self.safe_string(stopLoss, 'triggerPrice')
|
151
|
+
presetTakeProfit = self.safe_string(takeProfit, 'triggerPrice')
|
152
|
+
presetStopLossLimit = self.safe_string(stopLoss, 'price')
|
153
|
+
presetTakeProfitLimit = self.safe_string(takeProfit, 'price')
|
154
|
+
isPresetStopLoss = presetStopLoss is not None
|
155
|
+
isPresetTakeProfit = presetTakeProfit is not None
|
156
|
+
stopLossPrice = self.safe_string(params, 'stopLossPrice')
|
157
|
+
takeProfitPrice = self.safe_string(params, 'takeProfitPrice')
|
158
|
+
isStopLossPriceOrder = stopLossPrice is not None
|
159
|
+
isTakeProfitPriceOrder = takeProfitPrice is not None
|
160
|
+
trailingAmount = self.safe_string(params, 'trailingAmount')
|
161
|
+
trailingPercent = self.safe_string(params, 'trailingPercent')
|
162
|
+
trailingLimitAmount = self.safe_string(params, 'trailingLimitAmount')
|
163
|
+
trailingLimitPercent = self.safe_string(params, 'trailingLimitPercent')
|
164
|
+
isTrailingAmountOrder = trailingAmount is not None
|
165
|
+
isTrailingPercentOrder = trailingPercent is not None
|
166
|
+
isTrailingLimitAmountOrder = trailingLimitAmount is not None
|
167
|
+
isTrailingLimitPercentOrder = trailingLimitPercent is not None
|
168
|
+
offset = self.safe_string(params, 'offset', '') # can set self to - for minus
|
169
|
+
trailingAmountString = offset + self.number_to_string(trailingAmount) if (trailingAmount is not None) else None
|
170
|
+
trailingPercentString = offset + self.number_to_string(trailingPercent) if (trailingPercent is not None) else None
|
171
|
+
trailingLimitAmountString = offset + self.number_to_string(trailingLimitAmount) if (trailingLimitAmount is not None) else None
|
172
|
+
trailingLimitPercentString = offset + self.number_to_string(trailingLimitPercent) if (trailingLimitPercent is not None) else None
|
173
|
+
priceType = 'pct' if (isTrailingPercentOrder or isTrailingLimitPercentOrder) else 'quote'
|
174
|
+
if method == 'createOrderWs':
|
175
|
+
reduceOnly = self.safe_bool(params, 'reduceOnly')
|
176
|
+
if reduceOnly:
|
177
|
+
request['params']['reduce_only'] = True
|
178
|
+
timeInForce = self.safe_string_lower(params, 'timeInForce')
|
179
|
+
if timeInForce is not None:
|
180
|
+
request['params']['time_in_force'] = timeInForce
|
181
|
+
params = self.omit(params, ['reduceOnly', 'timeInForce'])
|
182
|
+
if isStopLossPriceOrder or isTakeProfitPriceOrder or isTrailingAmountOrder or isTrailingPercentOrder or isTrailingLimitAmountOrder or isTrailingLimitPercentOrder:
|
183
|
+
request['params']['triggers'] = {}
|
184
|
+
if isPresetStopLoss or isPresetTakeProfit:
|
185
|
+
request['params']['conditional'] = {}
|
186
|
+
if isPresetStopLoss:
|
187
|
+
request['params']['conditional']['order_type'] = 'stop-loss'
|
188
|
+
request['params']['conditional']['trigger_price'] = self.parse_to_numeric(self.price_to_precision(symbol, presetStopLoss))
|
189
|
+
elif isPresetTakeProfit:
|
190
|
+
request['params']['conditional']['order_type'] = 'take-profit'
|
191
|
+
request['params']['conditional']['trigger_price'] = self.parse_to_numeric(self.price_to_precision(symbol, presetTakeProfit))
|
192
|
+
if presetStopLossLimit is not None:
|
193
|
+
request['params']['conditional']['order_type'] = 'stop-loss-limit'
|
194
|
+
request['params']['conditional']['limit_price'] = self.parse_to_numeric(self.price_to_precision(symbol, presetStopLossLimit))
|
195
|
+
elif presetTakeProfitLimit is not None:
|
196
|
+
request['params']['conditional']['order_type'] = 'take-profit-limit'
|
197
|
+
request['params']['conditional']['limit_price'] = self.parse_to_numeric(self.price_to_precision(symbol, presetTakeProfitLimit))
|
198
|
+
params = self.omit(params, ['stopLoss', 'takeProfit'])
|
199
|
+
elif isStopLossPriceOrder or isTakeProfitPriceOrder:
|
200
|
+
if isStopLossPriceOrder:
|
201
|
+
request['params']['triggers']['price'] = self.parse_to_numeric(self.price_to_precision(symbol, stopLossPrice))
|
202
|
+
if isLimitOrder:
|
203
|
+
request['params']['order_type'] = 'stop-loss-limit'
|
204
|
+
else:
|
205
|
+
request['params']['order_type'] = 'stop-loss'
|
206
|
+
else:
|
207
|
+
request['params']['triggers']['price'] = self.parse_to_numeric(self.price_to_precision(symbol, takeProfitPrice))
|
208
|
+
if isLimitOrder:
|
209
|
+
request['params']['order_type'] = 'take-profit-limit'
|
210
|
+
else:
|
211
|
+
request['params']['order_type'] = 'take-profit'
|
212
|
+
elif isTrailingAmountOrder or isTrailingPercentOrder or isTrailingLimitAmountOrder or isTrailingLimitPercentOrder:
|
213
|
+
request['params']['triggers']['price_type'] = priceType
|
214
|
+
if not isLimitOrder and (isTrailingAmountOrder or isTrailingPercentOrder):
|
215
|
+
request['params']['order_type'] = 'trailing-stop'
|
216
|
+
if isTrailingAmountOrder:
|
217
|
+
request['params']['triggers']['price'] = self.parse_to_numeric(trailingAmountString)
|
218
|
+
else:
|
219
|
+
request['params']['triggers']['price'] = self.parse_to_numeric(trailingPercentString)
|
220
|
+
else:
|
221
|
+
# trailing limit orders are not conventionally supported because the static limit_price_type param is not available for trailing-stop-limit orders
|
222
|
+
request['params']['limit_price_type'] = priceType
|
223
|
+
request['params']['order_type'] = 'trailing-stop-limit'
|
224
|
+
if isTrailingLimitAmountOrder:
|
225
|
+
request['params']['triggers']['price'] = self.parse_to_numeric(trailingLimitAmountString)
|
226
|
+
else:
|
227
|
+
request['params']['triggers']['price'] = self.parse_to_numeric(trailingLimitPercentString)
|
228
|
+
elif method == 'editOrderWs':
|
229
|
+
if isPresetStopLoss or isPresetTakeProfit:
|
230
|
+
raise NotSupported(self.id + ' editing the stopLoss and takeProfit on existing orders is currently not supported')
|
231
|
+
if isStopLossPriceOrder or isTakeProfitPriceOrder:
|
232
|
+
if isStopLossPriceOrder:
|
233
|
+
request['params']['trigger_price'] = self.parse_to_numeric(self.price_to_precision(symbol, stopLossPrice))
|
234
|
+
else:
|
235
|
+
request['params']['trigger_price'] = self.parse_to_numeric(self.price_to_precision(symbol, takeProfitPrice))
|
236
|
+
elif isTrailingAmountOrder or isTrailingPercentOrder or isTrailingLimitAmountOrder or isTrailingLimitPercentOrder:
|
237
|
+
request['params']['trigger_price_type'] = priceType
|
238
|
+
if not isLimitOrder and (isTrailingAmountOrder or isTrailingPercentOrder):
|
239
|
+
if isTrailingAmountOrder:
|
240
|
+
request['params']['trigger_price'] = self.parse_to_numeric(trailingAmountString)
|
241
|
+
else:
|
242
|
+
request['params']['trigger_price'] = self.parse_to_numeric(trailingPercentString)
|
243
|
+
else:
|
244
|
+
request['params']['limit_price_type'] = priceType
|
245
|
+
if isTrailingLimitAmountOrder:
|
246
|
+
request['params']['trigger_price'] = self.parse_to_numeric(trailingLimitAmountString)
|
247
|
+
else:
|
248
|
+
request['params']['trigger_price'] = self.parse_to_numeric(trailingLimitPercentString)
|
249
|
+
params = self.omit(params, ['clientOrderId', 'cost', 'offset', 'stopLossPrice', 'takeProfitPrice', 'trailingAmount', 'trailingPercent', 'trailingLimitAmount', 'trailingLimitPercent'])
|
250
|
+
return [request, params]
|
251
|
+
|
130
252
|
async def create_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}) -> Order:
|
131
253
|
"""
|
254
|
+
create a trade order
|
132
255
|
|
133
|
-
https://docs.kraken.com/api/docs/websocket-
|
256
|
+
https://docs.kraken.com/api/docs/websocket-v2/add_order
|
134
257
|
|
135
|
-
create a trade order
|
136
258
|
:param str symbol: unified symbol of the market to create an order in
|
137
259
|
:param str type: 'market' or 'limit'
|
138
260
|
:param str side: 'buy' or 'sell'
|
@@ -144,50 +266,60 @@ class kraken(ccxt.async_support.kraken):
|
|
144
266
|
await self.load_markets()
|
145
267
|
token = await self.authenticate()
|
146
268
|
market = self.market(symbol)
|
147
|
-
url = self.urls['api']['ws']['
|
269
|
+
url = self.urls['api']['ws']['privateV2']
|
148
270
|
requestId = self.request_id()
|
149
271
|
messageHash = requestId
|
150
272
|
request: dict = {
|
151
|
-
'
|
152
|
-
'
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
273
|
+
'method': 'add_order',
|
274
|
+
'params': {
|
275
|
+
'order_type': type,
|
276
|
+
'side': side,
|
277
|
+
'order_qty': self.parse_to_numeric(self.amount_to_precision(symbol, amount)),
|
278
|
+
'symbol': market['symbol'],
|
279
|
+
'token': token,
|
280
|
+
},
|
281
|
+
'req_id': requestId,
|
158
282
|
}
|
159
|
-
request, params = self.
|
283
|
+
request, params = self.order_request_ws('createOrderWs', symbol, type, request, amount, price, params)
|
160
284
|
return await self.watch(url, messageHash, self.extend(request, params), messageHash)
|
161
285
|
|
162
286
|
def handle_create_edit_order(self, client, message):
|
163
287
|
#
|
164
288
|
# createOrder
|
165
|
-
#
|
166
|
-
#
|
167
|
-
#
|
168
|
-
#
|
169
|
-
#
|
170
|
-
#
|
171
|
-
#
|
289
|
+
# {
|
290
|
+
# "method": "add_order",
|
291
|
+
# "req_id": 1,
|
292
|
+
# "result": {
|
293
|
+
# "order_id": "OXM2QD-EALR2-YBAVEU"
|
294
|
+
# },
|
295
|
+
# "success": True,
|
296
|
+
# "time_in": "2025-05-13T10:12:13.876173Z",
|
297
|
+
# "time_out": "2025-05-13T10:12:13.890137Z"
|
298
|
+
# }
|
299
|
+
#
|
172
300
|
# editOrder
|
173
|
-
#
|
174
|
-
#
|
175
|
-
#
|
176
|
-
#
|
177
|
-
#
|
178
|
-
#
|
179
|
-
#
|
180
|
-
#
|
301
|
+
# {
|
302
|
+
# "method": "amend_order",
|
303
|
+
# "req_id": 1,
|
304
|
+
# "result": {
|
305
|
+
# "amend_id": "TYDLSQ-OYNYU-3MNRER",
|
306
|
+
# "order_id": "OGL7HR-SWFO4-NRQTHO"
|
307
|
+
# },
|
308
|
+
# "success": True,
|
309
|
+
# "time_in": "2025-05-14T13:54:10.840342Z",
|
310
|
+
# "time_out": "2025-05-14T13:54:10.855046Z"
|
311
|
+
# }
|
181
312
|
#
|
182
|
-
|
183
|
-
|
313
|
+
result = self.safe_dict(message, 'result', {})
|
314
|
+
order = self.parse_order(result)
|
315
|
+
messageHash = self.safe_value_2(message, 'reqid', 'req_id')
|
184
316
|
client.resolve(order, messageHash)
|
185
317
|
|
186
318
|
async def edit_order_ws(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}) -> Order:
|
187
319
|
"""
|
188
320
|
edit a trade order
|
189
321
|
|
190
|
-
https://docs.kraken.com/api/docs/websocket-
|
322
|
+
https://docs.kraken.com/api/docs/websocket-v2/amend_order
|
191
323
|
|
192
324
|
:param str id: order id
|
193
325
|
:param str symbol: unified symbol of the market to create an order in
|
@@ -200,20 +332,19 @@ class kraken(ccxt.async_support.kraken):
|
|
200
332
|
"""
|
201
333
|
await self.load_markets()
|
202
334
|
token = await self.authenticate()
|
203
|
-
|
204
|
-
url = self.urls['api']['ws']['private']
|
335
|
+
url = self.urls['api']['ws']['privateV2']
|
205
336
|
requestId = self.request_id()
|
206
337
|
messageHash = requestId
|
207
338
|
request: dict = {
|
208
|
-
'
|
209
|
-
'
|
210
|
-
|
211
|
-
|
212
|
-
|
339
|
+
'method': 'amend_order',
|
340
|
+
'params': {
|
341
|
+
'order_id': id,
|
342
|
+
'order_qty': self.parse_to_numeric(self.amount_to_precision(symbol, amount)),
|
343
|
+
'token': token,
|
344
|
+
},
|
345
|
+
'req_id': requestId,
|
213
346
|
}
|
214
|
-
|
215
|
-
request['volume'] = self.amount_to_precision(symbol, amount)
|
216
|
-
request, params = self.orderRequest('editOrderWs', symbol, type, request, amount, price, params)
|
347
|
+
request, params = self.order_request_ws('editOrderWs', symbol, type, request, amount, price, params)
|
217
348
|
return await self.watch(url, messageHash, self.extend(request, params), messageHash)
|
218
349
|
|
219
350
|
async def cancel_orders_ws(self, ids: List[str], symbol: Str = None, params={}):
|
@@ -223,20 +354,24 @@ class kraken(ccxt.async_support.kraken):
|
|
223
354
|
|
224
355
|
cancel multiple orders
|
225
356
|
:param str[] ids: order ids
|
226
|
-
:param str symbol: unified market symbol, default is None
|
357
|
+
:param str [symbol]: unified market symbol, default is None
|
227
358
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
228
359
|
:returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
229
360
|
"""
|
361
|
+
if symbol is not None:
|
362
|
+
raise NotSupported(self.id + ' cancelOrdersWs() does not support cancelling orders for a specific symbol.')
|
230
363
|
await self.load_markets()
|
231
364
|
token = await self.authenticate()
|
232
|
-
url = self.urls['api']['ws']['
|
365
|
+
url = self.urls['api']['ws']['privateV2']
|
233
366
|
requestId = self.request_id()
|
234
367
|
messageHash = requestId
|
235
368
|
request: dict = {
|
236
|
-
'
|
237
|
-
'
|
238
|
-
|
239
|
-
|
369
|
+
'method': 'cancel_order',
|
370
|
+
'params': {
|
371
|
+
'order_id': ids,
|
372
|
+
'token': token,
|
373
|
+
},
|
374
|
+
'req_id': requestId,
|
240
375
|
}
|
241
376
|
return await self.watch(url, messageHash, self.extend(request, params), messageHash)
|
242
377
|
|
@@ -247,35 +382,41 @@ class kraken(ccxt.async_support.kraken):
|
|
247
382
|
|
248
383
|
cancels an open order
|
249
384
|
:param str id: order id
|
250
|
-
:param str symbol: unified symbol of the market the order was made in
|
385
|
+
:param str [symbol]: unified symbol of the market the order was made in
|
251
386
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
252
387
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
253
388
|
"""
|
389
|
+
if symbol is not None:
|
390
|
+
raise NotSupported(self.id + ' cancelOrderWs() does not support cancelling orders for a specific symbol.')
|
254
391
|
await self.load_markets()
|
255
392
|
token = await self.authenticate()
|
256
|
-
url = self.urls['api']['ws']['
|
393
|
+
url = self.urls['api']['ws']['privateV2']
|
257
394
|
requestId = self.request_id()
|
258
395
|
messageHash = requestId
|
259
|
-
clientOrderId = self.safe_value_2(params, 'userref', 'clientOrderId', id)
|
260
|
-
params = self.omit(params, ['userref', 'clientOrderId'])
|
261
396
|
request: dict = {
|
262
|
-
'
|
263
|
-
'
|
264
|
-
|
265
|
-
|
397
|
+
'method': 'cancel_order',
|
398
|
+
'params': {
|
399
|
+
'order_id': [id],
|
400
|
+
'token': token,
|
401
|
+
},
|
402
|
+
'req_id': requestId,
|
266
403
|
}
|
267
404
|
return await self.watch(url, messageHash, self.extend(request, params), messageHash)
|
268
405
|
|
269
406
|
def handle_cancel_order(self, client, message):
|
270
407
|
#
|
271
|
-
#
|
272
|
-
#
|
273
|
-
#
|
274
|
-
#
|
275
|
-
#
|
276
|
-
#
|
408
|
+
# {
|
409
|
+
# "method": "cancel_order",
|
410
|
+
# "req_id": 123456789,
|
411
|
+
# "result": {
|
412
|
+
# "order_id": "OKAGJC-YHIWK-WIOZWG"
|
413
|
+
# },
|
414
|
+
# "success": True,
|
415
|
+
# "time_in": "2023-09-21T14:36:57.428972Z",
|
416
|
+
# "time_out": "2023-09-21T14:36:57.437952Z"
|
417
|
+
# }
|
277
418
|
#
|
278
|
-
reqId = self.safe_value(message, '
|
419
|
+
reqId = self.safe_value(message, 'req_id')
|
279
420
|
client.resolve(message, reqId)
|
280
421
|
|
281
422
|
async def cancel_all_orders_ws(self, symbol: Str = None, params={}):
|
@@ -284,7 +425,7 @@ class kraken(ccxt.async_support.kraken):
|
|
284
425
|
https://docs.kraken.com/api/docs/websocket-v1/cancelall
|
285
426
|
|
286
427
|
cancel all open orders
|
287
|
-
:param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
428
|
+
:param str [symbol]: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
|
288
429
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
289
430
|
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
290
431
|
"""
|
@@ -292,26 +433,32 @@ class kraken(ccxt.async_support.kraken):
|
|
292
433
|
raise NotSupported(self.id + ' cancelAllOrdersWs() does not support cancelling orders in a specific market.')
|
293
434
|
await self.load_markets()
|
294
435
|
token = await self.authenticate()
|
295
|
-
url = self.urls['api']['ws']['
|
436
|
+
url = self.urls['api']['ws']['privateV2']
|
296
437
|
requestId = self.request_id()
|
297
438
|
messageHash = requestId
|
298
439
|
request: dict = {
|
299
|
-
'
|
300
|
-
'
|
301
|
-
|
440
|
+
'method': 'cancel_all',
|
441
|
+
'params': {
|
442
|
+
'token': token,
|
443
|
+
},
|
444
|
+
'req_id': requestId,
|
302
445
|
}
|
303
446
|
return await self.watch(url, messageHash, self.extend(request, params), messageHash)
|
304
447
|
|
305
448
|
def handle_cancel_all_orders(self, client, message):
|
306
449
|
#
|
307
|
-
#
|
308
|
-
#
|
309
|
-
#
|
310
|
-
#
|
311
|
-
#
|
312
|
-
#
|
450
|
+
# {
|
451
|
+
# "method": "cancel_all",
|
452
|
+
# "req_id": 123456789,
|
453
|
+
# "result": {
|
454
|
+
# "count": 1
|
455
|
+
# },
|
456
|
+
# "success": True,
|
457
|
+
# "time_in": "2023-09-21T14:36:57.428972Z",
|
458
|
+
# "time_out": "2023-09-21T14:36:57.437952Z"
|
459
|
+
# }
|
313
460
|
#
|
314
|
-
reqId = self.safe_value(message, '
|
461
|
+
reqId = self.safe_value(message, 'req_id')
|
315
462
|
client.resolve(message, reqId)
|
316
463
|
|
317
464
|
def handle_ticker(self, client, message, subscription):
|
@@ -870,6 +1017,20 @@ class kraken(ccxt.async_support.kraken):
|
|
870
1017
|
# "version": "0.2.0"
|
871
1018
|
# }
|
872
1019
|
#
|
1020
|
+
# v2
|
1021
|
+
# {
|
1022
|
+
# channel: 'status',
|
1023
|
+
# type: 'update',
|
1024
|
+
# data: [
|
1025
|
+
# {
|
1026
|
+
# version: '2.0.10',
|
1027
|
+
# system: 'online',
|
1028
|
+
# api_version: 'v2',
|
1029
|
+
# connection_id: 6447481662169813000
|
1030
|
+
# }
|
1031
|
+
# ]
|
1032
|
+
# }
|
1033
|
+
#
|
873
1034
|
return message
|
874
1035
|
|
875
1036
|
async def authenticate(self, params={}):
|
@@ -1460,9 +1621,18 @@ class kraken(ccxt.async_support.kraken):
|
|
1460
1621
|
# "subscription": {name: "ticker"}
|
1461
1622
|
# }
|
1462
1623
|
#
|
1463
|
-
|
1624
|
+
# v2
|
1625
|
+
# {
|
1626
|
+
# "error": "Unsupported field: 'price' for the given msg type: add order",
|
1627
|
+
# "method": "add_order",
|
1628
|
+
# "success": False,
|
1629
|
+
# "time_in": "2025-05-13T08:59:44.803511Z",
|
1630
|
+
# "time_out": "2025-05-13T08:59:44.803542Z'
|
1631
|
+
# }
|
1632
|
+
#
|
1633
|
+
errorMessage = self.safe_string_2(message, 'errorMessage', 'error')
|
1464
1634
|
if errorMessage is not None:
|
1465
|
-
requestId = self.
|
1635
|
+
requestId = self.safe_value_2(message, 'reqid', 'req_id')
|
1466
1636
|
if requestId is not None:
|
1467
1637
|
broad = self.exceptions['ws']['broad']
|
1468
1638
|
broadKey = self.find_broadly_matched_key(broad, errorMessage)
|
@@ -1507,15 +1677,15 @@ class kraken(ccxt.async_support.kraken):
|
|
1507
1677
|
if method is not None:
|
1508
1678
|
method(client, message)
|
1509
1679
|
if self.handle_error_message(client, message):
|
1510
|
-
event = self.
|
1680
|
+
event = self.safe_string_2(message, 'event', 'method')
|
1511
1681
|
methods: dict = {
|
1512
1682
|
'heartbeat': self.handle_heartbeat,
|
1513
1683
|
'systemStatus': self.handle_system_status,
|
1514
1684
|
'subscriptionStatus': self.handle_subscription_status,
|
1515
|
-
'
|
1516
|
-
'
|
1517
|
-
'
|
1518
|
-
'
|
1685
|
+
'add_order': self.handle_create_edit_order,
|
1686
|
+
'amend_order': self.handle_create_edit_order,
|
1687
|
+
'cancel_order': self.handle_cancel_order,
|
1688
|
+
'cancel_all': self.handle_cancel_all_orders,
|
1519
1689
|
}
|
1520
1690
|
method = self.safe_value(methods, event)
|
1521
1691
|
if method is not None:
|