ccxt 4.1.80 → 4.1.82

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 +4 -4
  2. package/dist/ccxt.browser.js +445 -175
  3. package/dist/ccxt.browser.min.js +5 -5
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/bybit.js +4 -2
  6. package/dist/cjs/src/coinex.js +191 -71
  7. package/dist/cjs/src/digifinex.js +42 -8
  8. package/dist/cjs/src/htx.js +12 -10
  9. package/dist/cjs/src/lbank.js +70 -38
  10. package/dist/cjs/src/okx.js +52 -7
  11. package/dist/cjs/src/pro/binance.js +1 -1
  12. package/dist/cjs/src/pro/bingx.js +1 -1
  13. package/dist/cjs/src/pro/bitget.js +1 -1
  14. package/dist/cjs/src/pro/bybit.js +1 -1
  15. package/dist/cjs/src/pro/cex.js +1 -1
  16. package/dist/cjs/src/pro/coinbasepro.js +1 -1
  17. package/dist/cjs/src/pro/cryptocom.js +1 -1
  18. package/dist/cjs/src/pro/gate.js +1 -1
  19. package/dist/cjs/src/pro/kucoin.js +1 -1
  20. package/dist/cjs/src/pro/kucoinfutures.js +1 -1
  21. package/dist/cjs/src/pro/okx.js +1 -1
  22. package/dist/cjs/src/whitebit.js +62 -27
  23. package/js/ccxt.d.ts +1 -1
  24. package/js/ccxt.js +1 -1
  25. package/js/src/abstract/bybit.d.ts +1 -0
  26. package/js/src/bybit.js +4 -2
  27. package/js/src/coinex.js +191 -71
  28. package/js/src/digifinex.d.ts +1 -0
  29. package/js/src/digifinex.js +42 -8
  30. package/js/src/htx.js +12 -10
  31. package/js/src/lbank.d.ts +1 -0
  32. package/js/src/lbank.js +71 -39
  33. package/js/src/okx.js +52 -7
  34. package/js/src/pro/binance.js +1 -1
  35. package/js/src/pro/bingx.js +1 -1
  36. package/js/src/pro/bitget.js +1 -1
  37. package/js/src/pro/bybit.js +1 -1
  38. package/js/src/pro/cex.js +1 -1
  39. package/js/src/pro/coinbasepro.js +1 -1
  40. package/js/src/pro/cryptocom.js +1 -1
  41. package/js/src/pro/gate.js +1 -1
  42. package/js/src/pro/kucoin.js +1 -1
  43. package/js/src/pro/kucoinfutures.js +1 -1
  44. package/js/src/pro/okx.js +1 -1
  45. package/js/src/whitebit.js +62 -27
  46. package/package.json +1 -1
@@ -76612,6 +76612,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
76612
76612
  'v5/position/confirm-pending-mmr': 5,
76613
76613
  // account
76614
76614
  'v5/account/upgrade-to-uta': 5,
76615
+ 'v5/account/quick-repayment': 5,
76615
76616
  'v5/account/set-margin-mode': 5,
76616
76617
  'v5/account/set-hedging-mode': 5,
76617
76618
  'v5/account/mmp-modify': 5,
@@ -78259,8 +78260,9 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
78259
78260
  */
78260
78261
  await this.loadMarkets();
78261
78262
  let market = undefined;
78262
- const parsedSymbols = [];
78263
+ let parsedSymbols = undefined;
78263
78264
  if (symbols !== undefined) {
78265
+ parsedSymbols = [];
78264
78266
  const marketTypeInfo = this.handleMarketTypeAndParams('fetchTickers', undefined, params);
78265
78267
  const defaultType = marketTypeInfo[0]; // don't omit here
78266
78268
  // we can't use marketSymbols here due to the conflicing ids between markets
@@ -79199,7 +79201,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
79199
79201
  * @see https://bybit-exchange.github.io/docs/v5/account/wallet-balance
79200
79202
  * @param {object} [params] extra parameters specific to the exchange API endpoint
79201
79203
  * @param {string} [params.type] wallet type, ['spot', 'swap', 'fund']
79202
- * @returns {object} a [balance structure]{@link https://docs.ccxt.com/en/latest/manual.html?#balance-structure}
79204
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
79203
79205
  */
79204
79206
  await this.loadMarkets();
79205
79207
  const request = {};
@@ -91977,6 +91979,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
91977
91979
  * @method
91978
91980
  * @name coinex#fetchMarkets
91979
91981
  * @description retrieves data on all markets for coinex
91982
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market002_all_market_info
91983
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http006_market_list
91980
91984
  * @param {object} [params] extra parameters specific to the exchange API endpoint
91981
91985
  * @returns {object[]} an array of objects representing market data
91982
91986
  */
@@ -92248,6 +92252,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
92248
92252
  * @method
92249
92253
  * @name coinex#fetchTicker
92250
92254
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
92255
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market007_single_market_ticker
92256
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http008_market_ticker
92251
92257
  * @param {string} symbol unified symbol of the market to fetch the ticker for
92252
92258
  * @param {object} [params] extra parameters specific to the exchange API endpoint
92253
92259
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -92257,8 +92263,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
92257
92263
  const request = {
92258
92264
  'market': market['id'],
92259
92265
  };
92260
- const method = market['swap'] ? 'perpetualPublicGetMarketTicker' : 'publicGetMarketTicker';
92261
- const response = await this[method](this.extend(request, params));
92266
+ let response = undefined;
92267
+ if (market['swap']) {
92268
+ response = await this.perpetualPublicGetMarketTicker(this.extend(request, params));
92269
+ }
92270
+ else {
92271
+ response = await this.publicGetMarketTicker(this.extend(request, params));
92272
+ }
92262
92273
  //
92263
92274
  // Spot
92264
92275
  //
@@ -92334,8 +92345,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
92334
92345
  market = this.market(symbol);
92335
92346
  }
92336
92347
  const [marketType, query] = this.handleMarketTypeAndParams('fetchTickers', market, params);
92337
- const method = (marketType === 'swap') ? 'perpetualPublicGetMarketTickerAll' : 'publicGetMarketTickerAll';
92338
- const response = await this[method](query);
92348
+ let response = undefined;
92349
+ if (marketType === 'swap') {
92350
+ response = await this.perpetualPublicGetMarketTickerAll(query);
92351
+ }
92352
+ else {
92353
+ response = await this.publicGetMarketTickerAll();
92354
+ }
92339
92355
  //
92340
92356
  // Spot
92341
92357
  //
@@ -92417,6 +92433,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
92417
92433
  * @method
92418
92434
  * @name coinex#fetchTime
92419
92435
  * @description fetches the current integer timestamp in milliseconds from the exchange server
92436
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http005_system_time
92420
92437
  * @param {object} [params] extra parameters specific to the exchange API endpoint
92421
92438
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
92422
92439
  */
@@ -92435,6 +92452,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
92435
92452
  * @method
92436
92453
  * @name coinex#fetchOrderBook
92437
92454
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
92455
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market004_market_depth
92456
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http010_market_depth
92438
92457
  * @param {string} symbol unified symbol of the market to fetch the order book for
92439
92458
  * @param {int} [limit] the maximum amount of order book entries to return
92440
92459
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -92450,8 +92469,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
92450
92469
  'merge': '0',
92451
92470
  'limit': limit.toString(),
92452
92471
  };
92453
- const method = market['swap'] ? 'perpetualPublicGetMarketDepth' : 'publicGetMarketDepth';
92454
- const response = await this[method](this.extend(request, params));
92472
+ let response = undefined;
92473
+ if (market['swap']) {
92474
+ response = await this.perpetualPublicGetMarketDepth(this.extend(request, params));
92475
+ }
92476
+ else {
92477
+ response = await this.publicGetMarketDepth(this.extend(request, params));
92478
+ }
92455
92479
  //
92456
92480
  // Spot
92457
92481
  //
@@ -92631,6 +92655,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
92631
92655
  * @method
92632
92656
  * @name coinex#fetchTrades
92633
92657
  * @description get the list of most recent trades for a particular symbol
92658
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market005_market_deals
92659
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http011_market_deals
92634
92660
  * @param {string} symbol unified symbol of the market to fetch trades for
92635
92661
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
92636
92662
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -92646,8 +92672,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
92646
92672
  if (limit !== undefined) {
92647
92673
  request['limit'] = limit;
92648
92674
  }
92649
- const method = market['swap'] ? 'perpetualPublicGetMarketDeals' : 'publicGetMarketDeals';
92650
- const response = await this[method](this.extend(request, params));
92675
+ let response = undefined;
92676
+ if (market['swap']) {
92677
+ response = await this.perpetualPublicGetMarketDeals(this.extend(request, params));
92678
+ }
92679
+ else {
92680
+ response = await this.publicGetMarketDeals(this.extend(request, params));
92681
+ }
92651
92682
  //
92652
92683
  // Spot and Swap
92653
92684
  //
@@ -92673,6 +92704,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
92673
92704
  * @method
92674
92705
  * @name coinex#fetchTradingFee
92675
92706
  * @description fetch the trading fees for a market
92707
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market003_single_market_info
92676
92708
  * @param {string} symbol unified market symbol
92677
92709
  * @param {object} [params] extra parameters specific to the exchange API endpoint
92678
92710
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -92707,6 +92739,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
92707
92739
  * @method
92708
92740
  * @name coinex#fetchTradingFees
92709
92741
  * @description fetch the trading fees for multiple markets
92742
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market002_all_market_info
92710
92743
  * @param {object} [params] extra parameters specific to the exchange API endpoint
92711
92744
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
92712
92745
  */
@@ -92779,6 +92812,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
92779
92812
  * @method
92780
92813
  * @name coinex#fetchOHLCV
92781
92814
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
92815
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market006_market_kline
92816
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http012_market_kline
92782
92817
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
92783
92818
  * @param {string} timeframe the length of time each candle represents
92784
92819
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -92795,8 +92830,13 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
92795
92830
  if (limit !== undefined) {
92796
92831
  request['limit'] = limit;
92797
92832
  }
92798
- const method = market['swap'] ? 'perpetualPublicGetMarketKline' : 'publicGetMarketKline';
92799
- const response = await this[method](this.extend(request, params));
92833
+ let response = undefined;
92834
+ if (market['swap']) {
92835
+ response = await this.perpetualPublicGetMarketKline(this.extend(request, params));
92836
+ }
92837
+ else {
92838
+ response = await this.publicGetMarketKline(this.extend(request, params));
92839
+ }
92800
92840
  //
92801
92841
  // Spot
