ccxt 4.4.94 → 4.4.96

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 (125) hide show
  1. package/README.md +7 -7
  2. package/dist/ccxt.browser.min.js +7 -7
  3. package/dist/cjs/ccxt.js +4 -1
  4. package/dist/cjs/src/abstract/foxbit.js +9 -0
  5. package/dist/cjs/src/apex.js +2 -2
  6. package/dist/cjs/src/ascendex.js +3 -3
  7. package/dist/cjs/src/base/Exchange.js +8 -4
  8. package/dist/cjs/src/base/ws/Future.js +2 -2
  9. package/dist/cjs/src/bingx.js +148 -94
  10. package/dist/cjs/src/bitget.js +32 -144
  11. package/dist/cjs/src/bitmart.js +2 -2
  12. package/dist/cjs/src/bitrue.js +15 -8
  13. package/dist/cjs/src/bitstamp.js +1 -0
  14. package/dist/cjs/src/blofin.js +7 -1
  15. package/dist/cjs/src/bybit.js +17 -6
  16. package/dist/cjs/src/coinbase.js +36 -0
  17. package/dist/cjs/src/coinbaseexchange.js +4 -2
  18. package/dist/cjs/src/coinmate.js +34 -0
  19. package/dist/cjs/src/coinone.js +34 -0
  20. package/dist/cjs/src/coinsph.js +29 -0
  21. package/dist/cjs/src/coinspot.js +36 -1
  22. package/dist/cjs/src/cryptocom.js +2 -1
  23. package/dist/cjs/src/cryptomus.js +41 -1
  24. package/dist/cjs/src/defx.js +1 -1
  25. package/dist/cjs/src/derive.js +1 -1
  26. package/dist/cjs/src/ellipx.js +40 -0
  27. package/dist/cjs/src/foxbit.js +2016 -0
  28. package/dist/cjs/src/gate.js +1 -1
  29. package/dist/cjs/src/hyperliquid.js +3 -2
  30. package/dist/cjs/src/kucoin.js +1 -1
  31. package/dist/cjs/src/kucoinfutures.js +3 -2
  32. package/dist/cjs/src/mexc.js +28 -13
  33. package/dist/cjs/src/modetrade.js +3 -3
  34. package/dist/cjs/src/okcoin.js +1 -1
  35. package/dist/cjs/src/okx.js +12 -3
  36. package/dist/cjs/src/onetrading.js +1 -1
  37. package/dist/cjs/src/oxfun.js +2 -1
  38. package/dist/cjs/src/paradex.js +2 -2
  39. package/dist/cjs/src/pro/hyperliquid.js +6 -6
  40. package/dist/cjs/src/pro/kraken.js +18 -18
  41. package/dist/cjs/src/pro/mexc.js +10 -10
  42. package/dist/cjs/src/vertex.js +3 -2
  43. package/dist/cjs/src/woo.js +1281 -894
  44. package/dist/cjs/src/woofipro.js +2 -2
  45. package/js/ccxt.d.ts +5 -2
  46. package/js/ccxt.js +4 -2
  47. package/js/src/abstract/bingx.d.ts +3 -0
  48. package/js/src/abstract/foxbit.d.ts +29 -0
  49. package/js/src/abstract/foxbit.js +11 -0
  50. package/js/src/abstract/woo.d.ts +58 -3
  51. package/js/src/apex.d.ts +2 -2
  52. package/js/src/apex.js +2 -2
  53. package/js/src/ascendex.d.ts +1 -1
  54. package/js/src/ascendex.js +3 -3
  55. package/js/src/base/Exchange.d.ts +7 -6
  56. package/js/src/base/Exchange.js +8 -4
  57. package/js/src/base/ws/Future.js +2 -2
  58. package/js/src/bingx.d.ts +6 -6
  59. package/js/src/bingx.js +148 -94
  60. package/js/src/bitget.js +32 -144
  61. package/js/src/bitmart.d.ts +2 -2
  62. package/js/src/bitmart.js +2 -2
  63. package/js/src/bitrue.js +15 -8
  64. package/js/src/bitstamp.js +2 -1
  65. package/js/src/bittrade.d.ts +1 -1
  66. package/js/src/blofin.d.ts +2 -1
  67. package/js/src/blofin.js +7 -1
  68. package/js/src/bybit.d.ts +1 -1
  69. package/js/src/bybit.js +17 -6
  70. package/js/src/coinbase.js +36 -0
  71. package/js/src/coinbaseexchange.d.ts +2 -2
  72. package/js/src/coinbaseexchange.js +4 -2
  73. package/js/src/coinbaseinternational.d.ts +2 -2
  74. package/js/src/coinmate.js +34 -0
  75. package/js/src/coinone.js +34 -0
  76. package/js/src/coinsph.js +29 -0
  77. package/js/src/coinspot.d.ts +1 -1
  78. package/js/src/coinspot.js +36 -1
  79. package/js/src/cryptocom.d.ts +1 -1
  80. package/js/src/cryptocom.js +2 -1
  81. package/js/src/cryptomus.d.ts +1 -1
  82. package/js/src/cryptomus.js +41 -1
  83. package/js/src/defx.d.ts +2 -2
  84. package/js/src/defx.js +1 -1
  85. package/js/src/derive.d.ts +2 -2
  86. package/js/src/derive.js +1 -1
  87. package/js/src/digifinex.d.ts +1 -1
  88. package/js/src/ellipx.js +40 -0
  89. package/js/src/foxbit.d.ts +352 -0
  90. package/js/src/foxbit.js +2016 -0
  91. package/js/src/gate.js +1 -1
  92. package/js/src/htx.d.ts +2 -2
  93. package/js/src/hyperliquid.d.ts +2 -2
  94. package/js/src/hyperliquid.js +3 -2
  95. package/js/src/krakenfutures.d.ts +1 -1
  96. package/js/src/kucoin.d.ts +1 -1
  97. package/js/src/kucoin.js +1 -1
  98. package/js/src/kucoinfutures.d.ts +3 -3
  99. package/js/src/kucoinfutures.js +3 -2
  100. package/js/src/mexc.d.ts +1 -1
  101. package/js/src/mexc.js +28 -13
  102. package/js/src/modetrade.d.ts +2 -4
  103. package/js/src/modetrade.js +3 -3
  104. package/js/src/ndax.d.ts +1 -1
  105. package/js/src/okcoin.d.ts +1 -1
  106. package/js/src/okcoin.js +1 -1
  107. package/js/src/okx.d.ts +1 -1
  108. package/js/src/okx.js +12 -3
  109. package/js/src/onetrading.d.ts +1 -1
  110. package/js/src/onetrading.js +1 -1
  111. package/js/src/oxfun.d.ts +1 -1
  112. package/js/src/oxfun.js +2 -1
  113. package/js/src/paradex.d.ts +1 -1
  114. package/js/src/paradex.js +2 -2
  115. package/js/src/pro/hyperliquid.js +6 -6
  116. package/js/src/pro/kraken.js +18 -18
  117. package/js/src/pro/mexc.js +10 -10
  118. package/js/src/timex.d.ts +1 -1
  119. package/js/src/vertex.d.ts +2 -2
  120. package/js/src/vertex.js +3 -2
  121. package/js/src/woo.d.ts +80 -50
  122. package/js/src/woo.js +1281 -894
  123. package/js/src/woofipro.d.ts +2 -4
  124. package/js/src/woofipro.js +2 -2
  125. package/package.json +7 -7
