ccxt 4.0.97 → 4.0.98

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.
package/README.md CHANGED
@@ -215,13 +215,13 @@ console.log(version, Object.keys(exchanges));
215
215
 
216
216
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
217
217
 
218
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.97/dist/ccxt.browser.js
219
- * unpkg: https://unpkg.com/ccxt@4.0.97/dist/ccxt.browser.js
218
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.98/dist/ccxt.browser.js
219
+ * unpkg: https://unpkg.com/ccxt@4.0.98/dist/ccxt.browser.js
220
220
 
221
221
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
222
222
 
223
223
  ```HTML
224
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.97/dist/ccxt.browser.js"></script>
224
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.98/dist/ccxt.browser.js"></script>
225
225
  ```
226
226
 
227
227
  Creates a global `ccxt` object:
@@ -13758,6 +13758,7 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
13758
13758
  'cancelAllOrders': true,
13759
13759
  'cancelOrder': true,
13760
13760
  'createOrder': true,
13761
+ 'createPostOnlyOrder': true,
13761
13762
  'createStopLimitOrder': true,
13762
13763
  'createStopMarketOrder': true,
13763
13764
  'createStopOrder': true,
@@ -13859,6 +13860,7 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
13859
13860
  },
13860
13861
  },
13861
13862
  'options': {
13863
+ 'createMarketBuyOrderRequiresPrice': true,
13862
13864
  'accountsByType': {
13863
13865
  'spot': 'SPOT',
13864
13866
  'fund': 'FUND',
@@ -14815,30 +14817,39 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
14815
14817
  //
14816
14818
  return this.parseBalance(response);
14817
14819
  }
14820
+ parseType(type) {
14821
+ const types = {
14822
+ 'STOP_LIMIT': 'limit',
14823
+ 'STOP_MARKET': 'market',
14824
+ 'LIMIT': 'limit',
14825
+ 'MARKET': 'market',
14826
+ };
14827
+ return this.safeString(types, type, type);
14828
+ }
14818
14829
  parseOrder(order, market = undefined) {
14819
14830
  //
14820
14831
  // {
14821
- // "id": 10,
14822
- // "asset_pair_name": "EOS-BTC",
14823
- // "price": "10.00",
14824
- // "amount": "10.00",
14825
- // "filled_amount": "9.0",
14826
- // "avg_deal_price": "12.0",
14827
- // "side": "ASK",
14828
- // "state": "FILLED",
14829
- // "created_at":"2019-01-29T06:05:56Z",
14830
- // "updated_at":"2019-01-29T06:05:56Z",
14832
+ // "id": '42154072251',
14833
+ // "asset_pair_name": 'SOL-USDT',
14834
+ // "price": '20',
14835
+ // "amount": '0.5',
14836
+ // "filled_amount": '0',
14837
+ // "avg_deal_price": '0',
14838
+ // "side": 'ASK',
14839
+ // "state": 'PENDING',
14840
+ // "created_at": '2023-09-13T03:42:00Z',
14841
+ // "updated_at": '2023-09-13T03:42:00Z',
14842
+ // "type": 'LIMIT',
14843
+ // "stop_price": '0',
14844
+ // "immediate_or_cancel": false,
14845
+ // "post_only": false,
14846
+ // "client_order_id": ''
14831
14847
  // }
14832
14848
  //
14833
14849
  const id = this.safeString(order, 'id');
14834
14850
  const marketId = this.safeString(order, 'asset_pair_name');
14835
14851
  const symbol = this.safeSymbol(marketId, market, '-');
14836
14852
  const timestamp = this.parse8601(this.safeString(order, 'created_at'));
14837
- const price = this.safeString(order, 'price');
14838
- const amount = this.safeString(order, 'amount');
14839
- const average = this.safeString(order, 'avg_deal_price');
14840
- const filled = this.safeString(order, 'filled_amount');
14841
- const status = this.parseOrderStatus(this.safeString(order, 'state'));
14842
14853
  let side = this.safeString(order, 'side');
14843
14854
  if (side === 'BID') {
14844
14855
  side = 'buy';
@@ -14846,28 +14857,48 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
14846
14857
  else {
14847
14858
  side = 'sell';
14848
14859
  }
14849
- const lastTradeTimestamp = this.parse8601(this.safeString(order, 'updated_at'));
14860
+ let triggerPrice = this.safeString(order, 'stop_price');
14861
+ if (_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringEq */ .O.stringEq(triggerPrice, '0')) {
14862
+ triggerPrice = undefined;
14863
+ }
14864
+ const immediateOrCancel = this.safeValue(order, 'immediate_or_cancel');
14865
+ let timeInForce = undefined;
14866
+ if (immediateOrCancel) {
14867
+ timeInForce = 'IOC';
14868
+ }
14869
+ const type = this.parseType(this.safeString(order, 'type'));
14870
+ const price = this.safeString(order, 'price');
14871
+ let amount = undefined;
14872
+ let filled = undefined;
14873
+ let cost = undefined;
14874
+ if (type === 'market' && side === 'buy') {
14875
+ cost = this.safeString(order, 'filled_amount');
14876
+ }
14877
+ else {
14878
+ amount = this.safeString(order, 'amount');
14879
+ filled = this.safeString(order, 'filled_amount');
14880
+ }
14850
14881
  return this.safeOrder({
14851
14882
  'info': order,
14852
14883
  'id': id,
14853
- 'clientOrderId': undefined,
14884
+ 'clientOrderId': this.safeString(order, 'client_order_id'),
14854
14885
  'timestamp': timestamp,
14855
14886
  'datetime': this.iso8601(timestamp),
14856
- 'lastTradeTimestamp': lastTradeTimestamp,
14887
+ 'lastTradeTimestamp': this.parse8601(this.safeString(order, 'updated_at')),
14857
14888
  'symbol': symbol,
14858
- 'type': undefined,
14859
- 'timeInForce': undefined,
14860
- 'postOnly': undefined,
14889
+ 'type': type,
14890
+ 'timeInForce': timeInForce,
14891
+ 'postOnly': this.safeValue(order, 'post_only'),
14861
14892
  'side': side,
14862
14893
  'price': price,
14863
- 'stopPrice': undefined,
14864
- 'triggerPrice': undefined,
14894
+ 'stopPrice': triggerPrice,
14895
+ 'triggerPrice': triggerPrice,
14865
14896
  'amount': amount,
14866
- 'cost': undefined,
14867
- 'average': average,
14897
+ 'cost': cost,
14898
+ 'average': this.safeString(order, 'avg_deal_price'),
14868
14899
  'filled': filled,
14869
14900
  'remaining': undefined,
14870
- 'status': status,
14901
+ 'status': this.parseOrderStatus(this.safeString(order, 'state')),
14871
14902
  'fee': undefined,
14872
14903
  'trades': undefined,
14873
14904
  }, market);
@@ -14877,46 +14908,79 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
14877
14908
  * @method
14878
14909
  * @name bigone#createOrder
14879
14910
  * @description create a trade order
14911
+ * @see https://open.big.one/docs/spot_orders.html#create-order
14880
14912
  * @param {string} symbol unified symbol of the market to create an order in
14881
14913
  * @param {string} type 'market' or 'limit'
14882
14914
  * @param {string} side 'buy' or 'sell'
14883
14915
  * @param {float} amount how much of currency you want to trade in units of base currency
14884
14916
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
14885
14917
  * @param {object} [params] extra parameters specific to the bigone api endpoint
14918
+ * @param {float} [params.triggerPrice] the price at which a trigger order is triggered at
14919
+ * @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
14920
+ * @param {string} [params.timeInForce] "GTC", "IOC", or "PO"
14921
+ *
14922
+ * EXCHANGE SPECIFIC PARAMETERS
14923
+ * @param {string} operator *stop order only* GTE or LTE (default)
14924
+ * @param {string} client_order_id must match ^[a-zA-Z0-9-_]{1,36}$ this regex. client_order_id is unique in 24 hours, If created 24 hours later and the order closed, it will be released and can be reused
14886
14925
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
14887
14926
  */
14888
14927
  await this.loadMarkets();
14889
14928
  const market = this.market(symbol);
14890
- const requestSide = (side === 'buy') ? 'BID' : 'ASK';
14891
- const uppercaseType = type.toUpperCase();
14929
+ const isBuy = (side === 'buy');
14930
+ const requestSide = isBuy ? 'BID' : 'ASK';
14931
+ let uppercaseType = type.toUpperCase();
14932
+ const isLimit = uppercaseType === 'LIMIT';
14933
+ const exchangeSpecificParam = this.safeValue(params, 'post_only');
14934
+ let postOnly = undefined;
14935
+ [postOnly, params] = this.handlePostOnly((uppercaseType === 'MARKET'), exchangeSpecificParam, params);
14936
+ const triggerPrice = this.safeStringN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
14892
14937
  const request = {
14893
14938
  'asset_pair_name': market['id'],
14894
14939
  'side': requestSide,
14895
- 'amount': this.amountToPrecision(symbol, amount),
14940
+ 'amount': this.amountToPrecision(symbol, amount), // order amount, string, required
14896
14941
  // 'price': this.priceToPrecision (symbol, price), // order price, string, required
14897
- 'type': uppercaseType,
14898
14942
  // 'operator': 'GTE', // stop orders only, GTE greater than and equal, LTE less than and equal
14899
14943
  // 'immediate_or_cancel': false, // limit orders only, must be false when post_only is true
14900
14944
  // 'post_only': false, // limit orders only, must be false when immediate_or_cancel is true
14901
14945
  };
14902
- if (uppercaseType === 'LIMIT') {
14946
+ if (isLimit || (uppercaseType === 'STOP_LIMIT')) {
14903
14947
  request['price'] = this.priceToPrecision(symbol, price);
14948
+ if (isLimit) {
14949
+ const timeInForce = this.safeString(params, 'timeInForce');
14950
+ if (timeInForce === 'IOC') {
14951
+ request['immediate_or_cancel'] = true;
14952
+ }
14953
+ if (postOnly) {
14954
+ request['post_only'] = true;
14955
+ }
14956
+ }
14904
14957
  }
14905
14958
  else {
14906
- const isStopLimit = (uppercaseType === 'STOP_LIMIT');
14907
- const isStopMarket = (uppercaseType === 'STOP_MARKET');
14908
- if (isStopLimit || isStopMarket) {
14909
- const stopPrice = this.safeNumber2(params, 'stop_price', 'stopPrice');
14910
- if (stopPrice === undefined) {
14911
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' createOrder() requires a stop_price parameter');
14959
+ const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice');
14960
+ if (createMarketBuyOrderRequiresPrice && (side === 'buy')) {
14961
+ if (price === undefined) {
14962
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires 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');
14963
+ }
14964
+ else {
14965
+ const amountString = this.numberToString(amount);
14966
+ const priceString = this.numberToString(price);
14967
+ amount = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(amountString, priceString));
14912
14968
  }
14913
- request['stop_price'] = this.priceToPrecision(symbol, stopPrice);
14914
- params = this.omit(params, ['stop_price', 'stopPrice']);
14915
14969
  }
14916
- if (isStopLimit) {
14917
- request['price'] = this.priceToPrecision(symbol, price);
14970
+ }
14971
+ request['amount'] = this.amountToPrecision(symbol, amount);
14972
+ if (triggerPrice !== undefined) {
14973
+ request['stop_price'] = this.priceToPrecision(symbol, triggerPrice);
14974
+ request['operator'] = isBuy ? 'GTE' : 'LTE';
14975
+ if (isLimit) {
14976
+ uppercaseType = 'STOP_LIMIT';
14977
+ }
14978
+ else if (uppercaseType === 'MARKET') {
14979
+ uppercaseType = 'STOP_MARKET';
14918
14980
  }
14919
14981
  }
14982
+ request['type'] = uppercaseType;
14983
+ params = this.omit(params, ['stop_price', 'stopPrice', 'triggerPrice', 'timeInForce']);
14920
14984
  const response = await this.privatePostOrders(this.extend(request, params));
14921
14985
  //
14922
14986
  // {
@@ -42362,15 +42426,14 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
42362
42426
  'api': {
42363
42427
  'public': {
42364
42428
  'get': [
42365
- 'ticker/{currency}',
42366
- 'ticker/all',
42367
- 'ticker/ALL_BTC',
42368
- 'ticker/ALL_KRW',
42369
- 'orderbook/{currency}',
42370
- 'orderbook/all',
42371
- 'transaction_history/{currency}',
42372
- 'transaction_history/all',
42373
- 'candlestick/{currency}/{interval}',
42429
+ 'ticker/ALL_{quoteId}',
42430
+ 'ticker/{baseId}_{quoteId}',
42431
+ 'orderbook/ALL_{quoteId}',
42432
+ 'orderbook/{baseId}_{quoteId}',
42433
+ 'transaction_history/{baseId}_{quoteId}',
42434
+ 'assetsstatus/ALL',
42435
+ 'assetsstatus/{baseId}',
42436
+ 'candlestick/{baseId}_{quoteId}/{interval}',
42374
42437
  ],
42375
42438
  },
42376
42439
  'private': {
@@ -42389,6 +42452,7 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
42389
42452
  'trade/krw_withdrawal',
42390
42453
  'trade/market_buy',
42391
42454
  'trade/market_sell',
42455
+ 'trade/stop_limit',
42392
42456
  ],
42393
42457
  },
42394
42458
  },
@@ -42477,8 +42541,10 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
42477
42541
  const quote = quotes[i];
42478
42542
  const quoteId = quote;
42479
42543
  const extension = this.safeValue(quoteCurrencies, quote, {});
42480
- const method = 'publicGetTickerALL' + quote;
42481
- const response = await this[method](params);
42544
+ const request = {
42545
+ 'quoteId': quoteId,
42546
+ };
42547
+ const response = await this.publicGetTickerALLQuoteId(this.extend(request, params));
42482
42548
  const data = this.safeValue(response, 'data');
42483
42549
  const currencyIds = Object.keys(data);
42484
42550
  for (let j = 0; j < currencyIds.length; j++) {
@@ -42589,12 +42655,13 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
42589
42655
  await this.loadMarkets();
42590
42656
  const market = this.market(symbol);
42591
42657
  const request = {
42592
- 'currency': market['base'] + '_' + market['quote'],
42658
+ 'baseId': market['baseId'],
42659
+ 'quoteId': market['quoteId'],
42593
42660
  };
42594
42661
  if (limit !== undefined) {
42595
42662
  request['count'] = limit; // default 30, max 30
42596
42663
  }
42597
- const response = await this.publicGetOrderbookCurrency(this.extend(request, params));
42664
+ const response = await this.publicGetOrderbookBaseIdQuoteId(this.extend(request, params));
42598
42665
  //
42599
42666
  // {
42600
42667
  // "status":"0000",
@@ -42682,8 +42749,11 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
42682
42749
  const quotes = Object.keys(quoteCurrencies);
42683
42750
  for (let i = 0; i < quotes.length; i++) {
42684
42751
  const quote = quotes[i];
42685
- const method = 'publicGetTickerALL' + quote;
42686
- const response = await this[method](params);
42752
+ const quoteId = quote;
42753
+ const request = {
42754
+ 'quoteId': quoteId,
42755
+ };
42756
+ const response = await this.publicGetTickerALLQuoteId(this.extend(request, params));
42687
42757
  //
42688
42758
  // {
42689
42759
  // "status":"0000",
@@ -42733,9 +42803,10 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
42733
42803
  await this.loadMarkets();
42734
42804
  const market = this.market(symbol);
42735
42805
  const request = {
42736
- 'currency': market['base'],
42806
+ 'baseId': market['baseId'],
42807
+ 'quoteId': market['quoteId'],
42737
42808
  };
42738
- const response = await this.publicGetTickerCurrency(this.extend(request, params));
42809
+ const response = await this.publicGetTickerBaseIdQuoteId(this.extend(request, params));
42739
42810
  //
42740
42811
  // {
42741
42812
  // "status":"0000",
@@ -42793,10 +42864,11 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
42793
42864
  await this.loadMarkets();
42794
42865
  const market = this.market(symbol);
42795
42866
  const request = {
42796
- 'currency': market['base'],
42867
+ 'baseId': market['baseId'],
42868
+ 'quoteId': market['quoteId'],
42797
42869
  'interval': this.safeString(this.timeframes, timeframe, timeframe),
42798
42870
  };
42799
- const response = await this.publicGetCandlestickCurrencyInterval(this.extend(request, params));
42871
+ const response = await this.publicGetCandlestickBaseIdQuoteIdInterval(this.extend(request, params));
42800
42872
  //
42801
42873
  // {
42802
42874
  // 'status': '0000',
@@ -42915,12 +42987,13 @@ class bithumb extends _abstract_bithumb_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
42915
42987
  await this.loadMarkets();
42916
42988
  const market = this.market(symbol);
42917
42989
  const request = {
42918
- 'currency': market['base'] + '_' + market['quote'],
42990
+ 'baseId': market['baseId'],
42991
+ 'quoteId': market['quoteId'],
42919
42992
  };
42920
42993
  if (limit !== undefined) {
42921
42994
  request['count'] = limit; // default 20, max 100
42922
42995
  }
42923
- const response = await this.publicGetTransactionHistoryCurrency(this.extend(request, params));
42996
+ const response = await this.publicGetTransactionHistoryBaseIdQuoteId(this.extend(request, params));
42924
42997
  //
42925
42998
  // {
42926
42999
  // "status":"0000",
@@ -43453,7 +43526,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
43453
43526
  'fetchWithdrawals': true,
43454
43527
  'reduceMargin': false,
43455
43528
  'repayMargin': true,
43456
- 'setLeverage': false,
43529
+ 'setLeverage': true,
43457
43530
  'setMarginMode': false,
43458
43531
  'transfer': true,
43459
43532
  'withdraw': true,
@@ -43516,6 +43589,9 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
43516
43589
  'account/sub-account/v1/transfer-history': 7.5,
43517
43590
  'account/sub-account/main/v1/wallet': 5,
43518
43591
  'account/sub-account/main/v1/subaccount-list': 7.5,
43592
+ 'account/contract/sub-account/main/v1/wallet': 5,
43593
+ 'account/contract/sub-account/main/v1/transfer-list': 7.5,
43594
+ 'account/contract/sub-account/v1/transfer-history': 7.5,
43519
43595
  // account
43520
43596
  'account/v1/wallet': 5,
43521
43597
  'account/v1/currencies': 30,
@@ -43541,9 +43617,11 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
43541
43617
  'spot/v1/user_fee': 6,
43542
43618
  // contract
43543
43619
  'contract/private/assets-detail': 5,
43544
- 'contract/private/order': 2,
43620
+ 'contract/private/order': 1.2,
43545
43621
  'contract/private/order-history': 10,
43546
43622
  'contract/private/position': 10,
43623
+ 'contract/private/get-open-orders': 1.2,
43624
+ 'contract/private/trades': 10,
43547
43625
  },
43548
43626
  'post': {
43549
43627
  // sub-account endpoints
@@ -43552,6 +43630,9 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
43552
43630
  'account/sub-account/main/v1/main-to-sub': 30,
43553
43631
  'account/sub-account/sub/v1/sub-to-sub': 30,
43554
43632
  'account/sub-account/main/v1/sub-to-sub': 30,
43633
+ 'account/contract/sub-account/main/v1/sub-to-main': 7.5,
43634
+ 'account/contract/sub-account/main/v1/main-to-sub': 7.5,
43635
+ 'account/contract/sub-account/sub/v1/sub-to-main': 7.5,
43555
43636
  // account
43556
43637
  'account/v1/withdraw/apply': 7.5,
43557
43638
  // transaction and trading
@@ -43575,7 +43656,14 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
43575
43656
  'spot/v1/margin/isolated/repay': 6,
43576
43657
  'spot/v1/margin/isolated/transfer': 6,
43577
43658
  // contract
43578
- 'contract/private/trades': 10,
43659
+ 'account/v1/transfer-contract-list': 60,
43660
+ 'account/v1/transfer-contract': 60,
43661
+ 'contract/private/submit-order': 2.5,
43662
+ 'contract/private/cancel-order': 1.5,
43663
+ 'contract/private/cancel-orders': 30,
43664
+ 'contract/private/submit-plan-order': 2.5,
43665
+ 'contract/private/cancel-plan-order': 1.5,
43666
+ 'contract/private/submit-leverage': 2.5,
43579
43667
  },
43580
43668
  },
43581
43669
  },
@@ -45420,6 +45508,9 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45420
45508
  }
45421
45509
  const [marginMode, query] = this.handleMarginModeAndParams('createOrder', params);
45422
45510
  if (marginMode !== undefined) {
45511
+ if (marginMode !== 'isolated') {
45512
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' only isolated margin is supported');
45513
+ }
45423
45514
  method = 'privatePostSpotV1MarginSubmitOrder';
45424
45515
  }
45425
45516
  const response = await this[method](this.extend(request, query));
@@ -46572,22 +46663,33 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
46572
46663
  'info': interest,
46573
46664
  };
