ccxt 4.3.55 → 4.3.57

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 (50) hide show
  1. package/README.md +3 -5
  2. package/dist/ccxt.browser.min.js +2 -2
  3. package/dist/cjs/ccxt.js +1 -1
  4. package/dist/cjs/src/base/Exchange.js +26 -2
  5. package/dist/cjs/src/base/ws/Client.js +34 -4
  6. package/dist/cjs/src/binance.js +7 -7
  7. package/dist/cjs/src/bingx.js +83 -9
  8. package/dist/cjs/src/bitflyer.js +7 -1
  9. package/dist/cjs/src/bitget.js +56 -47
  10. package/dist/cjs/src/bitopro.js +20 -3
  11. package/dist/cjs/src/btcmarkets.js +26 -27
  12. package/dist/cjs/src/bybit.js +9 -5
  13. package/dist/cjs/src/coinone.js +13 -19
  14. package/dist/cjs/src/delta.js +5 -1
  15. package/dist/cjs/src/gate.js +109 -1
  16. package/dist/cjs/src/htx.js +88 -25
  17. package/dist/cjs/src/huobijp.js +65 -2
  18. package/dist/cjs/src/hyperliquid.js +1 -1
  19. package/dist/cjs/src/lbank.js +27 -6
  20. package/js/ccxt.d.ts +1 -1
  21. package/js/ccxt.js +1 -1
  22. package/js/src/abstract/bingx.d.ts +16 -0
  23. package/js/src/base/Exchange.d.ts +1 -0
  24. package/js/src/base/Exchange.js +26 -2
  25. package/js/src/base/ws/Client.d.ts +2 -0
  26. package/js/src/base/ws/Client.js +34 -4
  27. package/js/src/binance.js +7 -7
  28. package/js/src/bingx.d.ts +1 -0
  29. package/js/src/bingx.js +83 -9
  30. package/js/src/bitflyer.d.ts +1 -1
  31. package/js/src/bitflyer.js +7 -1
  32. package/js/src/bitget.d.ts +1 -1
  33. package/js/src/bitget.js +56 -47
  34. package/js/src/bitopro.d.ts +3 -2
  35. package/js/src/bitopro.js +20 -3
  36. package/js/src/btcmarkets.js +27 -28
  37. package/js/src/bybit.js +9 -5
  38. package/js/src/coinone.js +13 -19
  39. package/js/src/delta.d.ts +1 -1
  40. package/js/src/delta.js +5 -1
  41. package/js/src/gate.d.ts +3 -1
  42. package/js/src/gate.js +109 -1
  43. package/js/src/htx.d.ts +3 -2
  44. package/js/src/htx.js +88 -25
  45. package/js/src/huobijp.d.ts +3 -2
  46. package/js/src/huobijp.js +65 -2
  47. package/js/src/hyperliquid.js +1 -1
  48. package/js/src/lbank.d.ts +2 -2
  49. package/js/src/lbank.js +27 -6
  50. package/package.json +7 -3