92802
92842
  //
@@ -94044,6 +94084,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94044
94084
  * @method
94045
94085
  * @name coinex#cancelOrder
94046
94086
  * @description cancels an open order
94087
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade018_cancle_stop_pending_order
94088
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade015_cancel_order
94089
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http023_cancel_stop_order
94090
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http021_cancel_order
94047
94091
  * @param {string} id order id
94048
94092
  * @param {string} symbol unified symbol of the market the order was made in
94049
94093
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -94061,15 +94105,6 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94061
94105
  };
94062
94106
  const idRequest = swap ? 'order_id' : 'id';
94063
94107
  request[idRequest] = id;
94064
- let method = swap ? 'perpetualPrivatePostOrderCancel' : 'privateDeleteOrderPending';
94065
- if (stop) {
94066
- if (swap) {
94067
- method = 'perpetualPrivatePostOrderCancelStop';
94068
- }
94069
- else {
94070
- method = 'privateDeleteOrderStopPendingId';
94071
- }
94072
- }
94073
94108
  const accountId = this.safeInteger(params, 'account_id');
94074
94109
  const defaultType = this.safeString(this.options, 'defaultType');
94075
94110
  if (defaultType === 'margin') {
@@ -94079,7 +94114,23 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94079
94114
  request['account_id'] = accountId;
94080
94115
  }
94081
94116
  const query = this.omit(params, ['stop', 'account_id']);
94082
- const response = await this[method](this.extend(request, query));
94117
+ let response = undefined;
94118
+ if (stop) {
94119
+ if (swap) {
94120
+ response = await this.perpetualPrivatePostOrderCancelStop(this.extend(request, query));
94121
+ }
94122
+ else {
94123
+ response = await this.privateDeleteOrderStopPendingId(this.extend(request, query));
94124
+ }
94125
+ }
94126
+ else {
94127
+ if (swap) {
94128
+ response = await this.perpetualPrivatePostOrderCancel(this.extend(request, query));
94129
+ }
94130
+ else {
94131
+ response = await this.privateDeleteOrderPending(this.extend(request, query));
94132
+ }
94133
+ }
94083
94134
  //
94084
94135
  // Spot and Margin
94085
94136
  //
@@ -94194,6 +94245,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94194
94245
  * @method
94195
94246
  * @name coinex#cancelAllOrders
94196
94247
  * @description cancel all open orders in a market
94248
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade018_cancle_stop_pending_order
94249
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade015_cancel_order
94250
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http024_cancel_stop_all
94251
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http022_cancel_all
94197
94252
  * @param {string} symbol unified market symbol of the market to cancel orders in
94198
94253
  * @param {object} [params] extra parameters specific to the exchange API endpoint
94199
94254
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -94212,22 +94267,25 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94212
94267
  };
94213
94268
  const swap = market['swap'];
94214
94269
  const stop = this.safeValue(params, 'stop');
94215
- let method;
94270
+ params = this.omit(params, ['stop', 'account_id']);
94271
+ let response = undefined;
94216
94272
  if (swap) {
94217
- method = 'perpetualPrivatePostOrderCancelAll';
94218
94273
  if (stop) {
94219
- method = 'perpetualPrivatePostOrderCancelStopAll';
94274
+ response = await this.perpetualPrivatePostOrderCancelStopAll(this.extend(request, params));
94275
+ }
94276
+ else {
94277
+ response = await this.perpetualPrivatePostOrderCancelAll(this.extend(request, params));
94220
94278
  }
94221
94279
  }
94222
94280
  else {
94223
- method = 'privateDeleteOrderPending';
94281
+ request['account_id'] = accountId;
94224
94282
  if (stop) {
94225
- method = 'privateDeleteOrderStopPending';
94283
+ response = await this.privateDeleteOrderStopPending(this.extend(request, params));
94284
+ }
94285
+ else {
94286
+ response = await this.privateDeleteOrderPending(this.extend(request, params));
94226
94287
  }
94227
- request['account_id'] = accountId;
94228
94288
  }
94229
- params = this.omit(params, ['stop', 'account_id']);
94230
- const response = await this[method](this.extend(request, params));
94231
94289
  //
94232
94290
  // Spot and Margin
94233
94291
  //
@@ -94244,6 +94302,9 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94244
94302
  * @method
94245
94303
  * @name coinex#fetchOrder
94246
94304
  * @description fetches information on an order made by the user
94305
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http028_stop_status
94306
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http026_order_status
94307
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade007_order_status
94247
94308
  * @param {string} symbol unified symbol of the market the order was made in
94248
94309
  * @param {object} [params] extra parameters specific to the exchange API endpoint
94249
94310
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -94255,6 +94316,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94255
94316
  const market = this.market(symbol);
94256
94317
  const swap = market['swap'];
94257
94318
  const stop = this.safeValue(params, 'stop');
94319
+ params = this.omit(params, 'stop');
94258
94320
  const request = {
94259
94321
  'market': market['id'],
94260
94322
  // 'id': id, // SPOT
@@ -94262,15 +94324,18 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94262
94324
  };
94263
94325
  const idRequest = swap ? 'order_id' : 'id';
94264
94326
  request[idRequest] = id;
94265
- let method = undefined;
94327
+ let response = undefined;
94266
94328
  if (swap) {
94267
- method = stop ? 'perpetualPrivateGetOrderStopStatus' : 'perpetualPrivateGetOrderStatus';
94329
+ if (stop) {
94330
+ response = await this.perpetualPrivateGetOrderStopStatus(this.extend(request, params));
94331
+ }
94332
+ else {
94333
+ response = await this.perpetualPrivateGetOrderStatus(this.extend(request, params));
94334
+ }
94268
94335
  }
94269
94336
  else {
94270
- method = 'privateGetOrderStatus';
94337
+ response = await this.privateGetOrderStatus(this.extend(request, params));
94271
94338
  }
94272
- params = this.omit(params, 'stop');
94273
- const response = await this[method](this.extend(request, params));
94274
94339
  //
94275
94340
  // Spot
94276
94341
  //
@@ -94390,15 +94455,20 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94390
94455
  request['market'] = market['id'];
94391
94456
  }
94392
94457
  const [marketType, query] = this.handleMarketTypeAndParams('fetchOrdersByStatus', market, params);
94393
- let method = undefined;
94458
+ const accountId = this.safeInteger(params, 'account_id');
94459
+ const defaultType = this.safeString(this.options, 'defaultType');
94460
+ if (defaultType === 'margin') {
94461
+ if (accountId === undefined) {
94462
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchOpenOrders() and fetchClosedOrders() require an account_id parameter for margin orders');
94463
+ }
94464
+ request['account_id'] = accountId;
94465
+ }
94466
+ params = this.omit(query, 'account_id');
94467
+ let response = undefined;
94394
94468
  if (marketType === 'swap') {
94395
94469
  if (symbol === undefined) {
94396
94470
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchOrdersByStatus() requires a symbol argument for swap markets');
94397
94471
  }
94398
- method = 'perpetualPrivateGetOrder' + this.capitalize(status);
94399
- if (stop) {
94400
- method = 'perpetualPrivateGetOrderStopPending';
94401
- }
94402
94472
  if (side !== undefined) {
94403
94473
  request['side'] = side;
94404
94474
  }
@@ -94406,24 +94476,37 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94406
94476
  request['side'] = 0;
94407
94477
  }
94408
94478
  request['offset'] = 0;
94409
- }
94410
- else {
94411
- method = 'privateGetOrder' + this.capitalize(status);
94412
94479
  if (stop) {
94413
- method = 'privateGetOrderStop' + this.capitalize(status);
94480
+ response = await this.perpetualPrivateGetOrderStopPending(this.extend(request, params));
94481
+ }
94482
+ else {
94483
+ if (status === 'finished') {
94484
+ response = await this.perpetualPrivateGetOrderFinished(this.extend(request, params));
94485
+ }
94486
+ else if (status === 'pending') {
94487
+ response = await this.perpetualPrivateGetOrderPending(this.extend(request, params));
94488
+ }
94414
94489
  }
94415
- request['page'] = 1;
94416
94490
  }
