ccxt 4.1.29 → 4.1.30

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.
@@ -13647,11 +13647,15 @@ function createFuture() {
13647
13647
  });
13648
13648
  p.resolve = function _resolve() {
13649
13649
  // eslint-disable-next-line prefer-rest-params
13650
- resolve.apply(this, arguments);
13650
+ setTimeout(() => {
13651
+ resolve.apply(this, arguments);
13652
+ });
13651
13653
  };
13652
13654
  p.reject = function _reject() {
13653
13655
  // eslint-disable-next-line prefer-rest-params
13654
- reject.apply(this, arguments);
13656
+ setTimeout(() => {
13657
+ reject.apply(this, arguments);
13658
+ });
13655
13659
  };
13656
13660
  return p;
13657
13661
  }
@@ -38823,7 +38827,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
38823
38827
  'has': {
38824
38828
  'CORS': undefined,
38825
38829
  'spot': true,
38826
- 'margin': undefined,
38830
+ 'margin': true,
38827
38831
  'swap': true,
38828
38832
  'future': true,
38829
38833
  'option': false,
@@ -40290,20 +40294,47 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
40290
40294
  * @name bitget#fetchMarketLeverageTiers
40291
40295
  * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes for a single market
40292
40296
  * @see https://bitgetlimited.github.io/apidoc/en/mix/#get-position-tier
40297
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-tier-data
40298
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-tier-data
40293
40299
  * @param {string} symbol unified market symbol
40294
40300
  * @param {object} [params] extra parameters specific to the bitget api endpoint
40301
+ * @param {string} [params.marginMode] for spot margin 'cross' or 'isolated', default is 'isolated'
40302
+ * @param {string} [params.code] required for cross spot margin
40295
40303
  * @returns {object} a [leverage tiers structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure}
40296
40304
  */
40297
40305
  await this.loadMarkets();
40298
40306
  const request = {};
40299
- let market = undefined;
40300
- market = this.market(symbol);
40301
- if (market['spot']) {
40307
+ const market = this.market(symbol);
40308
+ let type = undefined;
40309
+ [type, params] = this.handleMarketTypeAndParams('fetchMarketLeverageTiers', market, params);
40310
+ let response = undefined;
40311
+ let marginMode = undefined;
40312
+ [marginMode, params] = this.handleMarginModeAndParams('fetchMarketLeverageTiers', params, 'isolated');
40313
+ if ((type === 'swap') || (type === 'future')) {
40314
+ const marketId = market['id'];
40315
+ const parts = marketId.split('_');
40316
+ const productType = this.safeStringUpper(parts, 1);
40317
+ request['symbol'] = marketId;
40318
+ request['productType'] = productType;
40319
+ response = await this.publicMixGetMarketQueryPositionLever(this.extend(request, params));
40320
+ }
40321
+ else if (marginMode === 'isolated') {
40322
+ request['symbol'] = market['info']['symbolName'];
40323
+ response = await this.publicMarginGetIsolatedPublicTierData(this.extend(request, params));
40324
+ }
40325
+ else if (marginMode === 'cross') {
40326
+ const code = this.safeString(params, 'code');
40327
+ this.checkRequiredArgument('fetchMarketLeverageTiers', code, 'code');
40328
+ params = this.omit(params, 'code');
40329
+ const currency = this.currency(code);
40330
+ request['coin'] = currency['code'];
40331
+ response = await this.publicMarginGetCrossPublicTierData(this.extend(request, params));
40332
+ }
40333
+ else {
40302
40334
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' fetchMarketLeverageTiers() symbol does not support market ' + symbol);
40303
40335
  }
40304
- request['symbol'] = market['id'];
40305
- request['productType'] = 'UMCBL';
40306
- const response = await this.publicMixGetMarketQueryPositionLever(this.extend(request, params));
40336
+ //
40337
+ // swap and future
40307
40338
  //
40308
40339
  // {
40309
40340
  // "code":"00000",
@@ -40320,10 +40351,50 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
40320
40351
  // "requestTime":1627292076687
40321
40352
  // }
40322
40353
  //
40323
- const result = this.safeValue(response, 'data');
40354
+ // isolated
40355
+ //
40356
+ // {
40357
+ // "code": "00000",
40358
+ // "msg": "success",
40359
+ // "requestTime": 1698352496622,
40360
+ // "data": [
40361
+ // {
40362
+ // "tier": "1",
40363
+ // "symbol": "BTCUSDT",
40364
+ // "leverage": "10",
40365
+ // "baseCoin": "BTC",
40366
+ // "quoteCoin": "USDT",
40367
+ // "baseMaxBorrowableAmount": "3",
40368
+ // "quoteMaxBorrowableAmount": "30000",
40369
+ // "maintainMarginRate": "0.05",
40370
+ // "initRate": "0.1111"
40371
+ // },
40372
+ // ]
40373
+ // }
40374
+ //
40375
+ // cross
40376
+ //
40377
+ // {
40378
+ // "code": "00000",
40379
+ // "msg": "success",
40380
+ // "requestTime": 1698352997077,
40381
+ // "data": [
40382
+ // {
40383
+ // "tier": "1",
40384
+ // "leverage": "3",
40385
+ // "coin": "BTC",
40386
+ // "maxBorrowableAmount": "26",
40387
+ // "maintainMarginRate": "0.1"
40388
+ // }
40389
+ // ]
40390
+ // }
40391
+ //
40392
+ const result = this.safeValue(response, 'data', []);
40324
40393
  return this.parseMarketLeverageTiers(result, market);
40325
40394
  }
