ccxt 4.3.20 → 4.3.22

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 (46) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/ccxt.js +1 -1
  3. package/dist/cjs/src/base/functions/platform.js +3 -1
  4. package/dist/cjs/src/base/functions.js +1 -0
  5. package/dist/cjs/src/binance.js +10 -1
  6. package/dist/cjs/src/bitmex.js +1 -0
  7. package/dist/cjs/src/coinex.js +142 -179
  8. package/dist/cjs/src/hyperliquid.js +24 -2
  9. package/dist/cjs/src/okx.js +3 -0
  10. package/dist/cjs/src/phemex.js +39 -4
  11. package/dist/cjs/src/pro/kucoinfutures.js +92 -0
  12. package/dist/cjs/src/pro/woo.js +52 -24
  13. package/js/ccxt.d.ts +1 -1
  14. package/js/ccxt.js +1 -1
  15. package/js/src/abstract/binance.d.ts +1 -0
  16. package/js/src/abstract/binancecoinm.d.ts +1 -0
  17. package/js/src/abstract/binanceus.d.ts +1 -0
  18. package/js/src/abstract/binanceusdm.d.ts +1 -0
  19. package/js/src/abstract/okx.d.ts +3 -0
  20. package/js/src/ascendex.d.ts +1 -1
  21. package/js/src/base/Exchange.d.ts +1 -1
  22. package/js/src/base/functions/platform.d.ts +2 -1
  23. package/js/src/base/functions/platform.js +3 -2
  24. package/js/src/binance.d.ts +1 -1
  25. package/js/src/binance.js +10 -1
  26. package/js/src/bingx.d.ts +1 -1
  27. package/js/src/bitget.d.ts +1 -1
  28. package/js/src/bitmex.js +1 -0
  29. package/js/src/coinex.d.ts +1 -1
  30. package/js/src/coinex.js +142 -179
  31. package/js/src/delta.d.ts +1 -1
  32. package/js/src/digifinex.d.ts +1 -1
  33. package/js/src/exmo.d.ts +1 -1
  34. package/js/src/gate.d.ts +1 -1
  35. package/js/src/hitbtc.d.ts +1 -1
  36. package/js/src/hyperliquid.d.ts +1 -1
  37. package/js/src/hyperliquid.js +24 -2
  38. package/js/src/okx.d.ts +1 -1
  39. package/js/src/okx.js +3 -0
  40. package/js/src/phemex.d.ts +1 -1
  41. package/js/src/phemex.js +39 -4
  42. package/js/src/pro/kucoinfutures.d.ts +3 -1
  43. package/js/src/pro/kucoinfutures.js +93 -1
  44. package/js/src/pro/woo.d.ts +2 -1
  45. package/js/src/pro/woo.js +52 -24
  46. package/package.json +1 -1