94417
- const accountId = this.safeInteger(params, 'account_id');
94418
- const defaultType = this.safeString(this.options, 'defaultType');
94419
- if (defaultType === 'margin') {
94420
- if (accountId === undefined) {
94421
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchOpenOrders() and fetchClosedOrders() require an account_id parameter for margin orders');
94491
+ else {
94492
+ request['page'] = 1;
94493
+ if (status === 'finished') {
94494
+ if (stop) {
94495
+ response = await this.privateGetOrderStopFinished(this.extend(request, params));
94496
+ }
94497
+ else {
94498
+ response = await this.privateGetOrderFinished(this.extend(request, params));
94499
+ }
94500
+ }
94501
+ else if (status === 'pending') {
94502
+ if (stop) {
94503
+ response = await this.privateGetOrderStopPending(this.extend(request, params));
94504
+ }
94505
+ else {
94506
+ response = await this.privateGetOrderPending(this.extend(request, params));
94507
+ }
94422
94508
  }
94423
- request['account_id'] = accountId;
94424
94509
  }
94425
- params = this.omit(query, 'account_id');
94426
- const response = await this[method](this.extend(request, params));
94427
94510
  //
94428
94511
  // Spot and Margin
94429
94512
  //
@@ -94584,6 +94667,10 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94584
94667
  * @method
94585
94668
  * @name coinex#fetchOpenOrders
94586
94669
  * @description fetch all unfilled currently open orders
94670
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http027_query_pending_stop
94671
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http025_query_pending
94672
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade013_stop_pending_order
94673
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade011_pending_order
94587
94674
  * @param {string} symbol unified market symbol
94588
94675
  * @param {int} [since] the earliest time in ms to fetch open orders for
94589
94676
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -94597,6 +94684,9 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94597
94684
  * @method
94598
94685
  * @name coinex#fetchClosedOrders
94599
94686
  * @description fetches information on multiple closed orders made by the user
94687
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http029_query_finished
94688
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade010_stop_finished_order
94689
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade012_finished_order
94600
94690
  * @param {string} symbol unified market symbol of the market orders were made in
94601
94691
  * @param {int} [since] the earliest time in ms to fetch orders for
94602
94692
  * @param {int} [limit] the maximum number of orde structures to retrieve
@@ -94610,6 +94700,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94610
94700
  * @method
94611
94701
  * @name coinex#createDepositAddress
94612
94702
  * @description create a currency deposit address
94703
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account019_update_deposit_address
94613
94704
  * @param {string} code unified currency code of the currency for the deposit address
94614
94705
  * @param {object} [params] extra parameters specific to the exchange API endpoint
94615
94706
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -94642,6 +94733,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94642
94733
  * @method
94643
94734
  * @name coinex#fetchDepositAddress
94644
94735
  * @description fetch the deposit address for a currency associated with this account
94736
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account020_query_deposit_address
94645
94737
  * @param {string} code unified currency code
94646
94738
  * @param {object} [params] extra parameters specific to the exchange API endpoint
94647
94739
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -94736,6 +94828,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94736
94828
  * @method
94737
94829
  * @name coinex#fetchMyTrades
94738
94830
  * @description fetch all trades made by the user
94831
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http013_user_deals
94832
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot003_trade014_user_deals
94739
94833
  * @param {string} symbol unified market symbol
94740
94834
  * @param {int} [since] the earliest time in ms to fetch trades for
94741
94835
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -94765,9 +94859,17 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94765
94859
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument for non-spot markets');
94766
94860
  }
94767
94861
  const swap = (type === 'swap');
94768
- let method = undefined;
94862
+ const accountId = this.safeInteger(params, 'account_id');
94863
+ const defaultType = this.safeString(this.options, 'defaultType');
94864
+ if (defaultType === 'margin') {
94865
+ if (accountId === undefined) {
94866
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchMyTrades() requires an account_id parameter for margin trades');
94867
+ }
94868
+ request['account_id'] = accountId;
94869
+ params = this.omit(params, 'account_id');
94870
+ }
94871
+ let response = undefined;
94769
94872
  if (swap) {
94770
- method = 'perpetualPublicGetMarketUserDeals';
94771
94873
  const side = this.safeInteger(params, 'side');
94772
94874
  if (side === undefined) {
94773
94875
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchMyTrades() requires a side parameter for swap markets');
@@ -94777,21 +94879,12 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94777
94879
  }
94778
94880
  request['side'] = side;
94779
94881
  params = this.omit(params, 'side');
94882
+ response = await this.perpetualPublicGetMarketUserDeals(this.extend(request, params));
94780
94883
  }
94781
94884
  else {
94782
- method = 'privateGetOrderUserDeals';
94783
94885
  request['page'] = 1;
94886
+ response = await this.privateGetOrderUserDeals(this.extend(request, params));
94784
94887
  }
94785
- const accountId = this.safeInteger(params, 'account_id');
94786
- const defaultType = this.safeString(this.options, 'defaultType');
94787
- if (defaultType === 'margin') {
94788
- if (accountId === undefined) {
94789
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' fetchMyTrades() requires an account_id parameter for margin trades');
94790
- }
94791
- request['account_id'] = accountId;
94792
- params = this.omit(params, 'account_id');
94793
- }
94794
- const response = await this[method](this.extend(request, params));
94795
94888
  //
94796
94889
  // Spot and Margin
94797
94890
  //
@@ -94874,6 +94967,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94874
94967
  * @method
94875
94968
  * @name coinex#fetchPositions
94876
94969
  * @description fetch all open positions
94970
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033_pending_position
94877
94971
  * @param {string[]|undefined} symbols list of unified market symbols
94878
94972
  * @param {object} [params] extra parameters specific to the exchange API endpoint
94879
94973
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -94969,6 +95063,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
94969
95063
  * @method
94970
95064
  * @name coinex#fetchPosition
94971
95065
  * @description fetch data on a single open contract trade position
95066
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033_pending_position
94972
95067
  * @param {string} symbol unified market symbol of the market the position is held in, default is undefined
94973
95068
  * @param {object} [params] extra parameters specific to the exchange API endpoint
94974
95069
  * @returns {object} a [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
@@ -95151,6 +95246,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
95151
95246
  * @method
95152
95247
  * @name coinex#setMarginMode
95153
95248
  * @description set margin mode to 'cross' or 'isolated'
95249
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http014_adjust_leverage
95154
95250
  * @param {string} marginMode 'cross' or 'isolated'
95155
95251
  * @param {string} symbol unified market symbol
95156
95252
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -95240,6 +95336,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
95240
95336
  * @method
95241
95337
  * @name coinex#fetchLeverageTiers
95242
95338
  * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
95339
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http007_market_limit
95243
95340
  * @param {string[]|undefined} symbols list of unified market symbols
95244
95341
  * @param {object} [params] extra parameters specific to the exchange API endpoint
95245
95342
  * @returns {object} a dictionary of [leverage tiers structures]{@link https://docs.ccxt.com/#/?id=leverage-tiers-structure}, indexed by market symbols
@@ -95404,6 +95501,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
95404
95501
  * @method
95405
95502
  * @name coinex#addMargin
95406
95503
  * @description add margin
95504
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
95407
95505
  * @param {string} symbol unified market symbol
95408
95506
  * @param {float} amount amount of margin to add
95409
95507
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -95416,6 +95514,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
95416
95514
  * @method
95417
95515
  * @name coinex#reduceMargin
95418
95516
  * @description remove margin from a position
95517
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
95419
95518
  * @param {string} symbol unified market symbol
95420
95519
  * @param {float} amount the amount of margin to remove
95421
95520
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -95428,6 +95527,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
95428
95527
  * @method
95429
95528
  * @name coinex#fetchFundingHistory
95430
95529
  * @description fetch the history of funding payments paid and received on this account
95530
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http034_funding_position
95431
95531
  * @param {string} symbol unified market symbol
95432
95532
  * @param {int} [since] the earliest time in ms to fetch funding history for
95433
95533
  * @param {int} [limit] the maximum number of funding history structures to retrieve
@@ -95503,6 +95603,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
95503
95603
  * @method
95504
95604
  * @name coinex#fetchFundingRate
95505
95605
  * @description fetch the current funding rate
95606
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http008_market_ticker
95506
95607
  * @param {string} symbol unified market symbol
95507
95608
  * @param {object} [params] extra parameters specific to the exchange API endpoint
95508
95609
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
@@ -95611,6 +95712,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
95611
95712
  * @method
95612
95713
  * @name coinex#fetchFundingRates
95613
95714
  * @description fetch the current funding rates
95715
+ * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http009_market_ticker_all
95614
95716
  * @param {string[]} symbols unified market symbols
95615
95717
  * @param {object} [params] extra parameters specific to the exchange API endpoint
95616
95718
  * @returns {object[]} an array of [funding rate structures]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
@@ -95937,6 +96039,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
95937
96039
  * @method
95938
96040
  * @name coinex#transfer
95939
96041
  * @description transfer currency internally between wallets on the same account
96042
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account014_balance_contract_transfer
96043
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account013_margin_transfer
95940
96044
  * @param {string} code unified currency code
95941
96045
  * @param {float} amount amount to transfer
95942
96046
  * @param {string} fromAccount account to transfer from
@@ -95951,12 +96055,14 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
95951
96055
  'amount': amountToPrecision,
95952
96056
  'coin_type': currency['id'],
95953
96057
  };
95954
- let method = 'privatePostContractBalanceTransfer';
96058
+ let response = undefined;
95955
96059
  if ((fromAccount === 'spot') && (toAccount === 'swap')) {
95956
96060
  request['transfer_side'] = 'in'; // 'in' spot to swap, 'out' swap to spot
96061
+ response = await this.privatePostContractBalanceTransfer(this.extend(request, params));
95957
96062
  }
95958
96063
  else if ((fromAccount === 'swap') && (toAccount === 'spot')) {
95959
96064
  request['transfer_side'] = 'out'; // 'in' spot to swap, 'out' swap to spot
96065
+ response = await this.privatePostContractBalanceTransfer(this.extend(request, params));
95960
96066
  }
95961
96067
  else {
95962
96068
  const accountsById = this.safeValue(this.options, 'accountsById', {});
@@ -95966,9 +96072,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
95966
96072
  // spot is 0, use fetchBalance() to find the margin account id
95967
96073
  request['from_account'] = parseInt(fromId);
95968
96074
  request['to_account'] = parseInt(toId);
95969
- method = 'privatePostMarginTransfer';
96075
+ response = await this.privatePostMarginTransfer(this.extend(request, params));
95970
96076
  }
95971
- const response = await this[method](this.extend(request, params));
95972
96077
  //
95973
96078
  // {"code": 0, "data": null, "message": "Success"}
95974
96079
  //
@@ -96050,6 +96155,8 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
96050
96155
  * @method
96051
96156
  * @name coinex#fetchTransfers
96052
96157
  * @description fetch a history of internal transfers made on an account
96158
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account025_margin_transfer_history
96159
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account024_contract_transfer_history
96053
96160
  * @param {string} code unified currency code of the currency transferred
96054
96161
  * @param {int} [since] the earliest time in ms to fetch transfers for
96055
96162
  * @param {int} [limit] the maximum number of transfers structures to retrieve
@@ -96060,7 +96167,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
96060
96167
  let currency = undefined;
96061
96168
  const request = {
96062
96169
  'page': 1,
96063
- 'limit': limit,
96170
+ // 'limit': limit,
96064
96171
  // 'asset': 'USDT',
96065
96172
  // 'start_time': since,
96066
96173
  // 'end_time': 1515806440,
@@ -96071,16 +96178,27 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
96071
96178
  request['page'] = page;
96072
96179
  }
96073
96180
  if (code !== undefined) {
96074
- currency = this.safeCurrencyCode(code);
96181
+ currency = this.currency(code);
96075
96182
  request['asset'] = currency['id'];
96076
96183
  }
96077
96184
  if (since !== undefined) {
96078
96185
  request['start_time'] = since;
96079
96186
  }
96187
+ if (limit !== undefined) {
96188
+ request['limit'] = limit;
96189
+ }
96190
+ else {
96191
+ request['limit'] = 100;
96192
+ }
96080
96193
  params = this.omit(params, 'page');
96081
96194
  const defaultType = this.safeString(this.options, 'defaultType');
96082
- const method = (defaultType === 'margin') ? 'privateGetMarginTransferHistory' : 'privateGetContractTransferHistory';
96083
- const response = await this[method](this.extend(request, params));
96195
+ let response = undefined;
96196
+ if (defaultType === 'margin') {
96197
+ response = await this.privateGetMarginTransferHistory(this.extend(request, params));
96198
+ }
96199
+ else {
96200
+ response = await this.privateGetContractTransferHistory(this.extend(request, params));
96201
+ }
96084
96202
  //
96085
96203
  // Swap
96086
96204
  //
@@ -96134,6 +96252,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
96134
96252
  * @method
96135
96253
  * @name coinex#fetchWithdrawals
96136
96254
  * @description fetch all withdrawals made from an account
96255
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account026_withdraw_list
96137
96256
  * @param {string} code unified currency code
96138
96257
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
96139
96258
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -96200,6 +96319,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
96200
96319
  * @method
96201
96320
  * @name coinex#fetchDeposits
96202
96321
  * @description fetch all deposits made to an account
96322
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account009_deposit_list
96203
96323
  * @param {string} code unified currency code
96204
96324
  * @param {int} [since] the earliest time in ms to fetch deposits for
96205
96325
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -96299,6 +96419,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
96299
96419
  * @method
96300
96420
  * @name coinex#fetchIsolatedBorrowRate
96301
96421
  * @description fetch the rate of interest to borrow a currency for margin trading
96422
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account007_margin_account_settings
96302
96423
  * @param {string} symbol unified symbol of the market to fetch the borrow rate for
96303
96424
  * @param {object} [params] extra parameters specific to the exchange API endpoint
96304
96425
  * @returns {object} an [isolated borrow rate structure]{@link https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure}
@@ -96337,6 +96458,7 @@ class coinex extends _abstract_coinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
96337
96458
  * @method
96338
96459
  * @name coinex#fetchIsolatedBorrowRates
96339
96460
  * @description fetch the borrow interest rates of all currencies
96461
+ * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account007_margin_account_settings
96340
96462
  * @param {object} [params] extra parameters specific to the exchange API endpoint
96341
96463
  * @returns {object} a list of [isolated borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#isolated-borrow-rate-structure}
96342
96464
  */
@@ -115088,6 +115210,9 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
115088
115210
  'addMargin': true,
115089
115211
  'cancelOrder': true,
115090
115212
  'cancelOrders': true,
115213
+ 'createMarketBuyOrderWithCost': true,
115214
+ 'createMarketOrderWithCost': false,
115215
+ 'createMarketSellOrderWithCost': false,
115091
115216
  'createOrder': true,
115092
115217
  'createOrders': true,
115093
115218
  'createPostOnlyOrder': true,
@@ -116620,6 +116745,7 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
116620
116745
  * @param {bool} [params.postOnly] true or false
116621
116746
  * @param {bool} [params.reduceOnly] true or false
116622
116747
  * @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
116748
+ * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
116623
116749
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
116624
116750
  */
116625
116751
  await this.loadMarkets();
@@ -116837,16 +116963,27 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
116837
116963
  request['type'] = side + suffix;
116838
116964
  // limit orders require the amount in the base currency, market orders require the amount in the quote currency
116839
116965
  let quantity = undefined;
116840
- const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
116841
- if (createMarketBuyOrderRequiresPrice && isMarketOrder && (side === 'buy')) {
116842
- if (price === undefined) {
116843
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires a price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option to false and pass in the cost to spend into the amount parameter');
116966
+ let createMarketBuyOrderRequiresPrice = true;
116967
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrderRequest', 'createMarketBuyOrderRequiresPrice', true);
116968
+ if (isMarketOrder && (side === 'buy')) {
116969
+ const cost = this.safeNumber(params, 'cost');
116970
+ params = this.omit(params, 'cost');
116971
+ if (cost !== undefined) {
116972
+ quantity = this.costToPrecision(symbol, cost);
116973
+ }
116974
+ else if (createMarketBuyOrderRequiresPrice) {
116975
+ if (price === undefined) {
116976
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires a price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
116977
+ }
116978
+ else {
116979
+ const amountString = this.numberToString(amount);
116980
+ const priceString = this.numberToString(price);
116981
+ const costRequest = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString));
116982
+ quantity = this.costToPrecision(symbol, costRequest);
116983
+ }
116844
116984
  }
116845
116985
  else {
116846
- const amountString = this.numberToString(amount);
116847
- const priceString = this.numberToString(price);
116848
- const cost = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString));
116849
- quantity = this.priceToPrecision(symbol, cost);
116986
+ quantity = this.costToPrecision(symbol, amount);
116850
116987
  }
116851
116988
  }
