ccxt 4.5.30 → 4.5.31

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 (47) hide show
  1. package/README.md +5 -6
  2. package/dist/ccxt.browser.min.js +18 -18
  3. package/dist/cjs/ccxt.js +1 -4
  4. package/dist/cjs/src/base/Exchange.js +16 -1
  5. package/dist/cjs/src/base/ws/WsClient.js +1 -0
  6. package/dist/cjs/src/gate.js +52 -6
  7. package/dist/cjs/src/hyperliquid.js +9 -1
  8. package/dist/cjs/src/kucoin.js +63 -64
  9. package/dist/cjs/src/pro/apex.js +2 -2
  10. package/dist/cjs/src/pro/ascendex.js +1 -1
  11. package/dist/cjs/src/pro/bingx.js +1 -1
  12. package/dist/cjs/src/pro/bybit.js +1 -1
  13. package/dist/cjs/src/pro/cryptocom.js +1 -1
  14. package/dist/cjs/src/pro/htx.js +1 -1
  15. package/dist/cjs/src/pro/hyperliquid.js +1 -1
  16. package/dist/cjs/src/pro/p2b.js +1 -1
  17. package/dist/cjs/src/pro/toobit.js +1 -1
  18. package/js/ccxt.d.ts +2 -5
  19. package/js/ccxt.js +2 -4
  20. package/js/src/abstract/kucoin.d.ts +2 -0
  21. package/js/src/abstract/kucoinfutures.d.ts +2 -0
  22. package/js/src/base/Exchange.d.ts +3 -0
  23. package/js/src/base/Exchange.js +16 -1
  24. package/js/src/base/ws/WsClient.js +1 -0
  25. package/js/src/binance.d.ts +1 -1
  26. package/js/src/exmo.d.ts +1 -1
  27. package/js/src/gate.js +52 -6
  28. package/js/src/hyperliquid.d.ts +1 -0
  29. package/js/src/hyperliquid.js +9 -1
  30. package/js/src/kucoin.d.ts +5 -3
  31. package/js/src/kucoin.js +63 -64
  32. package/js/src/pro/apex.js +2 -2
  33. package/js/src/pro/ascendex.js +1 -1
  34. package/js/src/pro/bingx.js +1 -1
  35. package/js/src/pro/bybit.js +1 -1
  36. package/js/src/pro/cryptocom.js +1 -1
  37. package/js/src/pro/htx.js +1 -1
  38. package/js/src/pro/hyperliquid.js +1 -1
  39. package/js/src/pro/p2b.js +1 -1
  40. package/js/src/pro/toobit.js +1 -1
  41. package/package.json +1 -1
  42. package/dist/cjs/src/abstract/oceanex.js +0 -11
  43. package/dist/cjs/src/oceanex.js +0 -1125
  44. package/js/src/abstract/oceanex.d.ts +0 -30
  45. package/js/src/abstract/oceanex.js +0 -11
  46. package/js/src/oceanex.d.ts +0 -231
  47. package/js/src/oceanex.js +0 -1124
package/dist/cjs/ccxt.js CHANGED
@@ -95,7 +95,6 @@ var modetrade = require('./src/modetrade.js');
95
95
  var myokx = require('./src/myokx.js');
96
96
  var ndax = require('./src/ndax.js');
97
97
  var novadax = require('./src/novadax.js');
98
- var oceanex = require('./src/oceanex.js');
99
98
  var okx = require('./src/okx.js');
100
99
  var okxus = require('./src/okxus.js');
101
100
  var onetrading = require('./src/onetrading.js');
@@ -199,7 +198,7 @@ var xt$1 = require('./src/pro/xt.js');
199
198
 
200
199
  //-----------------------------------------------------------------------------
201
200
  // this is updated by vss.js when building
202
- const version = '4.5.30';
201
+ const version = '4.5.31';
203
202
  Exchange["default"].ccxtVersion = version;