package/js/src/bingx.js CHANGED
@@ -115,6 +115,7 @@ export default class bingx extends Exchange {
115
115
  'account': 'https://open-api.{hostname}/openApi',
116
116
  'copyTrading': 'https://open-api.{hostname}/openApi',
117
117
  'cswap': 'https://open-api.{hostname}/openApi',
118
+ 'api': 'https://open-api.{hostname}/openApi',
118
119
  },
119
120
  'test': {
120
121
  'swap': 'https://open-api-vst.{hostname}/openApi', // only swap is really "test" but since the API keys are the same, we want to keep all the functionalities when the user enables the sandboxmode
@@ -444,6 +445,7 @@ export default class bingx extends Exchange {
444
445
  'private': {
445
446
  'get': {
446
447
  'asset/transfer': 1,
448
+ 'asset/transferRecord': 5,
447
449
  'capital/deposit/hisrec': 1,
448
450
  'capital/withdraw/history': 1,
449
451
  },
@@ -452,6 +454,20 @@ export default class bingx extends Exchange {
452
454
  },
453
455
  },
454
456
  },
457
+ 'asset': {
458
+ 'v1': {
459
+ 'private': {
460
+ 'post': {
461
+ 'transfer': 5,
462
+ },
463
+ },
464
+ 'public': {
465
+ 'get': {
466
+ 'transfer/supportCoins': 5,
467
+ },
468
+ },
469
+ },
470
+ },
455
471
  },
456
472
  },
