ccxt 4.3.85 → 4.3.86

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 (44) hide show
  1. package/README.md +7 -5
  2. package/dist/ccxt.browser.min.js +15 -15
  3. package/dist/cjs/ccxt.js +6 -1
  4. package/dist/cjs/src/abstract/hashkey.js +9 -0
  5. package/dist/cjs/src/base/Exchange.js +1 -1
  6. package/dist/cjs/src/binance.js +4 -2
  7. package/dist/cjs/src/bitfinex.js +2 -2
  8. package/dist/cjs/src/hashkey.js +4328 -0
  9. package/dist/cjs/src/hyperliquid.js +85 -65
  10. package/dist/cjs/src/indodax.js +37 -9
  11. package/dist/cjs/src/krakenfutures.js +12 -10
  12. package/dist/cjs/src/pro/ascendex.js +45 -5
  13. package/dist/cjs/src/pro/bingx.js +13 -12
  14. package/dist/cjs/src/pro/hashkey.js +839 -0
  15. package/dist/cjs/src/pro/hyperliquid.js +123 -0
  16. package/dist/cjs/src/pro/mexc.js +13 -7
  17. package/dist/cjs/src/pro/woo.js +1 -0
  18. package/dist/cjs/src/pro/woofipro.js +1 -0
  19. package/dist/cjs/src/pro/xt.js +1 -0
  20. package/js/ccxt.d.ts +8 -2
  21. package/js/ccxt.js +6 -2
  22. package/js/src/abstract/hashkey.d.ts +70 -0
  23. package/js/src/abstract/hashkey.js +11 -0
  24. package/js/src/base/Exchange.js +1 -1
  25. package/js/src/binance.js +4 -2
  26. package/js/src/bitfinex.js +2 -2
  27. package/js/src/hashkey.d.ts +178 -0
  28. package/js/src/hashkey.js +4329 -0
  29. package/js/src/hyperliquid.d.ts +3 -0
  30. package/js/src/hyperliquid.js +85 -65
  31. package/js/src/indodax.js +37 -9
  32. package/js/src/krakenfutures.js +12 -10
  33. package/js/src/pro/ascendex.d.ts +2 -0
  34. package/js/src/pro/ascendex.js +45 -5
  35. package/js/src/pro/bingx.js +13 -12
  36. package/js/src/pro/hashkey.d.ts +34 -0
  37. package/js/src/pro/hashkey.js +840 -0
  38. package/js/src/pro/hyperliquid.d.ts +7 -1
  39. package/js/src/pro/hyperliquid.js +123 -0
  40. package/js/src/pro/mexc.js +13 -7
  41. package/js/src/pro/woo.js +1 -0
  42. package/js/src/pro/woofipro.js +1 -0
  43. package/js/src/pro/xt.js +1 -0
  44. package/package.json +1 -1
@@ -55,10 +55,12 @@ export default class hyperliquid extends Exchange {
55
55
  };
56
56
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
57
57
  createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
58
+ createOrdersRequest(orders: any, params?: {}): Dict;
58
59
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<import("./base/types.js").Dictionary<any>>;
59
60
  cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<any[]>;
60
61
  cancelOrdersForSymbols(orders: CancellationRequest[], params?: {}): Promise<any>;
61
62
  cancelAllOrdersAfter(timeout: Int, params?: {}): Promise<any>;
63
+ editOrderRequest(id: string, symbol: string, type: string, side: string, amount?: Num, price?: Num, params?: {}): Dict;
62
64
  editOrder(id: string, symbol: string, type: string, side: string, amount?: Num, price?: Num, params?: {}): Promise<Order>;
63
65
  fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
64
66
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
@@ -93,4 +95,5 @@ export default class hyperliquid extends Exchange {
93
95
  body: any;
94
96
  headers: any;
95
97
  };
98
+ parseCreateOrderArgs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): {}[];
96
99
  }