116852
116989
  else {
@@ -116865,6 +117002,25 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
116865
117002
  params = this.omit(params, ['postOnly']);
116866
117003
  return this.extend(request, params);
116867
117004
  }
117005
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
117006
+ /**
117007
+ * @method
117008
+ * @name digifinex#createMarketBuyOrderWithCost
117009
+ * @description create a market buy order by providing the symbol and cost
117010
+ * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#create-new-order
117011
+ * @param {string} symbol unified symbol of the market to create an order in
117012
+ * @param {float} cost how much you want to trade in units of the quote currency
117013
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
117014
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
117015
+ */
117016
+ await this.loadMarkets();
117017
+ const market = this.market(symbol);
117018
+ if (!market['spot']) {
117019
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
117020
+ }
117021
+ params['createMarketBuyOrderRequiresPrice'] = false;
117022
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
117023
+ }
116868
117024
  async cancelOrder(id, symbol = undefined, params = {}) {
116869
117025
  /**
116870
117026
  * @method
@@ -139758,14 +139914,16 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
139758
139914
  // "margin_mode": "cross",
139759
139915
  // "margin_account": "USDT",
139760
139916
  // "margin_asset": "USDT",
139761
- // "margin_balance": 200.000000000000000000,
139762
- // "margin_static": 200.000000000000000000,
139763
- // "margin_position": 0,
139764
- // "margin_frozen": 0,
139765
- // "profit_real": 0E-18,
139766
- // "profit_unreal": 0,
139767
- // "withdraw_available": 2E+2,
139768
- // "risk_rate": null,
139917
+ // "margin_balance": 49.874186030200000000,
139918
+ // "money_in": 50,
139919
+ // "money_out": 0,
139920
+ // "margin_static": 49.872786030200000000,
139921
+ // "margin_position": 6.180000000000000000,
139922
+ // "margin_frozen": 6.000000000000000000,
139923
+ // "profit_unreal": 0.001400000000000000,
139924
+ // "withdraw_available": 37.6927860302,
139925
+ // "risk_rate": 271.984050521072796934,
139926
+ // "new_risk_rate": 0.001858676950514399,
139769
139927
  // "contract_detail": [
139770
139928
  // {
139771
139929
  // "symbol": "MANA",
@@ -139872,8 +140030,8 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
139872
140030
  }
139873
140031
  else {
139874
140032
  const account = this.account();
139875
- account['free'] = this.safeString(first, 'margin_balance', 'margin_available');
139876
- account['used'] = this.safeString(first, 'margin_frozen');
140033
+ account['free'] = this.safeString(first, 'withdraw_available');
140034
+ account['total'] = this.safeString(first, 'margin_balance');
139877
140035
  const currencyId = this.safeString2(first, 'margin_asset', 'symbol');
139878
140036
  const code = this.safeCurrencyCode(currencyId);
139879
140037
  result[code] = account;
@@ -166502,6 +166660,9 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
166502
166660
  'addMargin': false,
166503
166661
  'cancelAllOrders': true,
166504
166662
  'cancelOrder': true,
166663
+ 'createMarketBuyOrderWithCost': true,
166664
+ 'createMarketOrderWithCost': false,
166665
+ 'createMarketSellOrderWithCost': false,
166505
166666
  'createOrder': true,
166506
166667
  'createReduceOnlyOrder': false,
166507
166668
  'createStopLimitOrder': false,
@@ -166572,10 +166733,10 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
166572
166733
  'contract': 'https://lbkperp.lbank.com',
166573
166734
  },
166574
166735
  'api2': 'https://api.lbkex.com',
166575
- 'www': 'https://www.lbank.info',
166576
- 'doc': 'https://www.lbank.info/en-US/docs/index.html',
166577
- 'fees': 'https://lbankinfo.zendesk.com/hc/en-gb/articles/360012072873-Trading-Fees',
166578
- 'referral': 'https://www.lbank.info/invitevip?icode=7QCY',
166736
+ 'www': 'https://www.lbank.com',
166737
+ 'doc': 'https://www.lbank.com/en-US/docs/index.html',
166738
+ 'fees': 'https://support.lbank.site/hc/en-gb/articles/900000535703-Trading-Fees-From-14-00-on-April-7-2020-UTC-8-',
166739
+ 'referral': 'https://www.lbank.com/login/?icode=7QCY',
166579
166740
  },
166580
166741
  'api': {
166581
166742
  'spot': {
@@ -166763,7 +166924,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
166763
166924
  * @method
166764
166925
  * @name lbank2#fetchTime
166765
166926
  * @description fetches the current integer timestamp in milliseconds from the exchange server
166766
- * @see https://www.lbank.info/en-US/docs/index.html#get-timestamp
166927
+ * @see https://www.lbank.com/en-US/docs/index.html#get-timestamp
166767
166928
  * @see https://www.lbank.com/en-US/docs/contract.html#get-the-current-time
166768
166929
  * @param {object} [params] extra parameters specific to the exchange API endpoint
166769
166930
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
@@ -167058,7 +167219,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
167058
167219
  * @method
167059
167220
  * @name lbank2#fetchTicker
167060
167221
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
167061
- * @see https://www.lbank.info/en-US/docs/index.html#query-current-market-data-new
167222
+ * @see https://www.lbank.com/en-US/docs/index.html#query-current-market-data-new
167062
167223
  * @param {string} symbol unified symbol of the market to fetch the ticker for
167063
167224
  * @param {object} [params] extra parameters specific to the exchange API endpoint
167064
167225
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -167103,7 +167264,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
167103
167264
  * @method
167104
167265
  * @name lbank2#fetchTickers
167105
167266
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
167106
- * @see https://www.lbank.info/en-US/docs/index.html#query-current-market-data-new
167267
+ * @see https://www.lbank.com/en-US/docs/index.html#query-current-market-data-new
167107
167268
  * @see https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list
167108
167269
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
167109
167270
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -167183,7 +167344,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
167183
167344
  * @method
167184
167345
  * @name lbank2#fetchOrderBook
167185
167346
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
167186
- * @see https://www.lbank.info/en-US/docs/index.html#query-market-depth
167347
+ * @see https://www.lbank.com/en-US/docs/index.html#query-market-depth
167187
167348
  * @see https://www.lbank.com/en-US/docs/contract.html#get-handicap
167188
167349
  * @param {string} symbol unified symbol of the market to fetch the order book for
167189
167350
  * @param {int} [limit] the maximum amount of order book entries to return
@@ -167372,8 +167533,8 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
167372
167533
  * @method
167373
167534
  * @name lbank2#fetchTrades
167374
167535
  * @description get the list of most recent trades for a particular symbol
167375
- * @see https://www.lbank.info/en-US/docs/index.html#query-historical-transactions
167376
- * @see https://www.lbank.info/en-US/docs/index.html#recent-transactions-list
167536
+ * @see https://www.lbank.com/en-US/docs/index.html#query-historical-transactions
167537
+ * @see https://www.lbank.com/en-US/docs/index.html#recent-transactions-list
167377
167538
  * @param {string} symbol unified symbol of the market to fetch trades for
167378
167539
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
167379
167540
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -167445,7 +167606,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
167445
167606
  * @method
167446
167607
  * @name lbank2#fetchOHLCV
167447
167608
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
167448
- * @see https://www.lbank.info/en-US/docs/index.html#query-k-bar-data
167609
+ * @see https://www.lbank.com/en-US/docs/index.html#query-k-bar-data
167449
167610
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
167450
167611
  * @param {string} timeframe the length of time each candle represents
167451
167612
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -167630,9 +167791,9 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
167630
167791
  * @method
167631
167792
  * @name lbank2#fetchBalance
167632
167793
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
167633
- * @see https://www.lbank.info/en-US/docs/index.html#asset-information
167634
- * @see https://www.lbank.info/en-US/docs/index.html#account-information
167635
- * @see https://www.lbank.info/en-US/docs/index.html#get-all-coins-information
167794
+ * @see https://www.lbank.com/en-US/docs/index.html#asset-information
167795
+ * @see https://www.lbank.com/en-US/docs/index.html#account-information
167796
+ * @see https://www.lbank.com/en-US/docs/index.html#get-all-coins-information
167636
167797
  * @param {object} [params] extra parameters specific to the exchange API endpoint
167637
167798
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
167638
167799
  */
@@ -167697,7 +167858,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
167697
167858
  * @method
167698
167859
  * @name lbank2#fetchTradingFee
167699
167860
  * @description fetch the trading fees for a market
167700
- * @see https://www.lbank.info/en-US/docs/index.html#transaction-fee-rate-query
167861
+ * @see https://www.lbank.com/en-US/docs/index.html#transaction-fee-rate-query
167701
167862
  * @param {string} symbol unified market symbol
167702
167863
  * @param {object} [params] extra parameters specific to the exchange API endpoint
167703
167864
  * @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -167711,7 +167872,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
167711
167872
  * @method
167712
167873
  * @name lbank2#fetchTradingFees
167713
167874
  * @description fetch the trading fees for multiple markets
167714
- * @see https://www.lbank.info/en-US/docs/index.html#transaction-fee-rate-query
167875
+ * @see https://www.lbank.com/en-US/docs/index.html#transaction-fee-rate-query
167715
167876
  * @param {object} [params] extra parameters specific to the exchange API endpoint
167716
167877
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
167717
167878
  */
@@ -167727,13 +167888,33 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
167727
167888
  }
