ccxt 4.4.86 → 4.4.87

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 (70) hide show
  1. package/README.md +17 -5
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +11 -1
  4. package/dist/cjs/src/abstract/modetrade.js +9 -0
  5. package/dist/cjs/src/base/Exchange.js +10 -8
  6. package/dist/cjs/src/binance.js +1 -1
  7. package/dist/cjs/src/bitteam.js +31 -0
  8. package/dist/cjs/src/coinmetro.js +5 -1
  9. package/dist/cjs/src/derive.js +4 -5
  10. package/dist/cjs/src/ellipx.js +2 -3
  11. package/dist/cjs/src/gate.js +92 -76
  12. package/dist/cjs/src/htx.js +10 -8
  13. package/dist/cjs/src/hyperliquid.js +32 -16
  14. package/dist/cjs/src/kraken.js +5 -8
  15. package/dist/cjs/src/modetrade.js +2839 -0
  16. package/dist/cjs/src/okx.js +95 -2
  17. package/dist/cjs/src/okxus.js +53 -0
  18. package/dist/cjs/src/paradex.js +6 -1
  19. package/dist/cjs/src/phemex.js +4 -6
  20. package/dist/cjs/src/poloniex.js +181 -170
  21. package/dist/cjs/src/pro/modetrade.js +1334 -0
  22. package/dist/cjs/src/pro/okxus.js +38 -0
  23. package/dist/cjs/src/probit.js +18 -51
  24. package/dist/cjs/src/timex.js +5 -10
  25. package/dist/cjs/src/vertex.js +3 -4
  26. package/dist/cjs/src/whitebit.js +41 -11
  27. package/dist/cjs/src/woo.js +101 -77
  28. package/dist/cjs/src/woofipro.js +24 -21
  29. package/dist/cjs/src/xt.js +36 -44
  30. package/js/ccxt.d.ts +14 -2
  31. package/js/ccxt.js +10 -2
  32. package/js/src/abstract/modetrade.d.ts +122 -0
  33. package/js/src/abstract/modetrade.js +11 -0
  34. package/js/src/abstract/okxus.d.ts +352 -0
  35. package/js/src/abstract/okxus.js +11 -0
  36. package/js/src/base/Exchange.js +10 -8
  37. package/js/src/binance.js +1 -1
  38. package/js/src/bitteam.js +31 -0
  39. package/js/src/coinmetro.js +5 -1
  40. package/js/src/derive.js +4 -3
  41. package/js/src/ellipx.d.ts +1 -1
  42. package/js/src/ellipx.js +3 -5
  43. package/js/src/gate.js +92 -76
  44. package/js/src/htx.js +10 -8
  45. package/js/src/hyperliquid.js +32 -16
  46. package/js/src/kraken.js +5 -8
  47. package/js/src/modetrade.d.ts +475 -0
  48. package/js/src/modetrade.js +2840 -0
  49. package/js/src/okx.d.ts +24 -1
  50. package/js/src/okx.js +95 -2
  51. package/js/src/okxus.d.ts +4 -0
  52. package/js/src/okxus.js +54 -0
  53. package/js/src/paradex.js +6 -1
  54. package/js/src/phemex.js +4 -6
  55. package/js/src/poloniex.d.ts +2 -0
  56. package/js/src/poloniex.js +181 -170
  57. package/js/src/pro/modetrade.d.ts +155 -0
  58. package/js/src/pro/modetrade.js +1335 -0
  59. package/js/src/pro/okxus.d.ts +4 -0
  60. package/js/src/pro/okxus.js +39 -0
  61. package/js/src/probit.js +18 -51
  62. package/js/src/timex.js +5 -10
  63. package/js/src/vertex.js +3 -4
  64. package/js/src/whitebit.js +42 -11
  65. package/js/src/woo.d.ts +2 -0
  66. package/js/src/woo.js +101 -77
  67. package/js/src/woofipro.d.ts +2 -1
  68. package/js/src/woofipro.js +24 -21
  69. package/js/src/xt.js +36 -44
  70. package/package.json +1 -1
