ccxt 4.3.41 → 4.3.43

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.
Files changed (52) hide show
  1. package/README.md +5 -5
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/binance.js +169 -44
  5. package/dist/cjs/src/bitmart.js +196 -100
  6. package/dist/cjs/src/blockchaincom.js +11 -7
  7. package/dist/cjs/src/btcmarkets.js +31 -2
  8. package/dist/cjs/src/coinex.js +107 -108
  9. package/dist/cjs/src/kraken.js +30 -3
  10. package/dist/cjs/src/krakenfutures.js +56 -1
  11. package/dist/cjs/src/kucoin.js +59 -2
  12. package/dist/cjs/src/phemex.js +5 -4
  13. package/dist/cjs/src/pro/bitget.js +36 -22
  14. package/dist/cjs/src/pro/bybit.js +1 -1
  15. package/dist/cjs/src/pro/mexc.js +2 -2
  16. package/dist/cjs/src/pro/upbit.js +8 -4
  17. package/dist/cjs/src/pro/woo.js +2 -2
  18. package/dist/cjs/src/tradeogre.js +11 -5
  19. package/dist/cjs/src/wavesexchange.js +2 -2
  20. package/dist/cjs/src/wazirx.js +38 -15
  21. package/dist/cjs/src/zonda.js +9 -1
  22. package/js/ccxt.d.ts +3 -3
  23. package/js/ccxt.js +1 -1
  24. package/js/src/abstract/coinex.d.ts +2 -1
  25. package/js/src/binance.js +169 -44
  26. package/js/src/bitmart.js +196 -100
  27. package/js/src/blockchaincom.d.ts +2 -8
  28. package/js/src/blockchaincom.js +11 -7
  29. package/js/src/btcmarkets.d.ts +2 -2
  30. package/js/src/btcmarkets.js +31 -2
  31. package/js/src/coinex.js +107 -108
  32. package/js/src/kraken.d.ts +3 -3
  33. package/js/src/kraken.js +30 -3
  34. package/js/src/krakenfutures.d.ts +1 -1
  35. package/js/src/krakenfutures.js +56 -1
  36. package/js/src/kucoin.d.ts +1 -1
  37. package/js/src/kucoin.js +59 -2
  38. package/js/src/phemex.js +6 -5
  39. package/js/src/pro/bitget.js +36 -22
  40. package/js/src/pro/bybit.js +1 -1
  41. package/js/src/pro/mexc.js +2 -2
  42. package/js/src/pro/upbit.js +8 -4
  43. package/js/src/pro/woo.js +2 -2
  44. package/js/src/tradeogre.d.ts +1 -1
  45. package/js/src/tradeogre.js +12 -6
  46. package/js/src/wavesexchange.d.ts +1 -20
  47. package/js/src/wavesexchange.js +2 -2
  48. package/js/src/wazirx.d.ts +1 -1
  49. package/js/src/wazirx.js +38 -15
  50. package/js/src/zonda.d.ts +1 -1
  51. package/js/src/zonda.js +9 -1
  52. package/package.json +1 -1