package/js/src/bybit.js CHANGED
@@ -3061,16 +3061,20 @@ export default class bybit extends Exchange {
3061
3061
  const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
3062
3062
  const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
3063
3063
  let type = undefined;
3064
- [type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
3064
+ [type, params] = this.getBybitType('fetchBalance', undefined, params);
3065
3065
  const isSpot = (type === 'spot');
3066
- const isSwap = (type === 'swap');
3066
+ const isLinear = (type === 'linear');
3067
+ const isInverse = (type === 'inverse');
3067
3068
  if (isUnifiedAccount) {
3068
- if (isSpot || isSwap) {
3069
+ if (isInverse) {
3070
+ type = 'contract';
3071
+ }
3072
+ else {
3069
3073
  type = 'unified';
3070
3074
  }
3071
3075
  }
3072
3076
  else {
3073
- if (isSwap) {
3077
+ if (isLinear || isInverse) {
3074
3078
  type = 'contract';
3075
3079
  }
3076
3080
  }
@@ -3390,7 +3394,7 @@ export default class bybit extends Exchange {
3390
3394
  feeCurrencyCode = market['inverse'] ? market['base'] : market['settle'];
3391
3395
  }
3392
3396
  fee = {
3393
- 'cost': feeCostString,
3397
+ 'cost': this.parseNumber(feeCostString),
3394
3398
  'currency': feeCurrencyCode,
3395
3399
  };
3396
3400
  }
package/js/src/coinone.js CHANGED
@@ -21,8 +21,7 @@ export default class coinone extends Exchange {
21
21
  'id': 'coinone',
22
22
  'name': 'CoinOne',
23
23
  'countries': ['KR'],
24
- // 'enableRateLimit': false,
25
- 'rateLimit': 667,
24
+ 'rateLimit': 50,
26
25
  'version': 'v2',
27
26
  'pro': false,
28
27
  'has': {
@@ -194,10 +193,10 @@ export default class coinone extends Exchange {
194
193
  },
195
194
  'precisionMode': TICK_SIZE,
196
195
  'exceptions': {
197
- '405': OnMaintenance,
198
196
  '104': OrderNotFound,
197
+ '107': BadRequest,
199
198
  '108': BadSymbol,
200
- '107': BadRequest, // {"errorCode":"107","errorMsg":"Parameter error","result":"error"}
199
+ '405': OnMaintenance,
201
200
  },
202
201
  'commonCurrencies': {
203
202
  'SOC': 'Soda Coin',
@@ -1167,22 +1166,17 @@ export default class coinone extends Exchange {
1167
1166
  }
1168
1167
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
1169
1168
  if (response === undefined) {
1170
- return undefined;
1171
- }
1172
- if ('result' in response) {
1173
- const result = response['result'];
1174
- if (result !== 'success') {
1175
- //
1176
- // { "errorCode": "405", "status": "maintenance", "result": "error"}
1177
- //
1178
- const errorCode = this.safeString(response, 'errorCode');
1179
- const feedback = this.id + ' ' + body;
1180
- this.throwExactlyMatchedException(this.exceptions, errorCode, feedback);
1181
- throw new ExchangeError(feedback);
1182
- }
1169
+ return undefined; // fallback to default error handler
1183
1170
  }
1184
- else {
1185
- throw new ExchangeError(this.id + ' ' + body);
1171
+ //
1172
+ // {"result":"error","error_code":"107","error_msg":"Parameter value is wrong"}
1173
+ // {"result":"error","error_code":"108","error_msg":"Unknown CryptoCurrency"}
1174
+ //
1175
+ const errorCode = this.safeString(response, 'error_code');
1176
+ if (errorCode !== '0') {
1177
+ const feedback = this.id + ' ' + body;
1178
+ this.throwExactlyMatchedException(this.exceptions, errorCode, feedback);
1179
+ throw new ExchangeError(feedback); // unknown message
1186
1180
  }
1187
1181
  return undefined;
1188
1182
  }
package/js/src/delta.d.ts CHANGED
@@ -38,7 +38,7 @@ export default class delta extends Exchange {
38
38
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
39
39
  editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: Num, price?: Num, params?: {}): Promise<Order>;
40
40
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
41
- cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
41
+ cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
42
42
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
43
43
  fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
44
44
  fetchOrdersWithMethod(method: any, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
package/js/src/delta.js CHANGED
@@ -2015,7 +2015,11 @@ export default class delta extends Exchange {
2015
2015
  // "success":true
2016
2016
  // }
2017
2017
  //
2018
- return response;
2018
+ return [
2019
+ this.safeOrder({
2020
+ 'info': response,
2021
+ }),
2022
+ ];
2019
2023
  }
2020
2024
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
2021
2025
  /**
package/js/src/gate.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/gate.js';
2
- import type { Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OpenInterest, Order, Balances, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Leverage, Leverages, Num, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, Dict, LeverageTier, LeverageTiers, int } from './base/types.js';
2
+ import type { Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OpenInterest, Order, Balances, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Leverage, Leverages, Num, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position, Dict, LeverageTier, LeverageTiers, int, CancellationRequest } from './base/types.js';
3
3
  /**
4
4
  * @class gate
5
5
  * @augments Exchange
@@ -180,6 +180,8 @@ export default class gate extends Exchange {
180
180
  fetchOrdersByStatusRequest(status: any, symbol?: Str, since?: Int, limit?: Int, params?: {}): any[];
181
181
  fetchOrdersByStatus(status: any, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
182
182
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
183
+ cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
184
+ cancelOrdersForSymbols(orders: CancellationRequest[], params?: {}): Promise<Order[]>;
183
185
  cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
184
186
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
185
187
  parseTransfer(transfer: Dict, currency?: Currency): TransferEntry;
package/js/src/gate.js CHANGED
@@ -84,6 +84,8 @@ export default class gate extends Exchange {
84
84
  'borrowIsolatedMargin': true,
85
85
  'cancelAllOrders': true,
86
86
  'cancelOrder': true,
87
+ 'cancelOrders': true,
88
+ 'cancelOrdersForSymbols': true,
87
89
  'createMarketBuyOrderWithCost': true,
88
90
  'createMarketOrder': true,
89
91
  'createMarketOrderWithCost': false,
@@ -625,6 +627,7 @@ export default class gate extends Exchange {
625
627
  'createOrder': {
626
628
  'expiration': 86400, // for conditional orders
627
629
  },
630
+ 'createMarketBuyOrderRequiresPrice': true,
628
631
  'networks': {
629
632
  'AVAXC': 'AVAX_C',
630
633
  'BEP20': 'BSC',
@@ -4469,6 +4472,8 @@ export default class gate extends Exchange {
4469
4472
  // "message": "Not enough balance"
4470
4473
  // }
4471
4474
  //
4475
+ // {"user_id":10406147,"id":"id","succeeded":false,"message":"INVALID_PROTOCOL","label":"INVALID_PROTOCOL"}
4476
+ //
4472
4477
  const succeeded = this.safeBool(order, 'succeeded', true);
4473
4478
  if (!succeeded) {
4474
4479
  // cancelOrders response
@@ -4476,6 +4481,7 @@ export default class gate extends Exchange {
4476
4481
  'clientOrderId': this.safeString(order, 'text'),
4477
4482
  'info': order,
4478
4483
  'status': 'rejected',
4484
+ 'id': this.safeString(order, 'id'),
4479
4485
  });
4480
4486
  }
4481
4487
  const put = this.safeValue2(order, 'put', 'initial', {});
@@ -5075,6 +5081,92 @@ export default class gate extends Exchange {
5075
5081
  //
5076
5082
  return this.parseOrder(response, market);
5077
5083
  }
5084
+ async cancelOrders(ids, symbol = undefined, params = {}) {
5085
+ /**
5086
+ * @method
5087
+ * @name gate#cancelOrders
5088
+ * @description cancel multiple orders
5089
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list
5090
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list-2
5091
+ * @param {string[]} ids order ids
5092
+ * @param {string} symbol unified symbol of the market the order was made in
5093
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
5094
+ * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
5095
+ */
5096
+ await this.loadMarkets();
5097
+ let market = undefined;
5098
+ if (symbol !== undefined) {
5099
+ market = this.market(symbol);
5100
+ }
5101
+ let type = undefined;
5102
+ const defaultSettle = (market === undefined) ? 'usdt' : market['settle'];
5103
+ const settle = this.safeStringLower(params, 'settle', defaultSettle);
5104
+ [type, params] = this.handleMarketTypeAndParams('cancelOrders', market, params);
5105
+ const isSpot = (type === 'spot');
5106
+ if (isSpot && (symbol === undefined)) {
5107
+ throw new ArgumentsRequired(this.id + ' cancelOrders requires a symbol argument for spot markets');
5108
+ }
5109
+ if (isSpot) {
5110
+ const ordersRequests = [];
5111
+ for (let i = 0; i < ids.length; i++) {
5112
+ const id = ids[i];
5113
+ const orderItem = {
5114
+ 'id': id,
5115
+ 'symbol': symbol,
5116
+ };
5117
+ ordersRequests.push(orderItem);
5118
+ }
5119
+ return await this.cancelOrdersForSymbols(ordersRequests, params);
5120
+ }
5121
+ const request = {
5122
+ 'settle': settle,
5123
+ };
5124
+ const finalList = [request]; // hacky but needs to be done here
5125
+ for (let i = 0; i < ids.length; i++) {
5126
+ finalList.push(ids[i]);
5127
+ }
5128
+ const response = await this.privateFuturesPostSettleBatchCancelOrders(finalList);
5129
+ return this.parseOrders(response);
5130
+ }
5131
+ async cancelOrdersForSymbols(orders, params = {}) {
5132
+ /**
5133
+ * @method
5134
+ * @name gate#cancelOrdersForSymbols
5135
+ * @description cancel multiple orders for multiple symbols
5136
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-batch-of-orders-with-an-id-list
5137
+ * @param {string[]} ids order ids
5138
+ * @param {string} symbol unified symbol of the market the order was made in
5139
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
5140
+ * @param {string[]} [params.clientOrderIds] client order ids
5141
+ * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
5142
+ */
5143
+ await this.loadMarkets();
5144
+ const ordersRequests = [];
5145
+ for (let i = 0; i < orders.length; i++) {
5146
+ const order = orders[i];
5147
+ const symbol = this.safeString(order, 'symbol');
5148
+ const market = this.market(symbol);
5149
+ if (!market['spot']) {
5150
+ throw new NotSupported(this.id + ' cancelOrdersForSymbols() supports only spot markets');
5151
+ }
5152
+ const id = this.safeString(order, 'id');
5153
+ const orderItem = {
5154
+ 'id': id,
5155
+ 'currency_pair': market['id'],
5156
+ };
5157
+ ordersRequests.push(orderItem);
5158
+ }
5159
+ const response = await this.privateSpotPostCancelBatchOrders(ordersRequests);
5160
+ //
5161
+ // [
5162
+ // {
5163
+ // "currency_pair": "BTC_USDT",
5164
+ // "id": "123456"
5165
+ // }
5166
+ // ]
5167
+ //
5168
+ return this.parseOrders(response);
5169
+ }
5078
5170
  async cancelAllOrders(symbol = undefined, params = {}) {
5079
5171
  /**
5080
5172
  * @method
@@ -6079,7 +6171,22 @@ export default class gate extends Exchange {
6079
6171
  const authentication = api[0]; // public, private
6080
6172
  const type = api[1]; // spot, margin, future, delivery
6081
6173
  let query = this.omit(params, this.extractParams(path));
6082
- if (Array.isArray(params)) {
6174
+ const containsSettle = path.indexOf('settle') > -1;
6175
+ if (containsSettle && path.endsWith('batch_cancel_orders')) { // weird check to prevent $settle in php and converting {settle} to array(settle)
6176
+ // special case where we need to extract the settle from the path
6177
+ // but the body is an array of strings
6178
+ const settle = this.safeDict(params, 0);
6179
+ path = this.implodeParams(path, settle);
6180
+ // remove the first element from params
6181
+ const newParams = [];
6182
+ const anyParams = params;
6183
+ for (let i = 1; i < anyParams.length; i++) {
6184
+ newParams.push(params[i]);
6185
+ }
6186
+ params = newParams;
6187
+ query = newParams;
6188
+ }
6189
+ else if (Array.isArray(params)) {
6083
6190
  // endpoints like createOrders use an array instead of an object
6084
6191
  // so we infer the settle from one of the elements
6085
6192
  // they have to be all the same so relying on the first one is fine
@@ -7552,6 +7659,7 @@ export default class gate extends Exchange {
7552
7659
  // {"label": "INVALID_PARAM_VALUE", "message": "invalid argument: Trigger.rule"}
7553
7660
  // {"label": "INVALID_PARAM_VALUE", "message": "invalid argument: trigger.expiration invalid range"}
7554
7661
  // {"label": "INVALID_ARGUMENT", "detail": "invalid size"}
7662
+ // {"user_id":10406147,"id":"id","succeeded":false,"message":"INVALID_PROTOCOL","label":"INVALID_PROTOCOL"}
7555
7663
  //
7556
7664
  const label = this.safeString(response, 'label');
7557
7665
  if (label !== undefined) {
package/js/src/htx.d.ts CHANGED
@@ -90,8 +90,9 @@ export default class htx extends Exchange {
90
90
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
91
91
  createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
92
92
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
93
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any>;
94
- cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
93
+ cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any[]>;
94
+ parseCancelOrders(orders: any): any[];
95
+ cancelAllOrders(symbol?: Str, params?: {}): Promise<any[]>;
95
96
  cancelAllOrdersAfter(timeout: Int, params?: {}): Promise<any>;
96
97
  parseDepositAddress(depositAddress: any, currency?: Currency): {
97
98
  currency: string;
package/js/src/htx.js CHANGED
@@ -6029,7 +6029,66 @@ export default class htx extends Exchange {
6029
6029
  // "ts": 1604367997451
6030
6030
  // }
6031
6031
  //
6032
- return response;
6032
+ const data = this.safeDict(response, 'data');
6033
+ return this.parseCancelOrders(data);
6034
+ }
6035
+ parseCancelOrders(orders) {
6036
+ //
6037
+ // {
6038
+ // "success": [
6039
+ // "5983466"
6040
+ // ],
6041
+ // "failed": [
6042
+ // {
6043
+ // "err-msg": "Incorrect order state",
6044
+ // "order-state": 7,
6045
+ // "order-id": "",
6046
+ // "err-code": "order-orderstate-error",
6047
+ // "client-order-id": "first"
6048
+ // },
6049
+ // ...
6050
+ // ]
6051
+ // }
6052
+ //
6053
+ // {
6054
+ // "errors": [
6055
+ // {
6056
+ // "order_id": "769206471845261312",
6057
+ // "err_code": 1061,
6058
+ // "err_msg": "This order doesnt exist."
6059
+ // }
6060
+ // ],
6061
+ // "successes": "1258075374411399168,1258075393254871040"
6062
+ // }
6063
+ //
6064
+ const successes = this.safeString(orders, 'successes');
6065
+ let success = undefined;
6066
+ if (successes !== undefined) {
6067
+ success = successes.split(',');
6068
+ }
6069
+ else {
6070
+ success = this.safeList(orders, 'success', []);
6071
+ }
6072
+ const failed = this.safeList2(orders, 'errors', 'failed', []);
6073
+ const result = [];
6074
+ for (let i = 0; i < success.length; i++) {
6075
+ const order = success[i];
6076
+ result.push(this.safeOrder({
6077
+ 'info': order,
6078
+ 'id': order,
6079
+ 'status': 'canceled',
6080
+ }));
6081
+ }
6082
+ for (let i = 0; i < failed.length; i++) {
6083
+ const order = failed[i];
6084
+ result.push(this.safeOrder({
6085
+ 'info': order,
6086
+ 'id': this.safeString2(order, 'order-id', 'order_id'),
6087
+ 'status': 'failed',
6088
+ 'clientOrderId': this.safeString(order, 'client-order-id'),
6089
+ }));
6090
+ }
6091
+ return result;
6033
6092
  }
6034
6093
  async cancelAllOrders(symbol = undefined, params = {}) {
6035
6094
  /**
@@ -6070,6 +6129,22 @@ export default class htx extends Exchange {
6070
6129
  request['symbol'] = market['id'];
6071
6130
  }
6072
6131
  response = await this.spotPrivatePostV1OrderOrdersBatchCancelOpenOrders(this.extend(request, params));
6132
+ //
6133
+ // {
6134
+ // "code": 200,
6135
+ // "data": {
6136
+ // "success-count": 2,
6137
+ // "failed-count": 0,
6138
+ // "next-id": 5454600
6139
+ // }
6140
+ // }
6141
+ //
6142
+ const data = this.safeDict(response, 'data');
6143
+ return [
6144
+ this.safeOrder({
6145
+ 'info': data,
6146
+ }),
6147
+ ];
6073
6148
  }
6074
6149
  else {
6075
6150
  if (symbol === undefined) {
@@ -6149,31 +6224,19 @@ export default class htx extends Exchange {
6149
6224
  else {
6150
6225
  throw new NotSupported(this.id + ' cancelAllOrders() does not support ' + marketType + ' markets');
6151
6226
  }
6227
+ //
6228
+ // {
6229
+ // "status": "ok",
6230
+ // "data": {
6231
+ // "errors": [],
6232
+ // "successes": "1104754904426696704"
6233
+ // },
6234
+ // "ts": "1683435723755"
6235
+ // }
6236
+ //
6237
+ const data = this.safeDict(response, 'data');
6238
+ return this.parseCancelOrders(data);
6152
6239
  }
6153
- //
6154
- // spot
6155
- //
6156
- // {
6157
- // "code": 200,
6158
- // "data": {
6159
- // "success-count": 2,
6160
- // "failed-count": 0,
6161
- // "next-id": 5454600
6162
- // }
6163
- // }
6164
- //
6165
- // future and swap
6166
- //
6167
- // {
6168
- // "status": "ok",
6169
- // "data": {
6170
- // "errors": [],
6171
- // "successes": "1104754904426696704"
6172
- // },
6173
- // "ts": "1683435723755"
6174
- // }
6175
- //
6176
- return response;
6177
6240
  }
6178
6241
  async cancelAllOrdersAfter(timeout, params = {}) {
6179
6242
  /**
@@ -54,8 +54,9 @@ export default class huobijp extends Exchange {
54
54
  createMarketBuyOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
55
55
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
56
56
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
57
- cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any>;
58
- cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
57
+ cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any[]>;
58
+ parseCancelOrders(orders: any): any[];
59
+ cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
59
60
  currencyToPrecision(code: any, fee: any, networkCode?: any): string;
60
61
  safeNetwork(networkId: any): string;
61
62
  parseDepositAddress(depositAddress: any, currency?: Currency): {
package/js/src/huobijp.js CHANGED
@@ -1548,7 +1548,65 @@ export default class huobijp extends Exchange {
1548
1548
  // }
1549
1549
  // }
1550
1550
  //
1551
- return response;
1551
+ return this.parseCancelOrders(response);
1552
+ }
1553
+ parseCancelOrders(orders) {
1554
+ //
1555
+ // {
1556
+ // "success": [
1557
+ // "5983466"
1558
+ // ],
1559
+ // "failed": [
1560
+ // {
1561
+ // "err-msg": "Incorrect order state",
1562
+ // "order-state": 7,
1563
+ // "order-id": "",
1564
+ // "err-code": "order-orderstate-error",
1565
+ // "client-order-id": "first"
1566
+ // },
1567
+ // ...
1568
+ // ]
1569
+ // }
1570
+ //
1571
+ // {
1572
+ // "errors": [
1573
+ // {
1574
+ // "order_id": "769206471845261312",
1575
+ // "err_code": 1061,
1576
+ // "err_msg": "This order doesnt exist."
1577
+ // }
1578
+ // ],
1579
+ // "successes": "1258075374411399168,1258075393254871040"
1580
+ // }
1581
+ //
1582
+ const successes = this.safeString(orders, 'successes');
1583
+ let success = undefined;
1584
+ if (successes !== undefined) {
1585
+ success = successes.split(',');
1586
+ }
1587
+ else {
1588
+ success = this.safeList(orders, 'success', []);
1589
+ }
1590
+ const failed = this.safeList2(orders, 'errors', 'failed', []);
1591
+ const result = [];
1592
+ for (let i = 0; i < success.length; i++) {
1593
+ const order = success[i];
1594
+ result.push(this.safeOrder({
1595
+ 'info': order,
1596
+ 'id': order,
1597
+ 'status': 'canceled',
1598
+ }));
1599
+ }
1600
+ for (let i = 0; i < failed.length; i++) {
1601
+ const order = failed[i];
1602
+ result.push(this.safeOrder({
1603
+ 'info': order,
1604
+ 'id': this.safeString2(order, 'order-id', 'order_id'),
1605
+ 'status': 'failed',
1606
+ 'clientOrderId': this.safeString(order, 'client-order-id'),
1607
+ }));
1608
+ }
1609
+ return result;
1552
1610
  }
1553
1611
  async cancelAllOrders(symbol = undefined, params = {}) {
1554
1612
  /**
@@ -1583,7 +1641,12 @@ export default class huobijp extends Exchange {
1583
1641
  // }
1584
1642
  // }
1585
1643
  //
1586
- return response;
1644
+ const data = this.safeDict(response, 'data', {});
1645
+ return [
1646
+ this.safeOrder({
1647
+ 'info': data,
1648
+ }),
1649
+ ];
1587
1650
  }
1588
1651
  currencyToPrecision(code, fee, networkCode = undefined) {
1589
1652
  return this.decimalToPrecision(fee, 0, this.currencies[code]['precision'], this.precisionMode);
@@ -596,7 +596,7 @@ export default class hyperliquid extends Exchange {
596
596
  'limits': {
597
597
  'leverage': {
598
598
  'min': undefined,
599
- 'max': undefined,
599
+ 'max': this.safeInteger(market, 'maxLeverage'),
600
600
  },
601
601
  'amount': {
602
602
  'min': undefined,
package/js/src/lbank.d.ts CHANGED
@@ -33,8 +33,8 @@ export default class lbank extends Exchange {
33
33
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
34
34
  fetchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
35
35
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
36
- cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
37
- cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
36
+ cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
37
+ cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
38
38
  getNetworkCodeForCurrency(currencyCode: any, params: any): string;
39
39
  fetchDepositAddress(code: string, params?: {}): Promise<any>;
40
40
  fetchDepositAddressDefault(code: string, params?: {}): Promise<{
package/js/src/lbank.js CHANGED
@@ -1489,6 +1489,27 @@ export default class lbank extends Exchange {
1489
1489
  // "status":-1
1490
1490
  // }
1491
1491
  //
1492
+ // cancelOrder
1493
+ //
1494
+ // {
1495
+ // "executedQty":0.0,
1496
+ // "price":0.05,
1497
+ // "origQty":100.0,
1498
+ // "tradeType":"buy",
1499
+ // "status":0
1500
+ // }
1501
+ //
1502
+ // cancelAllOrders
1503
+ //
1504
+ // {
1505
+ // "executedQty":0.00000000000000000000,
1506
+ // "orderId":"293ef71b-3e67-4962-af93-aa06990a045f",
1507
+ // "price":0.05000000000000000000,
1508
+ // "origQty":100.00000000000000000000,
1509
+ // "tradeType":"buy",
1510
+ // "status":0
1511
+ // }
1512
+ //
1492
1513
  const id = this.safeString2(order, 'orderId', 'order_id');
1493
1514
  const clientOrderId = this.safeString2(order, 'clientOrderId', 'custom_id');
1494
1515
  const timestamp = this.safeInteger2(order, 'time', 'create_time');
@@ -1498,7 +1519,7 @@ export default class lbank extends Exchange {
1498
1519
  let timeInForce = undefined;
1499
1520
  let postOnly = false;
1500
1521
  let type = 'limit';
1501
- const rawType = this.safeString(order, 'type'); // buy, sell, buy_market, sell_market, buy_maker,sell_maker,buy_ioc,sell_ioc, buy_fok, sell_fok
1522
+ const rawType = this.safeString2(order, 'type', 'tradeType'); // buy, sell, buy_market, sell_market, buy_maker,sell_maker,buy_ioc,sell_ioc, buy_fok, sell_fok
1502
1523
  const parts = rawType.split('_');
1503
1524
  const side = this.safeString(parts, 0);
1504
1525
  const typePart = this.safeString(parts, 1); // market, maker, ioc, fok or undefined (limit)
@@ -1862,12 +1883,12 @@ export default class lbank extends Exchange {
1862
1883
  // "origQty":100.0,
1863
1884
  // "tradeType":"buy",
1864
1885
  // "status":0
1865
- // },
1886
+ // },
1866
1887
  // "error_code":0,
1867
1888
  // "ts":1648501286196
1868
1889
  // }
1869
- const result = this.safeValue(response, 'data', {});
1870
- return result;
1890
+ const data = this.safeDict(response, 'data', {});
1891
+ return this.parseOrder(data);
1871
1892
  }
1872
1893
  async cancelAllOrders(symbol = undefined, params = {}) {
1873
1894
  /**
@@ -1905,8 +1926,8 @@ export default class lbank extends Exchange {
1905
1926
  // "ts":1648506641469
1906
1927
  // }
1907
1928
  //
1908
- const result = this.safeValue(response, 'data', []);
1909
- return result;
1929
+ const data = this.safeList(response, 'data', []);
1930
+ return this.parseOrders(data);
1910
1931
  }
1911
1932
  getNetworkCodeForCurrency(currencyCode, params) {
1912
1933
  const defaultNetworks = this.safeValue(this.options, 'defaultNetworks');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.55",
3
+ "version": "4.3.57",
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",
@@ -119,9 +119,13 @@
119
119
  "request-tests": "npm run request-js && npm run request-py && npm run request-php && npm run request-cs",
120
120
  "response-ts": "npm run ti-ts -- --responseTests",
121
121
  "response-js": "npm run ti-js -- --responseTests",
122
- "response-py": "npm run ti-py -- --responseTests",
122
+ "response-py-sync": "npm run ti-py -- --responseTests --sync",
123
+ "response-py-async": "npm run ti-py -- --responseTests",
124
+ "response-py": "npm run response-py-sync && npm run response-py-async",
123
125
  "response-cs": "npm run ti-cs -- --responseTests",
124
- "response-php": "npm run ti-php -- --responseTests",
126
+ "response-php-async": "npm run ti-php -- --responseTests",
127
+ "response-php-sync": "npm run ti-php -- --responseTests --sync",
128
+ "response-php": "npm run response-php-sync && npm run response-php-async",
125
129
  "response-tests": "npm run response-js && npm run response-py && npm run response-php && npm run response-cs",
126
130
  "id-tests-js": "npm run ti-js -- --idTests",
127
131
  "id-tests-py": "npm run ti-py -- --idTests",