ccxt 4.3.52 → 4.3.54

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 (51) hide show
  1. package/README.md +6 -5
  2. package/dist/ccxt.browser.min.js +3 -3
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/vertex.js +9 -0
  5. package/dist/cjs/src/base/Precise.js +10 -0
  6. package/dist/cjs/src/base/functions/type.js +43 -10
  7. package/dist/cjs/src/bingx.js +1 -1
  8. package/dist/cjs/src/hyperliquid.js +27 -26
  9. package/dist/cjs/src/phemex.js +28 -1
  10. package/dist/cjs/src/poloniex.js +2 -1
  11. package/dist/cjs/src/pro/binance.js +1 -1
  12. package/dist/cjs/src/pro/bybit.js +20 -12
  13. package/dist/cjs/src/pro/kucoin.js +64 -26
  14. package/dist/cjs/src/pro/probit.js +8 -3
  15. package/dist/cjs/src/pro/vertex.js +978 -0
  16. package/dist/cjs/src/probit.js +10 -5
  17. package/dist/cjs/src/static_dependencies/ethers/hash/typed-data.js +1 -1
  18. package/dist/cjs/src/vertex.js +2941 -0
  19. package/dist/cjs/src/woo.js +29 -21
  20. package/js/ccxt.d.ts +8 -2
  21. package/js/ccxt.js +6 -2
  22. package/js/src/abstract/vertex.d.ts +22 -0
  23. package/js/src/abstract/vertex.js +11 -0
  24. package/js/src/base/Exchange.d.ts +1 -1
  25. package/js/src/base/Precise.d.ts +2 -0
  26. package/js/src/base/Precise.js +10 -0
  27. package/js/src/base/functions/type.js +43 -10
  28. package/js/src/binance.d.ts +1 -11
  29. package/js/src/bingx.js +1 -1
  30. package/js/src/bitget.d.ts +1 -1
  31. package/js/src/bitmart.d.ts +1 -1
  32. package/js/src/coinex.d.ts +1 -1
  33. package/js/src/htx.d.ts +1 -1
  34. package/js/src/hyperliquid.js +27 -26
  35. package/js/src/phemex.d.ts +1 -1
  36. package/js/src/phemex.js +28 -1
  37. package/js/src/poloniex.js +2 -1
  38. package/js/src/pro/binance.js +1 -1
  39. package/js/src/pro/bybit.d.ts +1 -1
  40. package/js/src/pro/bybit.js +20 -12
  41. package/js/src/pro/kucoin.js +64 -26
  42. package/js/src/pro/probit.js +8 -3
  43. package/js/src/pro/vertex.d.ts +39 -0
  44. package/js/src/pro/vertex.js +979 -0
  45. package/js/src/probit.js +11 -6
  46. package/js/src/static_dependencies/ethers/hash/typed-data.js +1 -1
  47. package/js/src/vertex.d.ts +112 -0
  48. package/js/src/vertex.js +2942 -0
  49. package/js/src/woo.d.ts +1 -0
  50. package/js/src/woo.js +29 -21
  51. package/package.json +1 -1