@@ -18,7 +18,7 @@ class coinex extends coinex$1 {
18
18
  return this.deepExtend(super.describe(), {
19
19
  'id': 'coinex',
20
20
  'name': 'CoinEx',
21
- 'version': 'v1',
21
+ 'version': 'v2',
22
22
  'countries': ['CN'],
23
23
  // IP ratelimit is 400 requests per second
24
24
  // rateLimit = 1000ms / 400 = 2.5
@@ -315,6 +315,8 @@ class coinex extends coinex$1 {
315
315
  'futures/position-level': 1,
316
316
  'futures/liquidation-history': 1,
317
317
  'futures/basis-history': 1,
318
+ 'assets/deposit-withdraw-config': 1,
319
+ 'assets/all-deposit-withdraw-config': 1,
318
320
  },
319
321
  },
320
322
  'private': {
@@ -337,7 +339,6 @@ class coinex extends coinex$1 {
337
339
  'assets/deposit-address': 40,
338
340
  'assets/deposit-history': 40,
339
341
  'assets/withdraw': 40,
340
- 'assets/deposit-withdraw-config': 1,
341
342
  'assets/transfer-history': 40,
342
343
  'spot/order-status': 8,
343
344
  'spot/batch-order-status': 8,
@@ -531,131 +532,129 @@ class coinex extends coinex$1 {
531
532
  });
532
533
  }
533
534
  async fetchCurrencies(params = {}) {
534
- const response = await this.v1PublicGetCommonAssetConfig(params);
535
+ /**
536
+ * @method
537
+ * @name coinex#fetchCurrencies
538
+ * @description fetches all available currencies on an exchange
539
+ * @see https://docs.coinex.com/api/v2/assets/deposit-withdrawal/http/list-all-deposit-withdrawal-config
540
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
541
+ * @returns {object} an associative dictionary of currencies
542
+ */
543
+ const response = await this.v2PublicGetAssetsAllDepositWithdrawConfig(params);
544
+ //
535
545
  // {
536
546
  // "code": 0,
537
- // "data": {
538
- // "USDT-ERC20": {
539
- // "asset": "USDT",
540
- // "chain": "ERC20",
541
- // "withdrawal_precision": 6,
542
- // "can_deposit": true,
543
- // "can_withdraw": true,
544
- // "deposit_least_amount": "4.9",
545
- // "withdraw_least_amount": "4.9",
546
- // "withdraw_tx_fee": "4.9",
547
- // "explorer_asset_url": "https://etherscan.io/token/0xdac17f958d2ee523a2206206994597c13d831ec7"
548
- // },
549
- // ...
550
- // },
551
- // "message": "Success",
547
+ // "data": [
548
+ // {
549
+ // "asset": {
550
+ // "ccy": "CET",
551
+ // "deposit_enabled": true,
552
+ // "withdraw_enabled": true,
553
+ // "inter_transfer_enabled": true,
554
+ // "is_st": false
555
+ // },
556
+ // "chains": [
557
+ // {
558
+ // "chain": "CSC",
559
+ // "min_deposit_amount": "0.8",
560
+ // "min_withdraw_amount": "8",
561
+ // "deposit_enabled": true,
562
+ // "withdraw_enabled": true,
563
+ // "deposit_delay_minutes": 0,
564
+ // "safe_confirmations": 10,
565
+ // "irreversible_confirmations": 20,
566
+ // "deflation_rate": "0",
567
+ // "withdrawal_fee": "0.026",
568
+ // "withdrawal_precision": 8,
569
+ // "memo": "",
570
+ // "is_memo_required_for_deposit": false,
571
+ // "explorer_asset_url": ""
572
+ // },
573
+ // ]
574
+ // }
575
+ // ],
576
+ // "message": "OK"
552
577
  // }
553
578
  //
554
- const data = this.safeValue(response, 'data', []);
555
- const coins = Object.keys(data);
579
+ const data = this.safeList(response, 'data', []);
556
580
  const result = {};
557
- for (let i = 0; i < coins.length; i++) {
558
- const coin = coins[i];
559
- const currency = data[coin];
560
- const currencyId = this.safeString(currency, 'asset');
561
- const networkId = this.safeString(currency, 'chain');
581
+ for (let i = 0; i < data.length; i++) {
582
+ const coin = data[i];
583
+ const asset = this.safeDict(coin, 'asset', {});
584
+ const chains = this.safeList(coin, 'chains', []);
585
+ const currencyId = this.safeString(asset, 'ccy');
586
+ if (currencyId === undefined) {
587
+ continue; // coinex returns empty structures for some reason
588
+ }
562
589
  const code = this.safeCurrencyCode(currencyId);
563
- const precisionString = this.parsePrecision(this.safeString(currency, 'withdrawal_precision'));
564
- const precision = this.parseNumber(precisionString);
565
- const canDeposit = this.safeValue(currency, 'can_deposit');
566
- const canWithdraw = this.safeValue(currency, 'can_withdraw');
567
- const feeString = this.safeString(currency, 'withdraw_tx_fee');
568
- const fee = this.parseNumber(feeString);
569
- const minNetworkDepositString = this.safeString(currency, 'deposit_least_amount');
570
- const minNetworkDeposit = this.parseNumber(minNetworkDepositString);
571
- const minNetworkWithdrawString = this.safeString(currency, 'withdraw_least_amount');
572
- const minNetworkWithdraw = this.parseNumber(minNetworkWithdrawString);
573
- if (this.safeValue(result, code) === undefined) {
574
- result[code] = {
575
- 'id': currencyId,
576
- 'numericId': undefined,
577
- 'code': code,
578
- 'info': undefined,
590
+ const canDeposit = this.safeBool(asset, 'deposit_enabled');
591
+ const canWithdraw = this.safeBool(asset, 'withdraw_enabled');
592
+ const firstChain = this.safeDict(chains, 0, {});
593
+ const firstPrecisionString = this.parsePrecision(this.safeString(firstChain, 'withdrawal_precision'));
594
+ result[code] = {
595
+ 'id': currencyId,
596
+ 'code': code,
597
+ 'name': undefined,
598
+ 'active': canDeposit && canWithdraw,
599
+ 'deposit': canDeposit,
600
+ 'withdraw': canWithdraw,
601
+ 'fee': undefined,
602
+ 'precision': this.parseNumber(firstPrecisionString),
603
+ 'limits': {
604
+ 'amount': {
605
+ 'min': undefined,
606
+ 'max': undefined,
607
+ },
608
+ 'deposit': {
609
+ 'min': undefined,
610
+ 'max': undefined,
611
+ },
612
+ 'withdraw': {
613
+ 'min': undefined,
614
+ 'max': undefined,
615
+ },
616
+ },
617
+ 'networks': {},
618
+ 'info': coin,
619
+ };
620
+ for (let j = 0; j < chains.length; j++) {
621
+ const chain = chains[j];
622
+ const networkId = this.safeString(chain, 'chain');
623
+ const precisionString = this.parsePrecision(this.safeString(chain, 'withdrawal_precision'));
624
+ const feeString = this.safeString(chain, 'withdrawal_fee');
625
+ const minNetworkDepositString = this.safeString(chain, 'min_deposit_amount');
626
+ const minNetworkWithdrawString = this.safeString(chain, 'min_withdraw_amount');
627
+ const canDepositChain = this.safeBool(chain, 'deposit_enabled');
628
+ const canWithdrawChain = this.safeBool(chain, 'withdraw_enabled');
629
+ const network = {
630
+ 'id': networkId,
631
+ 'network': networkId,
579
632
  'name': undefined,
580
- 'active': canDeposit && canWithdraw,
581
- 'deposit': canDeposit,
582
- 'withdraw': canWithdraw,
583
- 'fee': fee,
584
- 'precision': precision,
633
+ 'active': canDepositChain && canWithdrawChain,
634
+ 'deposit': canDepositChain,
635
+ 'withdraw': canWithdrawChain,
636
+ 'fee': this.parseNumber(feeString),
637
+ 'precision': this.parseNumber(precisionString),
585
638
  'limits': {
586
639
  'amount': {
587
640
  'min': undefined,
588
641
  'max': undefined,
589
642
  },
590
643
  'deposit': {
591
- 'min': minNetworkDeposit,
644
+ 'min': this.parseNumber(minNetworkDepositString),
592
645
  'max': undefined,
593
646
  },
594
647
  'withdraw': {
595
- 'min': minNetworkWithdraw,
648
+ 'min': this.parseNumber(minNetworkWithdrawString),
596
649
  'max': undefined,
597
650
  },
598
651
  },
652
+ 'info': chain,
599
653
  };
654
+ const networks = this.safeDict(result[code], 'networks', {});
655
+ networks[networkId] = network;
656
+ result[code]['networks'] = networks;
600
657
  }
601
- let minFeeString = this.safeString(result[code], 'fee');
602
- if (feeString !== undefined) {
603
- minFeeString = (minFeeString === undefined) ? feeString : Precise["default"].stringMin(feeString, minFeeString);
604
- }
605
- let depositAvailable = this.safeValue(result[code], 'deposit');
606
- depositAvailable = (canDeposit) ? canDeposit : depositAvailable;
607
- let withdrawAvailable = this.safeValue(result[code], 'withdraw');
608
- withdrawAvailable = (canWithdraw) ? canWithdraw : withdrawAvailable;
609
- let minDepositString = this.safeString(result[code]['limits']['deposit'], 'min');
610
- if (minNetworkDepositString !== undefined) {
611
- minDepositString = (minDepositString === undefined) ? minNetworkDepositString : Precise["default"].stringMin(minNetworkDepositString, minDepositString);
612
- }
613
- let minWithdrawString = this.safeString(result[code]['limits']['withdraw'], 'min');
614
- if (minNetworkWithdrawString !== undefined) {
615
- minWithdrawString = (minWithdrawString === undefined) ? minNetworkWithdrawString : Precise["default"].stringMin(minNetworkWithdrawString, minWithdrawString);
616
- }
617
- let minPrecisionString = this.safeString(result[code], 'precision');
618
- if (precisionString !== undefined) {
619
- minPrecisionString = (minPrecisionString === undefined) ? precisionString : Precise["default"].stringMin(precisionString, minPrecisionString);
620
- }
621
- const networks = this.safeValue(result[code], 'networks', {});
622
- const network = {
623
- 'info': currency,
624
- 'id': networkId,
625
- 'network': networkId,
626
- 'name': undefined,
627
- 'limits': {
628
- 'amount': {
629
- 'min': undefined,
630
- 'max': undefined,
631
- },
632
- 'deposit': {
633
- 'min': this.safeNumber(currency, 'deposit_least_amount'),
634
- 'max': undefined,
635
- },
636
- 'withdraw': {
637
- 'min': this.safeNumber(currency, 'withdraw_least_amount'),
638
- 'max': undefined,
639
- },
640
- },
641
- 'active': canDeposit && canWithdraw,
642
- 'deposit': canDeposit,
643
- 'withdraw': canWithdraw,
644
- 'fee': fee,
645
- 'precision': precision,
646
- };
647
- networks[networkId] = network;
648
- result[code]['networks'] = networks;
649
- result[code]['active'] = depositAvailable && withdrawAvailable;
650
- result[code]['deposit'] = depositAvailable;
651
- result[code]['withdraw'] = withdrawAvailable;
652
- const info = this.safeValue(result[code], 'info', []);
653
- info.push(currency);
654
- result[code]['info'] = info;
655
- result[code]['fee'] = this.parseNumber(minFeeString);
656
- result[code]['precision'] = this.parseNumber(minPrecisionString);
657
- result[code]['limits']['deposit']['min'] = this.parseNumber(minDepositString);
658
- result[code]['limits']['withdraw']['min'] = this.parseNumber(minWithdrawString);
659
658
  }
660
659
  return result;
661
660
  }
@@ -5428,7 +5427,7 @@ class coinex extends coinex$1 {
5428
5427
  const request = {
5429
5428
  'ccy': currency['id'],
5430
5429
  };
5431
- const response = await this.v2PrivateGetAssetsDepositWithdrawConfig(this.extend(request, params));
5430
+ const response = await this.v2PublicGetAssetsDepositWithdrawConfig(this.extend(request, params));
5432
5431
  //
5433
5432
  // {
5434
5433
  // "code": 0,
@@ -5786,7 +5785,7 @@ class coinex extends coinex$1 {
5786
5785
  preparedString += nonce + this.secret;
5787
5786
  const signature = this.hash(this.encode(preparedString), sha256.sha256);
5788
5787
  headers = {
5789
- 'Content-Type': 'application/json; charset=utf-8',
5788
+ 'Content-Type': 'application/json',
5790
5789
  'Accept': 'application/json',
5791
5790
  'X-COINEX-KEY': this.apiKey,
5792
5791
  'X-COINEX-SIGN': signature,
@@ -2137,6 +2137,14 @@ class kraken extends kraken$1 {
2137
2137
  params = this.omit(params, ['userref', 'clientOrderId']);
2138
2138
  try {
2139
2139
  response = await this.privatePostCancelOrder(this.extend(request, params));
2140
+ //
2141
+ // {
2142
+ // error: [],
2143
+ // result: {
2144
+ // count: '1'
2145
+ // }
2146
+ // }
2147
+ //
2140
2148
  }
2141
2149
  catch (e) {
2142
2150
  if (this.last_http_response) {
@@ -2146,7 +2154,9 @@ class kraken extends kraken$1 {
2146
2154
  }
2147
2155
  throw e;
2148
2156
  }
2149
- return response;
2157
+ return this.safeOrder({
2158
+ 'info': response,
2159
+ });
2150
2160
  }
2151
2161
  async cancelOrders(ids, symbol = undefined, params = {}) {
2152
2162
  /**
@@ -2171,7 +2181,11 @@ class kraken extends kraken$1 {
2171
2181
  // }
2172
2182
  // }
2173
2183
  //
2174
- return response;
2184
+ return [
2185
+ this.safeOrder({
2186
+ 'info': response,
2187
+ }),
2188
+ ];
2175
2189
  }
2176
2190
  async cancelAllOrders(symbol = undefined, params = {}) {
2177
2191
  /**
@@ -2184,7 +2198,20 @@ class kraken extends kraken$1 {
2184
2198
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
2185
2199
  */
2186
2200
  await this.loadMarkets();
2187
- return await this.privatePostCancelAll(params);
2201
+ const response = await this.privatePostCancelAll(params);
2202
+ //
2203
+ // {
2204
+ // error: [],
2205
+ // result: {
2206
+ // count: '1'
2207
+ // }
2208
+ // }
2209
+ //
2210
+ return [
2211
+ this.safeOrder({
2212
+ 'info': response,
2213
+ }),
2214
+ ];
2188
2215
  }
2189
2216
  async cancelAllOrdersAfter(timeout, params = {}) {
2190
2217
  /**
@@ -1269,7 +1269,46 @@ class krakenfutures extends krakenfutures$1 {
1269
1269
  request['symbol'] = this.marketId(symbol);
1270
1270
  }
1271
1271
  const response = await this.privatePostCancelallorders(this.extend(request, params));
1272
- return response;
1272
+ //
1273
+ // {
1274
+ // result: 'success',
1275
+ // cancelStatus: {
1276
+ // receivedTime: '2024-06-06T01:12:44.814Z',
1277
+ // cancelOnly: 'PF_XRPUSD',
1278
+ // status: 'cancelled',
1279
+ // cancelledOrders: [ { order_id: '272fd0ac-45c0-4003-b84d-d39b9e86bd36' } ],
1280
+ // orderEvents: [
1281
+ // {
1282
+ // uid: '272fd0ac-45c0-4003-b84d-d39b9e86bd36',
1283
+ // order: {
1284
+ // orderId: '272fd0ac-45c0-4003-b84d-d39b9e86bd36',
1285
+ // cliOrdId: null,
1286
+ // type: 'lmt',
1287
+ // symbol: 'PF_XRPUSD',
1288
+ // side: 'buy',
1289
+ // quantity: '10',
1290
+ // filled: '0',
1291
+ // limitPrice: '0.4',
1292
+ // reduceOnly: false,
1293
+ // timestamp: '2024-06-06T01:11:16.045Z',
1294
+ // lastUpdateTimestamp: '2024-06-06T01:11:16.045Z'
1295
+ // },
1296
+ // type: 'CANCEL'
1297
+ // }
1298
+ // ]
1299
+ // },
1300
+ // serverTime: '2024-06-06T01:12:44.814Z'
1301
+ // }
1302
+ //
1303
+ const cancelStatus = this.safeDict(response, 'cancelStatus');
1304
+ const orderEvents = this.safeList(cancelStatus, 'orderEvents', []);
1305
+ const orders = [];
1306
+ for (let i = 0; i < orderEvents.length; i++) {
1307
+ const orderEvent = this.safeDict(orderEvents, 0);
1308
+ const order = this.safeDict(orderEvent, 'order', {});
1309
+ orders.push(order);
1310
+ }
1311
+ return this.parseOrders(orders);
1273
1312
  }
1274
1313
  async cancelAllOrdersAfter(timeout, params = {}) {
1275
1314
  /**
@@ -1637,6 +1676,22 @@ class krakenfutures extends krakenfutures$1 {
1637
1676
  // ]
1638
1677
  // }
1639
1678
  //
1679
+ // cancelAllOrders
1680
+ //
1681
+ // {
1682
+ // "orderId": "85c40002-3f20-4e87-9302-262626c3531b",
1683
+ // "cliOrdId": null,
1684
+ // "type": "lmt",
1685
+ // "symbol": "pi_xbtusd",
1686
+ // "side": "buy",
1687
+ // "quantity": 1000,
1688
+ // "filled": 0,
1689
+ // "limitPrice": 10144,
1690
+ // "stopPrice": null,
1691
+ // "reduceOnly": false,
1692
+ // "timestamp": "2019-08-01T15:26:27.790Z"
1693
+ // }
1694
+ //
1640
1695
  // FETCH OPEN ORDERS
1641
1696
  //
1642
1697
  // {
@@ -2330,27 +2330,84 @@ class kucoin extends kucoin$1 {
2330
2330
  request['clientOid'] = clientOrderId;
2331
2331
  if (stop) {
2332
2332
  response = await this.privateDeleteStopOrderCancelOrderByClientOid(this.extend(request, params));
2333
+ //
2334
+ // {
2335
+ // code: '200000',
2336
+ // data: {
2337
+ // cancelledOrderId: 'vs8lgpiuao41iaft003khbbk',
2338
+ // clientOid: '123456'
2339
+ // }
2340
+ // }
2341
+ //
2333
2342
  }
2334
2343
  else if (hf) {
2335
2344
  response = await this.privateDeleteHfOrdersClientOrderClientOid(this.extend(request, params));
2345
+ //
2346
+ // {
2347
+ // "code": "200000",
2348
+ // "data": {
2349
+ // "clientOid": "6d539dc614db3"
2350
+ // }
2351
+ // }
2352
+ //
2336
2353
  }
2337
2354
  else {
2338
2355
  response = await this.privateDeleteOrderClientOrderClientOid(this.extend(request, params));
2356
+ //
2357
+ // {
2358
+ // code: '200000',
2359
+ // data: {
2360
+ // cancelledOrderId: '665e580f6660500007aba341',
2361
+ // clientOid: '1234567',
2362
+ // cancelledOcoOrderIds: null
2363
+ // }
2364
+ // }
2365
+ //
2339
2366
  }
2367
+ response = this.safeDict(response, 'data');
2368
+ return this.parseOrder(response);
2340
2369
  }
2341
2370
  else {
2342
2371
  request['orderId'] = id;
2343
2372
  if (stop) {
2344
2373
  response = await this.privateDeleteStopOrderOrderId(this.extend(request, params));
2374
+ //
2375
+ // {
2376
+ // code: '200000',
2377
+ // data: { cancelledOrderIds: [ 'vs8lgpiuaco91qk8003vebu9' ] }
2378
+ // }
2379
+ //
2345
2380
  }
2346
2381
  else if (hf) {
2347
2382
  response = await this.privateDeleteHfOrdersOrderId(this.extend(request, params));
2383
+ //
2384
+ // {
2385
+ // "code": "200000",
2386
+ // "data": {
2387
+ // "orderId": "630625dbd9180300014c8d52"
2388
+ // }
2389
+ // }
2390
+ //
2391
+ response = this.safeDict(response, 'data');
2392
+ return this.parseOrder(response);
2348
2393
  }
2349
2394
  else {
2350
2395
  response = await this.privateDeleteOrdersOrderId(this.extend(request, params));
2396
+ //
2397
+ // {
2398
+ // code: '200000',
2399
+ // data: { cancelledOrderIds: [ '665e4fbe28051a0007245c41' ] }
2400
+ // }
2401
+ //
2351
2402
  }
2403
+ const data = this.safeDict(response, 'data');
2404
+ const orderIds = this.safeList(data, 'cancelledOrderIds', []);
2405
+ const orderId = this.safeString(orderIds, 0);
2406
+ return this.safeOrder({
2407
+ 'info': data,
2408
+ 'id': orderId,
2409
+ });
2352
2410
  }
2353
- return response;
2354
2411
  }
2355
2412
  async cancelAllOrders(symbol = undefined, params = {}) {
2356
2413
  /**
@@ -2818,7 +2875,7 @@ class kucoin extends kucoin$1 {
2818
2875
  const stopPrice = this.safeNumber(order, 'stopPrice');
2819
2876
  return this.safeOrder({
2820
2877
  'info': order,
2821
- 'id': this.safeStringN(order, ['id', 'orderId', 'newOrderId']),
2878
+ 'id': this.safeStringN(order, ['id', 'orderId', 'newOrderId', 'cancelledOrderId']),
2822
2879
  'clientOrderId': this.safeString(order, 'clientOid'),
2823
2880
  'symbol': this.safeSymbol(marketId, market, '-'),
2824
2881
  'type': this.safeString(order, 'type'),
@@ -2954,6 +2954,7 @@ class phemex extends phemex$1 {
2954
2954
  /**
2955
2955
  * @method
2956
2956
  * @name phemex#fetchOrder
2957
+ * @see https://phemex-docs.github.io/#query-orders-by-ids
2957
2958
  * @description fetches information on an order made by the user
2958
2959
  * @param {string} symbol unified symbol of the market the order was made in
2959
2960
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -2964,9 +2965,6 @@ class phemex extends phemex$1 {
2964
2965
  }
2965
2966
  await this.loadMarkets();
2966
2967
  const market = this.market(symbol);
2967
- if (market['settle'] === 'USDT') {
2968
- throw new errors.NotSupported(this.id + 'fetchOrder() is not supported yet for USDT settled swap markets'); // https://github.com/phemex/phemex-api-docs/blob/master/Public-Hedged-Perpetual-API.md#query-user-order-by-orderid-or-query-user-order-by-client-order-id
2969
- }
2970
2968
  const request = {
2971
2969
  'symbol': market['id'],
2972
2970
  };
@@ -2979,7 +2977,10 @@ class phemex extends phemex$1 {
2979
2977
  request['orderID'] = id;
2980
2978
  }
2981
2979
  let response = undefined;
2982
- if (market['spot']) {
2980
+ if (market['settle'] === 'USDT') {
2981
+ response = await this.privateGetApiDataGFuturesOrdersByOrderId(this.extend(request, params));
2982
+ }
2983
+ else if (market['spot']) {
2983
2984
  response = await this.privateGetSpotOrdersActive(this.extend(request, params));
2984
2985
  }
2985
2986
  else {
@@ -1018,6 +1018,7 @@ class bitget extends bitget$1 {
1018
1018
  [marginMode, params] = this.handleMarginModeAndParams('watchOrders', params);
1019
1019
  if (marginMode !== undefined) {
1020
1020
  instType = 'MARGIN';
1021
+ messageHash = messageHash + ':' + marginMode;
1021
1022
  if (marginMode === 'isolated') {
1022
1023
  channel = 'orders-isolated';
1023
1024
  }
@@ -1111,7 +1112,13 @@ class bitget extends bitget$1 {
1111
1112
  const keys = Object.keys(marketSymbols);
1112
1113
  for (let i = 0; i < keys.length; i++) {
1113
1114
  const symbol = keys[i];
1114
- const innerMessageHash = messageHash + ':' + symbol;
1115
+ let innerMessageHash = messageHash + ':' + symbol;
1116
+ if (channel === 'orders-crossed') {
1117
+ innerMessageHash = innerMessageHash + ':cross';
1118
+ }
1119
+ else if (channel === 'orders-isolated') {
1120
+ innerMessageHash = innerMessageHash + ':isolated';
1121
+ }
1115
1122
  client.resolve(stored, innerMessageHash);
1116
1123
  }
1117
1124
  client.resolve(stored, messageHash);
@@ -1218,23 +1225,30 @@ class bitget extends bitget$1 {
1218
1225
  // isolated and cross margin
1219
1226
  //
1220
1227
  // {
1221
- // "enterPointSource": "web",
1222
- // "force": "gtc",
1223
- // "feeDetail": [],
1224
- // "orderType": "limit",
1225
- // "price": "35000.000000000",
1226
- // "quoteSize": "10.500000000",
1227
- // "side": "buy",
1228
- // "status": "live",
1229
- // "baseSize": "0.000300000",
1230
- // "cTime": "1701923982427",
1231
- // "clientOid": "4902047879864dc980c4840e9906db4e",
1232
- // "fillPrice": "0.000000000",
1233
- // "baseVolume": "0.000000000",
1234
- // "fillTotalAmount": "0.000000000",
1235
- // "loanType": "auto-loan-and-repay",
1236
- // "orderId": "1116515595178356737"
1237
- // }
1228
+ // enterPointSource: "web",
1229
+ // feeDetail: [
1230
+ // {
1231
+ // feeCoin: "AAVE",
1232
+ // deduction: "no",
1233
+ // totalDeductionFee: "0",
1234
+ // totalFee: "-0.00010740",
1235
+ // },
1236
+ // ],
1237
+ // force: "gtc",
1238
+ // orderType: "limit",
1239
+ // price: "93.170000000",
1240
+ // fillPrice: "93.170000000",
1241
+ // baseSize: "0.110600000", // total amount of order
1242
+ // quoteSize: "10.304602000", // total cost of order (independently if order is filled or pending)
1243
+ // baseVolume: "0.107400000", // filled amount of order (during order's lifecycle, and not for this specific incoming update)
1244
+ // fillTotalAmount: "10.006458000", // filled cost of order (during order's lifecycle, and not for this specific incoming update)
1245
+ // side: "buy",
1246
+ // status: "partially_filled",
1247
+ // cTime: "1717875017306",
1248
+ // clientOid: "b57afe789a06454e9c560a2aab7f7201",
1249
+ // loanType: "auto-loan",
1250
+ // orderId: "1183419084588060673",
1251
+ // }
1238
1252
  //
1239
1253
  const isSpot = !('posMode' in order);
1240
1254
  const isMargin = ('loanType' in order);
@@ -1275,12 +1289,12 @@ class bitget extends bitget$1 {
1275
1289
  let filledAmount = undefined;
1276
1290
  let cost = undefined;
1277
1291
  let remaining = undefined;
1278
- const totalFilled = this.safeString(order, 'accBaseVolume');
1292
+ let totalFilled = this.safeString(order, 'accBaseVolume');
1279
1293
  if (isSpot) {
1280
1294
  if (isMargin) {
1281
- filledAmount = this.omitZero(this.safeString(order, 'fillTotalAmount'));
1282
- totalAmount = this.omitZero(this.safeString(order, 'baseSize')); // for margin trading
1283
- cost = this.safeString(order, 'quoteSize');
1295
+ totalAmount = this.safeString(order, 'baseSize');
1296
+ totalFilled = this.safeString(order, 'baseVolume');
1297
+ cost = this.safeString(order, 'fillTotalAmount');
1284
1298
  }
1285
1299
  else {
1286
1300
  const partialFillAmount = this.safeString(order, 'baseVolume');
@@ -123,7 +123,7 @@ class bybit extends bybit$1 {
123
123
  },
124
124
  'streaming': {
125
125
  'ping': this.ping,
126
- 'keepAlive': 19000,
126
+ 'keepAlive': 18000,
127
127
  },
128
128
  });
129
129
  }
@@ -34,7 +34,7 @@ class mexc extends mexc$1 {
34
34
  'api': {
35
35
  'ws': {
36
36
  'spot': 'wss://wbs.mexc.com/ws',
37
- 'swap': 'wss://contract.mexc.com/ws',
37
+ 'swap': 'wss://contract.mexc.com/edge',
38
38
  },
39
39
  },
40
40
  },
@@ -61,7 +61,7 @@ class mexc extends mexc$1 {
61
61
  },
62
62
  'streaming': {
63
63
  'ping': this.ping,
64
- 'keepAlive': 10000,
64
+ 'keepAlive': 8000,
65
65
  },
66
66
  'exceptions': {},
67
67
  });