40326
40395
  parseMarketLeverageTiers(info, market = undefined) {
40396
+ //
40397
+ // swap and future
40327
40398
  //
40328
40399
  // [
40329
40400
  // {
@@ -40333,22 +40404,57 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
40333
40404
  // "leverage": 125,
40334
40405
  // "keepMarginRate": "0.004"
40335
40406
  // }
40336
- // ],
40407
+ // ]
40408
+ //
40409
+ // isolated
40410
+ //
40411
+ // [
40412
+ // {
40413
+ // "tier": "1",
40414
+ // "symbol": "BTCUSDT",
40415
+ // "leverage": "10",
40416
+ // "baseCoin": "BTC",
40417
+ // "quoteCoin": "USDT",
40418
+ // "baseMaxBorrowableAmount": "3",
40419
+ // "quoteMaxBorrowableAmount": "30000",
40420
+ // "maintainMarginRate": "0.05",
40421
+ // "initRate": "0.1111"
40422
+ // }
40423
+ // ]
40424
+ //
40425
+ // cross
40426
+ //
40427
+ // [
40428
+ // {
40429
+ // "tier": "1",
40430
+ // "leverage": "3",
40431
+ // "coin": "BTC",
40432
+ // "maxBorrowableAmount": "26",
40433
+ // "maintainMarginRate": "0.1"
40434
+ // }
40435
+ // ]
40337
40436
  //
40338
40437
  const tiers = [];
40438
+ let minNotional = 0;
40339
40439
  for (let i = 0; i < info.length; i++) {
40340
40440
  const item = info[i];
40341
- const minNotional = this.safeNumber(item, 'startUnit');
40342
- const maxNotional = this.safeNumber(item, 'endUnit');
40441
+ const minimumNotional = this.safeNumber(item, 'startUnit');
40442
+ if (minimumNotional !== undefined) {
40443
+ minNotional = minimumNotional;
40444
+ }
40445
+ const maxNotional = this.safeNumberN(item, ['endUnit', 'maxBorrowableAmount', 'baseMaxBorrowableAmount']);
40446
+ const marginCurrency = this.safeString2(item, 'coin', 'baseCoin');
40447
+ const currencyId = (marginCurrency !== undefined) ? marginCurrency : market['base'];
40343
40448
  tiers.push({
40344
- 'tier': this.sum(i, 1),
40345
- 'currency': market['base'],
40449
+ 'tier': this.safeInteger2(item, 'level', 'tier'),
40450
+ 'currency': this.safeCurrencyCode(currencyId),
40346
40451
  'minNotional': minNotional,
40347
40452
  'maxNotional': maxNotional,
40348
- 'maintenanceMarginRate': this.safeNumber(item, 'keepMarginRate'),
40453
+ 'maintenanceMarginRate': this.safeNumber2(item, 'keepMarginRate', 'maintainMarginRate'),
40349
40454
  'maxLeverage': this.safeNumber(item, 'leverage'),
40350
40455
  'info': item,
40351
40456
  });
40457
+ minNotional = maxNotional;
40352
40458
  }
40353
40459
  return tiers;
40354
40460
  }