204
203
  const exchanges = {
205
204
  'alpaca': alpaca["default"],
@@ -289,7 +288,6 @@ const exchanges = {
289
288
  'myokx': myokx["default"],
290
289
  'ndax': ndax["default"],
291
290
  'novadax': novadax["default"],
292
- 'oceanex': oceanex["default"],
293
291
  'okx': okx["default"],
294
292
  'okxus': okxus["default"],
295
293
  'onetrading': onetrading["default"],
@@ -531,7 +529,6 @@ exports.modetrade = modetrade["default"];
531
529
  exports.myokx = myokx["default"];
532
530
  exports.ndax = ndax["default"];
533
531
  exports.novadax = novadax["default"];
534
- exports.oceanex = oceanex["default"];
535
532
  exports.okx = okx["default"];
536
533
  exports.okxus = okxus["default"];
537
534
  exports.onetrading = onetrading["default"];
@@ -615,12 +615,16 @@ class Exchange {
615
615
  return undefined;
616
616
  }
617
617
  isBinaryMessage(msg) {
618
- return msg instanceof Uint8Array;
618
+ return msg instanceof Uint8Array || msg instanceof ArrayBuffer;
619
619
  }
620
620
  decodeProtoMsg(data) {
621
621
  if (!protobufMexc) {
622
622
  throw new errors.NotSupported(this.id + ' requires protobuf to decode messages, please install it with `npm install protobufjs`');
623
623
  }
624
+ if (data instanceof ArrayBuffer) {
625
+ // browser case
626
+ data = new Uint8Array(data);
627
+ }
624
628
  if (data instanceof Uint8Array) {
625
629
  const decoded = protobufMexc.default.PushDataV3ApiWrapper.decode(data);
626
630
  const dict = decoded.toJSON();
@@ -1291,6 +1295,11 @@ class Exchange {
1291
1295
  setProperty(obj, property, defaultValue = undefined) {
1292
1296
  obj[property] = defaultValue;
1293
1297
  }
1298
+ exceptionMessage(exc, includeStack = true) {
1299
+ const message = '[' + exc.constructor.name + '] ' + (!includeStack ? exc.message : exc.stack);
1300
+ const length = Math.min(100000, message.length);
1301
+ return message.slice(0, length);
1302
+ }
1294
1303
  axolotl(payload, hexKey, ed25519) {
1295
1304
  return crypto.axolotl(payload, hexKey, ed25519);
1296
1305
  }
@@ -5983,6 +5992,9 @@ class Exchange {
5983
5992
  }
5984
5993
  throw new errors.NotSupported(this.id + ' fetchClosedOrders() is not supported yet');
5985
5994
  }
5995
+ async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
5996
+ throw new errors.NotSupported(this.id + ' fetchCanceledOrders() is not supported yet');
5997
+ }
5986
5998
  async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
5987
5999
  throw new errors.NotSupported(this.id + ' fetchCanceledAndClosedOrders() is not supported yet');
5988
6000
  }
@@ -7733,6 +7745,9 @@ class Exchange {
7733
7745
  throw new errors.NotSupported(this.id + ' fetchPositionHistory () is not supported yet');
7734
7746
  }
7735
7747
  }
7748
+ async loadMarketsAndSignIn() {
7749
+ await Promise.all([this.loadMarkets(), this.signIn()]);
7750
+ }
7736
7751
  async fetchPositionsHistory(symbols = undefined, since = undefined, limit = undefined, params = {}) {
7737
7752
  /**
7738
7753
  * @method
@@ -49,6 +49,7 @@ class WsClient extends Client["default"] {
49
49
  }
50
50
  else {
51
51
  this.connection = new WebSocketPlatform(this.url, this.protocols);
52
+ this.connection.binaryType = "arraybuffer"; // for browsers not to use blob by default
52
53
  }
53
54
  this.connection.onopen = this.onOpen.bind(this);
54
55
  this.connection.onmessage = this.onMessage.bind(this);
@@ -4972,6 +4972,24 @@ class gate extends gate$1["default"] {
4972
4972
  //
4973
4973
  // {"user_id":10406147,"id":"id","succeeded":false,"message":"INVALID_PROTOCOL","label":"INVALID_PROTOCOL"}
4974
4974
  //
4975
+ // cancel trigger order returns timestamps in ms
4976
+ // id: '2007047737421336576',
4977
+ // id_string: '2007047737421336576',
4978
+ // trigger_time: '0',
4979
+ // trade_id: '0',
4980
+ // trade_id_string: '',
4981
+ // status: 'finished',
4982
+ // finish_as: 'cancelled',
4983
+ // reason: '',
4984
+ // create_time: '1767352444402496'
4985
+ // finish_time: '1767352509535790',
4986
+ // is_stop_order: false,
4987
+ // stop_trigger: { rule: '0', trigger_price: '', order_price: '' },
4988
+ // me_order_id: '0',
4989
+ // me_order_id_string: '',
4990
+ // order_type: '',
4991
+ // in_dual_mode: false,
4992
+ // parent_id: '0',
4975
4993
  const succeeded = this.safeBool(order, 'succeeded', true);
4976
4994
  if (!succeeded) {
4977
4995
  // cancelOrders response
@@ -5014,13 +5032,33 @@ class gate extends gate$1["default"] {
5014
5032
  side = Precise["default"].stringGt(amount, '0') ? 'buy' : 'sell';
5015
5033
  }
5016
5034
  const rawStatus = this.safeStringN(order, ['finish_as', 'status', 'open']);
5017
- let timestamp = this.safeInteger(order, 'create_time_ms');
5018
- if (timestamp === undefined) {
5019
- timestamp = this.safeTimestamp2(order, 'create_time', 'ctime');
5035
+ let timestampStr = this.safeString(order, 'create_time_ms');
5036
+ if (timestampStr === undefined) {
5037
+ timestampStr = this.safeString2(order, 'create_time', 'ctime');
5038
+ if (timestampStr !== undefined) {
5039
+ if (timestampStr.length === 10 || timestampStr.indexOf('.') >= 0) {
5040
+ // ts in seconds, multiply to ms
5041
+ timestampStr = Precise["default"].stringMul(timestampStr, '1000');
5042
+ }
5043
+ else if (timestampStr.length === 16) {
5044
+ // ts in microseconds, divide to ms
5045
+ timestampStr = Precise["default"].stringDiv(timestampStr, '1000');
5046
+ }
5047
+ }
5020
5048
  }
5021
- let lastTradeTimestamp = this.safeInteger(order, 'update_time_ms');
5022
- if (lastTradeTimestamp === undefined) {
5023
- lastTradeTimestamp = this.safeTimestamp2(order, 'update_time', 'finish_time');
5049
+ let lastTradeTimestampStr = this.safeString(order, 'update_time_ms');
5050
+ if (lastTradeTimestampStr === undefined) {
5051
+ lastTradeTimestampStr = this.safeString2(order, 'update_time', 'finish_time');
5052
+ if (lastTradeTimestampStr !== undefined) {
5053
+ if (lastTradeTimestampStr.length === 10 || lastTradeTimestampStr.indexOf('.') >= 0) {
5054
+ // ts in seconds, multiply to ms
5055
+ lastTradeTimestampStr = Precise["default"].stringMul(lastTradeTimestampStr, '1000');
5056
+ }
5057
+ else if (lastTradeTimestampStr.length === 16) {
5058
+ // ts in microseconds, divide to ms
5059
+ lastTradeTimestampStr = Precise["default"].stringDiv(lastTradeTimestampStr, '1000');
5060
+ }
5061
+ }
5024
5062
  }
5025
5063
  let marketType = 'contract';
5026
5064
  if (('currency_pair' in order) || ('market' in order)) {
@@ -5067,6 +5105,14 @@ class gate extends gate$1["default"] {
5067
5105
  amount = Precise["default"].stringDiv(amount, averageString);
5068
5106
  }
5069
5107
  }
5108
+ let timestamp = undefined;
5109
+ let lastTradeTimestamp = undefined;
5110
+ if (timestampStr !== undefined) {
5111
+ timestamp = this.parseToInt(timestampStr);
5112
+ }
5113
+ if (lastTradeTimestampStr !== undefined) {
5114
+ lastTradeTimestamp = this.parseToInt(lastTradeTimestampStr);
5115
+ }
5070
5116
  return this.safeOrder({
5071
5117
  'id': this.safeString(order, 'id'),
5072
5118
  'clientOrderId': this.safeString(order, 'text'),
@@ -1062,6 +1062,13 @@ class hyperliquid extends hyperliquid$1["default"] {
1062
1062
  'info': market,
1063
1063
  });
1064
1064
  }
1065
+ updateSpotCurrencyCode(code) {
1066
+ if (code === undefined) {
1067
+ return code;
1068
+ }
1069
+ const spotCurrencyMapping = this.safeDict(this.options, 'spotCurrencyMapping', {});
1070
+ return this.safeString(spotCurrencyMapping, code, code);
1071
+ }
1065
1072
  /**
1066
1073
  * @method
1067
1074
  * @name hyperliquid#fetchBalance
@@ -1129,7 +1136,8 @@ class hyperliquid extends hyperliquid$1["default"] {
1129
1136
  const spotBalances = { 'info': response };
1130
1137
  for (let i = 0; i < balances.length; i++) {
1131
1138
  const balance = balances[i];
1132
- const code = this.safeCurrencyCode(this.safeString(balance, 'coin'));
1139
+ const unifiedCode = this.safeCurrencyCode(this.safeString(balance, 'coin'));
1140
+ const code = isSpot ? this.updateSpotCurrencyCode(unifiedCode) : unifiedCode;
1133
1141
  const account = this.account();
1134
1142
  const total = this.safeString(balance, 'total');
1135
1143
  const used = this.safeString(balance, 'hold');
@@ -182,6 +182,7 @@ class kucoin extends kucoin$1["default"] {
182
182
  'get': {
183
183
  // account
184
184
  'user-info': 30,
185
+ 'user/api-key': 30,
185
186
  'accounts': 7.5,
186
187
  'accounts/{accountId}': 7.5,
187
188
  'accounts/ledgers': 3,
@@ -266,6 +267,8 @@ class kucoin extends kucoin$1["default"] {
266
267
  'convert/limit/orders': 5,
267
268
  // affiliate
268
269
  'affiliate/inviter/statistics': 30,
270
+ // earn
271
+ 'earn/redeem-preview': 5, // 5EW
269
272
  },
270
273
  'post': {
271
274
  // account
@@ -713,6 +716,9 @@ class kucoin extends kucoin$1["default"] {
713
716
  'withdraw': {
714
717
  'includeFee': false,
715
718
  },
719
+ 'transfer': {
720
+ 'fillResponseFromRequest': true,
721
+ },
716
722
  // endpoint versions
717
723
  'versions': {
718
724
  'public': {
@@ -4583,96 +4589,89 @@ class kucoin extends kucoin$1["default"] {
4583
4589
  * @method
4584
4590
  * @name kucoin#transfer
4585
4591
  * @description transfer currency internally between wallets on the same account
4586
- * @see https://www.kucoin.com/docs/rest/funding/transfer/inner-transfer
4587
- * @see https://docs.kucoin.com/futures/#transfer-funds-to-kucoin-main-account-2
4588
- * @see https://docs.kucoin.com/spot-hf/#internal-funds-transfers-in-high-frequency-trading-accounts
4592
+ * @see https://www.kucoin.com/docs-new/rest/account-info/transfer/flex-transfer?lang=en_US&
4589
4593
  * @param {string} code unified currency code
4590
4594
  * @param {float} amount amount to transfer
4591
4595
  * @param {string} fromAccount account to transfer from
4592
4596
  * @param {string} toAccount account to transfer to
4593
4597
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4598
+ * @param {string} [params.transferType] INTERNAL, PARENT_TO_SUB, SUB_TO_PARENT (default is INTERNAL)
4599
+ * @param {string} [params.fromUserId] required if transferType is SUB_TO_PARENT
4600
+ * @param {string} [params.toUserId] required if transferType is PARENT_TO_SUB
4594
4601
  * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/?id=transfer-structure}
4595
4602
  */
4596
4603
  async transfer(code, amount, fromAccount, toAccount, params = {}) {
4597
4604
  await this.loadMarkets();
4598
4605
  const currency = this.currency(code);
4599
4606
  const requestedAmount = this.currencyToPrecision(code, amount);
4607
+ const request = {
4608
+ 'currency': currency['id'],
4609
+ 'amount': requestedAmount,
4610
+ };
4611
+ let transferType = 'INTERNAL';
4612
+ [transferType, params] = this.handleParamString2(params, 'transferType', 'type', transferType);
4613
+ if (transferType === 'PARENT_TO_SUB') {
4614
+ if (!('toUserId' in params)) {
4615
+ throw new errors.ExchangeError(this.id + ' transfer() requires a toUserId param for PARENT_TO_SUB transfers');
4616
+ }
4617
+ }
4618
+ else if (transferType === 'SUB_TO_PARENT') {
4619
+ if (!('fromUserId' in params)) {
4620
+ throw new errors.ExchangeError(this.id + ' transfer() requires a fromUserId param for SUB_TO_PARENT transfers');
4621
+ }
4622
+ }
4623
+ if (!('clientOid' in params)) {
4624
+ request['clientOid'] = this.uuid();
4625
+ }
4600
4626
  let fromId = this.convertTypeToAccount(fromAccount);
4601
4627
  let toId = this.convertTypeToAccount(toAccount);
4602
4628
  const fromIsolated = this.inArray(fromId, this.ids);
4603
4629
  const toIsolated = this.inArray(toId, this.ids);
4604
- if (fromId === 'contract') {
4605
- if (toId !== 'main') {
4606
- throw new errors.ExchangeError(this.id + ' transfer() only supports transferring from futures account to main account');
4607
- }
4608
- const request = {
4609
- 'currency': currency['id'],
4610
- 'amount': requestedAmount,
4611
- };
4612
- if (!('bizNo' in params)) {
4613
- // it doesn't like more than 24 characters
4614
- request['bizNo'] = this.uuid22();
4615
- }
4616
- const response = await this.futuresPrivatePostTransferOut(this.extend(request, params));
4617
- //
4618
- // {
4619
- // "code": "200000",
4620
- // "data": {
4621
- // "applyId": "605a87217dff1500063d485d",
4622
- // "bizNo": "bcd6e5e1291f4905af84dc",
4623
- // "payAccountType": "CONTRACT",
4624
- // "payTag": "DEFAULT",
4625
- // "remark": '',
4626
- // "recAccountType": "MAIN",
4627
- // "recTag": "DEFAULT",
4628
- // "recRemark": '',
4629
- // "recSystem": "KUCOIN",
4630
- // "status": "PROCESSING",
4631
- // "currency": "XBT",
4632
- // "amount": "0.00001",
4633
- // "fee": "0",
4634
- // "sn": "573688685663948",
4635
- // "reason": '',
4636
- // "createdAt": 1616545569000,
4637
- // "updatedAt": 1616545569000
4638
- // }
4639
- // }
4640
- //
4641
- const data = this.safeDict(response, 'data');
4642
- return this.parseTransfer(data, currency);
4630
+ if (fromIsolated) {
4631
+ request['fromAccountTag'] = fromId;
4632
+ fromId = 'isolated';
4643
4633
  }
4644
- else {
4645
- const request = {
4646
- 'currency': currency['id'],
4647
- 'amount': requestedAmount,
4648
- };
4649
- if (fromIsolated || toIsolated) {
4650
- if (this.inArray(fromId, this.ids)) {
4651
- request['fromTag'] = fromId;
4652
- fromId = 'isolated';
4653
- }
4654
- if (this.inArray(toId, this.ids)) {
4655
- request['toTag'] = toId;
4656
- toId = 'isolated';
4657
- }
4658
- }
4634
+ if (toIsolated) {
4635
+ request['toAccountTag'] = toId;
4636
+ toId = 'isolated';
4637
+ }
4638
+ const hfOrMining = this.isHfOrMining(fromId, toId);
4639
+ let response = undefined;
4640
+ if (hfOrMining) {
4641
+ // new endpoint does not support hf and mining transfers
4642
+ // use old endpoint for hf and mining transfers
4659
4643
  request['from'] = fromId;
4660
4644
  request['to'] = toId;
4661
- if (!('clientOid' in params)) {
4662
- request['clientOid'] = this.uuid();
4663
- }
4664
- const response = await this.privatePostAccountsInnerTransfer(this.extend(request, params));
4645
+ response = await this.privatePostAccountsInnerTransfer(this.extend(request, params));
4646
+ }
4647
+ else {
4648
+ request['type'] = transferType;
4649
+ request['fromAccountType'] = fromId.toUpperCase();
4650
+ request['toAccountType'] = toId.toUpperCase();
4665
4651
  //
4666
4652
  // {
4667
4653
  // "code": "200000",
4668
4654
  // "data": {
4669
- // "orderId": "605a6211e657f00006ad0ad6"
4655
+ // "orderId": "694fcb5b08bb1600015cda75"
4670
4656
  // }
4671
4657
  // }
4672
4658
  //
4673
- const data = this.safeDict(response, 'data');
4674
- return this.parseTransfer(data, currency);
4659
+ response = await this.privatePostAccountsUniversalTransfer(this.extend(request, params));
4675
4660
  }
4661
+ const data = this.safeDict(response, 'data');
4662
+ const transfer = this.parseTransfer(data, currency);
4663
+ const transferOptions = this.safeDict(this.options, 'transfer', {});
4664
+ const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
4665
+ if (fillResponseFromRequest) {
4666
+ transfer['amount'] = amount;
4667
+ transfer['fromAccount'] = fromAccount;
4668
+ transfer['toAccount'] = toAccount;
4669
+ transfer['status'] = 'ok';
4670
+ }
4671
+ return transfer;
4672
+ }
4673
+ isHfOrMining(fromId, toId) {
4674
+ return (fromId === 'trade_hf' || toId === 'trade_hf' || fromId === 'pool' || toId === 'pool');
4676
4675
  }
4677
4676
  parseTransfer(transfer, currency = undefined) {
4678
4677
  //
@@ -985,7 +985,7 @@ class apex extends apex$1["default"] {
985
985
  await client.send({ 'args': [timeStamp.toString()], 'op': 'pong' });
986
986
  }
987
987
  catch (e) {
988
- const error = new errors.NetworkError(this.id + ' handlePing failed with error ' + this.json(e));
988
+ const error = new errors.NetworkError(this.id + ' handlePing failed with error ' + this.exceptionMessage(e));
989
989
  client.reset(error);
990
990
  }
991
991
  }
@@ -1000,7 +1000,7 @@ class apex extends apex$1["default"] {
1000
1000
  //
1001
1001
  // { pong: 1653296711335 }
1002
1002
  //
1003
- client.lastPong = this.safeInteger(message, 'pong');
1003
+ client.lastPong = this.safeInteger(message, 'pong', this.milliseconds());
1004
1004
  return message;
1005
1005
  }
1006
1006
  handlePing(client, message) {
@@ -975,7 +975,7 @@ class ascendex extends ascendex$1["default"] {
975
975
  await client.send({ 'op': 'pong', 'hp': this.safeInteger(message, 'hp') });
976
976
  }
977
977
  catch (e) {
978
- const error = new errors.NetworkError(this.id + ' handlePing failed with error ' + this.json(e));
978
+ const error = new errors.NetworkError(this.id + ' handlePing failed with error ' + this.exceptionMessage(e));
979
979
  client.reset(error);
980
980
  }
981
981
  }
@@ -1226,7 +1226,7 @@ class bingx extends bingx$1["default"] {
1226
1226
  }
1227
1227
  }
1228
1228
  catch (e) {
1229
- const error = new errors.NetworkError(this.id + ' pong failed with error ' + this.json(e));
1229
+ const error = new errors.NetworkError(this.id + ' pong failed with error ' + this.exceptionMessage(e));
1230
1230
  client.reset(error);
1231
1231
  }
1232
1232
  }
@@ -2480,7 +2480,7 @@ class bybit extends bybit$1["default"] {
2480
2480
  // "conn_id": "d266o6hqo29sqmnq4vk0-1yus1"
2481
2481
  // }
2482
2482
  //
2483
- client.lastPong = this.safeInteger(message, 'pong');
2483
+ client.lastPong = this.safeInteger(message, 'pong', this.milliseconds());
2484
2484
  return message;
2485
2485
  }
2486
2486
  handleAuthenticate(client, message) {
@@ -65,7 +65,7 @@ class cryptocom extends cryptocom$1["default"] {
65
65
  await client.send({ 'id': this.safeInteger(message, 'id'), 'method': 'public/respond-heartbeat' });
66
66
  }
67
67
  catch (e) {
68
- const error = new errors.NetworkError(this.id + ' pong failed with error ' + this.json(e));
68
+ const error = new errors.NetworkError(this.id + ' pong failed with error ' + this.exceptionMessage(e));
69
69
  client.reset(error);
70
70
  }
71
71
  }
@@ -2033,7 +2033,7 @@ class htx extends htx$1["default"] {
2033
2033
  }
2034
2034
  }
2035
2035
  catch (e) {
2036
- const error = new errors.NetworkError(this.id + ' pong failed ' + this.json(e));
2036
+ const error = new errors.NetworkError(this.id + ' pong failed ' + this.exceptionMessage(e));
2037
2037
  client.reset(error);
2038
2038
  }
2039
2039
  }