@@ -1092,25 +1092,9 @@ export default class hyperliquid extends Exchange {
1092
1092
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1093
1093
  */
1094
1094
  await this.loadMarkets();
1095
- const market = this.market(symbol);
1096
- const vaultAddress = this.safeString(params, 'vaultAddress');
1097
- params = this.omit(params, 'vaultAddress');
1098
- symbol = market['symbol'];
1099
- const order = {
1100
- 'symbol': symbol,
1101
- 'type': type,
1102
- 'side': side,
1103
- 'amount': amount,
1104
- 'price': price,
1105
- 'params': params,
1106
- };
1107
- const globalParams = {};
1108
- if (vaultAddress !== undefined) {
1109
- globalParams['vaultAddress'] = vaultAddress;
1110
- }
1111
- const response = await this.createOrders([order], globalParams);
1112
- const first = this.safeDict(response, 0);
1113
- return first;
1095
+ const [order, globalParams] = this.parseCreateOrderArgs(symbol, type, side, amount, price, params);
1096
+ const orders = await this.createOrders([order], globalParams);
1097
+ return orders[0];
1114
1098
  }
1115
1099
  async createOrders(orders, params = {}) {
1116
1100
  /**
@@ -1121,8 +1105,41 @@ export default class hyperliquid extends Exchange {
1121
1105
  * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
1122
1106
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1123
1107
  */
1124
- this.checkRequiredCredentials();
1125
1108
  await this.loadMarkets();
1109
+ const request = this.createOrdersRequest(orders, params);
1110
+ const response = await this.privatePostExchange(request);
1111
+ //
1112
+ // {
1113
+ // "status": "ok",
1114
+ // "response": {
1115
+ // "type": "order",
1116
+ // "data": {
1117
+ // "statuses": [
1118
+ // {
1119
+ // "resting": {
1120
+ // "oid": 5063830287
1121
+ // }
1122
+ // }
1123
+ // ]
1124
+ // }
1125
+ // }
1126
+ // }
1127
+ //
1128
+ const responseObj = this.safeDict(response, 'response', {});
1129
+ const data = this.safeDict(responseObj, 'data', {});
1130
+ const statuses = this.safeList(data, 'statuses', []);
1131
+ return this.parseOrders(statuses, undefined);
1132
+ }
1133
+ createOrdersRequest(orders, params = {}) {
1134
+ /**
1135
+ * @method
1136
+ * @name hyperliquid#createOrders
1137
+ * @description create a list of trade orders
1138
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
1139
+ * @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
1140
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1141
+ */
1142
+ this.checkRequiredCredentials();
1126
1143
  let defaultSlippage = this.safeString(this.options, 'defaultSlippage');
1127
1144
  defaultSlippage = this.safeString(params, 'slippage', defaultSlippage);
1128
1145
  let hasClientOrderId = false;
@@ -1242,28 +1259,7 @@ export default class hyperliquid extends Exchange {
1242
1259
  params = this.omit(params, 'vaultAddress');
1243
1260
  request['vaultAddress'] = vaultAddress;
1244
1261
  }
1245
- const response = await this.privatePostExchange(request);
1246
- //
1247
- // {
1248
- // "status": "ok",
1249
- // "response": {
1250
- // "type": "order",
1251
- // "data": {
1252
- // "statuses": [
1253
- // {
1254
- // "resting": {
1255
- // "oid": 5063830287
1256
- // }
1257
- // }
1258
- // ]
1259
- // }
1260
- // }
1261
- // }
1262
- //
1263
- const responseObj = this.safeDict(response, 'response', {});
1264
- const data = this.safeDict(responseObj, 'data', {});
1265
- const statuses = this.safeList(data, 'statuses', []);
1266
- return this.parseOrders(statuses, undefined);
1262
+ return request;
1267
1263
  }