@@ -42130,12 +42236,16 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42130
42236
  * @description create a list of trade orders (all orders should be of the same symbol)
42131
42237
  * @see https://bitgetlimited.github.io/apidoc/en/spot/#batch-order
42132
42238
  * @see https://bitgetlimited.github.io/apidoc/en/mix/#batch-order
42239
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-batch-order
42240
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#cross-batch-order
42133
42241
  * @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
42242
+ * @param {object} [params] extra parameters specific to the api endpoint
42134
42243
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
42135
42244
  */
42136
42245
  await this.loadMarkets();
42137
42246
  const ordersRequests = [];
42138
42247
  let symbol = undefined;
42248
+ let marginMode = undefined;
42139
42249
  for (let i = 0; i < orders.length; i++) {
42140
42250
  const rawOrder = orders[i];
42141
42251
  const marketId = this.safeString(rawOrder, 'symbol');
@@ -42152,23 +42262,44 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
42152
42262
  const amount = this.safeValue(rawOrder, 'amount');
42153
42263
  const price = this.safeValue(rawOrder, 'price');
42154
42264
  const orderParams = this.safeValue(rawOrder, 'params', {});
42265
+ const marginResult = this.handleMarginModeAndParams('createOrders', params);
42266
+ const currentMarginMode = marginResult[0];
42267
+ if (currentMarginMode !== undefined) {
42268
+ if (marginMode === undefined) {
42269
+ marginMode = currentMarginMode;
42270
+ }
42271
+ else {
42272
+ if (marginMode !== currentMarginMode) {
42273
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest(this.id + ' createOrders() requires all orders to have the same margin mode (isolated or cross)');
42274
+ }
42275
+ }
42276
+ }
42155
42277
  const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
42156
42278
  ordersRequests.push(orderRequest);
42157
42279
  }
42158
42280
  const market = this.market(symbol);
42281
+ const symbolRequest = (marginMode !== undefined) ? (market['info']['symbolName']) : (market['id']);
42159
42282
  const request = {
42160
- 'symbol': market['id'],
42283
+ 'symbol': symbolRequest,
42161
42284
  };
42162
42285
  let response = undefined;
42163
42286
  if (market['spot']) {
42164
42287
  request['orderList'] = ordersRequests;
42165
- response = await this.privateSpotPostTradeBatchOrders(request);
42166
42288
  }
42167
- else {
42289
+ if ((market['swap']) || (market['future'])) {
42168
42290
  request['orderDataList'] = ordersRequests;
42169
42291
  request['marginCoin'] = market['settleId'];
42170
42292
  response = await this.privateMixPostOrderBatchOrders(request);
42171
42293
  }
42294
+ else if (marginMode === 'isolated') {
42295
+ response = await this.privateMarginPostIsolatedOrderBatchPlaceOrder(request);
42296
+ }
42297
+ else if (marginMode === 'cross') {
42298
+ response = await this.privateMarginPostCrossOrderBatchPlaceOrder(request);
42299
+ }
42300
+ else {
42301
+ response = await this.privateSpotPostTradeBatchOrders(request);
42302
+ }
42172
42303
  //
42173
42304
  // {
42174
42305
  // "code": "00000",
@@ -54567,14 +54698,15 @@ class bitopro extends _abstract_bitopro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
54567
54698
  const request = {
54568
54699
  // 'pair': market['id'], // optional
54569
54700
  };
54570
- // privateDeleteOrdersAll or privateDeleteOrdersPair
54571
- let method = this.safeString(this.options, 'privateDeleteOrdersPair', 'privateDeleteOrdersAll');
54701
+ let response = undefined;
54572
54702
  if (symbol !== undefined) {
54573
54703
  const market = this.market(symbol);
54574
54704
  request['pair'] = market['id'];
54575
- method = 'privateDeleteOrdersPair';
54705
+ response = await this.privateDeleteOrdersPair(this.extend(request, params));
54706
+ }
54707
+ else {
54708
+ response = await this.privateDeleteOrdersAll(this.extend(request, params));
54576
54709
  }
54577
- const response = await this[method](this.extend(request, params));
54578
54710
  const result = this.safeValue(response, 'data', {});
54579
54711
  //
54580
54712
  // {
@@ -57980,6 +58112,16 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
57980
58112
  return orderbook;
57981
58113
  }