457
473
  'timeframes': {
@@ -516,16 +532,19 @@ export default class bingx extends Exchange {
516
532
  'options': {
517
533
  'defaultType': 'spot',
518
534
  'accountsByType': {
519
- 'funding': 'FUND',
520
- 'spot': 'SPOT',
521
- 'swap': 'PFUTURES',
522
- 'future': 'SFUTURES',
535
+ 'funding': 'fund',
536
+ 'spot': 'spot',
537
+ 'future': 'stdFutures',
538
+ 'swap': 'USDTMPerp',
539
+ 'linear': 'USDTMPerp',
540
+ 'inverse': 'coinMPerp',
523
541
  },
524
542
  'accountsById': {
525
- 'FUND': 'funding',
526
- 'SPOT': 'spot',
527
- 'PFUTURES': 'swap',
528
- 'SFUTURES': 'future',
543
+ 'fund': 'funding',
544
+ 'spot': 'spot',
545
+ 'stdFutures': 'future',
546
+ 'USDTMPerp': 'linear',
547
+ 'coinMPerp': 'inverse',
529
548
  },
530
549
  'recvWindow': 5 * 1000,
531
550
  'broker': 'CCXT',
@@ -769,6 +788,10 @@ export default class bingx extends Exchange {
769
788
  'min': this.safeNumber(rawNetwork, 'withdrawMin'),
770
789
  'max': this.safeNumber(rawNetwork, 'withdrawMax'),
771
790
  },
791
+ 'deposit': {
792
+ 'min': this.safeNumber(rawNetwork, 'depositMin'),
793
+ 'max': undefined,
794
+ },
772
795
  };
773
796
  const precision = this.parseNumber(this.parsePrecision(this.safeString(rawNetwork, 'withdrawPrecision')));
774
797
  networks[networkCode] = {
@@ -783,20 +806,40 @@ export default class bingx extends Exchange {
783
806
  'limits': limits,
784
807
  };
785
808
  }
786
- result[code] = this.safeCurrencyStructure({
787
- 'info': entry,
788
- 'code': code,
789
- 'id': currencyId,
790
- 'precision': undefined,
791
- 'name': name,
792
- 'active': undefined,
793
- 'deposit': undefined,
794
- 'withdraw': undefined,
795
- 'networks': networks,
796
- 'fee': undefined,
797
- 'limits': undefined,
798
- 'type': 'crypto', // only cryptos now
799
- });
809
+ if (!(code in result)) { // the exchange could return the same currency with different networks
810
+ result[code] = {
811
+ 'info': entry,
812
+ 'code': code,
813
+ 'id': currencyId,
814
+ 'precision': undefined,
815
+ 'name': name,
816
+ 'active': undefined,
817
+ 'deposit': undefined,
818
+ 'withdraw': undefined,
819
+ 'networks': networks,
820
+ 'fee': undefined,
821
+ 'limits': undefined,
822
+ 'type': 'crypto', // only cryptos now
823
+ };
824
+ }
825
+ else {
826
+ const existing = result[code];
827
+ const existingNetworks = this.safeDict(existing, 'networks', {});
828
+ const newNetworkCodes = Object.keys(networks);
829
+ for (let j = 0; j < newNetworkCodes.length; j++) {
830
+ const newNetworkCode = newNetworkCodes[j];
831
+ if (!(newNetworkCode in existingNetworks)) {
832
+ existingNetworks[newNetworkCode] = networks[newNetworkCode];
833
+ }
834
+ }
835
+ result[code]['networks'] = existingNetworks;
836
+ }
837
+ }
838
+ const codes = Object.keys(result);
839
+ for (let i = 0; i < codes.length; i++) {
840
+ const code = codes[i];
841
+ const currency = result[code];
842
+ result[code] = this.safeCurrencyStructure(currency);
800
843
  }
801
844
  return result;
802
845
  }