167728
167889
  return result;
167729
167890
  }
167891
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
167892
+ /**
167893
+ * @method
167894
+ * @name lbank#createMarketBuyOrderWithCost
167895
+ * @description create a market buy order by providing the symbol and cost
167896
+ * @see https://www.lbank.com/en-US/docs/index.html#place-order
167897
+ * @see https://www.lbank.com/en-US/docs/index.html#place-an-order
167898
+ * @param {string} symbol unified symbol of the market to create an order in
167899
+ * @param {float} cost how much you want to trade in units of the quote currency
167900
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
167901
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
167902
+ */
167903
+ await this.loadMarkets();
167904
+ const market = this.market(symbol);
167905
+ if (!market['spot']) {
167906
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
167907
+ }
167908
+ params['createMarketBuyOrderRequiresPrice'] = false;
167909
+ return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
167910
+ }
167730
167911
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
167731
167912
  /**
167732
167913
  * @method
167733
167914
  * @name lbank2#createOrder
167734
167915
  * @description create a trade order
167735
- * @see https://www.lbank.info/en-US/docs/index.html#place-order
167736
- * @see https://www.lbank.info/en-US/docs/index.html#place-an-order
167916
+ * @see https://www.lbank.com/en-US/docs/index.html#place-order
167917
+ * @see https://www.lbank.com/en-US/docs/index.html#place-an-order
167737
167918
  * @param {string} symbol unified symbol of the market to create an order in
167738
167919
  * @param {string} type 'market' or 'limit'
167739
167920
  * @param {string} side 'buy' or 'sell'
@@ -167778,21 +167959,30 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
167778
167959
  }
167779
167960
  else if (side === 'buy') {
167780
167961
  request['type'] = side + '_' + 'market';
167781
- if (this.options['createMarketBuyOrderRequiresPrice']) {
167962
+ let quoteAmount = undefined;
167963
+ let createMarketBuyOrderRequiresPrice = true;
167964
+ [createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
167965
+ const cost = this.safeNumber(params, 'cost');
167966
+ params = this.omit(params, 'cost');
167967
+ if (cost !== undefined) {
167968
+ quoteAmount = this.costToPrecision(symbol, cost);
167969
+ }
167970
+ else if (createMarketBuyOrderRequiresPrice) {
167782
167971
  if (price === undefined) {
167783
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + " createOrder () requires the price argument with market buy orders to calculate total order cost (amount to spend), where cost = amount * price. Supply the price argument to createOrder() call if you want the cost to be calculated for you from price and amount, or, alternatively, add .options['createMarketBuyOrderRequiresPrice'] = false to supply the cost in the amount argument (the exchange-specific behaviour)");
167972
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires the price argument for market buy orders to calculate the total cost to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
167784
167973
  }
167785
167974
  else {
167786
167975
  const amountString = this.numberToString(amount);
167787
167976
  const priceString = this.numberToString(price);
167788
- const quoteAmount = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
167789
- const cost = this.parseNumber(quoteAmount);
167790
- request['price'] = this.priceToPrecision(symbol, cost);
167977
+ const costRequest = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
167978
+ quoteAmount = this.costToPrecision(symbol, costRequest);
167791
167979
  }
167792
167980
  }
167793
167981
  else {
167794
- request['price'] = amount;
167982
+ quoteAmount = this.costToPrecision(symbol, amount);
167795
167983
  }
167984
+ // market buys require filling the price param instead of the amount param, for market buys the price is treated as the cost by lbank
167985
+ request['price'] = quoteAmount;
167796
167986
  }
167797
167987
  }
167798
167988
  if (clientOrderId !== undefined) {
@@ -167964,8 +168154,8 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
167964
168154
  * @method
167965
168155
  * @name lbank2#fetchOrder
167966
168156
  * @description fetches information on an order made by the user
167967
- * @see https://www.lbank.info/en-US/docs/index.html#query-order
167968
- * @see https://www.lbank.info/en-US/docs/index.html#query-order-new
168157
+ * @see https://www.lbank.com/en-US/docs/index.html#query-order
168158
+ * @see https://www.lbank.com/en-US/docs/index.html#query-order-new
167969
168159
  * @param {string} symbol unified symbol of the market the order was made in
167970
168160
  * @param {object} [params] extra parameters specific to the exchange API endpoint
167971
168161
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -168068,7 +168258,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
168068
168258
  * @method
168069
168259
  * @name lbank2#fetchMyTrades
168070
168260
  * @description fetch all trades made by the user
168071
- * @see https://www.lbank.info/en-US/docs/index.html#past-transaction-details
168261
+ * @see https://www.lbank.com/en-US/docs/index.html#past-transaction-details
168072
168262
  * @param {string} symbol unified market symbol
168073
168263
  * @param {int} [since] the earliest time in ms to fetch trades for
168074
168264
  * @param {int} [limit] the maximum number of trade structures to retrieve
@@ -168127,7 +168317,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
168127
168317
  * @method
168128
168318
  * @name lbank2#fetchOrders
168129
168319
  * @description fetches information on multiple orders made by the user
168130
- * @see https://www.lbank.info/en-US/docs/index.html#query-all-orders
168320
+ * @see https://www.lbank.com/en-US/docs/index.html#query-all-orders
168131
168321
  * @param {string} symbol unified market symbol of the market orders were made in
168132
168322
  * @param {int} [since] the earliest time in ms to fetch orders for
168133
168323
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -168187,7 +168377,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
168187
168377
  * @method
168188
168378
  * @name lbank2#fetchOpenOrders
168189
168379
  * @description fetch all unfilled currently open orders
168190
- * @see https://www.lbank.info/en-US/docs/index.html#current-pending-order
168380
+ * @see https://www.lbank.com/en-US/docs/index.html#current-pending-order
168191
168381
  * @param {string} symbol unified market symbol
168192
168382
  * @param {int} [since] the earliest time in ms to fetch open orders for
168193
168383
  * @param {int} [limit] the maximum number of open order structures to retrieve
@@ -168244,7 +168434,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
168244
168434
  * @method
168245
168435
  * @name lbank2#cancelOrder
168246
168436
  * @description cancels an open order
168247
- * @see https://www.lbank.info/en-US/docs/index.html#cancel-order-new
168437
+ * @see https://www.lbank.com/en-US/docs/index.html#cancel-order-new
168248
168438
  * @param {string} id order id
168249
168439
  * @param {string} symbol unified symbol of the market the order was made in
168250
168440
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -168286,7 +168476,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
168286
168476
  * @method
168287
168477
  * @name lbank2#cancelAllOrders
168288
168478
  * @description cancel all open orders in a market
168289
- * @see https://www.lbank.info/en-US/docs/index.html#cancel-all-pending-orders-for-a-single-trading-pair
168479
+ * @see https://www.lbank.com/en-US/docs/index.html#cancel-all-pending-orders-for-a-single-trading-pair
168290
168480
  * @param {string} symbol unified market symbol of the market to cancel orders in
168291
168481
  * @param {object} [params] extra parameters specific to the exchange API endpoint
168292
168482
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -168333,8 +168523,8 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
168333
168523
  * @method
168334
168524
  * @name lbank2#fetchDepositAddress
168335
168525
  * @description fetch the deposit address for a currency associated with this account
168336
- * @see https://www.lbank.info/en-US/docs/index.html#get-deposit-address
168337
- * @see https://www.lbank.info/en-US/docs/index.html#the-user-obtains-the-deposit-address
168526
+ * @see https://www.lbank.com/en-US/docs/index.html#get-deposit-address
168527
+ * @see https://www.lbank.com/en-US/docs/index.html#the-user-obtains-the-deposit-address
168338
168528
  * @param {string} code unified currency code
168339
168529
  * @param {object} [params] extra parameters specific to the exchange API endpoint
168340
168530
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -168432,7 +168622,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
168432
168622
  * @method
168433
168623
  * @name lbank2#withdraw
168434
168624
  * @description make a withdrawal
168435
- * @see https://www.lbank.info/en-US/docs/index.html#withdrawal
168625
+ * @see https://www.lbank.com/en-US/docs/index.html#withdrawal
168436
168626
  * @param {string} code unified currency code
168437
168627
  * @param {float} amount the amount to withdraw
168438
168628
  * @param {string} address the address to withdraw to
@@ -168598,7 +168788,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
168598
168788
  * @method
168599
168789
  * @name lbank2#fetchDeposits
168600
168790
  * @description fetch all deposits made to an account
168601
- * @see https://www.lbank.info/en-US/docs/index.html#get-recharge-history
168791
+ * @see https://www.lbank.com/en-US/docs/index.html#get-recharge-history
168602
168792
  * @param {string} code unified currency code
168603
168793
  * @param {int} [since] the earliest time in ms to fetch deposits for
168604
168794
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -168651,7 +168841,7 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
168651
168841
  * @method
168652
168842
  * @name lbank2#fetchWithdrawals
168653
168843
  * @description fetch all withdrawals made from an account
168654
- * @see https://www.lbank.info/en-US/docs/index.html#get-withdrawal-history
168844
+ * @see https://www.lbank.com/en-US/docs/index.html#get-withdrawal-history
168655
168845
  * @param {string} code unified currency code
168656
168846
  * @param {int} [since] the earliest time in ms to fetch withdrawals for
168657
168847
  * @param {int} [limit] the maximum number of withdrawals structures to retrieve
@@ -168854,8 +169044,8 @@ class lbank extends _abstract_lbank_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
168854
169044
  * @method
168855
169045
  * @name lbank2#fetchDepositWithdrawFees
168856
169046
  * @description when using private endpoint, only returns information for currencies with non-zero balance, use public method by specifying this.options['fetchDepositWithdrawFees']['method'] = 'fetchPublicDepositWithdrawFees'
168857
- * @see https://www.lbank.info/en-US/docs/index.html#get-all-coins-information
168858
- * @see https://www.lbank.info/en-US/docs/index.html#withdrawal-configurations
169047
+ * @see https://www.lbank.com/en-US/docs/index.html#get-all-coins-information
169048
+ * @see https://www.lbank.com/en-US/docs/index.html#withdrawal-configurations
168859
169049
  * @param {string[]|undefined} codes array of unified currency codes
168860
169050
  * @param {object} [params] extra parameters specific to the exchange API endpoint
168861
169051
  * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -189085,7 +189275,13 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
189085
189275
  });
189086
189276
  }
189087
189277
  }
189088
- const response = await this[method](request); // * dont extend with params, otherwise ARRAY will be turned into OBJECT
189278
+ let response = undefined;
189279
+ if (method === 'privatePostTradeCancelAlgos') {
189280
+ response = await this.privatePostTradeCancelAlgos(request); // * dont extend with params, otherwise ARRAY will be turned into OBJECT
189281
+ }
189282
+ else {
189283
+ response = await this.privatePostTradeCancelBatchOrders(request); // * dont extend with params, otherwise ARRAY will be turned into OBJECT
189284
+ }
189089
189285
  //
189090
189286
  // {
189091
189287
  // "code": "0",
@@ -189384,7 +189580,13 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
189384
189580
  }
189385
189581
  }
189386
189582
  const query = this.omit(params, ['method', 'clOrdId', 'clientOrderId', 'stop']);
189387
- const response = await this[method](this.extend(request, query));
189583
+ let response = undefined;
189584
+ if (method === 'privateGetTradeOrderAlgo') {
189585
+ response = await this.privateGetTradeOrderAlgo(this.extend(request, query));
189586
+ }
189587
+ else {
189588
+ response = await this.privateGetTradeOrder(this.extend(request, query));
189589
+ }
189388
189590
  //
189389
189591
  // Spot and Swap
189390
189592
  //
@@ -189543,7 +189745,13 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
189543
189745
  }
189544
189746
  }
189545
189747
  const query = this.omit(params, ['method', 'stop']);
189546
- const response = await this[method](this.extend(request, query));
189748
+ let response = undefined;
189749
+ if (method === 'privateGetTradeOrdersAlgoPending') {
189750
+ response = await this.privateGetTradeOrdersAlgoPending(this.extend(request, query));
189751
+ }
189752
+ else {
189753
+ response = await this.privateGetTradeOrdersPending(this.extend(request, query));
189754
+ }
189547
189755
  //
189548
189756
  // {
189549
189757
  // "code": "0",
@@ -189715,7 +189923,13 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
189715
189923
  }
189716
189924
  }
189717
189925
  const send = this.omit(query, ['method', 'stop', 'ordType']);
189718
- const response = await this[method](this.extend(request, send));
189926
+ let response = undefined;
189927
+ if (method === 'privateGetTradeOrdersAlgoHistory') {
189928
+ response = await this.privateGetTradeOrdersAlgoHistory(this.extend(request, send));
189929
+ }
189930
+ else {
189931
+ response = await this.privateGetTradeOrdersHistory(this.extend(request, send));
189932
+ }
189719
189933
  //
189720
189934
  // {
189721
189935
  // "code": "0",
@@ -189892,7 +190106,13 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
189892
190106
  request['state'] = 'filled';
189893
190107
  }
189894
190108
  const send = this.omit(query, ['method', 'stop']);
189895
- const response = await this[method](this.extend(request, send));
190109
+ let response = undefined;
190110
+ if (method === 'privateGetTradeOrdersAlgoHistory') {
190111
+ response = await this.privateGetTradeOrdersAlgoHistory(this.extend(request, send));
190112
+ }
190113
+ else {
190114
+ response = await this.privateGetTradeOrdersHistory(this.extend(request, send));
190115
+ }
189896
190116
  //
189897
190117
  // {
189898
190118
  // "code": "0",
@@ -190145,7 +190365,16 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
190145
190365
  request['ccy'] = currency['id'];
190146
190366
  }
190147
190367
  [request, params] = this.handleUntilOption('end', request, params);
190148
- const response = await this[method](this.extend(request, query));
190368
+ let response = undefined;
190369
+ if (method === 'privateGetAccountBillsArchive') {
190370
+ response = await this.privateGetAccountBillsArchive(this.extend(request, query));
190371
+ }
190372
+ else if (method === 'privateGetAssetBills') {
190373
+ response = await this.privateGetAssetBills(this.extend(request, query));
190374
+ }
190375
+ else {
190376
+ response = await this.privateGetAccountBills(this.extend(request, query));
190377
+ }
190149
190378
  //
190150
190379
  // privateGetAccountBills, privateGetAccountBillsArchive
190151
190380
  //
@@ -191057,7 +191286,13 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
191057
191286
  }
191058
191287
  const fetchPositionsOptions = this.safeValue(this.options, 'fetchPositions', {});
191059
191288
  const method = this.safeString(fetchPositionsOptions, 'method', 'privateGetAccountPositions');
191060
- const response = await this[method](this.extend(request, params));
191289
+ let response = undefined;
191290
+ if (method === 'privateGetAccountPositionsHistory') {
191291
+ response = await this.privateGetAccountPositionsHistory(this.extend(request, params));
191292
+ }
191293
+ else {
191294
+ response = await this.privateGetAccountPositions(this.extend(request, params));
191295
+ }
191061
191296
  //
191062
191297
  // {
191063
191298
  // "code": "0",
@@ -205859,7 +206094,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
205859
206094
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
205860
206095
  * @param {int} [limit] the maximum amount of trades to fetch
205861
206096
  * @param {object} [params] extra parameters specific to the exchange API endpoint
205862
- * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/en/latest/manual.html?#public-trades}
206097
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
205863
206098
  */