57982
58114
  parseTicker(ticker, market = undefined) {
58115
+ //
58116
+ // fetchBidsAsks
58117
+ //
58118
+ // {
58119
+ // "symbol": "LTCBTC",
58120
+ // "bidPrice": "4.00000000",
58121
+ // "bidQty": "431.00000000",
58122
+ // "askPrice": "4.00000200",
58123
+ // "askQty": "9.00000000"
58124
+ // }
57983
58125
  //
57984
58126
  // fetchTicker
57985
58127
  //
@@ -58004,10 +58146,10 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
58004
58146
  'datetime': undefined,
58005
58147
  'high': this.safeString(ticker, 'high24hr'),
58006
58148
  'low': this.safeString(ticker, 'low24hr'),
58007
- 'bid': this.safeString(ticker, 'highestBid'),
58008
- 'bidVolume': undefined,
58009
- 'ask': this.safeString(ticker, 'lowestAsk'),
58010
- 'askVolume': undefined,
58149
+ 'bid': this.safeString2(ticker, 'highestBid', 'bidPrice'),
58150
+ 'bidVolume': this.safeString(ticker, 'bidQty'),
58151
+ 'ask': this.safeString2(ticker, 'lowestAsk', 'askPrice'),
58152
+ 'askVolume': this.safeString(ticker, 'askQty'),
58011
58153
  'vwap': undefined,
58012
58154
  'open': undefined,
58013
58155
  'close': last,
@@ -58135,26 +58277,31 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
58135
58277
  * @method
58136
58278
  * @name bitrue#fetchBidsAsks
58137
58279
  * @description fetches the bid and ask price and volume for multiple markets
58280
+ * @see https://github.com/Bitrue-exchange/Spot-official-api-docs#symbol-order-book-ticker
58138
58281
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
58139
58282
  * @param {object} [params] extra parameters specific to the bitrue api endpoint
58140
58283
  * @returns {object} a dictionary of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
58141
58284
  */
58142
58285
  await this.loadMarkets();
58143
- const defaultType = this.safeString2(this.options, 'fetchBidsAsks', 'defaultType', 'spot');
58144
- const type = this.safeString(params, 'type', defaultType);
58145
- const query = this.omit(params, 'type');
58146
- let method = undefined;
58147
- if (type === 'future') {
58148
- method = 'fapiPublicGetTickerBookTicker';
58149
- }
58150
- else if (type === 'delivery') {
58151
- method = 'dapiPublicGetTickerBookTicker';
58152
- }
58153
- else {
58154
- method = 'publicGetTickerBookTicker';
58286
+ symbols = this.marketSymbols(symbols);
58287
+ let market = undefined;
58288
+ const request = {};
58289
+ if (symbols !== undefined) {
58290
+ const first = this.safeString(symbols, 0);
58291
+ market = this.market(first);
58292
+ request['symbol'] = market['id'];
58155
58293
  }
58156
- const response = await this[method](query);
58157
- return this.parseTickers(response, symbols);
58294
+ const response = await this.v1PublicGetTickerBookTicker(this.extend(request, params));
58295
+ // {
58296
+ // "symbol": "LTCBTC",
58297
+ // "bidPrice": "4.00000000",
58298
+ // "bidQty": "431.00000000",
58299
+ // "askPrice": "4.00000200",
58300
+ // "askQty": "9.00000000"
58301
+ // }
58302
+ const data = {};
58303
+ data[market['id']] = response;
58304
+ return this.parseTickers(data, symbols);
58158
58305
  }
58159
58306
  async fetchTickers(symbols = undefined, params = {}) {
58160
58307
  /**
@@ -118884,6 +119031,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
118884
119031
  * @method
118885
119032
  * @name gate#fetchCurrencies
118886
119033
  * @description fetches all available currencies on an exchange
119034
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-currencies-details
118887
119035
  * @param {object} [params] extra parameters specific to the gate api endpoint
118888
119036
  * @returns {object} an associative dictionary of currencies
118889
119037
  */
@@ -118994,6 +119142,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
118994
119142
  * @method
118995
119143
  * @name gate#fetchFundingRate
118996
119144
  * @description fetch the current funding rate
119145
+ * @see https://www.gate.io/docs/developers/apiv4/en/#get-a-single-contract
118997
119146
  * @param {string} symbol unified market symbol
118998
119147
  * @param {object} [params] extra parameters specific to the gate api endpoint
118999
119148
  * @returns {object} a [funding rate structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-structure}
@@ -119056,6 +119205,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
119056
119205
  * @method
119057
119206
  * @name gate#fetchFundingRates
119058
119207
  * @description fetch the funding rate for multiple markets
119208
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
119059
119209
  * @param {string[]|undefined} symbols list of unified market symbols
119060
119210
  * @param {object} [params] extra parameters specific to the gate api endpoint
119061
119211
  * @returns {object} a dictionary of [funding rates structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rates-structure}, indexe by market symbols
@@ -119522,6 +119672,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
119522
119672
  * @method
119523
119673
  * @name gate#fetchFundingHistory
119524
119674
  * @description fetch the history of funding payments paid and received on this account
119675
+ * @see https://www.gate.io/docs/developers/apiv4/en/#query-account-book-2
119676
+ * @see https://www.gate.io/docs/developers/apiv4/en/#query-account-book-3
119525
119677
  * @param {string} symbol unified market symbol
119526
119678
  * @param {int} [since] the earliest time in ms to fetch funding history for
119527
119679
  * @param {int} [limit] the maximum number of funding history structures to retrieve
@@ -120222,6 +120374,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
120222
120374
  * @method
120223
120375
  * @name gate#fetchFundingRateHistory
120224
120376
  * @description fetches historical funding rate prices
120377
+ * @see https://www.gate.io/docs/developers/apiv4/en/#funding-rate-history
120225
120378
  * @param {string} symbol unified symbol of the market to fetch the funding rate history for
120226
120379
  * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
120227
120380
  * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
@@ -120315,6 +120468,10 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
120315
120468
  * @method
120316
120469
  * @name gate#fetchTrades
120317
120470
  * @description get the list of most recent trades for a particular symbol
120471
+ * @see https://www.gate.io/docs/developers/apiv4/en/#retrieve-market-trades
120472
+ * @see https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history
120473
+ * @see https://www.gate.io/docs/developers/apiv4/en/#futures-trading-history-2
120474
+ * @see https://www.gate.io/docs/developers/apiv4/en/#options-trade-history
120318
120475
  * @param {string} symbol unified symbol of the market to fetch trades for
120319
120476
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
120320
120477
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -120418,6 +120575,10 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
120418
120575
  * @method
120419
120576
  * @name gate#fetchOrderTrades
120420
120577
  * @description fetch all the trades made from a single order
120578
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history
120579
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-2
120580
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-3
120581
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-personal-trading-history-4
120421
120582
  * @param {string} id order id
120422
120583
  * @param {string} symbol unified market symbol
120423
120584
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -120735,6 +120896,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
120735
120896
  * @method
120736
120897
  * @name gate#fetchDeposits
120737
120898
  * @description fetch all deposits made to an account
120899
+ * @see https://www.gate.io/docs/developers/apiv4/en/#retrieve-deposit-records
120738
120900
  * @param {string} code unified currency code
120739
120901
  * @param {int} [since] the earliest time in ms to fetch deposits for
120740
120902
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -120772,6 +120934,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
120772
120934
  * @method
120773
120935
  * @name gate#fetchWithdrawals
120774
120936
  * @description fetch all withdrawals made from an account
120937
+ * @see https://www.gate.io/docs/developers/apiv4/en/#retrieve-withdrawal-records
120775
120938
  * @param {string} code unified currency code
120776
120939
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
120777
120940
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -120809,6 +120972,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
120809
120972
  * @method
120810
120973
  * @name gate#withdraw
120811
120974
  * @description make a withdrawal
120975
+ * @see https://www.gate.io/docs/developers/apiv4/en/#withdraw
120812
120976
  * @param {string} code unified currency code
120813
120977
  * @param {float} amount the amount to withdraw
120814
120978
  * @param {string} address the address to withdraw to
@@ -120955,6 +121119,13 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
120955
121119
  * @method
120956
121120
  * @name gate#createOrder
120957
121121
  * @description Create an order on the exchange
121122
+ * @see https://www.gate.io/docs/developers/apiv4/en/#create-an-order
121123
+ * @see https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order
121124
+ * @see https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order
121125
+ * @see https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-2
121126
+ * @see https://www.gate.io/docs/developers/apiv4/en/#create-a-futures-order-2
121127
+ * @see https://www.gate.io/docs/developers/apiv4/en/#create-a-price-triggered-order-3
121128
+ * @see https://www.gate.io/docs/developers/apiv4/en/#create-an-options-order
120958
121129
  * @param {string} symbol Unified CCXT market symbol
120959
121130
  * @param {string} type 'limit' or 'market' *"market" is contract only*
120960
121131
  * @param {string} side 'buy' or 'sell'
@@ -121767,6 +121938,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
121767
121938
  * @method
121768
121939
  * @name gate#fetchOpenOrders
121769
121940
  * @description fetch all unfilled currently open orders
121941
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-open-orders
121770
121942
  * @param {string} symbol unified market symbol
121771
121943
  * @param {int} [since] the earliest time in ms to fetch open orders for
121772
121944
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -121783,6 +121955,13 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
121783
121955
  * @method
121784
121956
  * @name gate#fetchClosedOrders
121785
121957
  * @description fetches information on multiple closed orders made by the user
121958
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-orders
121959
+ * @see https://www.gate.io/docs/developers/apiv4/en/#retrieve-running-auto-order-list
121960
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders
121961
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders
121962
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-futures-orders-2
121963
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-auto-orders-2
121964
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-options-orders
121786
121965
  * @param {string} symbol unified market symbol of the market orders were made in
121787
121966
  * @param {int} [since] the earliest time in ms to fetch orders for
121788
121967
  * @param {int} [limit] the maximum number of orde structures to retrieve
@@ -121991,6 +122170,10 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
121991
122170
  * @method
121992
122171
  * @name gate#cancelOrder
121993
122172
  * @description Cancels an open order
122173
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order
122174
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-2
122175
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-3
122176
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-a-single-order-4
121994
122177
  * @param {string} id Order id
121995
122178
  * @param {string} symbol Unified market symbol
121996
122179
  * @param {object} [params] Parameters specified by the exchange api
@@ -122101,6 +122284,10 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122101
122284
  * @method
122102
122285
  * @name gate#cancelAllOrders
122103
122286
  * @description cancel all open orders
122287
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-in-specified-currency-pair
122288
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched
122289
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-2
122290
+ * @see https://www.gate.io/docs/developers/apiv4/en/#cancel-all-open-orders-matched-3
122104
122291
  * @param {string} symbol unified market symbol, only orders in the market of this symbol are cancelled when symbol is not undefined
122105
122292
  * @param {object} [params] extra parameters specific to the gate api endpoint
122106
122293
  * @returns {object[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
@@ -122232,6 +122419,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122232
122419
  * @method
122233
122420
  * @name gate#setLeverage
122234
122421
  * @description set the level of leverage for a market
122422
+ * @see https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage
122423
+ * @see https://www.gate.io/docs/developers/apiv4/en/#update-position-leverage-2
122235
122424
  * @param {float} leverage the rate of leverage
122236
122425
  * @param {string} symbol unified market symbol
122237
122426
  * @param {object} [params] extra parameters specific to the gate api endpoint
@@ -122596,6 +122785,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122596
122785
  * @method
122597
122786
  * @name gate#fetchLeverageTiers
122598
122787
  * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
122788
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts
122789
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-futures-contracts-2
122599
122790
  * @param {string[]|undefined} symbols list of unified market symbols
122600
122791
  * @param {object} [params] extra parameters specific to the gate api endpoint
122601
122792
  * @returns {object} a dictionary of [leverage tiers structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure}, indexed by market symbols
@@ -122851,12 +123042,12 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122851
123042
  'currency': currency['id'],
122852
123043
  'amount': this.currencyToPrecision(code, amount),
122853
123044
  };
122854
- let method = undefined;
123045
+ let response = undefined;
123046
+ params = this.omit(params, ['marginMode']);
122855
123047
  if (symbol === undefined) {
122856
- method = 'privateMarginPostCrossRepayments';
123048
+ response = await this.privateMarginPostCrossRepayments(this.extend(request, params));
122857
123049
  }
122858
123050
  else {
122859
- method = 'privateMarginPostLoansLoanIdRepayment';
122860
123051
  const market = this.market(symbol);
122861
123052
  request['currency_pair'] = market['id'];
122862
123053
  request['mode'] = 'partial';
@@ -122865,9 +123056,9 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122865
123056
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' repayMargin() requires loan_id param for isolated margin');
122866
123057
  }
122867
123058
  request['loan_id'] = loanId;
123059
+ params = this.omit(params, ['loan_id', 'id']);
123060
+ response = await this.privateMarginPostLoansLoanIdRepayment(this.extend(request, params));
122868
123061
  }
122869
- params = this.omit(params, ['marginMode', 'loan_id', 'id']);
122870
- let response = await this[method](this.extend(request, params));
122871
123062
  //
122872
123063
  // Cross
122873
123064
  //
@@ -122934,9 +123125,9 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122934
123125
  'currency': currency['id'],
122935
123126
  'amount': this.currencyToPrecision(code, amount),
122936
123127
  };