1268
1264
  async cancelOrder(id, symbol = undefined, params = {}) {
1269
1265
  /**
@@ -1484,33 +1480,11 @@ export default class hyperliquid extends Exchange {
1484
1480
  //
1485
1481
  return response;
1486
1482
  }
1487
- async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
1488
- /**
1489
- * @method
1490
- * @name hyperliquid#editOrder
1491
- * @description edit a trade order
1492
- * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
1493
- * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
1494
- * @param {string} id cancel order id
1495
- * @param {string} symbol unified symbol of the market to create an order in
1496
- * @param {string} type 'market' or 'limit'
1497
- * @param {string} side 'buy' or 'sell'
1498
- * @param {float} amount how much of currency you want to trade in units of base currency
1499
- * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1500
- * @param {object} [params] extra parameters specific to the exchange API endpoint
1501
- * @param {string} [params.timeInForce] 'Gtc', 'Ioc', 'Alo'
1502
- * @param {bool} [params.postOnly] true or false whether the order is post-only
1503
- * @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
1504
- * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
1505
- * @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
1506
- * @param {string} [params.vaultAddress] the vault address for order
1507
- * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1508
- */
1483
+ editOrderRequest(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
1509
1484
  this.checkRequiredCredentials();
1510
1485
  if (id === undefined) {
1511
1486
  throw new ArgumentsRequired(this.id + ' editOrder() requires an id argument');
1512
1487
  }
1513
- await this.loadMarkets();
1514
1488
  const market = this.market(symbol);
1515
1489
  type = type.toUpperCase();
1516
1490
  const isMarket = (type === 'MARKET');
@@ -1597,6 +1571,33 @@ export default class hyperliquid extends Exchange {
1597
1571
  params = this.omit(params, 'vaultAddress');
1598
1572
  request['vaultAddress'] = vaultAddress;
1599
1573
  }
1574
+ return request;
1575
+ }
1576
+ async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
1577
+ /**
1578
+ * @method
1579
+ * @name hyperliquid#editOrder
1580
+ * @description edit a trade order
1581
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
1582
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
1583
+ * @param {string} id cancel order id
1584
+ * @param {string} symbol unified symbol of the market to create an order in
1585
+ * @param {string} type 'market' or 'limit'
1586
+ * @param {string} side 'buy' or 'sell'
1587
+ * @param {float} amount how much of currency you want to trade in units of base currency
1588
+ * @param {float} [price] the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1589
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1590
+ * @param {string} [params.timeInForce] 'Gtc', 'Ioc', 'Alo'
1591
+ * @param {bool} [params.postOnly] true or false whether the order is post-only
1592
+ * @param {bool} [params.reduceOnly] true or false whether the order is reduce-only
1593
+ * @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
1594
+ * @param {string} [params.clientOrderId] client order id, (optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
1595
+ * @param {string} [params.vaultAddress] the vault address for order
1596
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1597
+ */
1598
+ await this.loadMarkets();
1599
+ const market = this.market(symbol);
1600
+ const request = this.editOrderRequest(id, symbol, type, side, amount, price, params);
1600
1601
  const response = await this.privatePostExchange(request);
1601
1602
  //
1602
1603
  // {
@@ -2758,4 +2759,23 @@ export default class hyperliquid extends Exchange {
2758
2759
  }
2759
2760
  return { 'url': url, 'method': method, 'body': body, 'headers': headers };
2760
2761
  }
2762
+ parseCreateOrderArgs(symbol, type, side, amount, price = undefined, params = {}) {
2763
+ const market = this.market(symbol);
2764
+ const vaultAddress = this.safeString(params, 'vaultAddress');
2765
+ params = this.omit(params, 'vaultAddress');
2766
+ symbol = market['symbol'];
2767
+ const order = {
2768
+ 'symbol': symbol,
2769
+ 'type': type,
2770
+ 'side': side,
2771
+ 'amount': amount,
2772
+ 'price': price,
2773
+ 'params': params,
2774
+ };
2775
+ const globalParams = {};
2776
+ if (vaultAddress !== undefined) {
2777
+ globalParams['vaultAddress'] = vaultAddress;
2778
+ }
2779
+ return [order, globalParams];
2780
+ }
2761
2781
  }
package/js/src/indodax.js CHANGED
@@ -8,6 +8,7 @@
8
8
  import Exchange from './abstract/indodax.js';
9
9
  import { ExchangeError, ArgumentsRequired, InsufficientFunds, InvalidOrder, OrderNotFound, AuthenticationError, BadSymbol } from './base/errors.js';