46574
46665
  }
46575
- handleMarginModeAndParams(methodName, params = {}, defaultValue = undefined) {
46666
+ async setLeverage(leverage, symbol = undefined, params = {}) {
46576
46667
  /**
46577
- * @ignore
46578
46668
  * @method
46579
- * @description marginMode specified by params["marginMode"], this.options["marginMode"], this.options["defaultMarginMode"], params["margin"] = true or this.options["defaultType"] = 'margin'
46580
- * @param {object} [params] extra parameters specific to the exchange api endpoint
46581
- * @returns {array} the marginMode in lowercase
46669
+ * @name bitmart#setLeverage
46670
+ * @description set the level of leverage for a market
46671
+ * @see https://developer-pro.bitmart.com/en/futures/#submit-leverage-signed
46672
+ * @param {float} leverage the rate of leverage
46673
+ * @param {string} symbol unified market symbol
46674
+ * @param {object} [params] extra parameters specific to the bitmart api endpoint
46675
+ * @param {string} [params.marginMode] 'isolated' or 'cross'
46676
+ * @returns {object} response from the exchange
46582
46677
  */
46678
+ this.checkRequiredSymbol('setLeverage', symbol);
46583
46679
  let marginMode = undefined;
46584
- [marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
46585
- if (marginMode !== undefined) {
46586
- if (marginMode !== 'isolated') {
46587
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' only isolated margin is supported');
46588
- }
46680
+ [marginMode, params] = this.handleMarginModeAndParams('setLeverage', params);
46681
+ this.checkRequiredArgument('setLeverage', marginMode, 'marginMode', ['isolated', 'cross']);
46682
+ await this.loadMarkets();
46683
+ const market = this.market(symbol);
46684
+ if (!market['swap']) {
46685
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol(this.id + ' setLeverage() supports swap contracts only');
46589
46686
  }
46590
- return [marginMode, params];
46687
+ const request = {
46688
+ 'symbol': market['id'],
46689
+ 'leverage': leverage.toString(),
46690
+ 'open_type': marginMode,
46691
+ };
46692
+ return await this.privatePostContractPrivateSubmitLeverage(this.extend(request, params));
46591
46693
  }
46592
46694
  nonce() {
46593
46695
  return this.milliseconds();
@@ -117833,7 +117935,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
117833
117935
  type = isMarketOrder ? 'market' : 'limit';
117834
117936
  side = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringGt */ .O.stringGt(amount, '0') ? 'buy' : 'sell';
117835
117937
  }
117836
- const rawStatus = this.safeStringN(order, ['status', 'finish_as', 'open']);
117938
+ const rawStatus = this.safeStringN(order, ['finish_as', 'status', 'open']);
117837
117939
  let timestamp = this.safeInteger(order, 'create_time_ms');
117838
117940
  if (timestamp === undefined) {
117839
117941
  timestamp = this.safeTimestamp2(order, 'create_time', 'ctime');
@@ -152977,6 +153079,7 @@ class latoken extends _abstract_latoken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
152977
153079
  'defaultType': 'spot',
152978
153080
  'types': {
152979
153081
  'wallet': 'ACCOUNT_TYPE_WALLET',
153082
+ 'funding': 'ACCOUNT_TYPE_WALLET',
152980
153083
  'spot': 'ACCOUNT_TYPE_SPOT',
152981
153084
  },
152982
153085
  'accounts': {
@@ -233188,8 +233291,8 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
233188
233291
  previousOrder['status'] = state;
233189
233292
  // update the newUpdates count
233190
233293
  orders.append(previousOrder);
233191
- marketIds.push(marketId);
233192
233294
  }
233295
+ marketIds.push(marketId);
233193
233296
  }
233194
233297
  }
233195
233298
  for (let i = 0; i < marketIds.length; i++) {
@@ -233197,7 +233300,7 @@ class poloniex extends _poloniex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] *
233197
233300
  const market = this.market(marketId);
233198
233301
  const symbol = market['symbol'];
233199
233302
  const messageHash = 'orders::' + symbol;
233200
- client.resolve(orders[symbol], messageHash);
233303
+ client.resolve(orders, messageHash);
233201
233304
  }