package/js/src/coinex.js CHANGED
@@ -298,7 +298,7 @@ export default class coinex extends Exchange {
298
298
  'v2': {
299
299
  'public': {
300
300
  'get': {
301
- 'maintain-info': 1,
301
+ 'maintain/info': 1,
302
302
  'ping': 1,
303
303
  'time': 1,
304
304
  'spot/market': 1,
@@ -4239,72 +4239,60 @@ export default class coinex extends Exchange {
4239
4239
  async modifyMarginHelper(symbol, amount, addOrReduce, params = {}) {
4240
4240
  await this.loadMarkets();
4241
4241
  const market = this.market(symbol);
4242
+ const rawAmount = this.amountToPrecision(symbol, amount);
4243
+ let requestAmount = rawAmount;
4244
+ if (addOrReduce === 'reduce') {
4245
+ requestAmount = Precise.stringNeg(rawAmount);
4246
+ }
4242
4247
  const request = {
4243
4248
  'market': market['id'],
4244
- 'amount': this.amountToPrecision(symbol, amount),
4245
- 'type': addOrReduce,
4249
+ 'market_type': 'FUTURES',
4250
+ 'amount': requestAmount,
4246
4251
  };
4247
- const response = await this.v1PerpetualPrivatePostPositionAdjustMargin(this.extend(request, params));
4252
+ const response = await this.v2PrivatePostFuturesAdjustPositionMargin(this.extend(request, params));
4248
4253
  //
4249
4254
  // {
4250
4255
  // "code": 0,
4251
4256
  // "data": {
4252
- // "adl_sort": 1,
4253
- // "adl_sort_val": "0.00004320",
4254
- // "amount": "0.0005",
4255
- // "amount_max": "0.0005",
4256
- // "amount_max_margin": "6.57352000000000000000",
4257
- // "bkr_price": "16294.08000000000000011090",
4258
- // "bkr_price_imply": "0.00000000000000000000",
4259
- // "close_left": "0.0005",
4260
- // "create_time": 1651202571.320778,
4261
- // "deal_all": "19.72000000000000000000",
4262
- // "deal_asset_fee": "0.00000000000000000000",
4263
- // "fee_asset": "",
4264
- // "finish_type": 1,
4265
- // "first_price": "39441.12",
4266
- // "insurance": "0.00000000000000000000",
4267
- // "latest_price": "39441.12",
4257
+ // "adl_level": 1,
4258
+ // "ath_margin_size": "2.034928",
4259
+ // "ath_position_amount": "0.0001",
4260
+ // "avg_entry_price": "61047.84",
4261
+ // "bkr_price": "30698.5600000000000004142",
4262
+ // "close_avbl": "0.0001",
4263
+ // "cml_position_value": "6.104784",
4264
+ // "created_at": 1715488472908,
4268
4265
  // "leverage": "3",
4269
- // "liq_amount": "0.00000000000000000000",
4270
- // "liq_order_price": "0",
4271
- // "liq_order_time": 0,
4272
- // "liq_price": "16491.28560000000000011090",
4273
- // "liq_price_imply": "0.00000000000000000000",
4274
- // "liq_profit": "0.00000000000000000000",
4275
- // "liq_time": 0,
4276
- // "mainten_margin": "0.005",
4277
- // "mainten_margin_amount": "0.09860280000000000000",
4278
- // "maker_fee": "0.00000000000000000000",
4279
- // "margin_amount": "11.57352000000000000000",
4266
+ // "liq_price": "30852.82412060301507579316",
4267
+ // "maintenance_margin_rate": "0.005",
4268
+ // "maintenance_margin_value": "0.03051465",
4269
+ // "margin_avbl": "3.034928",
4270
+ // "margin_mode": "isolated",
4280
4271
  // "market": "BTCUSDT",
4281
- // "open_margin": "0.58687582908396110455",
4282
- // "open_margin_imply": "0.00000000000000000000",
4283
- // "open_price": "39441.12000000000000000000",
4284
- // "open_val": "19.72056000000000000000",
4285
- // "open_val_max": "19.72056000000000000000",
4286
- // "position_id": 65171206,
4287
- // "profit_clearing": "-0.00986028000000000000",
4288
- // "profit_real": "-0.00986028000000000000",
4289
- // "profit_unreal": "0.00",
4290
- // "side": 2,
4291
- // "stop_loss_price": "0.00000000000000000000",
4292
- // "stop_loss_type": 0,
4293
- // "s ys": 0,
4294
- // "take_profit_price": "0.00000000000000000000",
4295
- // "take_profit_type": 0,
4296
- // "taker_fee": "0.00000000000000000000",
4297
- // "total": 3464,
4298
- // "type": 1,
4299
- // "update_time": 1651202638.911212,
4300
- // "user_id": 3620173
4272
+ // "market_type": "FUTURES",
4273
+ // "max_position_value": "6.104784",
4274
+ // "open_interest": "0.0001",
4275
+ // "position_id": 306458800,
4276
+ // "position_margin_rate": "0.49713929272518077625",
4277
+ // "realized_pnl": "-0.003052392",
4278
+ // "settle_price": "61047.84",
4279
+ // "settle_value": "6.104784",
4280
+ // "side": "long",
4281
+ // "stop_loss_price": "0",
4282
+ // "stop_loss_type": "",
4283
+ // "take_profit_price": "0",
4284
+ // "take_profit_type": "",
4285
+ // "unrealized_pnl": "0",
4286
+ // "updated_at": 1715488805563
4301
4287
  // },
4302
- // "message":"OK"
4288
+ // "message": "OK"
4303
4289
  // }
4304
4290
  //
4305
4291
  const data = this.safeDict(response, 'data');
4306
- const status = this.safeString(response, 'message');
4292
+ const status = this.safeStringLower(response, 'message');
4293
+ const type = (addOrReduce === 'reduce') ? 'reduce' : 'add';
4307
4294
  return this.extend(this.parseMarginModification(data, market), {
4295
+ 'type': type,
4308
4296
  'amount': this.parseNumber(amount),
4309
4297
  'status': status,
4310
4298
  });
@@ -4313,86 +4301,66 @@ export default class coinex extends Exchange {
4313
4301
  //
4314
4302
  // addMargin/reduceMargin
4315
4303
  //
4316
- // {
4317
- // "adl_sort": 1,
4318
- // "adl_sort_val": "0.00004320",
4319
- // "amount": "0.0005",
4320
- // "amount_max": "0.0005",
4321
- // "amount_max_margin": "6.57352000000000000000",
4322
- // "bkr_price": "16294.08000000000000011090",
4323
- // "bkr_price_imply": "0.00000000000000000000",
4324
- // "close_left": "0.0005",
4325
- // "create_time": 1651202571.320778,
4326
- // "deal_all": "19.72000000000000000000",
4327
- // "deal_asset_fee": "0.00000000000000000000",
4328
- // "fee_asset": "",
4329
- // "finish_type": 1,
4330
- // "first_price": "39441.12",
4331
- // "insurance": "0.00000000000000000000",
4332
- // "latest_price": "39441.12",
4333
- // "leverage": "3",
4334
- // "liq_amount": "0.00000000000000000000",
4335
- // "liq_order_price": "0",
4336
- // "liq_order_time": 0,
4337
- // "liq_price": "16491.28560000000000011090",
4338
- // "liq_price_imply": "0.00000000000000000000",
4339
- // "liq_profit": "0.00000000000000000000",
4340
- // "liq_time": 0,
4341
- // "mainten_margin": "0.005",
4342
- // "mainten_margin_amount": "0.09860280000000000000",
4343
- // "maker_fee": "0.00000000000000000000",
4344
- // "margin_amount": "11.57352000000000000000",
4345
- // "market": "BTCUSDT",
4346
- // "open_margin": "0.58687582908396110455",
4347
- // "open_margin_imply": "0.00000000000000000000",
4348
- // "open_price": "39441.12000000000000000000",
4349
- // "open_val": "19.72056000000000000000",
4350
- // "open_val_max": "19.72056000000000000000",
4351
- // "position_id": 65171206,
4352
- // "profit_clearing": "-0.00986028000000000000",
4353
- // "profit_real": "-0.00986028000000000000",
4354
- // "profit_unreal": "0.00",
4355
- // "side": 2,
4356
- // "stop_loss_price": "0.00000000000000000000",
4357
- // "stop_loss_type": 0,
4358
- // "sy s": 0,
4359
- // "take_profit_price": "0.00000000000000000000",
4360
- // "take_profit_type": 0,
4361
- // "taker_fee": "0.00000000000000000000",
4362
- // "total": 3464,
4363
- // "type": 1,
4364
- // "update_time": 1651202638.911212,
4365
- // "user_id": 3620173
4366
- // }
4304
+ // {
4305
+ // "adl_level": 1,
4306
+ // "ath_margin_size": "2.034928",
4307
+ // "ath_position_amount": "0.0001",
4308
+ // "avg_entry_price": "61047.84",
4309
+ // "bkr_price": "30698.5600000000000004142",
4310
+ // "close_avbl": "0.0001",
4311
+ // "cml_position_value": "6.104784",
4312
+ // "created_at": 1715488472908,
4313
+ // "leverage": "3",
4314
+ // "liq_price": "30852.82412060301507579316",
4315
+ // "maintenance_margin_rate": "0.005",
4316
+ // "maintenance_margin_value": "0.03051465",
4317
+ // "margin_avbl": "3.034928",
4318
+ // "margin_mode": "isolated",
4319
+ // "market": "BTCUSDT",
4320
+ // "market_type": "FUTURES",
4321
+ // "max_position_value": "6.104784",
4322
+ // "open_interest": "0.0001",
4323
+ // "position_id": 306458800,
4324
+ // "position_margin_rate": "0.49713929272518077625",
4325
+ // "realized_pnl": "-0.003052392",
4326
+ // "settle_price": "61047.84",
4327
+ // "settle_value": "6.104784",
4328
+ // "side": "long",
4329
+ // "stop_loss_price": "0",
4330
+ // "stop_loss_type": "",
4331
+ // "take_profit_price": "0",
4332
+ // "take_profit_type": "",
4333
+ // "unrealized_pnl": "0",
4334
+ // "updated_at": 1715488805563
4335
+ // }
4367
4336
  //
4368
4337
  // fetchMarginAdjustmentHistory
4369
4338
  //
4370
- // {
4371
- // bkr_price: '0',
4372
- // leverage: '3',
4373
- // liq_price: '0',
4374
- // margin_amount: '5.33236666666666666666',
4375
- // margin_change: '3',
4376
- // market: 'XRPUSDT',
4377
- // position_amount: '11',
4378
- // position_id: '297155652',
4379
- // position_type: '2',
4380
- // settle_price: '0.6361',
4381
- // time: '1711050906.382891',
4382
- // type: '1',
4383
- // user_id: '3685860'
4384
- // }
4339
+ // {
4340
+ // "bkr_pirce": "24698.56000000000000005224",
4341
+ // "created_at": 1715489978697,
4342
+ // "leverage": "3",
4343
+ // "liq_price": "24822.67336683417085432386",
4344
+ // "margin_avbl": "3.634928",
4345
+ // "margin_change": "-1.5",
4346
+ // "margin_mode": "isolated",
4347
+ // "market": "BTCUSDT",
4348
+ // "market_type": "FUTURES",
4349
+ // "open_interest": "0.0001",
4350
+ // "position_id": 306458800,
4351
+ // "settle_price": "61047.84"
4352
+ // }
4385
4353
  //
4386
4354
  const marketId = this.safeString(data, 'market');
4387
- const type = this.safeString(data, 'type');
4388
- const timestamp = this.safeIntegerProduct2(data, 'time', 'update_time', 1000);
4355
+ const timestamp = this.safeInteger2(data, 'updated_at', 'created_at');
4356
+ const change = this.safeString(data, 'margin_change');
4389
4357
  return {
4390
4358
  'info': data,
4391
4359
  'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
4392
- 'type': (type === '1') ? 'add' : 'reduce',
4360
+ 'type': undefined,
4393
4361
  'marginMode': 'isolated',
4394
- 'amount': this.safeNumber(data, 'margin_change'),
4395
- 'total': this.safeNumber(data, 'position_amount'),
4362
+ 'amount': this.parseNumber(Precise.stringAbs(change)),
4363
+ 'total': this.safeNumber(data, 'margin_avbl'),
4396
4364
  'code': market['quote'],
4397
4365
  'status': undefined,
4398
4366
  'timestamp': timestamp,
@@ -4404,26 +4372,26 @@ export default class coinex extends Exchange {
4404
4372
  * @method
4405
4373
  * @name coinex#addMargin
4406
4374
  * @description add margin
4407
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
4375
+ * @see https://docs.coinex.com/api/v2/futures/position/http/adjust-position-margin
4408
4376
  * @param {string} symbol unified market symbol
4409
4377
  * @param {float} amount amount of margin to add
4410
4378
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4411
4379
  * @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=add-margin-structure}
4412
4380
  */
4413
- return await this.modifyMarginHelper(symbol, amount, 1, params);
4381
+ return await this.modifyMarginHelper(symbol, amount, 'add', params);
4414
4382
  }
4415
4383
  async reduceMargin(symbol, amount, params = {}) {
4416
4384
  /**
4417
4385
  * @method
4418
4386
  * @name coinex#reduceMargin
4419
4387
  * @description remove margin from a position
4420
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
4388
+ * @see https://docs.coinex.com/api/v2/futures/position/http/adjust-position-margin
4421
4389
  * @param {string} symbol unified market symbol
4422
4390
  * @param {float} amount the amount of margin to remove
4423
4391
  * @param {object} [params] extra parameters specific to the exchange API endpoint
4424
4392
  * @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=reduce-margin-structure}
4425
4393
  */
4426
- return await this.modifyMarginHelper(symbol, amount, 2, params);
4394
+ return await this.modifyMarginHelper(symbol, amount, 'reduce', params);
4427
4395
  }
4428
4396
  async fetchFundingHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4429
4397
  /**
@@ -5947,7 +5915,7 @@ export default class coinex extends Exchange {
5947
5915
  const code = this.safeString(response, 'code');
5948
5916
  const data = this.safeValue(response, 'data');
5949
5917
  const message = this.safeString(response, 'message');
5950
- if ((code !== '0') || ((message !== 'Success') && (message !== 'Succeeded') && (message !== 'Ok') && !data)) {
5918
+ if ((code !== '0') || ((message !== 'Success') && (message !== 'Succeeded') && (message.toLowerCase() !== 'ok') && !data)) {
5951
5919
  const feedback = this.id + ' ' + message;
5952
5920
  this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);
5953
5921
  this.throwExactlyMatchedException(this.exceptions['exact'], code, feedback);
@@ -5960,71 +5928,66 @@ export default class coinex extends Exchange {
5960
5928
  * @method
5961
5929
  * @name coinex#fetchMarginAdjustmentHistory
5962
5930
  * @description fetches the history of margin added or reduced from contract isolated positions
5963
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http046_position_margin_history
5964
- * @param {string} [symbol] unified market symbol
5931
+ * @see https://docs.coinex.com/api/v2/futures/position/http/list-position-margin-history
5932
+ * @param {string} symbol unified market symbol
5965
5933
  * @param {string} [type] not used by coinex fetchMarginAdjustmentHistory
5966
5934
  * @param {int} [since] timestamp in ms of the earliest change to fetch
5967
- * @param {int} [limit] the maximum amount of changes to fetch, default=100, max=100
5935
+ * @param {int} [limit] the maximum amount of changes to fetch, default is 10
5968
5936
  * @param {object} params extra parameters specific to the exchange api endpoint
5969
5937
  * @param {int} [params.until] timestamp in ms of the latest change to fetch
5970
- *
5971
- * EXCHANGE SPECIFIC PARAMETERS
5972
- * @param {int} [params.offset] offset
5938
+ * @param {int} [params.positionId] the id of the position that you want to retrieve margin adjustment history for
5973
5939
  * @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
5974
5940
  */
5975
5941
  await this.loadMarkets();
5976
- const until = this.safeInteger(params, 'until');
5977
- params = this.omit(params, 'until');
5978
- if (limit === undefined) {
5979
- limit = 100;
5942
+ if (symbol === undefined) {
5943
+ throw new ArgumentsRequired(this.id + ' fetchMarginAdjustmentHistory() requires a symbol argument');
5980
5944
  }
5981
- const request = {
5982
- 'market': '',
5983
- 'position_id': 0,
5984
- 'offset': 0,
5985
- 'limit': limit,
5986
- };
5987
- if (symbol !== undefined) {
5988
- const market = this.market(symbol);
5989
- request['market'] = market['id'];
5945
+ const positionId = this.safeInteger2(params, 'positionId', 'position_id');
5946
+ params = this.omit(params, 'positionId');
5947
+ if (positionId === undefined) {
5948
+ throw new ArgumentsRequired(this.id + ' fetchMarginAdjustmentHistory() requires a positionId parameter');
5990
5949
  }
5950
+ const market = this.market(symbol);
5951
+ let request = {
5952
+ 'market': market['id'],
5953
+ 'market_type': 'FUTURES',
5954
+ 'position_id': positionId,
5955
+ };
5956
+ [request, params] = this.handleUntilOption('end_time', request, params);
5991
5957
  if (since !== undefined) {
5992
5958
  request['start_time'] = since;
5993
5959
  }
5994
- if (until !== undefined) {
5995
- request['end_time'] = until;
5960
+ if (limit !== undefined) {
5961
+ request['limit'] = limit;
5996
5962
  }
5997
- const response = await this.v1PerpetualPrivateGetPositionMarginHistory(this.extend(request, params));
5963
+ const response = await this.v2PrivateGetFuturesPositionMarginHistory(this.extend(request, params));
5998
5964
  //
5999
- // {
6000
- // code: '0',
6001
- // data: {
6002
- // limit: '100',
6003
- // offset: '0',
6004
- // records: [
6005
- // {
6006
- // bkr_price: '0',
6007
- // leverage: '3',
6008
- // liq_price: '0',
6009
- // margin_amount: '5.33236666666666666666',
6010
- // margin_change: '3',
6011
- // market: 'XRPUSDT',
6012
- // position_amount: '11',
6013
- // position_id: '297155652',
6014
- // position_type: '2',
6015
- // settle_price: '0.6361',
6016
- // time: '1711050906.382891',
6017
- // type: '1',
6018
- // user_id: '3685860'
6019
- // }
6020
- // ]
6021
- // },
6022
- // message: 'OK'
6023
- // }
5965
+ // {
5966
+ // "code": 0,
5967
+ // "data": [
5968
+ // {
5969
+ // "bkr_pirce": "24698.56000000000000005224",
5970
+ // "created_at": 1715489978697,
5971
+ // "leverage": "3",
5972
+ // "liq_price": "24822.67336683417085432386",
5973
+ // "margin_avbl": "3.634928",
5974
+ // "margin_change": "-1.5",
5975
+ // "margin_mode": "isolated",
5976
+ // "market": "BTCUSDT",
5977
+ // "market_type": "FUTURES",
5978
+ // "open_interest": "0.0001",
5979
+ // "position_id": 306458800,
5980
+ // "settle_price": "61047.84"
5981
+ // },
5982
+ // ],
5983
+ // "message": "OK",
5984
+ // "pagination": {
5985
+ // "has_next": true
5986
+ // }
5987
+ // }
6024
5988
  //
6025
- const data = this.safeDict(response, 'data', {});
6026
- const records = this.safeList(data, 'records', []);
6027
- const modifications = this.parseMarginModifications(records, undefined, 'market', 'swap');
5989
+ const data = this.safeList(response, 'data', []);
5990
+ const modifications = this.parseMarginModifications(data, undefined, 'market', 'swap');
6028
5991
  return this.filterBySymbolSinceLimit(modifications, symbol, since, limit);
6029
5992
  }
6030
5993
  }
package/js/src/delta.d.ts CHANGED
@@ -118,7 +118,7 @@ export default class delta extends Exchange {
118
118
  addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
119
119
  reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
120
120
  modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
121
- parseMarginModification(data: any, market?: Market): MarginModification;
121
+ parseMarginModification(data: Dict, market?: Market): MarginModification;
122
122
  fetchOpenInterest(symbol: string, params?: {}): Promise<import("./base/types.js").OpenInterest>;
123
123
  parseOpenInterest(interest: any, market?: Market): import("./base/types.js").OpenInterest;
124
124
  fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
@@ -136,7 +136,7 @@ export default class digifinex extends Exchange {
136
136
  addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
137
137
  reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
138
138
  modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
139
- parseMarginModification(data: any, market?: Market): MarginModification;
139
+ parseMarginModification(data: Dict, market?: Market): MarginModification;
140
140
  fetchFundingHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").FundingHistory[]>;
141
141
  parseIncome(income: any, market?: Market): {
142
142
  info: any;
package/js/src/exmo.d.ts CHANGED
@@ -7,7 +7,7 @@ import type { Dict, Int, Order, OrderSide, OrderType, Trade, OrderBook, OHLCV, B
7
7
  export default class exmo extends Exchange {
8
8
  describe(): any;
9
9
  modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
10
- parseMarginModification(data: any, market?: Market): MarginModification;
10
+ parseMarginModification(data: Dict, market?: Market): MarginModification;
11
11
  reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
12
12
  addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
13
13
  fetchTradingFees(params?: {}): Promise<TradingFees>;
package/js/src/gate.d.ts CHANGED
@@ -250,7 +250,7 @@ export default class gate extends Exchange {
250
250
  headers: any;
251
251
  };
252
252
  modifyMarginHelper(symbol: string, amount: any, params?: {}): Promise<MarginModification>;
253
- parseMarginModification(data: any, market?: Market): MarginModification;
253
+ parseMarginModification(data: Dict, market?: Market): MarginModification;
254
254
  reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
255
255
  addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
256
256
  fetchOpenInterestHistory(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OpenInterest[]>;
@@ -113,7 +113,7 @@ export default class hitbtc extends Exchange {
113
113
  previousFundingDatetime: any;
114
114
  };
115
115
  modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
116
- parseMarginModification(data: any, market?: Market): MarginModification;
116
+ parseMarginModification(data: Dict, market?: Market): MarginModification;
117
117
  reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
118
118
  addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
119
119
  fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
@@ -75,7 +75,7 @@ export default class hyperliquid extends Exchange {
75
75
  addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
76
76
  reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
77
77
  modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
78
- parseMarginModification(data: any, market?: Market): MarginModification;
78
+ parseMarginModification(data: Dict, market?: Market): MarginModification;
79
79
  transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
80
80
  withdraw(code: string, amount: any, address: any, tag?: any, params?: {}): Promise<any>;
81
81
  formatVaultAddress(address?: Str): string;
@@ -1631,14 +1631,17 @@ export default class hyperliquid extends Exchange {
1631
1631
  * @param {int} [limit] the maximum number of open orders structures to retrieve
1632
1632
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1633
1633
  * @param {string} [params.user] user address, will default to this.walletAddress if not provided
1634
+ * @param {string} [params.method] 'openOrders' or 'frontendOpenOrders' default is 'frontendOpenOrders'
1634
1635
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1635
1636
  */
1636
1637
  let userAddress = undefined;
1637
1638
  [userAddress, params] = this.handlePublicAddress('fetchOpenOrders', params);
1639
+ let method = undefined;
1640
+ [method, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'method', 'frontendOpenOrders');
1638
1641
  await this.loadMarkets();
1639
1642
  const market = this.safeMarket(symbol);
1640
1643
  const request = {
1641
- 'type': 'openOrders',
1644
+ 'type': method,
1642
1645
  'user': userAddress,
1643
1646
  };
1644
1647
  const response = await this.publicPostInfo(this.extend(request, params));
@@ -1816,6 +1819,25 @@ export default class hyperliquid extends Exchange {
1816
1819
  // "oid":6195281425
1817
1820
  // }
1818
1821
  // }
1822
+ // frontendOrder
1823
+ // {
1824
+ // "children": [],
1825
+ // "cloid": null,
1826
+ // "coin": "BLUR",
1827
+ // "isPositionTpsl": false,
1828
+ // "isTrigger": true,
1829
+ // "limitPx": "0.5",
1830
+ // "oid": 8670487141,
1831
+ // "orderType": "Stop Limit",
1832
+ // "origSz": "20.0",
1833
+ // "reduceOnly": false,
1834
+ // "side": "B",
1835
+ // "sz": "20.0",
1836
+ // "tif": null,
1837
+ // "timestamp": 1715523663687,
1838
+ // "triggerCondition": "Price above 0.6",
1839
+ // "triggerPx": "0.6"
1840
+ // }
1819
1841
  //
1820
1842
  let entry = this.safeDictN(order, ['order', 'resting', 'filled']);
1821
1843
  if (entry === undefined) {
@@ -1853,7 +1875,7 @@ export default class hyperliquid extends Exchange {
1853
1875
  'lastTradeTimestamp': undefined,
1854
1876
  'lastUpdateTimestamp': undefined,
1855
1877
  'symbol': symbol,
1856
- 'type': this.safeStringLower(entry, 'orderType'),
1878
+ 'type': this.parseOrderType(this.safeStringLower(entry, 'orderType')),
1857
1879
  'timeInForce': this.safeStringUpper(entry, 'tif'),
1858
1880
  'postOnly': undefined,
1859
1881
  'reduceOnly': this.safeBool(entry, 'reduceOnly'),
package/js/src/okx.d.ts CHANGED
@@ -172,7 +172,7 @@ export default class okx extends Exchange {
172
172
  fetchBorrowRateHistories(codes?: any, since?: Int, limit?: Int, params?: {}): Promise<{}>;
173
173
  fetchBorrowRateHistory(code: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
174
174
  modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
175
- parseMarginModification(data: any, market?: Market): MarginModification;
175
+ parseMarginModification(data: Dict, market?: Market): MarginModification;
176
176
  reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
177
177
  addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
178
178
  fetchMarketLeverageTiers(symbol: string, params?: {}): Promise<any[]>;
package/js/src/okx.js CHANGED
@@ -248,6 +248,9 @@ export default class okx extends Exchange {
248
248
  'sprd/books': 1 / 2,
249
249
  'sprd/ticker': 1,
250
250
  'sprd/public-trades': 1 / 5,
251
+ 'market/sprd-ticker': 2,
252
+ 'market/sprd-candles': 2,
253
+ 'market/sprd-history-candles': 2,
251
254
  'tradingBot/grid/ai-param': 1,
252
255
  'tradingBot/grid/min-investment': 1,
253
256
  'tradingBot/public/rsi-back-testing': 1,
@@ -101,7 +101,7 @@ export default class phemex extends Exchange {
101
101
  };
102
102
  setMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
103
103
  parseMarginStatus(status: any): string;
104
- parseMarginModification(data: any, market?: Market): MarginModification;
104
+ parseMarginModification(data: Dict, market?: Market): MarginModification;
105
105
  setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
106
106
  setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
107
107
  fetchLeverageTiers(symbols?: Strings, params?: {}): Promise<{}>;