10
10
  import { TICK_SIZE } from './base/functions/number.js';
11
+ import { Precise } from './base/Precise.js';
11
12
  import { sha512 } from './static_dependencies/noble-hashes/sha512.js';
12
13
  // ---------------------------------------------------------------------------
13
14
  /**
@@ -835,9 +836,6 @@ export default class indodax extends Exchange {
835
836
  * @param {object} [params] extra parameters specific to the exchange API endpoint
836
837
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
837
838
  */
838
- if (type !== 'limit') {
839
- throw new ExchangeError(this.id + ' createOrder() allows limit orders only');
840
- }
841
839
  await this.loadMarkets();
842
840
  const market = this.market(symbol);
843
841
  const request = {
@@ -845,14 +843,44 @@ export default class indodax extends Exchange {
845
843
  'type': side,
846
844
  'price': price,
847
845
  };
848
- const currency = market['baseId'];
849
- if (side === 'buy') {
850
- request[market['quoteId']] = amount * price;
846
+ let priceIsRequired = false;
847
+ let quantityIsRequired = false;
848
+ if (type === 'market') {
849
+ if (side === 'buy') {
850
+ let quoteAmount = undefined;
851
+ const cost = this.safeNumber(params, 'cost');
852
+ params = this.omit(params, 'cost');
853
+ if (cost !== undefined) {
854
+ quoteAmount = this.costToPrecision(symbol, cost);
855
+ }
856
+ else {
857
+ if (price === undefined) {
858
+ throw new InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price).');
859
+ }
860
+ const amountString = this.numberToString(amount);
861
+ const priceString = this.numberToString(price);
862
+ const costRequest = Precise.stringMul(amountString, priceString);
863
+ quoteAmount = this.costToPrecision(symbol, costRequest);
864
+ }
865
+ request[market['quoteId']] = quoteAmount;
866
+ }
867
+ else {
868
+ quantityIsRequired = true;
869
+ }
851
870
  }
852
- else {
853
- request[market['baseId']] = amount;
871
+ else if (type === 'limit') {
872
+ priceIsRequired = true;
873
+ quantityIsRequired = true;
874
+ }
875
+ if (priceIsRequired) {
876
+ if (price === undefined) {
877
+ throw new InvalidOrder(this.id + ' createOrder() requires a price argument for a ' + type + ' order');
878
+ }
879
+ request['price'] = price;
880
+ }
881
+ if (quantityIsRequired) {
882
+ request[market['baseId']] = this.amountToPrecision(symbol, amount);
854
883
  }
855
- request[currency] = amount;
856
884
  const result = await this.privatePostTrade(this.extend(request, params));
857
885
  const data = this.safeValue(result, 'return', {});
858
886
  const id = this.safeString(data, 'order_id');
@@ -1770,17 +1770,19 @@ export default class krakenfutures extends Exchange {
1770
1770
  }
1771
1771
  // Final order (after placement / editing / execution / canceling)
1772
1772
  const orderTrigger = this.safeValue(item, 'orderTrigger');
1773
- details = this.safeValue2(item, 'new', 'order', orderTrigger);
1774
- if (details !== undefined) {
1775
- isPrior = false;
1776
- fixed = true;
1777
- }
1778
- else if (!fixed) {
1779
- const orderPriorExecution = this.safeValue(item, 'orderPriorExecution');
1780
- details = this.safeValue2(item, 'orderPriorExecution', 'orderPriorEdit');
1781
- price = this.safeString(orderPriorExecution, 'limitPrice');
1773
+ if (details === undefined) {
1774
+ details = this.safeValue2(item, 'new', 'order', orderTrigger);
1782
1775
  if (details !== undefined) {
1783
- isPrior = true;
1776
+ isPrior = false;
1777
+ fixed = true;
1778
+ }
1779
+ else if (!fixed) {
1780
+ const orderPriorExecution = this.safeValue(item, 'orderPriorExecution');
1781
+ details = this.safeValue2(item, 'orderPriorExecution', 'orderPriorEdit');
1782
+ price = this.safeString(orderPriorExecution, 'limitPrice');
1783
+ if (details !== undefined) {
1784
+ isPrior = true;
1785
+ }
1784
1786
  }
1785
1787
  }
1786
1788
  }
@@ -4,10 +4,12 @@ import Client from '../base/ws/Client.js';
4
4
  export default class ascendex extends ascendexRest {
5
5
  describe(): any;
6
6
  watchPublic(messageHash: any, params?: {}): Promise<any>;
7
+ watchPublicMultiple(messageHashes: any, params?: {}): Promise<any>;
7
8
  watchPrivate(channel: any, messageHash: any, params?: {}): Promise<any>;
8
9
  watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
9
10
  handleOHLCV(client: Client, message: any): any;
10
11
  watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
12
+ watchTradesForSymbols(symbols: string[], since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
11
13
  handleTrades(client: Client, message: any): void;
12
14
  watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
13
15
  watchOrderBookSnapshot(symbol: string, limit?: Int, params?: {}): Promise<any>;
@@ -21,6 +21,7 @@ export default class ascendex extends ascendexRest {
21
21
  'watchOrders': true,
22
22
  'watchTicker': false,
23
23
  'watchTrades': true,
24
+ 'watchTradesForSymbols': true,
24
25
  },
25
26
  'urls': {
26
27
  'api': {
@@ -58,6 +59,16 @@ export default class ascendex extends ascendexRest {
58
59
  const message = this.extend(request, params);
59
60
  return await this.watch(url, messageHash, message, messageHash);
60
61
  }
62
+ async watchPublicMultiple(messageHashes, params = {}) {
63
+ const url = this.urls['api']['ws']['public'];
64
+ const id = this.nonce();
65
+ const request = {
66
+ 'id': id.toString(),
67
+ 'op': 'sub',
68
+ };
69
+ const message = this.extend(request, params);
70
+ return await this.watchMultiple(url, messageHashes, message, messageHashes);
71
+ }
61
72
  async watchPrivate(channel, messageHash, params = {}) {
62
73
  await this.loadAccounts();
63
74
  const accountGroup = this.safeString(this.options, 'account-group');
@@ -78,6 +89,7 @@ export default class ascendex extends ascendexRest {
78
89
  * @method
79
90
  * @name ascendex#watchOHLCV
80
91
  * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
92
+ * @see https://ascendex.github.io/ascendex-pro-api/#channel-bar-data
81
93
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
82
94
  * @param {string} timeframe the length of time each candle represents
83
95
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -143,22 +155,48 @@ export default class ascendex extends ascendexRest {
143
155
  * @method
144
156
  * @name ascendex#watchTrades
145
157
  * @description get the list of most recent trades for a particular symbol
158
+ * @see https://ascendex.github.io/ascendex-pro-api/#channel-market-trades
146
159
  * @param {string} symbol unified symbol of the market to fetch trades for
147
160
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
148
161
  * @param {int} [limit] the maximum amount of trades to fetch
149
162
  * @param {object} [params] extra parameters specific to the exchange API endpoint
150
163
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
151
164
  */
165
+ return await this.watchTradesForSymbols([symbol], since, limit, params);
166
+ }
167
+ async watchTradesForSymbols(symbols, since = undefined, limit = undefined, params = {}) {
168
+ /**
169
+ * @method
170
+ * @name ascendex#watchTradesForSymbols
171
+ * @description get the list of most recent trades for a list of symbols
172
+ * @see https://ascendex.github.io/ascendex-pro-api/#channel-market-trades
173
+ * @param {string[]} symbols unified symbol of the market to fetch trades for
174
+ * @param {int} [since] timestamp in ms of the earliest trade to fetch
175
+ * @param {int} [limit] the maximum amount of trades to fetch
176
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
177
+ * @param {string} [params.name] the name of the method to call, 'trade' or 'aggTrade', default is 'trade'
178
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
179
+ */
152
180
  await this.loadMarkets();
153
- const market = this.market(symbol);
154
- symbol = market['symbol'];
155
- const channel = 'trades' + ':' + market['id'];
181
+ symbols = this.marketSymbols(symbols, undefined, false, true, true);
182
+ const marketIds = [];
183
+ const messageHashes = [];
184
+ if (symbols !== undefined) {
185
+ for (let i = 0; i < symbols.length; i++) {
186
+ const market = this.market(symbols[i]);
187
+ marketIds.push(market['id']);
188
+ messageHashes.push('trades:' + market['id']);
189
+ }
190
+ }
191
+ const channel = 'trades:' + marketIds.join(',');
156
192
  params = this.extend(params, {
157
193
  'ch': channel,
158
194
  });
159
- const trades = await this.watchPublic(channel, params);
195
+ const trades = await this.watchPublicMultiple(messageHashes, params);
160
196
  if (this.newUpdates) {
161
- limit = trades.getLimit(symbol, limit);
197
+ const first = this.safeValue(trades, 0);
198
+ const tradeSymbol = this.safeString(first, 'symbol');
199
+ limit = trades.getLimit(tradeSymbol, limit);
162
200
  }
163
201
  return this.filterBySinceLimit(trades, since, limit, 'timestamp', true);
164
202
  }
@@ -204,6 +242,7 @@ export default class ascendex extends ascendexRest {
204
242
  * @method
205
243
  * @name ascendex#watchOrderBook
206
244
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
245
+ * @see https://ascendex.github.io/ascendex-pro-api/#channel-level-2-order-book-updates
207
246
  * @param {string} symbol unified symbol of the market to fetch the order book for
208
247
  * @param {int} [limit] the maximum amount of order book entries to return
209
248
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -360,6 +399,7 @@ export default class ascendex extends ascendexRest {
360
399
  * @method
361
400
  * @name ascendex#watchBalance
362
401
  * @description watch balance and get the amount of funds available for trading or funds locked in orders
402
+ * @see https://ascendex.github.io/ascendex-pro-api/#channel-order-and-balance
363
403
  * @param {object} [params] extra parameters specific to the exchange API endpoint
364
404
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
365
405
  */
@@ -16,6 +16,7 @@ export default class bingx extends bingxRest {
16
16
  'has': {
17
17
  'ws': true,
18
18
  'watchTrades': true,
19
+ 'watchTradesForSymbols': false,
19
20
  'watchOrderBook': true,
20
21
  'watchOrderBookForSymbols': true,
21
22
  'watchOHLCV': true,
@@ -438,8 +439,8 @@ export default class bingx extends bingxRest {
438
439
  * @method
439
440
  * @name bingx#watchTrades
440
441
  * @description watches information on multiple trades made in a market
441
- * @see https://bingx-api.github.io/docs/#/spot/socket/market.html#Subscribe%20to%20tick-by-tick
442
- * @see https://bingx-api.github.io/docs/#/swapV2/socket/market.html#Subscribe%20the%20Latest%20Trade%20Detail
442
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/socket/market.html#Subscription%20transaction%20by%20transaction
443
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20the%20Latest%20Trade%20Detail
443
444
  * @param {string} symbol unified market symbol of the market orders were made in
444
445
  * @param {int} [since] the earliest time in ms to fetch orders for
445
446
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -561,8 +562,8 @@ export default class bingx extends bingxRest {
561
562
  * @method
562
563
  * @name bingx#watchOrderBook
563
564
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
564
- * @see https://bingx-api.github.io/docs/#/spot/socket/market.html#Subscribe%20Market%20Depth%20Data
565
- * @see https://bingx-api.github.io/docs/#/swapV2/socket/market.html#Subscribe%20Market%20Depth%20Data
565
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/socket/market.html#Subscribe%20Market%20Depth%20Data
566
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20Market%20Depth%20Data
566
567
  * @param {string} symbol unified symbol of the market to fetch the order book for
567
568
  * @param {int} [limit] the maximum amount of order book entries to return
568
569
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -793,8 +794,8 @@ export default class bingx extends bingxRest {
793
794
  * @method
794
795
  * @name bingx#watchOHLCV
795
796
  * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
796
- * @see https://bingx-api.github.io/docs/#/spot/socket/market.html#K%E7%BA%BF%20Streams
797
- * @see https://bingx-api.github.io/docs/#/swapV2/socket/market.html#Subscribe%20K-Line%20Data
797
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/socket/market.html#K-line%20Streams
798
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/socket/market.html#Subscribe%20K-Line%20Data
798
799
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
799
800
  * @param {string} timeframe the length of time each candle represents
800
801
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -837,8 +838,8 @@ export default class bingx extends bingxRest {
837
838
  /**
838
839
  * @method
839
840
  * @name bingx#watchOrders
840
- * @see https://bingx-api.github.io/docs/#/spot/socket/account.html#Subscription%20order%20update%20data
841
- * @see https://bingx-api.github.io/docs/#/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push
841
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/socket/account.html#Subscription%20order%20update%20data
842
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push
842
843
  * @description watches information on multiple orders made by the user
843
844
  * @param {string} symbol unified market symbol of the market orders were made in
844
845
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -884,8 +885,8 @@ export default class bingx extends bingxRest {
884
885
  /**
885
886
  * @method
886
887
  * @name bingx#watchMyTrades
887
- * @see https://bingx-api.github.io/docs/#/spot/socket/account.html#Subscription%20order%20update%20data
888
- * @see https://bingx-api.github.io/docs/#/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push
888
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/socket/account.html#Subscription%20order%20update%20data
889
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push
889
890
  * @description watches information on multiple trades made by the user
890
891
  * @param {string} symbol unified market symbol of the market trades were made in
891
892
  * @param {int} [since] the earliest time in ms to trades orders for
@@ -931,8 +932,8 @@ export default class bingx extends bingxRest {
931
932
  /**
932
933
  * @method
933
934
  * @name bingx#watchBalance
934
- * @see https://bingx-api.github.io/docs/#/spot/socket/account.html#Subscription%20order%20update%20data
935
- * @see https://bingx-api.github.io/docs/#/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push
935
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/socket/account.html#Subscription%20account%20balance%20push
936
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push
936
937
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
937
938
  * @param {object} [params] extra parameters specific to the exchange API endpoint
938
939
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
@@ -0,0 +1,34 @@
1
+ import hashkeyRest from '../hashkey.js';
2
+ import type { Balances, Dict, Int, Market, OHLCV, Order, OrderBook, Position, Str, Strings, Ticker, Trade } from '../base/types.js';
3
+ import Client from '../base/ws/Client.js';
4
+ export default class hashkey extends hashkeyRest {
5
+ describe(): any;
6
+ wathPublic(market: Market, topic: string, messageHash: string, params?: {}): Promise<any>;
7
+ watchPrivate(messageHash: any): Promise<any>;
8
+ getPrivateUrl(listenKey: any): string;
9
+ watchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
10
+ handleOHLCV(client: Client, message: any): void;
11
+ parseWsOHLCV(ohlcv: any, market?: Market): OHLCV;
12
+ watchTicker(symbol: string, params?: {}): Promise<Ticker>;
13
+ handleTicker(client: Client, message: any): void;
14
+ watchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
15
+ handleTrades(client: Client, message: any): void;
16
+ watchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
17
+ handleOrderBook(client: Client, message: any): void;
18
+ watchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
19
+ handleOrder(client: Client, message: any): void;
20
+ parseWsOrder(order: Dict, market?: Market): Order;
21
+ watchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
22
+ handleMyTrade(client: Client, message: any, subscription?: {}): void;
23
+ parseWsTrade(trade: any, market?: any): Trade;
24
+ watchPositions(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
25
+ handlePosition(client: Client, message: any): void;
26
+ parseWsPosition(position: any, market?: Market): Position;
27
+ watchBalance(params?: {}): Promise<Balances>;
28
+ setBalanceCache(client: Client, type: any, subscribeHash: any): void;
29
+ loadBalanceSnapshot(client: any, messageHash: any, type: any): Promise<void>;
30
+ handleBalance(client: Client, message: any): void;
31
+ authenticate(params?: {}): Promise<string>;
32
+ keepAliveListenKey(listenKey: any, params?: {}): Promise<void>;
33
+ handleMessage(client: Client, message: any): void;
34
+ }