ccxt 4.3.41__py2.py3-none-any.whl → 4.3.42__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/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bitmart.py +191 -100
- ccxt/async_support/blockchaincom.py +11 -7
- ccxt/async_support/coinex.py +1 -1
- ccxt/async_support/kraken.py +30 -3
- ccxt/async_support/krakenfutures.py +55 -1
- ccxt/async_support/kucoin.py +59 -2
- ccxt/base/exchange.py +1 -1
- ccxt/bitmart.py +191 -100
- ccxt/blockchaincom.py +11 -7
- ccxt/coinex.py +1 -1
- ccxt/kraken.py +30 -3
- ccxt/krakenfutures.py +55 -1
- ccxt/kucoin.py +59 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitget.py +5 -0
- ccxt/pro/mexc.py +1 -1
- ccxt/pro/upbit.py +8 -4
- ccxt/pro/woo.py +1 -1
- {ccxt-4.3.41.dist-info → ccxt-4.3.42.dist-info}/METADATA +4 -4
- {ccxt-4.3.41.dist-info → ccxt-4.3.42.dist-info}/RECORD +25 -25
- {ccxt-4.3.41.dist-info → ccxt-4.3.42.dist-info}/WHEEL +0 -0
- {ccxt-4.3.41.dist-info → ccxt-4.3.42.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/bitmart.py
CHANGED
@@ -1126,27 +1126,46 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1126
1126
|
|
1127
1127
|
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
1128
1128
|
#
|
1129
|
-
# spot(REST)
|
1129
|
+
# spot(REST) fetchTickers
|
1130
1130
|
#
|
1131
|
-
#
|
1132
|
-
#
|
1133
|
-
#
|
1134
|
-
#
|
1135
|
-
#
|
1136
|
-
#
|
1137
|
-
#
|
1138
|
-
#
|
1139
|
-
#
|
1140
|
-
#
|
1141
|
-
#
|
1142
|
-
#
|
1143
|
-
#
|
1144
|
-
#
|
1145
|
-
#
|
1146
|
-
#
|
1147
|
-
#
|
1131
|
+
# {
|
1132
|
+
# 'result': [
|
1133
|
+
# "AFIN_USDT", # symbol
|
1134
|
+
# "0.001047", # last
|
1135
|
+
# "11110", # v_24h
|
1136
|
+
# "11.632170", # qv_24h
|
1137
|
+
# "0.001048", # open_24h
|
1138
|
+
# "0.001048", # high_24h
|
1139
|
+
# "0.001047", # low_24h
|
1140
|
+
# "-0.00095", # price_change_24h
|
1141
|
+
# "0.001029", # bid_px
|
1142
|
+
# "5555", # bid_sz
|
1143
|
+
# "0.001041", # ask_px
|
1144
|
+
# "5297", # ask_sz
|
1145
|
+
# "1717122550482" # timestamp
|
1146
|
+
# ]
|
1147
|
+
# }
|
1148
|
+
#
|
1149
|
+
# spot(REST) fetchTicker
|
1150
|
+
#
|
1151
|
+
# {
|
1152
|
+
# "symbol": "BTC_USDT",
|
1153
|
+
# "last": "68500.00",
|
1154
|
+
# "v_24h": "10491.65490",
|
1155
|
+
# "qv_24h": "717178990.42",
|
1156
|
+
# "open_24h": "68149.75",
|
1157
|
+
# "high_24h": "69499.99",
|
1158
|
+
# "low_24h": "67132.40",
|
1159
|
+
# "fluctuation": "0.00514",
|
1160
|
+
# "bid_px": "68500",
|
1161
|
+
# "bid_sz": "0.00162",
|
1162
|
+
# "ask_px": "68500.01",
|
1163
|
+
# "ask_sz": "0.01722",
|
1164
|
+
# "ts": "1717131391671"
|
1165
|
+
# }
|
1148
1166
|
#
|
1149
1167
|
# spot(WS)
|
1168
|
+
#
|
1150
1169
|
# {
|
1151
1170
|
# "symbol":"BTC_USDT",
|
1152
1171
|
# "last_price":"146.24",
|
@@ -1172,19 +1191,44 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1172
1191
|
# "legal_coin_price":"0.1302699"
|
1173
1192
|
# }
|
1174
1193
|
#
|
1175
|
-
|
1176
|
-
|
1177
|
-
# ticker from WS has a different field(in seconds)
|
1178
|
-
timestamp = self.safe_integer_product(ticker, 's_t', 1000)
|
1194
|
+
result = self.safe_list(ticker, 'result', [])
|
1195
|
+
average = self.safe_string_2(ticker, 'avg_price', 'index_price')
|
1179
1196
|
marketId = self.safe_string_2(ticker, 'symbol', 'contract_symbol')
|
1197
|
+
timestamp = self.safe_integer_2(ticker, 'timestamp', 'ts')
|
1198
|
+
last = self.safe_string_2(ticker, 'last_price', 'last')
|
1199
|
+
percentage = self.safe_string(ticker, 'price_change_percent_24h')
|
1200
|
+
change = self.safe_string(ticker, 'fluctuation')
|
1201
|
+
high = self.safe_string_2(ticker, 'high_24h', 'high_price')
|
1202
|
+
low = self.safe_string_2(ticker, 'low_24h', 'low_price')
|
1203
|
+
bid = self.safe_string_2(ticker, 'best_bid', 'bid_px')
|
1204
|
+
bidVolume = self.safe_string_2(ticker, 'best_bid_size', 'bid_sz')
|
1205
|
+
ask = self.safe_string_2(ticker, 'best_ask', 'ask_px')
|
1206
|
+
askVolume = self.safe_string_2(ticker, 'best_ask_size', 'ask_sz')
|
1207
|
+
open = self.safe_string(ticker, 'open_24h')
|
1208
|
+
baseVolume = self.safe_string_2(ticker, 'base_volume_24h', 'v_24h')
|
1209
|
+
quoteVolume = self.safe_string_lower_2(ticker, 'quote_volume_24h', 'qv_24h')
|
1210
|
+
listMarketId = self.safe_string(result, 0)
|
1211
|
+
if listMarketId is not None:
|
1212
|
+
marketId = listMarketId
|
1213
|
+
timestamp = self.safe_integer(result, 12)
|
1214
|
+
high = self.safe_string(result, 5)
|
1215
|
+
low = self.safe_string(result, 6)
|
1216
|
+
bid = self.safe_string(result, 8)
|
1217
|
+
bidVolume = self.safe_string(result, 9)
|
1218
|
+
ask = self.safe_string(result, 10)
|
1219
|
+
askVolume = self.safe_string(result, 11)
|
1220
|
+
open = self.safe_string(result, 4)
|
1221
|
+
last = self.safe_string(result, 1)
|
1222
|
+
change = self.safe_string(result, 7)
|
1223
|
+
baseVolume = self.safe_string(result, 2)
|
1224
|
+
quoteVolume = self.safe_string_lower(result, 3)
|
1180
1225
|
market = self.safe_market(marketId, market)
|
1181
1226
|
symbol = market['symbol']
|
1182
|
-
|
1183
|
-
|
1227
|
+
if timestamp is None:
|
1228
|
+
# ticker from WS has a different field(in seconds)
|
1229
|
+
timestamp = self.safe_integer_product(ticker, 's_t', 1000)
|
1184
1230
|
if percentage is None:
|
1185
|
-
percentage = Precise.string_mul(
|
1186
|
-
baseVolume = self.safe_string(ticker, 'base_volume_24h')
|
1187
|
-
quoteVolume = self.safe_string(ticker, 'quote_volume_24h')
|
1231
|
+
percentage = Precise.string_mul(change, '100')
|
1188
1232
|
if quoteVolume is None:
|
1189
1233
|
if baseVolume is None:
|
1190
1234
|
# self is swap
|
@@ -1194,25 +1238,22 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1194
1238
|
# contrary to name and documentation, base_volume_24h is actually the quote volume
|
1195
1239
|
quoteVolume = baseVolume
|
1196
1240
|
baseVolume = None
|
1197
|
-
average = self.safe_string_2(ticker, 'avg_price', 'index_price')
|
1198
|
-
high = self.safe_string_2(ticker, 'high_24h', 'high_price')
|
1199
|
-
low = self.safe_string_2(ticker, 'low_24h', 'low_price')
|
1200
1241
|
return self.safe_ticker({
|
1201
1242
|
'symbol': symbol,
|
1202
1243
|
'timestamp': timestamp,
|
1203
1244
|
'datetime': self.iso8601(timestamp),
|
1204
1245
|
'high': high,
|
1205
1246
|
'low': low,
|
1206
|
-
'bid':
|
1207
|
-
'bidVolume':
|
1208
|
-
'ask':
|
1209
|
-
'askVolume':
|
1247
|
+
'bid': bid,
|
1248
|
+
'bidVolume': bidVolume,
|
1249
|
+
'ask': ask,
|
1250
|
+
'askVolume': askVolume,
|
1210
1251
|
'vwap': None,
|
1211
|
-
'open':
|
1252
|
+
'open': open,
|
1212
1253
|
'close': last,
|
1213
1254
|
'last': last,
|
1214
1255
|
'previousClose': None,
|
1215
|
-
'change':
|
1256
|
+
'change': change,
|
1216
1257
|
'percentage': percentage,
|
1217
1258
|
'average': average,
|
1218
1259
|
'baseVolume': baseVolume,
|
@@ -1223,6 +1264,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1223
1264
|
async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
1224
1265
|
"""
|
1225
1266
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
1267
|
+
:see: https://developer-pro.bitmart.com/en/spot/#get-ticker-of-a-trading-pair-v3
|
1226
1268
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
1227
1269
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1228
1270
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -1234,79 +1276,73 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1234
1276
|
if market['swap']:
|
1235
1277
|
request['contract_symbol'] = market['id']
|
1236
1278
|
response = await self.publicGetContractV1Tickers(self.extend(request, params))
|
1279
|
+
#
|
1280
|
+
# {
|
1281
|
+
# "message":"OK",
|
1282
|
+
# "code":1000,
|
1283
|
+
# "trace":"4a0ebceb-d3f7-45a3-8feb-f61e230e24cd",
|
1284
|
+
# "data":{
|
1285
|
+
# "tickers":[
|
1286
|
+
# {
|
1287
|
+
# "contract_symbol":"DOGEUSDT",
|
1288
|
+
# "last_price":"0.130180",
|
1289
|
+
# "index_price":"0.13028635",
|
1290
|
+
# "last_funding_rate":"0.00002025",
|
1291
|
+
# "price_change_percent_24h":"-2.326",
|
1292
|
+
# "volume_24h":"116789313.01797258",
|
1293
|
+
# "url":"https://futures.bitmart.com/en?symbol=DOGEUSDT",
|
1294
|
+
# "high_price":"0.134520",
|
1295
|
+
# "low_price":"0.128570",
|
1296
|
+
# "legal_coin_price":"0.13017401"
|
1297
|
+
# }
|
1298
|
+
# ]
|
1299
|
+
# }
|
1300
|
+
# }
|
1301
|
+
#
|
1237
1302
|
elif market['spot']:
|
1238
1303
|
request['symbol'] = market['id']
|
1239
|
-
response = await self.
|
1304
|
+
response = await self.publicGetSpotQuotationV3Ticker(self.extend(request, params))
|
1305
|
+
#
|
1306
|
+
# {
|
1307
|
+
# "code": 1000,
|
1308
|
+
# "trace": "f2194c2c202d2.99.1717535",
|
1309
|
+
# "message": "success",
|
1310
|
+
# "data": {
|
1311
|
+
# "symbol": "BTC_USDT",
|
1312
|
+
# "last": "68500.00",
|
1313
|
+
# "v_24h": "10491.65490",
|
1314
|
+
# "qv_24h": "717178990.42",
|
1315
|
+
# "open_24h": "68149.75",
|
1316
|
+
# "high_24h": "69499.99",
|
1317
|
+
# "low_24h": "67132.40",
|
1318
|
+
# "fluctuation": "0.00514",
|
1319
|
+
# "bid_px": "68500",
|
1320
|
+
# "bid_sz": "0.00162",
|
1321
|
+
# "ask_px": "68500.01",
|
1322
|
+
# "ask_sz": "0.01722",
|
1323
|
+
# "ts": "1717131391671"
|
1324
|
+
# }
|
1325
|
+
# }
|
1326
|
+
#
|
1240
1327
|
else:
|
1241
1328
|
raise NotSupported(self.id + ' fetchTicker() does not support ' + market['type'] + ' markets, only spot and swap markets are accepted')
|
1242
|
-
#
|
1243
|
-
# spot
|
1244
|
-
#
|
1245
|
-
# {
|
1246
|
-
# "message":"OK",
|
1247
|
-
# "code":1000,
|
1248
|
-
# "trace":"6aa5b923-2f57-46e3-876d-feca190e0b82",
|
1249
|
-
# "data":{
|
1250
|
-
# "tickers":[
|
1251
|
-
# {
|
1252
|
-
# "symbol":"ETH_BTC",
|
1253
|
-
# "last_price":"0.036037",
|
1254
|
-
# "quote_volume_24h":"4380.6660000000",
|
1255
|
-
# "base_volume_24h":"159.3582006712",
|
1256
|
-
# "high_24h":"0.036972",
|
1257
|
-
# "low_24h":"0.035524",
|
1258
|
-
# "open_24h":"0.036561",
|
1259
|
-
# "close_24h":"0.036037",
|
1260
|
-
# "best_ask":"0.036077",
|
1261
|
-
# "best_ask_size":"9.9500",
|
1262
|
-
# "best_bid":"0.035983",
|
1263
|
-
# "best_bid_size":"4.2792",
|
1264
|
-
# "fluctuation":"-0.0143",
|
1265
|
-
# "url":"https://www.bitmart.com/trade?symbol=ETH_BTC"
|
1266
|
-
# }
|
1267
|
-
# ]
|
1268
|
-
# }
|
1269
|
-
# }
|
1270
|
-
#
|
1271
|
-
# swap
|
1272
|
-
#
|
1273
|
-
# {
|
1274
|
-
# "message":"OK",
|
1275
|
-
# "code":1000,
|
1276
|
-
# "trace":"4a0ebceb-d3f7-45a3-8feb-f61e230e24cd",
|
1277
|
-
# "data":{
|
1278
|
-
# "tickers":[
|
1279
|
-
# {
|
1280
|
-
# "contract_symbol":"DOGEUSDT",
|
1281
|
-
# "last_price":"0.130180",
|
1282
|
-
# "index_price":"0.13028635",
|
1283
|
-
# "last_funding_rate":"0.00002025",
|
1284
|
-
# "price_change_percent_24h":"-2.326",
|
1285
|
-
# "volume_24h":"116789313.01797258",
|
1286
|
-
# "url":"https://futures.bitmart.com/en?symbol=DOGEUSDT",
|
1287
|
-
# "high_price":"0.134520",
|
1288
|
-
# "low_price":"0.128570",
|
1289
|
-
# "legal_coin_price":"0.13017401"
|
1290
|
-
# }
|
1291
|
-
# ]
|
1292
|
-
# }
|
1293
|
-
# }
|
1294
|
-
#
|
1295
|
-
data = self.safe_value(response, 'data', {})
|
1296
|
-
tickers = self.safe_value(data, 'tickers', [])
|
1297
1329
|
# fails in naming for contract tickers 'contract_symbol'
|
1298
1330
|
tickersById = None
|
1331
|
+
tickers = []
|
1332
|
+
ticker: dict = {}
|
1299
1333
|
if market['spot']:
|
1300
|
-
|
1301
|
-
|
1334
|
+
ticker = self.safe_dict(response, 'data', {})
|
1335
|
+
else:
|
1336
|
+
data = self.safe_dict(response, 'data', {})
|
1337
|
+
tickers = self.safe_list(data, 'tickers', [])
|
1302
1338
|
tickersById = self.index_by(tickers, 'contract_symbol')
|
1303
|
-
|
1339
|
+
ticker = self.safe_dict(tickersById, market['id'])
|
1304
1340
|
return self.parse_ticker(ticker, market)
|
1305
1341
|
|
1306
1342
|
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
1307
1343
|
"""
|
1308
1344
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
1309
|
-
:see: https://developer-pro.bitmart.com/en/spot/#get-ticker-of-all-pairs-
|
1345
|
+
:see: https://developer-pro.bitmart.com/en/spot/#get-ticker-of-all-pairs-v3
|
1310
1346
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
1311
1347
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1312
1348
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -1321,16 +1357,71 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1321
1357
|
type, params = self.handle_market_type_and_params('fetchTickers', market, params)
|
1322
1358
|
response = None
|
1323
1359
|
if type == 'spot':
|
1324
|
-
response = await self.
|
1360
|
+
response = await self.publicGetSpotQuotationV3Tickers(params)
|
1361
|
+
#
|
1362
|
+
# {
|
1363
|
+
# "code": 1000,
|
1364
|
+
# "trace": "17c5e5d9ac49f9b71efca2bed55f1a.105.171225637482393",
|
1365
|
+
# "message": "success",
|
1366
|
+
# "data": [
|
1367
|
+
# [
|
1368
|
+
# "AFIN_USDT",
|
1369
|
+
# "0.001047",
|
1370
|
+
# "11110",
|
1371
|
+
# "11.632170",
|
1372
|
+
# "0.001048",
|
1373
|
+
# "0.001048",
|
1374
|
+
# "0.001047",
|
1375
|
+
# "-0.00095",
|
1376
|
+
# "0.001029",
|
1377
|
+
# "5555",
|
1378
|
+
# "0.001041",
|
1379
|
+
# "5297",
|
1380
|
+
# "1717122550482"
|
1381
|
+
# ],
|
1382
|
+
# ]
|
1383
|
+
# }
|
1384
|
+
#
|
1325
1385
|
elif type == 'swap':
|
1326
1386
|
response = await self.publicGetContractV1Tickers(params)
|
1387
|
+
#
|
1388
|
+
# {
|
1389
|
+
# "message": "OK",
|
1390
|
+
# "code": 1000,
|
1391
|
+
# "trace": "c1dec681c24ea5d.105.171712565",
|
1392
|
+
# "data": {
|
1393
|
+
# "tickers": [
|
1394
|
+
# {
|
1395
|
+
# "contract_symbol": "SNTUSDT",
|
1396
|
+
# "last_price": "0.0366600",
|
1397
|
+
# "index_price": "0.03587373",
|
1398
|
+
# "last_funding_rate": "0.00005000",
|
1399
|
+
# "price_change_percent_24h": "-2.629",
|
1400
|
+
# "volume_24h": "10102540.19909109848",
|
1401
|
+
# "url": "https://futures.bitmart.com/en?symbol=SNTUSDT",
|
1402
|
+
# "high_price": "0.0405600",
|
1403
|
+
# "low_price": "0.0355000",
|
1404
|
+
# "legal_coin_price": "0.03666697"
|
1405
|
+
# },
|
1406
|
+
# ]
|
1407
|
+
# }
|
1408
|
+
# }
|
1409
|
+
#
|
1327
1410
|
else:
|
1328
1411
|
raise NotSupported(self.id + ' fetchTickers() does not support ' + type + ' markets, only spot and swap markets are accepted')
|
1329
|
-
|
1330
|
-
|
1412
|
+
tickers = []
|
1413
|
+
if type == 'spot':
|
1414
|
+
tickers = self.safe_list(response, 'data', [])
|
1415
|
+
else:
|
1416
|
+
data = self.safe_dict(response, 'data', {})
|
1417
|
+
tickers = self.safe_list(data, 'tickers', [])
|
1331
1418
|
result: dict = {}
|
1332
1419
|
for i in range(0, len(tickers)):
|
1333
|
-
ticker =
|
1420
|
+
ticker: dict = {}
|
1421
|
+
if type == 'spot':
|
1422
|
+
ticker = self.parse_ticker({'result': tickers[i]})
|
1423
|
+
else:
|
1424
|
+
ticker = self.parse_ticker(tickers[i])
|
1334
1425
|
symbol = ticker['symbol']
|
1335
1426
|
result[symbol] = ticker
|
1336
1427
|
return self.filter_by_array_tickers(result, 'symbol', symbols)
|
@@ -589,15 +589,15 @@ class blockchaincom(Exchange, ImplicitAPI):
|
|
589
589
|
'orderId': id,
|
590
590
|
}
|
591
591
|
response = await self.privateDeleteOrdersOrderId(self.extend(request, params))
|
592
|
-
return {
|
592
|
+
return self.safe_order({
|
593
593
|
'id': id,
|
594
594
|
'info': response,
|
595
|
-
}
|
595
|
+
})
|
596
596
|
|
597
597
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
598
598
|
"""
|
599
599
|
cancel all open orders
|
600
|
-
:see: https://api.blockchain.com/v3
|
600
|
+
:see: https://api.blockchain.com/v3/#deleteallorders
|
601
601
|
:param str symbol: unified market symbol of the market to cancel orders in, all markets are used if None, default is None
|
602
602
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
603
603
|
:returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -612,10 +612,14 @@ class blockchaincom(Exchange, ImplicitAPI):
|
|
612
612
|
marketId = self.market_id(symbol)
|
613
613
|
request['symbol'] = marketId
|
614
614
|
response = await self.privateDeleteOrders(self.extend(request, params))
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
615
|
+
#
|
616
|
+
# {}
|
617
|
+
#
|
618
|
+
return [
|
619
|
+
self.safe_order({
|
620
|
+
'info': response,
|
621
|
+
}),
|
622
|
+
]
|
619
623
|
|
620
624
|
async def fetch_trading_fees(self, params={}) -> TradingFees:
|
621
625
|
"""
|
ccxt/async_support/coinex.py
CHANGED
@@ -5440,7 +5440,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
5440
5440
|
preparedString += nonce + self.secret
|
5441
5441
|
signature = self.hash(self.encode(preparedString), 'sha256')
|
5442
5442
|
headers = {
|
5443
|
-
'Content-Type': 'application/json
|
5443
|
+
'Content-Type': 'application/json',
|
5444
5444
|
'Accept': 'application/json',
|
5445
5445
|
'X-COINEX-KEY': self.apiKey,
|
5446
5446
|
'X-COINEX-SIGN': signature,
|
ccxt/async_support/kraken.py
CHANGED
@@ -2008,12 +2008,22 @@ class kraken(Exchange, ImplicitAPI):
|
|
2008
2008
|
params = self.omit(params, ['userref', 'clientOrderId'])
|
2009
2009
|
try:
|
2010
2010
|
response = await self.privatePostCancelOrder(self.extend(request, params))
|
2011
|
+
#
|
2012
|
+
# {
|
2013
|
+
# error: [],
|
2014
|
+
# result: {
|
2015
|
+
# count: '1'
|
2016
|
+
# }
|
2017
|
+
# }
|
2018
|
+
#
|
2011
2019
|
except Exception as e:
|
2012
2020
|
if self.last_http_response:
|
2013
2021
|
if self.last_http_response.find('EOrder:Unknown order') >= 0:
|
2014
2022
|
raise OrderNotFound(self.id + ' cancelOrder() error ' + self.last_http_response)
|
2015
2023
|
raise e
|
2016
|
-
return
|
2024
|
+
return self.safe_order({
|
2025
|
+
'info': response,
|
2026
|
+
})
|
2017
2027
|
|
2018
2028
|
async def cancel_orders(self, ids, symbol: Str = None, params={}):
|
2019
2029
|
"""
|
@@ -2036,7 +2046,11 @@ class kraken(Exchange, ImplicitAPI):
|
|
2036
2046
|
# }
|
2037
2047
|
# }
|
2038
2048
|
#
|
2039
|
-
return
|
2049
|
+
return [
|
2050
|
+
self.safe_order({
|
2051
|
+
'info': response,
|
2052
|
+
}),
|
2053
|
+
]
|
2040
2054
|
|
2041
2055
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
2042
2056
|
"""
|
@@ -2047,7 +2061,20 @@ class kraken(Exchange, ImplicitAPI):
|
|
2047
2061
|
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
2048
2062
|
"""
|
2049
2063
|
await self.load_markets()
|
2050
|
-
|
2064
|
+
response = await self.privatePostCancelAll(params)
|
2065
|
+
#
|
2066
|
+
# {
|
2067
|
+
# error: [],
|
2068
|
+
# result: {
|
2069
|
+
# count: '1'
|
2070
|
+
# }
|
2071
|
+
# }
|
2072
|
+
#
|
2073
|
+
return [
|
2074
|
+
self.safe_order({
|
2075
|
+
'info': response,
|
2076
|
+
}),
|
2077
|
+
]
|
2051
2078
|
|
2052
2079
|
async def cancel_all_orders_after(self, timeout: Int, params={}):
|
2053
2080
|
"""
|
@@ -1207,7 +1207,45 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1207
1207
|
if symbol is not None:
|
1208
1208
|
request['symbol'] = self.market_id(symbol)
|
1209
1209
|
response = await self.privatePostCancelallorders(self.extend(request, params))
|
1210
|
-
|
1210
|
+
#
|
1211
|
+
# {
|
1212
|
+
# result: 'success',
|
1213
|
+
# cancelStatus: {
|
1214
|
+
# receivedTime: '2024-06-06T01:12:44.814Z',
|
1215
|
+
# cancelOnly: 'PF_XRPUSD',
|
1216
|
+
# status: 'cancelled',
|
1217
|
+
# cancelledOrders: [{order_id: '272fd0ac-45c0-4003-b84d-d39b9e86bd36'}],
|
1218
|
+
# orderEvents: [
|
1219
|
+
# {
|
1220
|
+
# uid: '272fd0ac-45c0-4003-b84d-d39b9e86bd36',
|
1221
|
+
# order: {
|
1222
|
+
# orderId: '272fd0ac-45c0-4003-b84d-d39b9e86bd36',
|
1223
|
+
# cliOrdId: null,
|
1224
|
+
# type: 'lmt',
|
1225
|
+
# symbol: 'PF_XRPUSD',
|
1226
|
+
# side: 'buy',
|
1227
|
+
# quantity: '10',
|
1228
|
+
# filled: '0',
|
1229
|
+
# limitPrice: '0.4',
|
1230
|
+
# reduceOnly: False,
|
1231
|
+
# timestamp: '2024-06-06T01:11:16.045Z',
|
1232
|
+
# lastUpdateTimestamp: '2024-06-06T01:11:16.045Z'
|
1233
|
+
# },
|
1234
|
+
# type: 'CANCEL'
|
1235
|
+
# }
|
1236
|
+
# ]
|
1237
|
+
# },
|
1238
|
+
# serverTime: '2024-06-06T01:12:44.814Z'
|
1239
|
+
# }
|
1240
|
+
#
|
1241
|
+
cancelStatus = self.safe_dict(response, 'cancelStatus')
|
1242
|
+
orderEvents = self.safe_list(cancelStatus, 'orderEvents', [])
|
1243
|
+
orders = []
|
1244
|
+
for i in range(0, len(orderEvents)):
|
1245
|
+
orderEvent = self.safe_dict(orderEvents, 0)
|
1246
|
+
order = self.safe_dict(orderEvent, 'order', {})
|
1247
|
+
orders.append(order)
|
1248
|
+
return self.parse_orders(orders)
|
1211
1249
|
|
1212
1250
|
async def cancel_all_orders_after(self, timeout: Int, params={}):
|
1213
1251
|
"""
|
@@ -1551,6 +1589,22 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1551
1589
|
# ]
|
1552
1590
|
# }
|
1553
1591
|
#
|
1592
|
+
# cancelAllOrders
|
1593
|
+
#
|
1594
|
+
# {
|
1595
|
+
# "orderId": "85c40002-3f20-4e87-9302-262626c3531b",
|
1596
|
+
# "cliOrdId": null,
|
1597
|
+
# "type": "lmt",
|
1598
|
+
# "symbol": "pi_xbtusd",
|
1599
|
+
# "side": "buy",
|
1600
|
+
# "quantity": 1000,
|
1601
|
+
# "filled": 0,
|
1602
|
+
# "limitPrice": 10144,
|
1603
|
+
# "stopPrice": null,
|
1604
|
+
# "reduceOnly": False,
|
1605
|
+
# "timestamp": "2019-08-01T15:26:27.790Z"
|
1606
|
+
# }
|
1607
|
+
#
|
1554
1608
|
# FETCH OPEN ORDERS
|
1555
1609
|
#
|
1556
1610
|
# {
|
ccxt/async_support/kucoin.py
CHANGED
@@ -2238,19 +2238,76 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2238
2238
|
request['clientOid'] = clientOrderId
|
2239
2239
|
if stop:
|
2240
2240
|
response = await self.privateDeleteStopOrderCancelOrderByClientOid(self.extend(request, params))
|
2241
|
+
#
|
2242
|
+
# {
|
2243
|
+
# code: '200000',
|
2244
|
+
# data: {
|
2245
|
+
# cancelledOrderId: 'vs8lgpiuao41iaft003khbbk',
|
2246
|
+
# clientOid: '123456'
|
2247
|
+
# }
|
2248
|
+
# }
|
2249
|
+
#
|
2241
2250
|
elif hf:
|
2242
2251
|
response = await self.privateDeleteHfOrdersClientOrderClientOid(self.extend(request, params))
|
2252
|
+
#
|
2253
|
+
# {
|
2254
|
+
# "code": "200000",
|
2255
|
+
# "data": {
|
2256
|
+
# "clientOid": "6d539dc614db3"
|
2257
|
+
# }
|
2258
|
+
# }
|
2259
|
+
#
|
2243
2260
|
else:
|
2244
2261
|
response = await self.privateDeleteOrderClientOrderClientOid(self.extend(request, params))
|
2262
|
+
#
|
2263
|
+
# {
|
2264
|
+
# code: '200000',
|
2265
|
+
# data: {
|
2266
|
+
# cancelledOrderId: '665e580f6660500007aba341',
|
2267
|
+
# clientOid: '1234567',
|
2268
|
+
# cancelledOcoOrderIds: null
|
2269
|
+
# }
|
2270
|
+
# }
|
2271
|
+
#
|
2272
|
+
response = self.safe_dict(response, 'data')
|
2273
|
+
return self.parse_order(response)
|
2245
2274
|
else:
|
2246
2275
|
request['orderId'] = id
|
2247
2276
|
if stop:
|
2248
2277
|
response = await self.privateDeleteStopOrderOrderId(self.extend(request, params))
|
2278
|
+
#
|
2279
|
+
# {
|
2280
|
+
# code: '200000',
|
2281
|
+
# data: {cancelledOrderIds: ['vs8lgpiuaco91qk8003vebu9']}
|
2282
|
+
# }
|
2283
|
+
#
|
2249
2284
|
elif hf:
|
2250
2285
|
response = await self.privateDeleteHfOrdersOrderId(self.extend(request, params))
|
2286
|
+
#
|
2287
|
+
# {
|
2288
|
+
# "code": "200000",
|
2289
|
+
# "data": {
|
2290
|
+
# "orderId": "630625dbd9180300014c8d52"
|
2291
|
+
# }
|
2292
|
+
# }
|
2293
|
+
#
|
2294
|
+
response = self.safe_dict(response, 'data')
|
2295
|
+
return self.parse_order(response)
|
2251
2296
|
else:
|
2252
2297
|
response = await self.privateDeleteOrdersOrderId(self.extend(request, params))
|
2253
|
-
|
2298
|
+
#
|
2299
|
+
# {
|
2300
|
+
# code: '200000',
|
2301
|
+
# data: {cancelledOrderIds: ['665e4fbe28051a0007245c41']}
|
2302
|
+
# }
|
2303
|
+
#
|
2304
|
+
data = self.safe_dict(response, 'data')
|
2305
|
+
orderIds = self.safe_list(data, 'cancelledOrderIds', [])
|
2306
|
+
orderId = self.safe_string(orderIds, 0)
|
2307
|
+
return self.safe_order({
|
2308
|
+
'info': data,
|
2309
|
+
'id': orderId,
|
2310
|
+
})
|
2254
2311
|
|
2255
2312
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
2256
2313
|
"""
|
@@ -2664,7 +2721,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
2664
2721
|
stopPrice = self.safe_number(order, 'stopPrice')
|
2665
2722
|
return self.safe_order({
|
2666
2723
|
'info': order,
|
2667
|
-
'id': self.safe_string_n(order, ['id', 'orderId', 'newOrderId']),
|
2724
|
+
'id': self.safe_string_n(order, ['id', 'orderId', 'newOrderId', 'cancelledOrderId']),
|
2668
2725
|
'clientOrderId': self.safe_string(order, 'clientOid'),
|
2669
2726
|
'symbol': self.safe_symbol(marketId, market, '-'),
|
2670
2727
|
'type': self.safe_string(order, 'type'),
|