@@ -1261,7 +1261,7 @@ class hyperliquid extends hyperliquid$1["default"] {
1261
1261
  // "channel": "pong"
1262
1262
  // }
1263
1263
  //
1264
- client.lastPong = this.safeInteger(message, 'pong');
1264
+ client.lastPong = this.safeInteger(message, 'pong', this.milliseconds());
1265
1265
  return message;
1266
1266
  }
1267
1267
  requestId() {
@@ -491,7 +491,7 @@ class p2b extends p2b$1["default"] {
491
491
  // id: 1706539608030
492
492
  // }
493
493
  //
494
- client.lastPong = this.safeInteger(message, 'id');
494
+ client.lastPong = this.safeInteger(message, 'id', this.milliseconds());
495
495
  return message;
496
496
  }
497
497
  onError(client, error) {
@@ -1105,7 +1105,7 @@ class toobit extends toobit$1["default"] {
1105
1105
  this.delay(listenKeyRefreshRate, this.keepAliveListenKey, params);
1106
1106
  }
1107
1107
  catch (e) {
1108
- const err = new errors.AuthenticationError(this.id + ' ' + this.json(e));
1108
+ const err = new errors.AuthenticationError(this.id + ' ' + this.exceptionMessage(e));
1109
1109
  client.reject(err, messageHash);
1110
1110
  if (messageHash in client.subscriptions) {
1111
1111
  delete client.subscriptions[messageHash];
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarketMarginModes, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, LongShortRatio, OrderBooks, OpenInterests, ConstructorArgs } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
7
- declare const version = "4.5.29";
7
+ declare const version = "4.5.30";
8
8
  import alpaca from './src/alpaca.js';
9
9
  import apex from './src/apex.js';
10
10
  import arkham from './src/arkham.js';
@@ -92,7 +92,6 @@ import modetrade from './src/modetrade.js';
92
92
  import myokx from './src/myokx.js';
93
93
  import ndax from './src/ndax.js';
94
94
  import novadax from './src/novadax.js';
95
- import oceanex from './src/oceanex.js';
96
95
  import okx from './src/okx.js';
97
96
  import okxus from './src/okxus.js';
98
97
  import onetrading from './src/onetrading.js';
@@ -281,7 +280,6 @@ declare const exchanges: {
281
280
  myokx: typeof myokx;
282
281
  ndax: typeof ndax;
283
282
  novadax: typeof novadax;
284
- oceanex: typeof oceanex;
285
283
  okx: typeof okx;
286
284
  okxus: typeof okxus;
287
285
  onetrading: typeof onetrading;
@@ -557,7 +555,6 @@ declare const ccxt: {
557
555
  myokx: typeof myokx;
558
556
  ndax: typeof ndax;
559
557
  novadax: typeof novadax;
560
- oceanex: typeof oceanex;
561
558
  okx: typeof okx;
562
559
  okxus: typeof okxus;
563
560
  onetrading: typeof onetrading;
@@ -582,5 +579,5 @@ declare const ccxt: {
582
579
  zebpay: typeof zebpay;
583
580
  zonda: typeof zonda;
584
581
  } & typeof functions & typeof errors;
585
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, ConstructorArgs, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketMarginModes, MarketInterface, Trade, Order, OrderBook, OrderBooks, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, OpenInterests, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, LongShortRatio, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, alpaca, apex, arkham, ascendex, backpack, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbns, bitfinex, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitrue, bitso, bitstamp, bitteam, bittrade, bitvavo, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bullish, bybit, bydfi, cex, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, cryptomus, deepcoin, defx, delta, deribit, derive, digifinex, dydx, exmo, fmfwio, foxbit, gate, gateio, gemini, hashkey, hibachi, hitbtc, hollaex, htx, huobi, hyperliquid, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, latoken, lbank, luno, mercado, mexc, modetrade, myokx, ndax, novadax, oceanex, okx, okxus, onetrading, oxfun, p2b, paradex, paymium, phemex, poloniex, probit, timex, tokocrypto, toobit, upbit, wavesexchange, whitebit, woo, woofipro, xt, yobit, zaif, zebpay, zonda, };
582
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, ConstructorArgs, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketMarginModes, MarketInterface, Trade, Order, OrderBook, OrderBooks, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, OpenInterests, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, LongShortRatio, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers, alpaca, apex, arkham, ascendex, backpack, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbns, bitfinex, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitrue, bitso, bitstamp, bitteam, bittrade, bitvavo, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bullish, bybit, bydfi, cex, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, cryptomus, deepcoin, defx, delta, deribit, derive, digifinex, dydx, exmo, fmfwio, foxbit, gate, gateio, gemini, hashkey, hibachi, hitbtc, hollaex, htx, huobi, hyperliquid, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, latoken, lbank, luno, mercado, mexc, modetrade, myokx, ndax, novadax, okx, okxus, onetrading, oxfun, p2b, paradex, paymium, phemex, poloniex, probit, timex, tokocrypto, toobit, upbit, wavesexchange, whitebit, woo, woofipro, xt, yobit, zaif, zebpay, zonda, };
586
583
  export default ccxt;
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.5.29';
41
+ const version = '4.5.30';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import alpaca from './src/alpaca.js';
@@ -128,7 +128,6 @@ import modetrade from './src/modetrade.js';
128
128
  import myokx from './src/myokx.js';
129
129
  import ndax from './src/ndax.js';
130
130
  import novadax from './src/novadax.js';
131
- import oceanex from './src/oceanex.js';
132
131
  import okx from './src/okx.js';
133
132
  import okxus from './src/okxus.js';
134
133
  import onetrading from './src/onetrading.js';
@@ -318,7 +317,6 @@ const exchanges = {
318
317
  'myokx': myokx,
319
318
  'ndax': ndax,
320
319
  'novadax': novadax,
321
- 'oceanex': oceanex,
322
320
  'okx': okx,
323
321
  'okxus': okxus,
324
322
  'onetrading': onetrading,
@@ -434,6 +432,6 @@ pro.exchanges = Object.keys(pro);
434
432
  pro['Exchange'] = Exchange; // now the same for rest and ts
435
433
  //-----------------------------------------------------------------------------
436
434
  const ccxt = Object.assign({ version, Exchange, Precise, 'exchanges': Object.keys(exchanges), 'pro': pro }, exchanges, functions, errors);
437
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, alpaca, apex, arkham, ascendex, backpack, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbns, bitfinex, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitrue, bitso, bitstamp, bitteam, bittrade, bitvavo, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bullish, bybit, bydfi, cex, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, cryptomus, deepcoin, defx, delta, deribit, derive, digifinex, dydx, exmo, fmfwio, foxbit, gate, gateio, gemini, hashkey, hibachi, hitbtc, hollaex, htx, huobi, hyperliquid, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, latoken, lbank, luno, mercado, mexc, modetrade, myokx, ndax, novadax, oceanex, okx, okxus, onetrading, oxfun, p2b, paradex, paymium, phemex, poloniex, probit, timex, tokocrypto, toobit, upbit, wavesexchange, whitebit, woo, woofipro, xt, yobit, zaif, zebpay, zonda, };
435
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, ManualInteractionNeeded, RestrictedLocation, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending, UnsubscribeError, alpaca, apex, arkham, ascendex, backpack, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbns, bitfinex, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitrue, bitso, bitstamp, bitteam, bittrade, bitvavo, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bullish, bybit, bydfi, cex, coinbase, coinbaseadvanced, coinbaseexchange, coinbaseinternational, coincatch, coincheck, coinex, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, cryptomus, deepcoin, defx, delta, deribit, derive, digifinex, dydx, exmo, fmfwio, foxbit, gate, gateio, gemini, hashkey, hibachi, hitbtc, hollaex, htx, huobi, hyperliquid, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, latoken, lbank, luno, mercado, mexc, modetrade, myokx, ndax, novadax, okx, okxus, onetrading, oxfun, p2b, paradex, paymium, phemex, poloniex, probit, timex, tokocrypto, toobit, upbit, wavesexchange, whitebit, woo, woofipro, xt, yobit, zaif, zebpay, zonda, };
438
436
  export default ccxt;
439
437
  //-----------------------------------------------------------------------------
@@ -25,6 +25,7 @@ interface Exchange {
25
25
  publicGetConvertCurrencies(params?: {}): Promise<implicitReturnType>;
26
26
  publicPostBulletPublic(params?: {}): Promise<implicitReturnType>;
27
27
  privateGetUserInfo(params?: {}): Promise<implicitReturnType>;
28
+ privateGetUserApiKey(params?: {}): Promise<implicitReturnType>;
28
29
  privateGetAccounts(params?: {}): Promise<implicitReturnType>;
29
30
  privateGetAccountsAccountId(params?: {}): Promise<implicitReturnType>;
30
31
  privateGetAccountsLedgers(params?: {}): Promise<implicitReturnType>;
@@ -103,6 +104,7 @@ interface Exchange {
103
104
  privateGetConvertLimitOrderDetail(params?: {}): Promise<implicitReturnType>;
104
105
  privateGetConvertLimitOrders(params?: {}): Promise<implicitReturnType>;
105
106
  privateGetAffiliateInviterStatistics(params?: {}): Promise<implicitReturnType>;
107
+ privateGetEarnRedeemPreview(params?: {}): Promise<implicitReturnType>;
106
108
  privatePostSubUserCreated(params?: {}): Promise<implicitReturnType>;
107
109
  privatePostSubApiKey(params?: {}): Promise<implicitReturnType>;
108
110
  privatePostSubApiKeyUpdate(params?: {}): Promise<implicitReturnType>;
@@ -25,6 +25,7 @@ interface kucoin {
25
25
  publicGetConvertCurrencies(params?: {}): Promise<implicitReturnType>;
26
26
  publicPostBulletPublic(params?: {}): Promise<implicitReturnType>;
27
27
  privateGetUserInfo(params?: {}): Promise<implicitReturnType>;
28
+ privateGetUserApiKey(params?: {}): Promise<implicitReturnType>;
28
29
  privateGetAccounts(params?: {}): Promise<implicitReturnType>;
29
30
  privateGetAccountsAccountId(params?: {}): Promise<implicitReturnType>;
30
31
  privateGetAccountsLedgers(params?: {}): Promise<implicitReturnType>;
@@ -103,6 +104,7 @@ interface kucoin {
103
104
  privateGetConvertLimitOrderDetail(params?: {}): Promise<implicitReturnType>;
104
105
  privateGetConvertLimitOrders(params?: {}): Promise<implicitReturnType>;
105
106
  privateGetAffiliateInviterStatistics(params?: {}): Promise<implicitReturnType>;
107
+ privateGetEarnRedeemPreview(params?: {}): Promise<implicitReturnType>;
106
108
  privatePostSubUserCreated(params?: {}): Promise<implicitReturnType>;
107
109
  privatePostSubApiKey(params?: {}): Promise<implicitReturnType>;
108
110
  privatePostSubApiKeyUpdate(params?: {}): Promise<implicitReturnType>;
@@ -387,6 +387,7 @@ export default class Exchange {
387
387
  arraySlice(array: any, first: any, second?: any): any;
388
388
  getProperty(obj: any, property: any, defaultValue?: any): any;
389
389
  setProperty(obj: any, property: any, defaultValue?: any): void;
390
+ exceptionMessage(exc: any, includeStack?: boolean): string;
390
391
  axolotl(payload: any, hexKey: any, ed25519: any): string;
391
392
  fixStringifiedJsonMembers(content: string): string;
392
393
  ethAbiEncode(types: any, args: any): Uint8Array;
@@ -823,6 +824,7 @@ export default class Exchange {
823
824
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
824
825
  fetchOpenOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
825
826
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
827
+ fetchCanceledOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
826
828
  fetchCanceledAndClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
827
829
  fetchClosedOrdersWs(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
828
830
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
@@ -973,6 +975,7 @@ export default class Exchange {
973
975
  convertExpireDateToMarketIdDate(date: string): string;
974
976
  convertMarketIdExpireDate(date: string): string;
975
977
  fetchPositionHistory(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
978
+ loadMarketsAndSignIn(): Promise<void>;
976
979
  fetchPositionsHistory(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
977
980
  parseMarginModification(data: Dict, market?: Market): MarginModification;
978
981
  parseMarginModifications(response: object[], symbols?: Strings, symbolKey?: Str, marketType?: MarketType): MarginModification[];