205864
206099
  await this.loadMarkets();
205865
206100
  symbols = this.marketSymbols(symbols, undefined, false, true, true);
@@ -208960,7 +209195,7 @@ class bingx extends _bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
208960
209195
  * @see https://bingx-api.github.io/docs/#/swapV2/socket/account.html#Account%20balance%20and%20position%20update%20push
208961
209196
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
208962
209197
  * @param {object} [params] extra parameters specific to the exchange API endpoint
208963
- * @returns {object} a [balance structure]{@link https://docs.ccxt.com/en/latest/manual.html?#balance-structure}
209198
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
208964
209199
  */
208965
209200
  await this.loadMarkets();
208966
209201
  await this.authenticate();
@@ -211891,7 +212126,7 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
211891
212126
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
211892
212127
  * @param {int} [limit] the maximum amount of trades to fetch
211893
212128
  * @param {object} [params] extra parameters specific to the exchange API endpoint
211894
- * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/en/latest/manual.html?#public-trades}
212129
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
211895
212130
  */
211896
212131
  const symbolsLength = symbols.length;
211897
212132
  if (symbolsLength === 0) {
@@ -220898,7 +221133,7 @@ class bybit extends _bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
220898
221133
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
220899
221134
  * @param {int} [limit] the maximum amount of trades to fetch
220900
221135
  * @param {object} [params] extra parameters specific to the exchange API endpoint
220901
- * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/en/latest/manual.html?#public-trades}
221136
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
220902
221137
  */
220903
221138
  await this.loadMarkets();
220904
221139
  symbols = this.marketSymbols(symbols);
@@ -222539,7 +222774,7 @@ class cex extends _cex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
222539
222774
  * @see https://docs.cex.io/#ws-api-get-balance
222540
222775
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
222541
222776
  * @param {object} [params] extra parameters specific to the cex api endpoint
222542
- * @returns {object} a [balance structure]{@link https://docs.ccxt.com/en/latest/manual.html?#balance-structure}
222777
+ * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
222543
222778
  */
222544
222779
  await this.loadMarkets();
222545
222780
  await this.authenticate();
@@ -224423,7 +224658,7 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
224423
224658
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
224424
224659
  * @param {int} [limit] the maximum amount of trades to fetch
224425
224660
  * @param {object} [params] extra parameters specific to the exchange API endpoint
224426
- * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/en/latest/manual.html?#public-trades}
224661
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
224427
224662
  */
224428
224663
  const symbolsLength = symbols.length;
224429
224664
  if (symbolsLength === 0) {
@@ -226523,7 +226758,7 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
226523
226758
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
226524
226759
  * @param {int} [limit] the maximum amount of trades to fetch
226525
226760
  * @param {object} [params] extra parameters specific to the exchange API endpoint
226526
- * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/en/latest/manual.html?#public-trades}
226761
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
226527
226762
  */
226528
226763
  await this.loadMarkets();
226529
226764
  symbols = this.marketSymbols(symbols);
@@ -229788,7 +230023,7 @@ class gate extends _gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
229788
230023
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
229789
230024
  * @param {int} [limit] the maximum amount of trades to fetch
229790
230025
  * @param {object} [params] extra parameters specific to the exchange API endpoint
229791
- * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/en/latest/manual.html?#public-trades}
230026
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
229792
230027
  */
229793
230028
  await this.loadMarkets();
229794
230029
  symbols = this.marketSymbols(symbols);
@@ -240566,7 +240801,7 @@ class kucoin extends _kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
240566
240801
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
240567
240802
  * @param {int} [limit] the maximum amount of trades to fetch
240568
240803
  * @param {object} [params] extra parameters specific to the exchange API endpoint
240569
- * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/en/latest/manual.html?#public-trades}
240804
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
240570
240805
  */
240571
240806
  const symbolsLength = symbols.length;
240572
240807
  if (symbolsLength === 0) {
@@ -241655,7 +241890,7 @@ class kucoinfutures extends _kucoinfutures_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
241655
241890
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
241656
241891
  * @param {int} [limit] the maximum amount of trades to fetch
241657
241892
  * @param {object} [params] extra parameters specific to the exchange API endpoint
241658
- * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/en/latest/manual.html?#public-trades}
241893
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
241659
241894
  */
241660
241895
  const symbolsLength = symbols.length;
241661
241896
  if (symbolsLength === 0) {
@@ -245253,7 +245488,7 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
245253
245488
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
245254
245489
  * @param {int} [limit] the maximum amount of trades to fetch
245255
245490
  * @param {object} [params] extra parameters specific to the exchange API endpoint
245256
- * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/en/latest/manual.html?#public-trades}
245491
+ * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
245257
245492
  */
245258
245493
  const symbolsLength = symbols.length;
245259
245494
  if (symbolsLength === 0) {
@@ -274389,7 +274624,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
274389
274624
  * @method
274390
274625
  * @name whitebit#fetchMarkets
274391
274626
  * @description retrieves data on all markets for whitebit
274392
- * @see https://whitebit-exchange.github.io/api-docs/docs/Public/http-v4#market-info
274627
+ * @see https://docs.whitebit.com/public/http-v4/#market-info
274393
274628
  * @param {object} [params] extra parameters specific to the exchange API endpoint
274394
274629
  * @returns {object[]} an array of objects representing market data
274395
274630
  */
@@ -274513,6 +274748,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
274513
274748
  * @method
274514
274749
  * @name whitebit#fetchCurrencies
274515
274750
  * @description fetches all available currencies on an exchange
274751
+ * @see https://docs.whitebit.com/public/http-v4/#asset-status-list
274516
274752
  * @param {object} [params] extra parameters specific to the exchange API endpoint
274517
274753
  * @returns {object} an associative dictionary of currencies
274518
274754
  */
@@ -274572,6 +274808,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
274572
274808
  * @name whitebit#fetchTransactionFees
274573
274809
  * @deprecated
274574
274810
  * @description please use fetchDepositWithdrawFees instead
274811
+ * @see https://docs.whitebit.com/public/http-v4/#fee
274575
274812
  * @param {string[]|undefined} codes not used by fetchTransactionFees ()
274576
274813
  * @param {object} [params] extra parameters specific to the exchange API endpoint
274577
274814
  * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -274626,6 +274863,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
274626
274863
  * @method
274627
274864
  * @name whitebit#fetchDepositWithdrawFees
274628
274865
  * @description fetch deposit and withdraw fees
274866
+ * @see https://docs.whitebit.com/public/http-v4/#fee
274629
274867
  * @param {string[]|undefined} codes not used by fetchDepositWithdrawFees ()
274630
274868
  * @param {object} [params] extra parameters specific to the exchange API endpoint
274631
274869
  * @returns {object} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -274775,6 +275013,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
274775
275013
  * @method
274776
275014
  * @name whitebit#fetchTradingFees
274777
275015
  * @description fetch the trading fees for multiple markets
275016
+ * @see https://docs.whitebit.com/public/http-v4/#asset-status-list
274778
275017
  * @param {object} [params] extra parameters specific to the exchange API endpoint
274779
275018
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
274780
275019
  */
@@ -274822,6 +275061,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
274822
275061
  * @method
274823
275062
  * @name whitebit#fetchTicker
274824
275063
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
275064
+ * @see https://docs.whitebit.com/public/http-v4/#market-activity
274825
275065
  * @param {string} symbol unified symbol of the market to fetch the ticker for
274826
275066
  * @param {object} [params] extra parameters specific to the exchange API endpoint
274827
275067
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -274910,6 +275150,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
274910
275150
  * @method
274911
275151
  * @name whitebit#fetchTickers
274912
275152
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
275153
+ * @see https://docs.whitebit.com/public/http-v4/#market-activity
274913
275154
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
274914
275155
  * @param {object} [params] extra parameters specific to the exchange API endpoint
274915
275156
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -274943,8 +275184,8 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
274943
275184
  /**
274944
275185
  * @method
274945
275186
  * @name whitebit#fetchOrderBook
274946
- * @see https://whitebit-exchange.github.io/api-docs/public/http-v4/#orderbook
274947
275187
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
275188
+ * @see https://docs.whitebit.com/public/http-v4/#orderbook
274948
275189
  * @param {string} symbol unified symbol of the market to fetch the order book for
274949
275190
  * @param {int} [limit] the maximum amount of order book entries to return
274950
275191
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -274986,6 +275227,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
274986
275227
  * @method
274987
275228
  * @name whitebit#fetchTrades
274988
275229
  * @description get the list of most recent trades for a particular symbol
275230
+ * @see https://docs.whitebit.com/public/http-v4/#recent-trades
274989
275231
  * @param {string} symbol unified symbol of the market to fetch trades for
274990
275232
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
274991
275233
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -275017,6 +275259,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275017
275259
  * @method
275018
275260
  * @name whitebit#fetchMyTrades
275019
275261
  * @description fetch all trades made by the user
275262
+ * @see https://docs.whitebit.com/private/http-trade-v4/#query-executed-order-history
275020
275263
  * @param {string} symbol unified symbol of the market to fetch trades for
275021
275264
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
275022
275265
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -275170,6 +275413,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275170
275413
  * @method
275171
275414
  * @name whitebit#fetchOHLCV
275172
275415
  * @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
275416
+ * @see https://docs.whitebit.com/public/http-v1/#kline
275173
275417
  * @param {string} symbol unified symbol of the market to fetch OHLCV data for
275174
275418
  * @param {string} timeframe the length of time each candle represents
275175
275419
  * @param {int} [since] timestamp in ms of the earliest candle to fetch
@@ -275236,6 +275480,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275236
275480
  * @method
275237
275481
  * @name whitebit#fetchStatus
275238
275482
  * @description the latest known information on the availability of the exchange API
275483
+ * @see https://docs.whitebit.com/public/http-v4/#server-status
275239
275484
  * @param {object} [params] extra parameters specific to the exchange API endpoint
275240
275485
  * @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
275241
275486
  */
@@ -275259,6 +275504,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275259
275504
  * @method
275260
275505
  * @name whitebit#fetchTime
275261
275506
  * @description fetches the current integer timestamp in milliseconds from the exchange server
275507
+ * @see https://docs.whitebit.com/public/http-v4/#server-time
275262
275508
  * @param {object} [params] extra parameters specific to the exchange API endpoint
275263
275509
  * @returns {int} the current integer timestamp in milliseconds from the exchange server
275264
275510
  */
@@ -275275,6 +275521,11 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275275
275521
  * @method
275276
275522
  * @name whitebit#createOrder
275277
275523
  * @description create a trade order
275524
+ * @see https://docs.whitebit.com/private/http-trade-v4/#create-limit-order
275525
+ * @see https://docs.whitebit.com/private/http-trade-v4/#create-market-order
275526
+ * @see https://docs.whitebit.com/private/http-trade-v4/#create-buy-stock-market-order
275527
+ * @see https://docs.whitebit.com/private/http-trade-v4/#create-stop-limit-order
275528
+ * @see https://docs.whitebit.com/private/http-trade-v4/#create-stop-market-order
275278
275529
  * @param {string} symbol unified symbol of the market to create an order in
275279
275530
  * @param {string} type 'market' or 'limit'
275280
275531
  * @param {string} side 'buy' or 'sell'
@@ -275311,45 +275562,50 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275311
275562
  if (postOnly) {
275312
275563
  request['postOnly'] = true;
275313
275564
  }
275314
- let method;
275315
275565
  if (marginMode !== undefined && marginMode !== 'cross') {
275316
275566
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createOrder() is only available for cross margin');
275317
275567
  }
275568
+ params = this.omit(query, ['postOnly', 'triggerPrice', 'stopPrice']);
275318
275569
  const useCollateralEndpoint = marginMode !== undefined || marketType === 'swap';
275570
+ let response = undefined;
275319
275571
  if (isStopOrder) {
275320
275572
  request['activation_price'] = this.priceToPrecision(symbol, stopPrice);
275321
275573
  if (isLimitOrder) {
275322
275574
  // stop limit order
275323
- method = 'v4PrivatePostOrderStopLimit';
275324
275575
  request['price'] = this.priceToPrecision(symbol, price);
275576
+ response = await this.v4PrivatePostOrderStopLimit(this.extend(request, params));
275325
275577
  }
275326
275578
  else {
275327
275579
  // stop market order
275328
- method = 'v4PrivatePostOrderStopMarket';
275329
275580
  if (useCollateralEndpoint) {
275330
- method = 'v4PrivatePostOrderCollateralTriggerMarket';
275581
+ response = await this.v4PrivatePostOrderCollateralTriggerMarket(this.extend(request, params));
275582
+ }
275583
+ else {
275584
+ response = await this.v4PrivatePostOrderStopMarket(this.extend(request, params));
275331
275585
  }
275332
275586
  }
275333
275587
  }
275334
275588
  else {
275335
275589
  if (isLimitOrder) {
275336
275590
  // limit order
275337
- method = 'v4PrivatePostOrderNew';
275591
+ request['price'] = this.priceToPrecision(symbol, price);
275338
275592
  if (useCollateralEndpoint) {
275339
- method = 'v4PrivatePostOrderCollateralLimit';
275593
+ response = await this.v4PrivatePostOrderCollateralLimit(this.extend(request, params));
275594
+ }
275595
+ else {
275596
+ response = await this.v4PrivatePostOrderNew(this.extend(request, params));
275340
275597
  }
275341
- request['price'] = this.priceToPrecision(symbol, price);
275342
275598
  }
275343
275599
  else {
275344
275600
  // market order
275345
- method = 'v4PrivatePostOrderStockMarket';
275346
275601
  if (useCollateralEndpoint) {
275347
- method = 'v4PrivatePostOrderCollateralMarket';
275602
+ response = await this.v4PrivatePostOrderCollateralMarket(this.extend(request, params));
275603
+ }
275604
+ else {
275605
+ response = await this.v4PrivatePostOrderStockMarket(this.extend(request, params));
275348
275606
  }
275349
275607
  }
275350
275608
  }
275351
- params = this.omit(query, ['postOnly', 'triggerPrice', 'stopPrice']);
275352
- const response = await this[method](this.extend(request, params));
275353
275609
  return this.parseOrder(response);
275354
275610
  }
275355
275611
  async cancelOrder(id, symbol = undefined, params = {}) {
@@ -275357,6 +275613,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275357
275613
  * @method
275358
275614
  * @name whitebit#cancelOrder
275359
275615
  * @description cancels an open order
275616
+ * @see https://docs.whitebit.com/private/http-trade-v4/#cancel-order
275360
275617
  * @param {string} id order id
275361
275618
  * @param {string} symbol unified symbol of the market the order was made in
275362
275619
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -275400,14 +275657,17 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275400
275657
  * @method
275401
275658
  * @name whitebit#fetchBalance
275402
275659
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
275660
+ * @see https://docs.whitebit.com/private/http-main-v4/#main-balance
275661
+ * @see https://docs.whitebit.com/private/http-trade-v4/#trading-balance
275403
275662
  * @param {object} [params] extra parameters specific to the exchange API endpoint
275404
275663
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
275405
275664
  */
275406
275665
  await this.loadMarkets();
275407
- const [marketType, query] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
275408
- let method = undefined;
275666
+ let marketType = undefined;
275667
+ [marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
275668
+ let response = undefined;
275409
275669
  if (marketType === 'swap') {
275410
- method = 'v4PrivatePostCollateralAccountBalance';
275670
+ response = await this.v4PrivatePostCollateralAccountBalance(params);
275411
275671
  }
275412
275672
  else {
275413
275673
  const options = this.safeValue(this.options, 'fetchBalance', {});
@@ -275415,13 +275675,12 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275415
275675
  const account = this.safeString(params, 'account', defaultAccount);
275416
275676
  params = this.omit(params, 'account');
275417
275677
  if (account === 'main') {
275418
- method = 'v4PrivatePostMainAccountBalance';
275678
+ response = await this.v4PrivatePostMainAccountBalance(params);
275419
275679
  }
275420
275680
  else {
275421
- method = 'v4PrivatePostTradeAccountBalance';
275681
+ response = await this.v4PrivatePostTradeAccountBalance(params);
275422
275682
  }
275423
275683
  }
275424
- const response = await this[method](query);
275425
275684
  //
275426
275685
  // main account
275427
275686
  //
@@ -275451,6 +275710,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275451
275710
  * @method
275452
275711
  * @name whitebit#fetchOpenOrders
275453
275712
  * @description fetch all unfilled currently open orders
275713
+ * @see https://docs.whitebit.com/private/http-trade-v4/#query-unexecutedactive-orders
275454
275714
  * @param {string} symbol unified market symbol
275455
275715
  * @param {int} [since] the earliest time in ms to fetch open orders for
275456
275716
  * @param {int} [limit] the maximum number of open order structures to retrieve
@@ -275496,6 +275756,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275496
275756
  * @method
275497
275757
  * @name whitebit#fetchClosedOrders
275498
275758
  * @description fetches information on multiple closed orders made by the user
275759
+ * @see https://docs.whitebit.com/private/http-trade-v4/#query-executed-orders
275499
275760
  * @param {string} symbol unified market symbol of the market orders were made in
275500
275761
  * @param {int} [since] the earliest time in ms to fetch orders for
275501
275762
  * @param {int} [limit] the maximum number of orde structures to retrieve
@@ -275656,6 +275917,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275656
275917
  * @method
275657
275918
  * @name whitebit#fetchOrderTrades
275658
275919
  * @description fetch all the trades made from a single order
275920
+ * @see https://docs.whitebit.com/private/http-trade-v4/#query-executed-order-deals
275659
275921
  * @param {string} id order id
275660
275922
  * @param {string} symbol unified market symbol
275661
275923
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -275703,6 +275965,8 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275703
275965
  * @method
275704
275966
  * @name whitebit#fetchDepositAddress
275705
275967
  * @description fetch the deposit address for a currency associated with this account
275968
+ * @see https://docs.whitebit.com/private/http-main-v4/#get-fiat-deposit-address
275969
+ * @see https://docs.whitebit.com/private/http-main-v4/#get-cryptocurrency-deposit-address
275706
275970
  * @param {string} code unified currency code
275707
275971
  * @param {object} [params] extra parameters specific to the exchange API endpoint
275708
275972
  * @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
@@ -275712,10 +275976,9 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275712
275976
  const request = {
275713
275977
  'ticker': currency['id'],
275714
275978
  };
275715
- let method = 'v4PrivatePostMainAccountAddress';
275979
+ let response = undefined;
275716
275980
  if (this.isFiat(code)) {
275717
- method = 'v4PrivatePostMainAccountFiatDepositUrl';
275718
- const provider = this.safeNumber(params, 'provider');
275981
+ const provider = this.safeString(params, 'provider');
275719
275982
  if (provider === undefined) {
275720
275983
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchDepositAddress() requires a provider when the ticker is fiat');
275721
275984
  }
@@ -275729,8 +275992,11 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275729
275992
  if (uniqueId === undefined) {
275730
275993
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchDepositAddress() requires an uniqueId when the ticker is fiat');
275731
275994
  }
275995
+ response = await this.v4PrivatePostMainAccountFiatDepositUrl(this.extend(request, params));
275996
+ }
275997
+ else {
275998
+ response = await this.v4PrivatePostMainAccountAddress(this.extend(request, params));
275732
275999
  }
275733
- const response = await this[method](this.extend(request, params));
275734
276000
  //
275735
276001
  // fiat
275736
276002
  //
@@ -275775,6 +276041,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275775
276041
  * @method
275776
276042
  * @name whitebit#setLeverage
275777
276043
  * @description set the level of leverage for a market
276044
+ * @see https://docs.whitebit.com/private/http-trade-v4/#change-collateral-account-leverage
275778
276045
  * @param {float} leverage the rate of leverage
275779
276046
  * @param {string} symbol unified market symbol
275780
276047
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -275800,7 +276067,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275800
276067
  * @method
275801
276068
  * @name whitebit#transfer
275802
276069
  * @description transfer currency internally between wallets on the same account
275803
- * @see https://github.com/whitebit-exchange/api-docs/blob/main/docs/Private/http-main-v4.md#transfer-between-main-and-trade-balances
276070
+ * @see https://docs.whitebit.com/private/http-main-v4/#transfer-between-main-and-trade-balances
275804
276071
  * @param {string} code unified currency code
275805
276072
  * @param {float} amount amount to transfer
275806
276073
  * @param {string} fromAccount account to transfer from - main, spot, collateral
@@ -275847,6 +276114,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275847
276114
  * @method
275848
276115
  * @name whitebit#withdraw
275849
276116
  * @description make a withdrawal
276117
+ * @see https://docs.whitebit.com/private/http-main-v4/#create-withdraw-request
275850
276118
  * @param {string} code unified currency code
275851
276119
  * @param {float} amount the amount to withdraw
275852
276120
  * @param {string} address the address to withdraw to
@@ -275973,6 +276241,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
275973
276241
  * @method
275974
276242
  * @name whitebit#fetchDeposit
275975
276243
  * @description fetch information on a deposit
276244
+ * @see https://docs.whitebit.com/private/http-main-v4/#get-depositwithdraw-history
275976
276245
  * @param {string} id deposit id
275977
276246
  * @param {string} code not used by whitebit fetchDeposit ()
275978
276247
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -276037,6 +276306,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
276037
276306
  * @method
276038
276307
  * @name whitebit#fetchDeposits
276039
276308
  * @description fetch all deposits made to an account
276309
+ * @see https://docs.whitebit.com/private/http-main-v4/#get-depositwithdraw-history
276040
276310
  * @param {string} code unified currency code
276041
276311
  * @param {int} [since] the earliest time in ms to fetch deposits for
276042
276312
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -276103,7 +276373,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
276103
276373
  * @method
276104
276374
  * @name whitebit#fetchBorrowInterest
276105
276375
  * @description fetch the interest owed by the user for borrowing currency for margin trading
276106
- * @see https://github.com/whitebit-exchange/api-docs/blob/main/docs/Private/http-trade-v4.md#open-positions
276376
+ * @see https://docs.whitebit.com/private/http-trade-v4/#open-positions
276107
276377
  * @param {string} code unified currency code
276108
276378
  * @param {string} symbol unified market symbol
276109
276379
  * @param {int} [since] the earliest time in ms to fetch borrrow interest for
@@ -276182,7 +276452,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
276182
276452
  /**
276183
276453
  * @method
276184
276454
  * @name whitebit#fetchFundingRate
276185
- * @see https://whitebit-exchange.github.io/api-docs/public/http-v4/#available-futures-markets-list
276455
+ * @see https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
276186
276456
  * @description fetch the current funding rate
276187
276457
  * @param {string} symbol unified market symbol
276188
276458
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -276197,7 +276467,7 @@ class whitebit extends _abstract_whitebit_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
276197
276467
  /**
276198
276468
  * @method
276199
276469
  * @name whitebit#fetchFundingRates
276200
- * @see https://whitebit-exchange.github.io/api-docs/public/http-v4/#available-futures-markets-list
276470
+ * @see https://docs.whitebit.com/public/http-v4/#available-futures-markets-list
276201
276471
  * @description fetch the funding rate for multiple markets
276202
276472
  * @param {string[]|undefined} symbols list of unified market symbols
276203
276473
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -288562,7 +288832,7 @@ SOFTWARE.
288562
288832
 
288563
288833
  //-----------------------------------------------------------------------------
288564
288834
  // this is updated by vss.js when building
288565
- const version = '4.1.80';
288835
+ const version = '4.1.82';
288566
288836
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
288567
288837
  //-----------------------------------------------------------------------------
288568
288838