122937
- let method = undefined;
123128
+ let response = undefined;
122938
123129
  if (symbol === undefined) {
122939
- method = 'privateMarginPostCrossLoans';
123130
+ response = await this.privateMarginPostCrossLoans(this.extend(request, params));
122940
123131
  }
122941
123132
  else {
122942
123133
  const market = this.market(symbol);
@@ -122946,10 +123137,9 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
122946
123137
  // as it is the smallest tick size currently offered by gateio
122947
123138
  request['rate'] = this.safeString(params, 'rate', '0.0001');
122948
123139
  request['auto_renew'] = true;
122949
- method = 'privateMarginPostLoans';
123140
+ params = this.omit(params, ['rate']);
123141
+ response = await this.privateMarginPostLoans(this.extend(request, params));
122950
123142
  }
122951
- params = this.omit(params, ['marginMode', 'rate']);
122952
- const response = await this[method](this.extend(request, params));
122953
123143
  //
122954
123144
  // Cross
122955
123145
  //
@@ -123173,6 +123363,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
123173
123363
  * @method
123174
123364
  * @name gate#reduceMargin
123175
123365
  * @description remove margin from a position
123366
+ * @see https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
123367
+ * @see https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2
123176
123368
  * @param {string} symbol unified market symbol
123177
123369
  * @param {float} amount the amount of margin to remove