@@ -632,13 +632,14 @@ export default class woofipro extends Exchange {
632
632
  * @method
633
633
  * @name woofipro#fetchCurrencies
634
634
  * @description fetches all available currencies on an exchange
635
- * @see https://orderly.network/docs/build-on-evm/evm-api/restful-api/public/get-token-info
635
+ * @see https://orderly.network/docs/build-on-omnichain/evm-api/restful-api/public/get-supported-collateral-info#get-supported-collateral-info
636
+ * @see https://orderly.network/docs/build-on-omnichain/evm-api/restful-api/public/get-supported-chains-per-builder#get-supported-chains-per-builder
636
637
  * @param {object} [params] extra parameters specific to the exchange API endpoint
637
638
  * @returns {object} an associative dictionary of currencies
638
639
  */
639
640
  async fetchCurrencies(params = {}) {
640
641
  const result = {};
641
- const response = await this.v1PublicGetPublicToken(params);
642
+ const tokenPromise = this.v1PublicGetPublicToken(params);
642
643
  //
643
644
  // {
644
645
  // "success": true,
@@ -661,26 +662,28 @@ export default class woofipro extends Exchange {
661
662
  // }
662
663
  // }
663
664
  //
664
- const data = this.safeDict(response, 'data', {});
665
- const tokenRows = this.safeList(data, 'rows', []);
665
+ const chainPromise = this.v1PublicGetPublicChainInfo(params);
666
+ const [tokenResponse, chainResponse] = await Promise.all([tokenPromise, chainPromise]);
667
+ const tokenData = this.safeDict(tokenResponse, 'data', {});
668
+ const tokenRows = this.safeList(tokenData, 'rows', []);
669
+ const chainData = this.safeDict(chainResponse, 'data', {});
670
+ const chainRows = this.safeList(chainData, 'rows', []);
671
+ const indexedChains = this.indexBy(chainRows, 'chain_id');
666
672
  for (let i = 0; i < tokenRows.length; i++) {
667
673
  const token = tokenRows[i];
668
674
  const currencyId = this.safeString(token, 'token');
669
675
  const networks = this.safeList(token, 'chain_details');
670
676
  const code = this.safeCurrencyCode(currencyId);
671
- let minPrecision = undefined;
672
677
  const resultingNetworks = {};
673
678
  for (let j = 0; j < networks.length; j++) {
674
- const network = networks[j];
675
- // TODO: transform chain id to human readable name
676
- const networkId = this.safeString(network, 'chain_id');
677
- const precision = this.parsePrecision(this.safeString(network, 'decimals'));
678
- if (precision !== undefined) {
679
- minPrecision = (minPrecision === undefined) ? precision : Precise.stringMin(precision, minPrecision);
680
- }
681
- resultingNetworks[networkId] = {
679
+ const networkEntry = networks[j];
680
+ const networkId = this.safeString(networkEntry, 'chain_id');
681
+ const networkRow = this.safeDict(indexedChains, networkId);
682
+ const networkName = this.safeString(networkRow, 'name');
683
+ const networkCode = this.networkIdToCode(networkName, code);
684
+ resultingNetworks[networkCode] = {
682
685
  'id': networkId,
683
- 'network': networkId,
686
+ 'network': networkCode,
684
687
  'limits': {
685
688
  'withdraw': {
686
689
  'min': undefined,
@@ -694,16 +697,16 @@ export default class woofipro extends Exchange {
694
697
  'active': undefined,
695
698
  'deposit': undefined,
696
699
  'withdraw': undefined,
697
- 'fee': this.safeNumber(network, 'withdrawal_fee'),
698
- 'precision': this.parseNumber(precision),
699
- 'info': network,
700
+ 'fee': this.safeNumber(networkEntry, 'withdrawal_fee'),
701
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(networkEntry, 'decimals'))),
702
+ 'info': [networkEntry, networkRow],
700
703
  };
701
704
  }
702
- result[code] = {
705
+ result[code] = this.safeCurrencyStructure({
703
706
  'id': currencyId,
704
- 'name': currencyId,
707
+ 'name': undefined,
705
708
  'code': code,
706
- 'precision': this.parseNumber(minPrecision),
709
+ 'precision': undefined,
707
710
  'active': undefined,
708
711
  'fee': undefined,
709
712
  'networks': resultingNetworks,
@@ -720,7 +723,7 @@ export default class woofipro extends Exchange {
720
723
  },
721
724
  },
722
725
  'info': token,
723
- };
726
+ });
724
727
  }
725
728
  return result;
726
729
  }
package/js/src/xt.js CHANGED
@@ -900,50 +900,30 @@ export default class xt extends Exchange {
900
900
  const entry = currenciesData[i];
901
901
  const currencyId = this.safeString(entry, 'currency');
902
902
  const code = this.safeCurrencyCode(currencyId);
903
- const minPrecision = this.parseNumber(this.parsePrecision(this.safeString(entry, 'maxPrecision')));
904
903
  const networkEntry = this.safeValue(chainsDataIndexed, currencyId, {});
905
904
  const rawNetworks = this.safeValue(networkEntry, 'supportChains', []);
906
905
  const networks = {};
907
- let minWithdrawString = undefined;
908
- let minWithdrawFeeString = undefined;
909
- let active = false;
910
- let deposit = false;
911
- let withdraw = false;
912
906
  for (let j = 0; j < rawNetworks.length; j++) {
913
907
  const rawNetwork = rawNetworks[j];
914
908
  const networkId = this.safeString(rawNetwork, 'chain');
915
- const network = this.networkIdToCode(networkId);
916
- const depositEnabled = this.safeValue(rawNetwork, 'depositEnabled');
917
- deposit = (depositEnabled) ? depositEnabled : deposit;
918
- const withdrawEnabled = this.safeValue(rawNetwork, 'withdrawEnabled');
919
- withdraw = (withdrawEnabled) ? withdrawEnabled : withdraw;
920
- const networkActive = depositEnabled && withdrawEnabled;
921
- active = (networkActive) ? networkActive : active;
922
- const withdrawFeeString = this.safeString(rawNetwork, 'withdrawFeeAmount');
923
- if (withdrawFeeString !== undefined) {
924
- minWithdrawFeeString = (minWithdrawFeeString === undefined) ? withdrawFeeString : Precise.stringMin(withdrawFeeString, minWithdrawFeeString);
925
- }
926
- const minNetworkWithdrawString = this.safeString(rawNetwork, 'withdrawMinAmount');
927
- if (minNetworkWithdrawString !== undefined) {
928
- minWithdrawString = (minWithdrawString === undefined) ? minNetworkWithdrawString : Precise.stringMin(minNetworkWithdrawString, minWithdrawString);
929
- }
930
- networks[network] = {
909
+ const networkCode = this.networkIdToCode(networkId, code);
910
+ networks[networkCode] = {
931
911
  'info': rawNetwork,
932
912
  'id': networkId,
933
- 'network': network,
913
+ 'network': networkCode,
934
914
  'name': undefined,
935
- 'active': networkActive,
936
- 'fee': this.parseNumber(withdrawFeeString),
937
- 'precision': minPrecision,
938
- 'deposit': depositEnabled,
939
- 'withdraw': withdrawEnabled,
915
+ 'active': undefined,
916
+ 'fee': this.safeNumber(rawNetwork, 'withdrawFeeAmount'),
917
+ 'precision': undefined,
918
+ 'deposit': this.safeBool(rawNetwork, 'depositEnabled'),
919
+ 'withdraw': this.safeBool(rawNetwork, 'withdrawEnabled'),
940
920
  'limits': {
941
921
  'amount': {
942
922
  'min': undefined,
943
923
  'max': undefined,
944
924
  },
945
925
  'withdraw': {
946
- 'min': this.parseNumber(minNetworkWithdrawString),
926
+ 'min': this.safeNumber(rawNetwork, 'withdrawMinAmount'),
947
927
  'max': undefined,
948
928
  },
949
929
  'deposit': {
@@ -961,16 +941,16 @@ export default class xt extends Exchange {
961
941
  else {
962
942
  type = 'other';
963
943
  }
964
- result[code] = {
944
+ result[code] = this.safeCurrencyStructure({
965
945
  'info': entry,
966
946
  'id': currencyId,
967
947
  'code': code,
968
948
  'name': this.safeString(entry, 'fullName'),
969
- 'active': active,
970
- 'fee': this.parseNumber(minWithdrawFeeString),
971
- 'precision': minPrecision,
972
- 'deposit': deposit,
973
- 'withdraw': withdraw,
949
+ 'active': undefined,
950
+ 'fee': undefined,
951
+ 'precision': this.parseNumber(this.parsePrecision(this.safeString(entry, 'maxPrecision'))),
952
+ 'deposit': this.safeString(entry, 'depositStatus') === '1',
953
+ 'withdraw': this.safeString(entry, 'withdrawStatus') === '1',
974
954
  'networks': networks,
975
955
  'type': type,
976
956
  'limits': {
@@ -979,7 +959,7 @@ export default class xt extends Exchange {
979
959
  'max': undefined,
980
960
  },
981
961
  'withdraw': {
982
- 'min': this.parseNumber(minWithdrawString),
962
+ 'min': undefined,
983
963
  'max': undefined,
984
964
  },
985
965
  'deposit': {
@@ -987,7 +967,7 @@ export default class xt extends Exchange {
987
967
  'max': undefined,
988
968
  },
989
969
  },
990
- };
970
+ });
991
971
  }
992
972
  return result;
993
973
  }
@@ -2968,24 +2948,30 @@ export default class xt extends Exchange {
2968
2948
  }
2969
2949
  async fetchOrdersByStatus(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
2970
2950
  await this.loadMarkets();
2971
- const request = {};
2951
+ let request = {};
2972
2952
  let market = undefined;
2973
2953
  if (symbol !== undefined) {
2974
2954
  market = this.market(symbol);
2975
2955
  request['symbol'] = market['id'];
2976
2956
  }
2957
+ if (limit !== undefined) {
2958
+ request['size'] = limit;
2959
+ }
2960
+ if (since !== undefined) {
2961
+ request['startTime'] = since;
2962
+ }
2977
2963
  let type = undefined;
2978
2964
  let subType = undefined;
2979
2965
  let response = undefined;
2980
2966
  [type, params] = this.handleMarketTypeAndParams('fetchOrdersByStatus', market, params);
2981
2967
  [subType, params] = this.handleSubTypeAndParams('fetchOrdersByStatus', market, params);
2982
- const trigger = this.safeValue(params, 'stop');
2968
+ const trigger = this.safeBool2(params, 'stop', 'trigger');
2983
2969
  const stopLossTakeProfit = this.safeValue(params, 'stopLossTakeProfit');
2984
2970
  if (status === 'open') {
2985
2971
  if (trigger || stopLossTakeProfit) {
2986
2972
  request['state'] = 'NOT_TRIGGERED';
2987
2973
  }
2988
- else if (subType !== undefined) {
2974
+ else if (type === 'swap') {
2989
2975
  request['state'] = 'NEW';
2990
2976
  }
2991
2977
  }
@@ -3017,7 +3003,7 @@ export default class xt extends Exchange {
3017
3003
  }
3018
3004
  }
3019
3005
  if (trigger) {
3020
- params = this.omit(params, 'stop');
3006
+ params = this.omit(params, ['stop', 'trigger']);
3021
3007
  if (subType === 'inverse') {
3022
3008
  response = await this.privateInverseGetFutureTradeV1EntrustPlanList(this.extend(request, params));
3023
3009
  }
@@ -3052,6 +3038,7 @@ export default class xt extends Exchange {
3052
3038
  request['startTime'] = since;
3053
3039
  }
3054
3040
  if (limit !== undefined) {
3041
+ request = this.omit(request, 'size');
3055
3042
  request['limit'] = limit;
3056
3043
  }
3057
3044
  response = await this.privateSpotGetHistoryOrder(this.extend(request, params));
@@ -3238,9 +3225,14 @@ export default class xt extends Exchange {
3238
3225
  // }
3239
3226
  // }
3240
3227
  //
3241
- const isSpotOpenOrders = ((status === 'open') && (subType === undefined));
3242
- const data = this.safeValue(response, 'result', {});
3243
- const orders = isSpotOpenOrders ? this.safeValue(response, 'result', []) : this.safeValue(data, 'items', []);
3228
+ let orders = [];
3229
+ const resultDict = this.safeDict(response, 'result');
3230
+ if (resultDict !== undefined) {
3231
+ orders = this.safeList(resultDict, 'items', []);
3232
+ }
3233
+ else {
3234
+ orders = this.safeList(response, 'result');
3235
+ }
3244
3236
  return this.parseOrders(orders, market, since, limit);
3245
3237
  }
3246
3238
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.4.86",
3
+ "version": "4.4.87",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",