233202
233305
  client.resolve(orders, 'orders');
233203
233306
  return message;
@@ -238283,8 +238386,8 @@ class probit extends _abstract_probit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
238283
238386
  const networkList = {};
238284
238387
  for (let j = 0; j < platformsByPriority.length; j++) {
238285
238388
  const network = platformsByPriority[j];
238286
- const id = this.safeString(network, 'id');
238287
- const networkCode = this.networkIdToCode(id);
238389
+ const networkId = this.safeString(network, 'id');
238390
+ const networkCode = this.networkIdToCode(networkId);
238288
238391
  const currentDepositSuspended = this.safeValue(network, 'deposit_suspended');
238289
238392
  const currentWithdrawalSuspended = this.safeValue(network, 'withdrawal_suspended');
238290
238393
  const currentDeposit = !currentDepositSuspended;
@@ -238297,7 +238400,7 @@ class probit extends _abstract_probit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
238297
238400
  const withdrawFee = this.safeValue(network, 'withdrawal_fee', []);
238298
238401
  const fee = this.safeValue(withdrawFee, 0, {});
238299
238402
  networkList[networkCode] = {
238300
- 'id': id,
238403
+ 'id': networkId,
238301
238404
  'network': networkCode,
238302
238405
  'active': currentActive,
238303
238406
  'deposit': currentDeposit,
@@ -273595,7 +273698,7 @@ SOFTWARE.
273595
273698
 
273596
273699
  //-----------------------------------------------------------------------------
273597
273700
  // this is updated by vss.js when building
273598
- const version = '4.0.97';
273701
+ const version = '4.0.98';
273599
273702
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
273600
273703
  //-----------------------------------------------------------------------------
273601
273704