123178
123370
  * @param {object} [params] extra parameters specific to the exmo api endpoint
@@ -123185,6 +123377,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
123185
123377
  * @method
123186
123378
  * @name gate#addMargin
123187
123379
  * @description add margin
123380
+ * @see https://www.gate.io/docs/developers/apiv4/en/#update-position-margin
123381
+ * @see https://www.gate.io/docs/developers/apiv4/en/#update-position-margin-2
123188
123382
  * @param {string} symbol unified market symbol
123189
123383
  * @param {float} amount amount of margin to add
123190
123384
  * @param {object} [params] extra parameters specific to the exmo api endpoint
@@ -123722,6 +123916,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
123722
123916
  * @method
123723
123917
  * @name gate#fetchUnderlyingAssets
123724
123918
  * @description fetches the market ids of underlying assets for a specific contract market type
123919
+ * @see https://www.gate.io/docs/developers/apiv4/en/#list-all-underlyings
123725
123920
  * @param {object} [params] exchange specific params
123726
123921
  * @param {string} [params.type] the contract market type, 'option', 'swap' or 'future', the default is 'option'
123727
123922
  * @returns {object[]} a list of [underlying assets]{@link https://github.com/ccxt/ccxt/wiki/Manual#underlying-assets-structure}
@@ -131901,7 +132096,6 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
131901
132096
  'GET': 'Themis',
131902
132097
  'GTC': 'Game.com',
131903
132098
  'HIT': 'HitChain',
131904
- 'HOT': 'Hydro Protocol',
131905
132099
  // https://github.com/ccxt/ccxt/issues/7399
131906
132100
  // https://coinmarketcap.com/currencies/pnetwork/
131907
132101
  // https://coinmarketcap.com/currencies/penta/markets/
@@ -139515,7 +139709,6 @@ class huobijp extends _abstract_huobijp_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
139515
139709
  'GET': 'Themis',
139516
139710
  'GTC': 'Game.com',
139517
139711
  'HIT': 'HitChain',
139518
- 'HOT': 'Hydro Protocol',
139519
139712
  // https://github.com/ccxt/ccxt/issues/7399
139520
139713
  // https://coinmarketcap.com/currencies/pnetwork/
139521
139714
  // https://coinmarketcap.com/currencies/penta/markets/
@@ -149352,7 +149545,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
149352
149545
  result.push({
149353
149546
  'info': item,
149354
149547
  'symbol': symbol,
149355
- 'fundingRate': this.safeNumber(item, 'fundingRate'),
149548
+ 'fundingRate': this.safeNumber(item, 'relativeFundingRate'),
149356
149549
  'timestamp': this.parse8601(datetime),
149357
149550
  'datetime': datetime,
149358
149551
  });
@@ -189224,6 +189417,9 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
189224
189417
  [type, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
189225
189418
  let method = 'privateGetSpotWallets';
189226
189419
  const request = {};
189420
+ if ((type !== 'spot') && (type !== 'swap')) {
189421
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' does not support ' + type + ' markets, only spot and swap');
189422
+ }
189227
189423
  if (type === 'swap') {
189228
189424
  const code = this.safeString(params, 'code');
189229
189425
  let settle = undefined;
@@ -224338,6 +224534,7 @@ class huobi extends _huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
224338
224534
  // id: 1583473663565,
224339
224535
  // rep: 'market.btcusdt.mbp.150',
224340
224536
  // status: 'ok',
224537
+ // ts: 1698359289261,
224341
224538
  // data: {
224342
224539
  // seqNum: 104999417756,
224343
224540
  // bids: [
@@ -224366,6 +224563,9 @@ class huobi extends _huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
224366
224563
  const sequence = this.safeInteger(tick, 'seqNum');
224367
224564
  const nonce = this.safeInteger(data, 'seqNum');
224368
224565
  snapshot['nonce'] = nonce;
224566
+ const timestamp = this.safeInteger(message, 'ts');
224567
+ snapshot['timestamp'] = timestamp;
224568
+ snapshot['datetime'] = this.iso8601(timestamp);
224369
224569
  const snapshotLimit = this.safeInteger(subscription, 'limit');
224370
224570
  const snapshotOrderBook = this.orderBook(snapshot, snapshotLimit);
224371
224571
  client.resolve(snapshotOrderBook, id);
@@ -279395,7 +279595,7 @@ SOFTWARE.
279395
279595
 
279396
279596
  //-----------------------------------------------------------------------------
279397
279597
  // this is updated by vss.js when building
279398
- const version = '4.1.29';
279598
+ const version = '4.1.30';
279399
279599
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
279400
279600
  //-----------------------------------------------------------------------------
279401
279601