@@ -156,6 +156,7 @@ class kucoin extends kucoin$1 {
156
156
  * @method
157
157
  * @name kucoin#watchTicker
158
158
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
159
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/market-snapshot
159
160
  * @param {string} symbol unified symbol of the market to fetch the ticker for
160
161
  * @param {object} [params] extra parameters specific to the exchange API endpoint
161
162
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -388,6 +389,7 @@ class kucoin extends kucoin$1 {
388
389
  * @method
389
390
  * @name kucoin#watchOHLCV
390
391
  * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
392
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/klines
391
393
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
392
394
  * @param {string} timeframe the length of time each candle represents
393
395
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -456,6 +458,7 @@ class kucoin extends kucoin$1 {
456
458
  * @method
457
459
  * @name kucoin#watchTrades
458
460
  * @description get the list of most recent trades for a particular symbol
461
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/match-execution-data
459
462
  * @param {string} symbol unified symbol of the market to fetch trades for
460
463
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
461
464
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -469,6 +472,7 @@ class kucoin extends kucoin$1 {
469
472
  * @method
470
473
  * @name kucoin#watchTrades
471
474
  * @description get the list of most recent trades for a particular symbol
475
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/public-channels/match-execution-data
472
476
  * @param {string} symbol unified symbol of the market to fetch trades for
473
477
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
474
478
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -803,6 +807,8 @@ class kucoin extends kucoin$1 {
803
807
  * @method
804
808
  * @name kucoin#watchOrders
805
809
  * @description watches information on multiple orders made by the user
810
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/private-channels/private-order-change
811
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/private-channels/stop-order-event
806
812
  * @param {string} symbol unified market symbol of the market orders were made in
807
813
  * @param {int} [since] the earliest time in ms to fetch orders for
808
814
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -939,6 +945,10 @@ class kucoin extends kucoin$1 {
939
945
  //
940
946
  const messageHash = 'orders';
941
947
  const data = this.safeValue(message, 'data');
948
+ const tradeId = this.safeString(data, 'tradeId');
949
+ if (tradeId !== undefined) {
950
+ this.handleMyTrade(client, message);
951
+ }
942
952
  const parsed = this.parseWsOrder(data);
943
953
  const symbol = this.safeString(parsed, 'symbol');
944
954
  const orderId = this.safeString(parsed, 'id');
@@ -968,6 +978,7 @@ class kucoin extends kucoin$1 {
968
978
  * @method
969
979
  * @name kucoin#watchMyTrades
970
980
  * @description watches information on multiple trades made by the user
981
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/private-channels/private-order-change
971
982
  * @param {string} symbol unified market symbol of the market trades were made in
972
983
  * @param {int} [since] the earliest time in ms to fetch trades for
973
984
  * @param {int} [limit] the maximum number of trade structures to retrieve
@@ -976,7 +987,7 @@ class kucoin extends kucoin$1 {
976
987
  */
977
988
  await this.loadMarkets();
978
989
  const url = await this.negotiate(true);
979
- const topic = '/spot/tradeFills';
990
+ const topic = '/spotMarket/tradeOrders';
980
991
  const request = {
981
992
  'privateChannel': true,
982
993
  };
@@ -993,6 +1004,34 @@ class kucoin extends kucoin$1 {
993
1004
  return this.filterBySymbolSinceLimit(trades, symbol, since, limit, true);
994
1005
  }
995
1006
  handleMyTrade(client, message) {
1007
+ //
1008
+ // {
1009
+ // "type": "message",
1010
+ // "topic": "/spotMarket/tradeOrders",
1011
+ // "subject": "orderChange",
1012
+ // "channelType": "private",
1013
+ // "data": {
1014
+ // "symbol": "KCS-USDT",
1015
+ // "orderType": "limit",
1016
+ // "side": "sell",
1017
+ // "orderId": "5efab07953bdea00089965fa",
1018
+ // "liquidity": "taker",
1019
+ // "type": "match",
1020
+ // "feeType": "takerFee",
1021
+ // "orderTime": 1670329987026,
1022
+ // "size": "0.1",
1023
+ // "filledSize": "0.1",
1024
+ // "price": "0.938",
1025
+ // "matchPrice": "0.96738",
1026
+ // "matchSize": "0.1",
1027
+ // "tradeId": "5efab07a4ee4c7000a82d6d9",
1028
+ // "clientOid": "1593487481000313",
1029
+ // "remainSize": "0",
1030
+ // "status": "match",
1031
+ // "ts": 1670329987311000000
1032
+ // }
1033
+ // }
1034
+ //
996
1035
  if (this.myTrades === undefined) {
997
1036
  const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
998
1037
  this.myTrades = new Cache.ArrayCacheBySymbolById(limit);
@@ -1007,19 +1046,26 @@ class kucoin extends kucoin$1 {
1007
1046
  }
1008
1047
  parseWsTrade(trade, market = undefined) {
1009
1048
  //
1010
- // {
1011
- // "fee": 0.00262148,
1012
- // "feeCurrency": "USDT",
1013
- // "feeRate": 0.001,
1014
- // "orderId": "62417436b29df8000183df2f",
1015
- // "orderType": "market",
1016
- // "price": 131.074,
1017
- // "side": "sell",
1018
- // "size": 0.02,
1019
- // "symbol": "LTC-USDT",
1020
- // "time": "1648456758734571745",
1021
- // "tradeId": "624174362e113d2f467b3043"
1022
- // }
1049
+ // {
1050
+ // "symbol": "KCS-USDT",
1051
+ // "orderType": "limit",
1052
+ // "side": "sell",
1053
+ // "orderId": "5efab07953bdea00089965fa",
1054
+ // "liquidity": "taker",
1055
+ // "type": "match",
1056
+ // "feeType": "takerFee",
1057
+ // "orderTime": 1670329987026,
1058
+ // "size": "0.1",
1059
+ // "filledSize": "0.1",
1060
+ // "price": "0.938",
1061
+ // "matchPrice": "0.96738",
1062
+ // "matchSize": "0.1",
1063
+ // "tradeId": "5efab07a4ee4c7000a82d6d9",
1064
+ // "clientOid": "1593487481000313",
1065
+ // "remainSize": "0",
1066
+ // "status": "match",
1067
+ // "ts": 1670329987311000000
1068
+ // }
1023
1069
  //
1024
1070
  const marketId = this.safeString(trade, 'symbol');
1025
1071
  market = this.safeMarket(marketId, market, '-');
@@ -1030,15 +1076,7 @@ class kucoin extends kucoin$1 {
1030
1076
  const price = this.safeString(trade, 'price');
1031
1077
  const amount = this.safeString(trade, 'size');
1032
1078
  const order = this.safeString(trade, 'orderId');
1033
- const timestamp = this.safeIntegerProduct(trade, 'time', 0.000001);
1034
- const feeCurrency = market['quote'];
1035
- const feeRate = this.safeString(trade, 'feeRate');
1036
- const feeCost = this.safeString(trade, 'fee');
1037
- const fee = {
1038
- 'cost': feeCost,
1039
- 'rate': feeRate,
1040
- 'currency': feeCurrency,
1041
- };
1079
+ const timestamp = this.safeIntegerProduct(trade, 'ts', 0.000001);
1042
1080
  return this.safeTrade({
1043
1081
  'info': trade,
1044
1082
  'timestamp': timestamp,
@@ -1047,12 +1085,12 @@ class kucoin extends kucoin$1 {
1047
1085
  'id': tradeId,
1048
1086
  'order': order,
1049
1087
  'type': type,
1050
- 'takerOrMaker': undefined,
1088
+ 'takerOrMaker': this.safeString(trade, 'liquidity'),
1051
1089
  'side': side,
1052
1090
  'price': price,
1053
1091
  'amount': amount,
1054
1092
  'cost': undefined,
1055
- 'fee': fee,
1093
+ 'fee': undefined,
1056
1094
  }, market);
1057
1095
  }
1058
1096
  async watchBalance(params = {}) {
@@ -1060,6 +1098,7 @@ class kucoin extends kucoin$1 {
1060
1098
  * @method
1061
1099
  * @name kucoin#watchBalance
1062
1100
  * @description watch balance and get the amount of funds available for trading or funds locked in orders
1101
+ * @see https://www.kucoin.com/docs/websocket/spot-trading/private-channels/account-balance-change
1063
1102
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1064
1103
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
1065
1104
  */
@@ -1158,7 +1197,6 @@ class kucoin extends kucoin$1 {
1158
1197
  'trade.l3match': this.handleTrade,
1159
1198
  'trade.candles.update': this.handleOHLCV,
1160
1199
  'account.balance': this.handleBalance,
1161
- '/spot/tradeFills': this.handleMyTrade,
1162
1200
  'orderChange': this.handleOrder,
1163
1201
  'stopOrder': this.handleOrder,
1164
1202
  };
@@ -44,7 +44,6 @@ class probit extends probit$1 {
44
44
  },
45
45
  },
46
46
  'streaming': {},
47
- 'exceptions': {},
48
47
  });
49
48
  }
50
49
  async watchBalance(params = {}) {
@@ -493,8 +492,14 @@ class probit extends probit$1 {
493
492
  const code = this.safeString(message, 'errorCode');
494
493
  const errMessage = this.safeString(message, 'message', '');
495
494
  const details = this.safeValue(message, 'details');
496
- // todo - throw properly here
497
- throw new errors.ExchangeError(this.id + ' ' + code + ' ' + errMessage + ' ' + this.json(details));
495
+ const feedback = this.id + ' ' + code + ' ' + errMessage + ' ' + this.json(details);
496
+ if ('exact' in this.exceptions) {
497
+ this.throwExactlyMatchedException(this.exceptions['exact'], code, feedback);
498
+ }
499
+ if ('broad' in this.exceptions) {
500
+ this.throwBroadlyMatchedException(this.exceptions['broad'], errMessage, feedback);
501
+ }
502
+ throw new errors.ExchangeError(feedback);
498
503
  }
499
504
  handleAuthenticate(client, message) {
500
505
  //