@@ -4862,11 +4905,11 @@ export default class bingx extends Exchange {
4862
4905
  * @method
4863
4906
  * @name bingx#transfer
4864
4907
  * @description transfer currency internally between wallets on the same account
4865
- * @see https://bingx-api.github.io/docs/#/en-us/common/account-api.html#Asset%20Transfer
4908
+ * @see https://bingx-api.github.io/docs/#/en-us/common/account-api.html#Asset%20Transfer%20New
4866
4909
  * @param {string} code unified currency code
4867
4910
  * @param {float} amount amount to transfer
4868
4911
  * @param {string} fromAccount account to transfer from (spot, swap, futures, or funding)
4869
- * @param {string} toAccount account to transfer to (spot, swap, futures, or funding)
4912
+ * @param {string} toAccount account to transfer to (spot, swap (linear or inverse), future, or funding)
4870
4913
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4871
4914
  * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
4872
4915
  */
@@ -4874,14 +4917,33 @@ export default class bingx extends Exchange {
4874
4917
  await this.loadMarkets();
4875
4918
  const currency = this.currency(code);
4876
4919
  const accountsByType = this.safeDict(this.options, 'accountsByType', {});
4877
- const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
4878
- const toId = this.safeString(accountsByType, toAccount, toAccount);
4920
+ let subType = undefined;
4921
+ [subType, params] = this.handleSubTypeAndParams('transfer', undefined, params);
4922
+ let fromId = this.safeString(accountsByType, fromAccount, fromAccount);
4923
+ let toId = this.safeString(accountsByType, toAccount, toAccount);
4924
+ if (fromId === 'swap') {
4925
+ if (subType === 'inverse') {
4926
+ fromId = 'coinMPerp';
4927
+ }
4928
+ else {
4929
+ fromId = 'USDTMPerp';
4930
+ }
4931
+ }
4932
+ if (toId === 'swap') {
4933
+ if (subType === 'inverse') {
4934
+ toId = 'coinMPerp';
4935
+ }
4936
+ else {
4937
+ toId = 'USDTMPerp';
4938
+ }
4939
+ }
4879
4940
  const request = {
4941
+ 'fromAccount': fromId,
4942
+ 'toAccount': toId,
4880
4943
  'asset': currency['id'],
4881
4944
  'amount': this.currencyToPrecision(code, amount),
4882
- 'type': fromId + '_' + toId,
4883
4945
  };
4884
- const response = await this.spotV3PrivateGetGetAssetTransfer(this.extend(request, params));
4946
+ const response = await this.apiAssetV1PrivatePostTransfer(this.extend(request, params));
4885
4947
  //
4886
4948
  // {
4887
4949
  // "tranId": 1933130865269936128,
@@ -4890,7 +4952,7 @@ export default class bingx extends Exchange {
4890
4952
  //
4891
4953
  return {
4892
4954
  'info': response,
4893
- 'id': this.safeString(response, 'tranId'),
4955
+ 'id': this.safeString(response, 'transferId'),
4894
4956
  'timestamp': undefined,
4895
4957
  'datetime': undefined,
4896
4958
  'currency': code,
@@ -4904,18 +4966,19 @@ export default class bingx extends Exchange {
4904
4966
  * @method
4905
4967
  * @name bingx#fetchTransfers
4906
4968
  * @description fetch a history of internal transfers made on an account
4907
- * @see https://bingx-api.github.io/docs/#/spot/account-api.html#Query%20User%20Universal%20Transfer%20History%20(USER_DATA)
4969
+ * @see https://bingx-api.github.io/docs/#/en-us/common/account-api.html#Asset%20transfer%20records%20new
4908
4970
  * @param {string} [code] unified currency code of the currency transferred
4909
4971
  * @param {int} [since] the earliest time in ms to fetch transfers for
4910
4972
  * @param {int} [limit] the maximum number of transfers structures to retrieve (default 10, max 100)
4911
4973
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4912
- * @param {string} params.fromAccount (mandatory) transfer from (spot, swap, futures, or funding)
4913
- * @param {string} params.toAccount (mandatory) transfer to (spot, swap, futures, or funding)
4974
+ * @param {string} params.fromAccount (mandatory) transfer from (spot, swap (linear or inverse), future, or funding)
4975
+ * @param {string} params.toAccount (mandatory) transfer to (spot, swap(linear or inverse), future, or funding)
4914
4976
  * @param {boolean} [params.paginate] whether to paginate the results (default false)
4915
4977
  * @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
4916
4978
  */
4917
4979
  async fetchTransfers(code = undefined, since = undefined, limit = undefined, params = {}) {
4918
4980
  await this.loadMarkets();
4981
+ let request = {};
4919
4982
  let currency = undefined;
4920
4983
  if (code !== undefined) {
4921
4984
  currency = this.currency(code);
@@ -4926,7 +4989,13 @@ export default class bingx extends Exchange {
4926
4989
  const fromId = this.safeString(accountsByType, fromAccount, fromAccount);
4927
4990
  const toId = this.safeString(accountsByType, toAccount, toAccount);
4928
4991
  if (fromId === undefined || toId === undefined) {
4929
- throw new ExchangeError(this.id + ' fromAccount & toAccount parameter are required');
4992
+ throw new ExchangeError(this.id + ' fromAccount & toAccount parameters are required');
4993
+ }
4994
+ if (fromAccount !== undefined) {
4995
+ request['fromAccount'] = fromId;
4996
+ }
4997
+ if (toAccount !== undefined) {
4998
+ request['toAccount'] = toId;
4930
4999
  }
4931
5000
  params = this.omit(params, ['fromAccount', 'toAccount']);
4932
5001
  const maxLimit = 100;
@@ -4935,29 +5004,27 @@ export default class bingx extends Exchange {
4935
5004
  if (paginate) {
4936
5005
  return await this.fetchPaginatedCallDynamic('fetchTransfers', undefined, since, limit, params, maxLimit);
4937
5006
  }
4938
- let request = {
4939
- 'type': fromId + '_' + toId,
4940
- };
4941
5007
  if (since !== undefined) {
4942
5008
  request['startTime'] = since;
4943
5009
  }
4944
5010
  if (limit !== undefined) {
4945
- request['size'] = limit;
5011
+ request['pageSize'] = limit;
4946
5012
  }
4947
5013
  [request, params] = this.handleUntilOption('endTime', request, params);
4948
- const response = await this.spotV3PrivateGetAssetTransfer(this.extend(request, params));
5014
+ const response = await this.apiV3PrivateGetAssetTransferRecord(this.extend(request, params));
4949
5015
  //
4950
5016
  // {
4951
- // "total": 3,
5017
+ // "total": 2,
4952
5018
  // "rows": [
4953
5019
  // {
4954
- // "asset": "USDT",
4955
- // "amount": "100.00000000000000000000",
4956
- // "type": "FUND_SFUTURES",
5020
+ // "asset": "LTC",
5021
+ // "amount": "0.05000000000000000000",
4957
5022
  // "status": "CONFIRMED",
4958
- // "tranId": 1067594500957016069,
4959
- // "timestamp": 1658388859000
4960
- // },
5023
+ // "transferId": "1051461075661819338791",
5024
+ // "timestamp": 1752202092000,
5025
+ // "fromAccount": "spot",
5026
+ // "toAccount": "USDTMPerp"
5027
+ // }
4961
5028
  // ]
4962
5029
  // }
4963
5030
  //
@@ -4965,15 +5032,14 @@ export default class bingx extends Exchange {
4965
5032
  return this.parseTransfers(rows, currency, since, limit);
4966
5033
  }
4967
5034
  parseTransfer(transfer, currency = undefined) {
4968
- const tranId = this.safeString(transfer, 'tranId');
5035
+ const tranId = this.safeString(transfer, 'transferId');
4969
5036
  const timestamp = this.safeInteger(transfer, 'timestamp');
4970
- const currencyCode = this.safeCurrencyCode(undefined, currency);
5037
+ const currencyId = this.safeString(transfer, 'asset');
5038
+ const currencyCode = this.safeCurrencyCode(currencyId, currency);
4971
5039
  const status = this.safeString(transfer, 'status');
4972
5040
  const accountsById = this.safeDict(this.options, 'accountsById', {});
4973
- const typeId = this.safeString(transfer, 'type');
4974
- const typeIdSplit = typeId.split('_');
4975
- const fromId = this.safeString(typeIdSplit, 0);
4976
- const toId = this.safeString(typeIdSplit, 1);
5041
+ const fromId = this.safeString(transfer, 'fromAccount');
5042
+ const toId = this.safeString(transfer, 'toAccount');
4977
5043
  const fromAccount = this.safeString(accountsById, fromId, fromId);
4978
5044
  const toAccount = this.safeString(accountsById, toId, toId);
4979
5045
  return {
@@ -5719,37 +5785,13 @@ export default class bingx extends Exchange {
5719
5785
  }
5720
5786
  parseDepositWithdrawFee(fee, currency = undefined) {
5721
5787
  //
5722
- // {
5723
- // "coin": "BTC",
5724
- // "name": "BTC",
5725
- // "networkList": [
5726
- // {
5727
- // "name": "BTC",
5728
- // "network": "BTC",
5729
- // "isDefault": true,
5730
- // "minConfirm": "2",
5731
- // "withdrawEnable": true,
5732
- // "withdrawFee": "0.00035",
5733
- // "withdrawMax": "1.62842",
5734
- // "withdrawMin": "0.0005"
5735
- // },
5736
- // {
5737
- // "name": "BTC",
5738
- // "network": "BEP20",
5739
- // "isDefault": false,
5740
- // "minConfirm": "15",
5741
- // "withdrawEnable": true,
5742
- // "withdrawFee": "0.00001",
5743
- // "withdrawMax": "1.62734",
5744
- // "withdrawMin": "0.0001"
5745
- // }
5746
- // ]
5747
- // }
5788
+ // currencie structure
5748
5789
  //
5749
- const networkList = this.safeList(fee, 'networkList', []);
5750
- const networkListLength = networkList.length;
5790
+ const networks = this.safeDict(fee, 'networks', {});
5791
+ const networkCodes = Object.keys(networks);
5792
+ const networksLength = networkCodes.length;
5751
5793
  const result = {
5752
- 'info': fee,
5794
+ 'info': networks,
5753
5795
  'withdraw': {
5754
5796
  'fee': undefined,
5755
5797
  'percentage': undefined,
@@ -5760,18 +5802,15 @@ export default class bingx extends Exchange {
5760
5802
  },
5761
5803
  'networks': {},
5762
5804
  };
5763
- if (networkListLength !== 0) {
5764
- for (let i = 0; i < networkListLength; i++) {
5765
- const network = networkList[i];
5766
- const networkId = this.safeString(network, 'network');
5767
- const isDefault = this.safeBool(network, 'isDefault');
5768
- const currencyCode = this.safeString(currency, 'code');
5769
- const networkCode = this.networkIdToCode(networkId, currencyCode);
5805
+ if (networksLength !== 0) {
5806
+ for (let i = 0; i < networksLength; i++) {
5807
+ const networkCode = networkCodes[i];
5808
+ const network = networks[networkCode];
5770
5809
  result['networks'][networkCode] = {
5771
5810
  'deposit': { 'fee': undefined, 'percentage': undefined },
5772
- 'withdraw': { 'fee': this.safeNumber(network, 'withdrawFee'), 'percentage': false },
5811
+ 'withdraw': { 'fee': this.safeNumber(network, 'fee'), 'percentage': false },
5773
5812
  };
5774
- if (isDefault) {
5813
+ if (networksLength === 1) {
5775
5814
  result['withdraw']['fee'] = this.safeNumber(network, 'withdrawFee');
5776
5815
  result['withdraw']['percentage'] = false;
5777
5816
  }
@@ -5790,9 +5829,17 @@ export default class bingx extends Exchange {
5790
5829
  */
5791
5830
  async fetchDepositWithdrawFees(codes = undefined, params = {}) {
5792
5831
  await this.loadMarkets();
5793
- const response = await this.walletsV1PrivateGetCapitalConfigGetall(params);
5794
- const coins = this.safeList(response, 'data');
5795
- return this.parseDepositWithdrawFees(coins, codes, 'coin');
5832
+ const response = await this.fetchCurrencies(params);
5833
+ const depositWithdrawFees = {};
5834
+ const responseCodes = Object.keys(response);
5835
+ for (let i = 0; i < responseCodes.length; i++) {
5836
+ const code = responseCodes[i];
5837
+ if ((codes === undefined) || (this.inArray(code, codes))) {
5838
+ const entry = response[code];
5839
+ depositWithdrawFees[code] = this.parseDepositWithdrawFee(entry);
5840
+ }
5841
+ }
5842
+ return depositWithdrawFees;
5796
5843
  }
5797
5844
  /**
5798
5845
  * @method
@@ -6533,8 +6580,15 @@ export default class bingx extends Exchange {
6533
6580
  }
6534
6581
  let url = this.implodeHostname(this.urls['api'][type]);
6535
6582
  path = this.implodeParams(path, params);
6536
- if (version === 'transfer') {
6537
- type = 'account/transfer';
6583
+ const versionIsTransfer = (version === 'transfer');
6584
+ const versionIsAsset = (version === 'asset');
6585
+ if (versionIsTransfer || versionIsAsset) {
6586
+ if (versionIsTransfer) {
6587
+ type = 'account/transfer';
6588
+ }
6589
+ else {
6590
+ type = 'api/asset';
6591
+ }
6538
6592
  version = section[2];
6539
6593
  access = section[3];
6540
6594
  }
package/js/src/bitget.js CHANGED
@@ -2003,7 +2003,7 @@ export default class bitget extends Exchange {
2003
2003
  'cross': hasCrossMargin,
2004
2004
  'isolated': hasIsolatedMargin,
2005
2005
  };
2006
- isMarginTradingAllowed = hasCrossMargin || hasCrossMargin;
2006
+ isMarginTradingAllowed = hasCrossMargin || hasIsolatedMargin;
2007
2007
  }
2008
2008
  else {
2009
2009
  if (symbolType === 'perpetual') {
@@ -4229,82 +4229,35 @@ export default class bitget extends Exchange {
4229
4229
  // "result": "success"
4230
4230
  // }
4231
4231
  //
4232
- // spot: fetchOrder
4233
- //
4234
- // {
4235
- // "userId": "7264631750",
4236
- // "symbol": "BTCUSDT",
4237
- // "orderId": "1111461743123927040",
4238
- // "clientOid": "63f95110-93b5-4309-8f77-46339f1bcf3c",
4239
- // "price": "25000.0000000000000000",
4240
- // "size": "0.0002000000000000",
4241
- // "orderType": "limit",
4242
- // "side": "buy",
4243
- // "status": "live",
4244
- // "priceAvg": "0",
4245
- // "baseVolume": "0.0000000000000000",
4246
- // "quoteVolume": "0.0000000000000000",
4247
- // "enterPointSource": "API",
4248
- // "feeDetail": "",
4249
- // "orderSource": "normal",
4250
- // "cTime": "1700719050198",
4251
- // "uTime": "1700719050198"
4252
- // }
4253
- //
4254
- // swap and future: fetchOrder
4255
- //
4256
- // {
4257
- // "symbol": "BTCUSDT",
4258
- // "size": "0.001",
4259
- // "orderId": "1111465253393825792",
4260
- // "clientOid": "1111465253431574529",
4261
- // "baseVolume": "0",
4262
- // "fee": "0",
4263
- // "price": "27000",
4264
- // "priceAvg": "",
4265
- // "state": "live",
4266
- // "side": "buy",
4267
- // "force": "gtc",
4268
- // "totalProfits": "0",
4269
- // "posSide": "long",
4270
- // "marginCoin": "USDT",
4271
- // "presetStopSurplusPrice": "",
4272
- // "presetStopLossPrice": "",
4273
- // "quoteVolume": "0",
4274
- // "orderType": "limit",
4275
- // "leverage": "20",
4276
- // "marginMode": "crossed",
4277
- // "reduceOnly": "NO",
4278
- // "enterPointSource": "API",
4279
- // "tradeSide": "open",
4280
- // "posMode": "hedge_mode",
4281
- // "orderSource": "normal",
4282
- // "cTime": "1700719887120",
4283
- // "uTime": "1700719887120"
4284
- // }
4285
- //
4286
- // spot: fetchOpenOrders
4232
+ // spot: fetchOrder, fetchOpenOrders, fetchCanceledAndClosedOrders
4287
4233
  //
4288
4234
  // {
4289
4235
  // "userId": "7264631750",
4290
4236
  // "symbol": "BTCUSDT",
4291
4237
  // "orderId": "1111499608327360513",
4292
4238
  // "clientOid": "d0d4dad5-18d0-4869-a074-ec40bb47cba6",
4293
- // "priceAvg": "25000.0000000000000000",
4294
- // "size": "0.0002000000000000",
4239
+ // "size": "0.0002000000000000", // COST for 'buy market' order! AMOUNT in all other cases
4240
+ // "price": "0", // in fetchOrder: 0 for market order, otherwise limit price (field not present in fetchOpenOrders
4295
4241
  // "orderType": "limit",
4296
4242
  // "side": "buy",
4297
4243
  // "status": "live",
4298
4244
  // "basePrice": "0",
4299
- // "baseVolume": "0.0000000000000000",
4300
- // "quoteVolume": "0.0000000000000000",
4245
+ // "priceAvg": "25000.0000000000000000", // 0 if nothing filled
4246
+ // "baseVolume": "0.0000000000000000", // 0 if nothing filled
4247
+ // "quoteVolume": "0.0000000000000000", // 0 if nothing filled
4301
4248
  // "enterPointSource": "WEB",
4302
4249
  // "orderSource": "normal",
4303
4250
  // "cTime": "1700728077966",
4304
4251
  // "uTime": "1700728077966"
4252
+ // "feeDetail": "{\\"newFees\\":{\\"c\\":0,\\"d\\":0,\\"deduction\\":false,\\"r\\":-0.0064699886,\\"t\\":-0.0064699886,\\"totalDeductionFee\\":0},\\"USDT\\":{\\"deduction\\":false,\\"feeCoinCode\\":\\"USDT\\",\\"totalDeductionFee\\":0,\\"totalFee\\":-0.0064699886000000}}", // might not be present in fetchOpenOrders
4253
+ // "triggerPrice": null,
4254
+ // "tpslType": "normal",
4255
+ // "quoteCoin": "USDT", // not present in fetchOpenOrders
4256
+ // "baseCoin": "DOT", // not present in fetchOpenOrders
4257
+ // "cancelReason": "", // not present in fetchOpenOrders
4305
4258
  // }
4306
4259
  //
4307
- // spot stop: fetchOpenOrders, fetchCanceledAndClosedOrders
4260
+ // spot trigger: fetchOpenOrders, fetchCanceledAndClosedOrders
4308
4261
  //
4309
4262
  // {
4310
4263
  // "orderId": "1111503385931620352",
@@ -4345,18 +4298,19 @@ export default class bitget extends Exchange {
4345
4298
  // "uTime": "1700729691866"
4346
4299
  // }
4347
4300
  //
4348
- // swap: fetchOpenOrders, fetchCanceledAndClosedOrders
4301
+ // swap and future: fetchOrder, fetchOpenOrders, fetchCanceledAndClosedOrders
4349
4302
  //
4350
4303
  // {
4351
4304
  // "symbol": "BTCUSDT",
4352
- // "size": "0.002",
4353
- // "orderId": "1111488897767604224",
4354
- // "clientOid": "1111488897805352960",
4305
+ // "size": "0.001",
4306
+ // "orderId": "1111465253393825792",
4307
+ // "clientOid": "1111465253431574529",
4355
4308
  // "baseVolume": "0",
4356
4309
  // "fee": "0",
4357
- // "price": "25000",
4310
+ // "price": "27000",
4358
4311
  // "priceAvg": "",
4359
- // "status": "live",
4312
+ // "state": "live",
4313
+ // // "status": "live", // key for fetchOpenOrders, fetchClosedOrders
4360
4314
  // "side": "buy",
4361
4315
  // "force": "gtc",
4362
4316
  // "totalProfits": "0",
@@ -4365,7 +4319,7 @@ export default class bitget extends Exchange {
4365
4319
  // "quoteVolume": "0",
4366
4320
  // "leverage": "20",
4367
4321
  // "marginMode": "crossed",
4368
- // "enterPointSource": "web",
4322
+ // "enterPointSource": "API",
4369
4323
  // "tradeSide": "open",
4370
4324
  // "posMode": "hedge_mode",
4371
4325
  // "orderType": "limit",
@@ -4373,94 +4327,22 @@ export default class bitget extends Exchange {
4373
4327
  // "presetStopSurplusPrice": "",
4374
4328
  // "presetStopLossPrice": "",
4375
4329
  // "reduceOnly": "NO",
4376
- // "cTime": "1700725524378",
4377
- // "uTime": "1700725524378"
4378
- // }
4330
+ // "cTime": "1700719887120",
4331
+ // "uTime": "1700719887120"
4379
4332
  //
4380
- // swap stop: fetchOpenOrders
4333
+ // for swap trigger order, the additional below fields are present:
4381
4334
  //
4382
- // {
4383
4335
  // "planType": "normal_plan",
4384
- // "symbol": "BTCUSDT",
4385
- // "size": "0.001",
4386
- // "orderId": "1111491399869075457",
4387
- // "clientOid": "1111491399869075456",
4388
- // "price": "27000",
4389
4336
  // "callbackRatio": "",
4390
4337
  // "triggerPrice": "24000",
4391
4338
  // "triggerType": "mark_price",
4392
4339
  // "planStatus": "live",
4393
- // "side": "buy",
4394
- // "posSide": "long",
4395
- // "marginCoin": "USDT",
4396
- // "marginMode": "crossed",
4397
- // "enterPointSource": "API",
4398
- // "tradeSide": "open",
4399
- // "posMode": "hedge_mode",
4400
- // "orderType": "limit",
4401
- // "stopSurplusTriggerPrice": "",
4402
- // "stopSurplusExecutePrice": "",
4403
- // "stopSurplusTriggerType": "fill_price",
4404
- // "stopLossTriggerPrice": "",
4405
- // "stopLossExecutePrice": "",
4406
- // "stopLossTriggerType": "fill_price",
4407
- // "cTime": "1700726120917",
4408
- // "uTime": "1700726120917"
4409
- // }
4410
- //
4411
- // spot: fetchCanceledAndClosedOrders
4412
- //
4413
- // {
4414
- // "userId": "7264631750",
4415
- // "symbol": "BTCUSDT",
4416
- // "orderId": "1111499608327360513",
4417
- // "clientOid": "d0d4dad5-18d0-4869-a074-ec40bb47cba6",
4418
- // "price": "25000.0000000000000000",
4419
- // "size": "0.0002000000000000",
4420
- // "orderType": "limit",
4421
- // "side": "buy",
4422
- // "status": "cancelled",
4423
- // "priceAvg": "0",
4424
- // "baseVolume": "0.0000000000000000",
4425
- // "quoteVolume": "0.0000000000000000",
4426
- // "enterPointSource": "WEB",
4427
- // "feeDetail": "",
4428
- // "orderSource": "normal",
4429
- // "cTime": "1700728077966",
4430
- // "uTime": "1700728911471"
4431
- // }
4432
- //
4433
- // swap stop: fetchCanceledAndClosedOrders
4434
- //
4435
- // {
4436
- // "planType": "normal_plan",
4437
- // "symbol": "BTCUSDT",
4438
- // "size": "0.001",
4439
- // "orderId": "1111491399869075457",
4440
- // "clientOid": "1111491399869075456",
4441
- // "planStatus": "cancelled",
4442
- // "price": "27000",
4443
- // "feeDetail": null,
4444
- // "baseVolume": "0",
4445
- // "callbackRatio": "",
4446
- // "triggerPrice": "24000",
4447
- // "triggerType": "mark_price",
4448
- // "side": "buy",
4449
- // "posSide": "long",
4450
- // "marginCoin": "USDT",
4451
- // "marginMode": "crossed",
4452
- // "enterPointSource": "API",
4453
- // "tradeSide": "open",
4454
- // "posMode": "hedge_mode",
4455
- // "orderType": "limit",
4456
4340
  // "stopSurplusTriggerPrice": "",
4457
4341
  // "stopSurplusExecutePrice": "",
4458
4342
  // "stopSurplusTriggerType": "fill_price",
4459
4343
  // "stopLossTriggerPrice": "",
4460
4344
  // "stopLossExecutePrice": "",
4461
4345
  // "stopLossTriggerType": "fill_price",
4462
- // "cTime": "1700726120917",
4463
- // "uTime": "1700727879652"
4464
4346
  // }
4465
4347
  //
4466
4348
  const errorMessage = this.safeString(order, 'errorMsg');
@@ -4551,6 +4433,12 @@ export default class bitget extends Exchange {
4551
4433
  // on bitget hedge mode if the position is long the side is always buy, and if the position is short the side is always sell
4552
4434
  // so the side of the reduceOnly order is inversed
4553
4435
  }
4436
+ const orderType = this.safeString(order, 'orderType');
4437
+ const isBuyMarket = (side === 'buy') && (orderType === 'market');
4438
+ if (market['spot'] && isBuyMarket) {
4439
+ // as noted in top comment, for 'buy market' the 'size' field is COST, not AMOUNT
4440
+ size = this.safeString(order, 'baseVolume');
4441
+ }
4554
4442
  return this.safeOrder({
4555
4443
  'info': order,
4556
4444
  'id': this.safeString2(order, 'orderId', 'data'),
@@ -4560,7 +4448,7 @@ export default class bitget extends Exchange {
4560
4448
  'lastTradeTimestamp': updateTimestamp,
4561
4449
  'lastUpdateTimestamp': updateTimestamp,
4562
4450
  'symbol': market['symbol'],
4563
- 'type': this.safeString(order, 'orderType'),
4451
+ 'type': orderType,
4564
4452
  'side': side,
4565
4453
  'price': price,
4566
4454
  'amount': size,