ccxt 4.1.37 → 4.1.39

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.
@@ -38242,26 +38242,45 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
38242
38242
  'swap': false,
38243
38243
  'future': false,
38244
38244
  'option': false,
38245
+ 'addMargin': false,
38246
+ 'borrowMargin': false,
38245
38247
  'cancelOrder': true,
38246
38248
  'createOrder': true,
38249
+ 'createReduceOnlyOrder': false,
38247
38250
  'createStopLimitOrder': false,
38248
38251
  'createStopMarketOrder': false,
38249
38252
  'createStopOrder': false,
38250
38253
  'fetchBalance': true,
38254
+ 'fetchBorrowInterest': false,
38251
38255
  'fetchBorrowRate': false,
38252
38256
  'fetchBorrowRateHistories': false,
38253
38257
  'fetchBorrowRateHistory': false,
38254
38258
  'fetchBorrowRates': false,
38255
38259
  'fetchBorrowRatesPerSymbol': false,
38256
38260
  'fetchClosedOrders': true,
38261
+ 'fetchFundingHistory': false,
38262
+ 'fetchFundingRate': false,
38263
+ 'fetchFundingRateHistory': false,
38264
+ 'fetchFundingRates': false,
38265
+ 'fetchIndexOHLCV': false,
38266
+ 'fetchIsolatedPositions': false,
38267
+ 'fetchLeverage': false,
38268
+ 'fetchLeverageTiers': false,
38257
38269
  'fetchMarginMode': false,
38270
+ 'fetchMarketLeverageTiers': false,
38258
38271
  'fetchMarkets': true,
38272
+ 'fetchMarkOHLCV': false,
38259
38273
  'fetchMyTrades': true,
38260
38274
  'fetchOHLCV': true,
38275
+ 'fetchOpenInterestHistory': false,
38261
38276
  'fetchOpenOrders': true,
38262
38277
  'fetchOrder': true,
38263
38278
  'fetchOrderBook': true,
38279
+ 'fetchPosition': false,
38264
38280
  'fetchPositionMode': false,
38281
+ 'fetchPositions': false,
38282
+ 'fetchPositionsRisk': false,
38283
+ 'fetchPremiumIndexOHLCV': false,
38265
38284
  'fetchTicker': true,
38266
38285
  'fetchTickers': false,
38267
38286
  'fetchTrades': true,
@@ -38270,6 +38289,12 @@ class bitforex extends _abstract_bitforex_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
38270
38289
  'fetchTransfers': false,
38271
38290
  'fetchWithdrawal': false,
38272
38291
  'fetchWithdrawals': false,
38292
+ 'reduceMargin': false,
38293
+ 'repayMargin': false,
38294
+ 'setLeverage': false,
38295
+ 'setMargin': false,
38296
+ 'setMarginMode': false,
38297
+ 'setPositionMode': false,
38273
38298
  'transfer': false,
38274
38299
  'withdraw': false,
38275
38300
  },
@@ -74639,6 +74664,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
74639
74664
  'v5/user/query-api': 5,
74640
74665
  'v5/user/get-member-type': 5,
74641
74666
  'v5/user/aff-customer-info': 5,
74667
+ 'v5/user/del-submember': 5,
74642
74668
  // spot leverage token
74643
74669
  'v5/spot-lever-token/order-record': 1,
74644
74670
  // spot margin trade
@@ -111220,6 +111246,7 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
111220
111246
  'cancelOrder': true,
111221
111247
  'cancelOrders': true,
111222
111248
  'createOrder': true,
111249
+ 'createOrders': true,
111223
111250
  'createPostOnlyOrder': true,
111224
111251
  'createReduceOnlyOrder': true,
111225
111252
  'createStopLimitOrder': false,
@@ -111477,6 +111504,7 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
111477
111504
  'options': {
111478
111505
  'defaultType': 'spot',
111479
111506
  'types': ['spot', 'margin', 'otc'],
111507
+ 'createMarketBuyOrderRequiresPrice': true,
111480
111508
  'accountsByType': {
111481
111509
  'spot': '1',
111482
111510
  'margin': '2',
@@ -112740,28 +112768,173 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
112740
112768
  * @param {string} symbol unified symbol of the market to create an order in
112741
112769
  * @param {string} type 'market' or 'limit'
112742
112770
  * @param {string} side 'buy' or 'sell'
112743
- * @param {float} amount how much of currency you want to trade in units of base currency
112771
+ * @param {float} amount how much you want to trade in units of the base currency, spot market orders use the quote currency, swap requires the number of contracts
112744
112772
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
112745
112773
  * @param {object} [params] extra parameters specific to the digifinex api endpoint
112746
112774
  * @param {string} [params.timeInForce] "GTC", "IOC", "FOK", or "PO"
112747
112775
  * @param {bool} [params.postOnly] true or false
112748
112776
  * @param {bool} [params.reduceOnly] true or false
112777
+ * @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
112749
112778
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
112750
112779
  */
112751
112780
  await this.loadMarkets();
112752
112781
  const market = this.market(symbol);
112753
- symbol = market['symbol'];
112782
+ const marginResult = this.handleMarginModeAndParams('createOrder', params);
112783
+ const marginMode = marginResult[0];
112784
+ const request = this.createOrderRequest(symbol, type, side, amount, price, params);
112785
+ let response = undefined;
112786
+ if (market['swap']) {
112787
+ response = await this.privateSwapPostTradeOrderPlace(request);
112788
+ }
112789
+ else {
112790
+ if (marginMode !== undefined) {
112791
+ response = await this.privateSpotPostMarginOrderNew(request);
112792
+ }
112793
+ else {
112794
+ response = await this.privateSpotPostSpotOrderNew(request);
112795
+ }
112796
+ }
112797
+ //
112798
+ // spot and margin
112799
+ //
112800
+ // {
112801
+ // "code": 0,
112802
+ // "order_id": "198361cecdc65f9c8c9bb2fa68faec40"
112803
+ // }
112804
+ //
112805
+ // swap
112806
+ //
112807
+ // {
112808
+ // "code": 0,
112809
+ // "data": "1590873693003714560"
112810
+ // }
112811
+ //
112812
+ const order = this.parseOrder(response, market);
112813
+ order['symbol'] = market['symbol'];
112814
+ order['type'] = type;
112815
+ order['side'] = side;
112816
+ order['amount'] = amount;
112817
+ order['price'] = price;
112818
+ return order;
112819
+ }
112820
+ async createOrders(orders, params = {}) {
112821
+ /**
112822
+ * @method
112823
+ * @name digifinex#createOrders
112824
+ * @description create a list of trade orders (all orders should be of the same symbol)
112825
+ * @see https://docs.digifinex.com/en-ww/spot/v3/rest.html#create-multiple-order
112826
+ * @see https://docs.digifinex.com/en-ww/swap/v2/rest.html#batchorder
112827
+ * @param {array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
112828
+ * @param {object} [params] extra parameters specific to the digifinex api endpoint
112829
+ * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
112830
+ */
112831
+ await this.loadMarkets();
112832
+ const ordersRequests = [];
112833
+ let symbol = undefined;
112834
+ let marginMode = undefined;
112835
+ for (let i = 0; i < orders.length; i++) {
112836
+ const rawOrder = orders[i];
112837
+ const marketId = this.safeString(rawOrder, 'symbol');
112838
+ if (symbol === undefined) {
112839
+ symbol = marketId;
112840
+ }
112841
+ else {
112842
+ if (symbol !== marketId) {
112843
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' createOrders() requires all orders to have the same symbol');
112844
+ }
112845
+ }
112846
+ const type = this.safeString(rawOrder, 'type');
112847
+ const side = this.safeString(rawOrder, 'side');
112848
+ const amount = this.safeValue(rawOrder, 'amount');
112849
+ const price = this.safeValue(rawOrder, 'price');
112850
+ const orderParams = this.safeValue(rawOrder, 'params', {});
112851
+ const marginResult = this.handleMarginModeAndParams('createOrders', params);
112852
+ const currentMarginMode = marginResult[0];
112853
+ if (currentMarginMode !== undefined) {
112854
+ if (marginMode === undefined) {
112855
+ marginMode = currentMarginMode;
112856
+ }
112857
+ else {
112858
+ if (marginMode !== currentMarginMode) {
112859
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest(this.id + ' createOrders() requires all orders to have the same margin mode (isolated or cross)');
112860
+ }
112861
+ }
112862
+ }
112863
+ const orderRequest = this.createOrderRequest(marketId, type, side, amount, price, orderParams);
112864
+ ordersRequests.push(orderRequest);
112865
+ }
112866
+ const market = this.market(symbol);
112867
+ const request = {};
112868
+ let response = undefined;
112869
+ if (market['swap']) {
112870
+ response = await this.privateSwapPostTradeBatchOrder(ordersRequests);
112871
+ }
112872
+ else {
112873
+ request['market'] = (marginMode !== undefined) ? 'margin' : 'spot';
112874
+ request['symbol'] = market['id'];
112875
+ request['list'] = this.json(ordersRequests);
112876
+ response = await this.privateSpotPostMarketOrderBatchNew(request);
112877
+ }
112878
+ //
112879
+ // spot
112880
+ //
112881
+ // {
112882
+ // "code": 0,
112883
+ // "order_ids": [
112884
+ // "064290fbe2d26e7b28d7e6c0a5cf70a5",
112885
+ // "24c8f9b73d81e4d9d8d7e3280281c258"
112886
+ // ]
112887
+ // }
112888
+ //
112889
+ // swap
112890
+ //
112891
+ // {
112892
+ // "code": 0,
112893
+ // "data": [
112894
+ // "1720297963537829888",
112895
+ // "1720297963537829889"
112896
+ // ]
112897
+ // }
112898
+ //
112899
+ let data = [];
112900
+ if (market['swap']) {
112901
+ data = this.safeValue(response, 'data', []);
112902
+ }
112903
+ else {
112904
+ data = this.safeValue(response, 'order_ids', []);
112905
+ }
112906
+ const result = [];
112907
+ for (let i = 0; i < orders.length; i++) {
112908
+ const rawOrder = orders[i];
112909
+ const individualOrder = {};
112910
+ individualOrder['order_id'] = data[i];
112911
+ individualOrder['instrument_id'] = market['id'];
112912
+ individualOrder['amount'] = this.safeNumber(rawOrder, 'amount');
112913
+ individualOrder['price'] = this.safeNumber(rawOrder, 'price');
112914
+ result.push(individualOrder);
112915
+ }
112916
+ return this.parseOrders(result, market);
112917
+ }
112918
+ createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
112919
+ /**
112920
+ * @method
112921
+ * @ignore
112922
+ * @name digifinex#createOrderRequest
112923
+ * @description helper function to build request
112924
+ * @param {string} symbol unified symbol of the market to create an order in
112925
+ * @param {string} type 'market' or 'limit'
112926
+ * @param {string} side 'buy' or 'sell'
112927
+ * @param {float} amount how much you want to trade in units of the base currency, spot market orders use the quote currency, swap requires the number of contracts
112928
+ * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
112929
+ * @param {object} [params] extra parameters specific to the digifinex api endpoint
112930
+ * @returns {object} request to be sent to the exchange
112931
+ */
112932
+ const market = this.market(symbol);
112754
112933
  let marketType = undefined;
112755
112934
  let marginMode = undefined;
112756
- [marketType, params] = this.handleMarketTypeAndParams('createOrder', market, params);
112757
- let method = this.getSupportedMapping(marketType, {
112758
- 'spot': 'privateSpotPostSpotOrderNew',
112759
- 'margin': 'privateSpotPostMarginOrderNew',
112760
- 'swap': 'privateSwapPostTradeOrderPlace',
112761
- });
112762
- [marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
112935
+ [marketType, params] = this.handleMarketTypeAndParams('createOrderRequest', market, params);
112936
+ [marginMode, params] = this.handleMarginModeAndParams('createOrderRequest', params);
112763
112937
  if (marginMode !== undefined) {
112764
- method = 'privateSpotPostMarginOrderNew';
112765
112938
  marketType = 'margin';
112766
112939
  }
112767
112940
  const request = {};
@@ -112818,40 +112991,34 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
112818
112991
  }
112819
112992
  request['type'] = side + suffix;
112820
112993
  // limit orders require the amount in the base currency, market orders require the amount in the quote currency
112821
- request['amount'] = this.amountToPrecision(symbol, amount);
112994
+ let quantity = undefined;
112995
+ const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
112996
+ if (createMarketBuyOrderRequiresPrice && isMarketOrder && (side === 'buy')) {
112997
+ if (price === undefined) {
112998
+ 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');
112999
+ }
113000
+ else {
113001
+ const amountString = this.numberToString(amount);
113002
+ const priceString = this.numberToString(price);
113003
+ const cost = this.parseNumber(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(amountString, priceString));
113004
+ quantity = this.priceToPrecision(symbol, cost);
113005
+ }
113006
+ }
113007
+ else {
113008
+ quantity = this.amountToPrecision(symbol, amount);
113009
+ }
113010
+ request['amount'] = quantity;
112822
113011
  }
112823
113012
  if (postOnly) {
112824
113013
  if (postOnlyParsed) {
112825
- request['postOnly'] = postOnlyParsed;
113014
+ request['post_only'] = postOnlyParsed;
112826
113015
  }
112827
113016
  else {
112828
- request['postOnly'] = postOnly;
113017
+ request['post_only'] = postOnly;
112829
113018
  }
112830
113019
  }
112831
- const query = this.omit(params, ['postOnly', 'post_only']);
112832
- const response = await this[method](this.extend(request, query));
112833
- //
112834
- // spot and margin
112835
- //
112836
- // {
112837
- // "code": 0,
112838
- // "order_id": "198361cecdc65f9c8c9bb2fa68faec40"
112839
- // }
112840
- //
112841
- // swap
112842
- //
112843
- // {
112844
- // "code": 0,
112845
- // "data": "1590873693003714560"
112846
- // }
112847
- //
112848
- const order = this.parseOrder(response, market);
112849
- order['symbol'] = symbol;
112850
- order['type'] = type;
112851
- order['side'] = side;
112852
- order['amount'] = amount;
112853
- order['price'] = price;
112854
- return order;
113020
+ params = this.omit(params, ['postOnly']);
113021
+ return this.extend(request, params);
112855
113022
  }
112856
113023
  async cancelOrder(id, symbol = undefined, params = {}) {
112857
113024
  /**
@@ -112988,6 +113155,15 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
112988
113155
  // "data": "1590873693003714560"
112989
113156
  // }
112990
113157
  //
113158
+ // spot and swap: createOrders
113159
+ //
113160
+ // {
113161
+ // "order_id": "d64d92a5e0a120f792f385485bc3d95b",
113162
+ // "instrument_id": "BTC_USDT",
113163
+ // "amount": 0.0001,
113164
+ // "price": 27000
113165
+ // }
113166
+ //
112991
113167
  // spot: fetchOrder, fetchOpenOrders, fetchOrders
112992
113168
  //
112993
113169
  // {
@@ -113033,24 +113209,26 @@ class digifinex extends _abstract_digifinex_js__WEBPACK_IMPORTED_MODULE_0__/* ["
113033
113209
  let type = undefined;
113034
113210
  let side = this.safeString(order, 'type');
113035
113211
  const marketId = this.safeString2(order, 'symbol', 'instrument_id');
113036
- const symbol = this.safeSymbol(marketId, market, '_');
113212
+ const symbol = this.safeSymbol(marketId, market);
113037
113213
  market = this.market(symbol);
113038
113214
  if (market['type'] === 'swap') {
113039
113215
  const orderType = this.safeInteger(order, 'order_type');
113040
- if ((orderType === 9) || (orderType === 10) || (orderType === 11) || (orderType === 12) || (orderType === 15)) {
113041
- timeInForce = 'FOK';
113042
- }
113043
- else if ((orderType === 1) || (orderType === 2) || (orderType === 3) || (orderType === 4) || (orderType === 13)) {
113044
- timeInForce = 'IOC';
113045
- }
113046
- else if ((orderType === 6) || (orderType === 7) || (orderType === 8) || (orderType === 14)) {
113047
- timeInForce = 'GTC';
113048
- }
113049
- if ((orderType === 0) || (orderType === 1) || (orderType === 4) || (orderType === 5) || (orderType === 9) || (orderType === 10)) {
113050
- type = 'limit';
113051
- }
113052
- else {
113053
- type = 'market';
113216
+ if (orderType !== undefined) {
113217
+ if ((orderType === 9) || (orderType === 10) || (orderType === 11) || (orderType === 12) || (orderType === 15)) {
113218
+ timeInForce = 'FOK';
113219
+ }
113220
+ else if ((orderType === 1) || (orderType === 2) || (orderType === 3) || (orderType === 4) || (orderType === 13)) {
113221
+ timeInForce = 'IOC';
113222
+ }
113223
+ else if ((orderType === 6) || (orderType === 7) || (orderType === 8) || (orderType === 14)) {
113224
+ timeInForce = 'GTC';
113225
+ }
113226
+ if ((orderType === 0) || (orderType === 1) || (orderType === 4) || (orderType === 5) || (orderType === 9) || (orderType === 10)) {
113227
+ type = 'limit';
113228
+ }
113229
+ else {
113230
+ type = 'market';
113231
+ }
113054
113232
  }
113055
113233
  if (side === '1') {
113056
113234
  side = 'open long';
@@ -136372,6 +136550,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
136372
136550
  * @param {string} [params.offset] *contract only* 'open', 'close', or 'both', required in hedge mode
136373
136551
  * @param {bool} [params.postOnly] *contract only* true or false
136374
136552
  * @param {int} [params.leverRate] *contract only* required for all contract orders except tpsl, leverage greater than 20x requires prior approval of high-leverage agreement
136553
+ * @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
136375
136554
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
136376
136555
  */
136377
136556
  await this.loadMarkets();
@@ -136444,6 +136623,13 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
136444
136623
  if (postOnly) {
136445
136624
  orderType = 'limit-maker';
136446
136625
  }
136626
+ const timeInForce = this.safeString(params, 'timeInForce', 'GTC');
136627
+ if (timeInForce === 'FOK') {
136628
+ orderType = orderType + '-fok';
136629
+ }
136630
+ else if (timeInForce === 'IOC') {
136631
+ orderType = 'ioc';
136632
+ }
136447
136633
  request['type'] = side + '-' + orderType;
136448
136634
  const clientOrderId = this.safeString2(params, 'clientOrderId', 'client-order-id'); // must be 64 chars max and unique within 24 hours
136449
136635
  if (clientOrderId === undefined) {
@@ -136491,7 +136677,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
136491
136677
  if (orderType in limitOrderTypes) {
136492
136678
  request['price'] = this.priceToPrecision(symbol, price);
136493
136679
  }
136494
- params = this.omit(params, ['stopPrice', 'stop-price', 'clientOrderId', 'client-order-id', 'operator']);
136680
+ params = this.omit(params, ['stopPrice', 'stop-price', 'clientOrderId', 'client-order-id', 'operator', 'timeInForce']);
136495
136681
  const response = await this.spotPrivatePostV1OrderOrdersPlace(this.extend(request, params));
136496
136682
  //
136497
136683
  // spot
@@ -136536,6 +136722,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
136536
136722
  * @param {float} amount how much of currency you want to trade in units of base currency
136537
136723
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
136538
136724
  * @param {object} params extra parameters specific to the huobi api endpoint
136725
+ * @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
136539
136726
  * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
136540
136727
  */
136541
136728
  const market = this.market(symbol);
@@ -136549,6 +136736,13 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
136549
136736
  if (postOnly) {
136550
136737
  type = 'post_only';
136551
136738
  }
136739
+ const timeInForce = this.safeString(params, 'timeInForce', 'GTC');
136740
+ if (timeInForce === 'FOK') {
136741
+ type = 'fok';
136742
+ }
136743
+ else if (timeInForce === 'IOC') {
136744
+ type = 'ioc';
136745
+ }
136552
136746
  const triggerPrice = this.safeNumber2(params, 'stopPrice', 'trigger_price');
136553
136747
  const stopLossTriggerPrice = this.safeNumber2(params, 'stopLossPrice', 'sl_trigger_price');
136554
136748
  const takeProfitTriggerPrice = this.safeNumber2(params, 'takeProfitPrice', 'tp_trigger_price');
@@ -136601,7 +136795,7 @@ class huobi extends _abstract_huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
136601
136795
  request['lever_rate'] = leverRate;
136602
136796
  request['order_price_type'] = type;
136603
136797
  }
136604
- params = this.omit(params, ['reduceOnly', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerType', 'leverRate']);
136798
+ params = this.omit(params, ['reduceOnly', 'stopPrice', 'stopLossPrice', 'takeProfitPrice', 'triggerType', 'leverRate', 'timeInForce']);
136605
136799
  const broker = this.safeValue(this.options, 'broker', {});
136606
136800
  const brokerId = this.safeString(broker, 'id');
136607
136801
  request['channel_code'] = brokerId;
@@ -148405,6 +148599,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
148405
148599
  'api': {
148406
148600
  'public': {
148407
148601
  'get': [
148602
+ 'feeschedules',
148408
148603
  'instruments',
148409
148604
  'orderbook',
148410
148605
  'tickers',
@@ -148414,6 +148609,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
148414
148609
  },
148415
148610
  'private': {
148416
148611
  'get': [
148612
+ 'feeschedules/volumes',
148417
148613
  'openpositions',
148418
148614
  'notifications',
148419
148615
  'accounts',
@@ -148454,11 +148650,6 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
148454
148650
  'market/{symbol}/executions',
148455
148651
  ],
148456
148652
  },
148457
- 'feeschedules': {
148458
- 'get': [
148459
- 'volumes',
148460
- ],
148461
- },
148462
148653
  },
148463
148654
  'fees': {
148464
148655
  'trading': {
@@ -170766,16 +170957,16 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
170766
170957
  await this.loadMarkets();
170767
170958
  const request = {};
170768
170959
  let market = undefined;
170960
+ let marketType = undefined;
170769
170961
  if (symbol !== undefined) {
170770
170962
  market = this.market(symbol);
170771
- request['symbol'] = market['id'];
170772
170963
  }
170773
- let marketType = undefined;
170774
170964
  [marketType, params] = this.handleMarketTypeAndParams('fetchOpenOrders', market, params);
170775
170965
  if (marketType === 'spot') {
170776
170966
  if (symbol === undefined) {
170777
170967
  throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchOpenOrders() requires a symbol argument for spot market');
170778
170968
  }
170969
+ request['symbol'] = market['id'];
170779
170970
  let method = 'spotPrivateGetOpenOrders';
170780
170971
  const [marginMode, query] = this.handleMarginModeAndParams('fetchOpenOrders', params);
170781
170972
  if (marginMode !== undefined) {
@@ -170872,7 +171063,6 @@ class mexc extends _abstract_mexc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
170872
171063
  let market = undefined;
170873
171064
  if (symbol !== undefined) {
170874
171065
  market = this.market(symbol);
170875
- request['symbol'] = market['id'];
170876
171066
  }
170877
171067
  const [marketType] = this.handleMarketTypeAndParams('fetchOrdersByState', market, params);
170878
171068
  if (marketType === 'spot') {
@@ -191178,6 +191368,9 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
191178
191368
  'Filled': 'closed',
191179
191369
  'Canceled': 'canceled',
191180
191370
  '1': 'open',
191371
+ '2': 'canceled',
191372
+ '3': 'closed',
191373
+ '4': 'canceled',
191181
191374
  '5': 'open',
191182
191375
  '6': 'open',
191183
191376
  '7': 'closed',
@@ -199513,13 +199706,19 @@ class bequant extends _hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .
199513
199706
  /* harmony import */ var _base_Precise_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(2194);
199514
199707
  /* harmony import */ var _base_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(6689);
199515
199708
  /* harmony import */ var _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3020);
199516
- /* harmony import */ var _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1372);
199709
+ /* harmony import */ var _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(1372);
199710
+ /* harmony import */ var _base_functions_rsa_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(5981);
199711
+ /* harmony import */ var _base_functions_crypto_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(6890);
199712
+ /* harmony import */ var _static_dependencies_noble_curves_ed25519_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(8817);
199517
199713
  // ----------------------------------------------------------------------------
199518
199714
 
199519
199715
 
199520
199716
 
199521
199717
 
199522
199718
 
199719
+
199720
+
199721
+
199523
199722
  // -----------------------------------------------------------------------------
199524
199723
  class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
199525
199724
  describe() {
@@ -200726,7 +200925,20 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
200726
200925
  params['recvWindow'] = recvWindow;
200727
200926
  }
200728
200927
  extendedParams = this.keysort(extendedParams);
200729
- extendedParams['signature'] = this.hmac(this.encode(this.urlencode(extendedParams)), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__/* .sha256 */ .J);
200928
+ const query = this.urlencode(extendedParams);
200929
+ let signature = undefined;
200930
+ if (this.secret.indexOf('PRIVATE KEY') > -1) {
200931
+ if (this.secret.length > 120) {
200932
+ signature = (0,_base_functions_rsa_js__WEBPACK_IMPORTED_MODULE_4__/* .rsa */ .j)(query, this.secret, _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_5__/* .sha256 */ .J);
200933
+ }
200934
+ else {
200935
+ signature = (0,_base_functions_crypto_js__WEBPACK_IMPORTED_MODULE_6__/* .eddsa */ .UZ)(this.encode(query), this.secret, _static_dependencies_noble_curves_ed25519_js__WEBPACK_IMPORTED_MODULE_7__/* .ed25519 */ .UN);
200936
+ }
200937
+ }
200938
+ else {
200939
+ signature = this.hmac(this.encode(query), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_5__/* .sha256 */ .J);
200940
+ }
200941
+ extendedParams['signature'] = signature;
200730
200942
  return extendedParams;
200731
200943
  }
200732
200944
  async authenticate(params = {}) {
@@ -202045,6 +202257,15 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
202045
202257
  }
202046
202258
  }
202047
202259
  handleWsError(client, message) {
202260
+ //
202261
+ // {
202262
+ // "error": {
202263
+ // "code": 2,
202264
+ // "msg": "Invalid request: invalid stream"
202265
+ // },
202266
+ // "id": 1
202267
+ // }
202268
+ //
202048
202269
  const id = this.safeString(message, 'id');
202049
202270
  let rejected = false;
202050
202271
  const error = this.safeValue(message, 'error', {});
@@ -202055,7 +202276,17 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
202055
202276
  }
202056
202277
  catch (e) {
202057
202278
  rejected = true;
202279
+ // private endpoint uses id as messageHash
202058
202280
  client.reject(e, id);
202281
+ // public endpoint stores messageHash in subscriptios
202282
+ const subscriptionKeys = Object.keys(client.subscriptions);
202283
+ for (let i = 0; i < subscriptionKeys.length; i++) {
202284
+ const subscriptionHash = subscriptionKeys[i];
202285
+ const subscriptionId = this.safeString(client.subscriptions[subscriptionHash], 'id');
202286
+ if (id === subscriptionId) {
202287
+ client.reject(e, subscriptionHash);
202288
+ }
202289
+ }
202059
202290
  }
202060
202291
  if (!rejected) {
202061
202292
  client.reject(message, id);
@@ -202068,7 +202299,8 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
202068
202299
  handleMessage(client, message) {
202069
202300
  // handle WebSocketAPI
202070
202301
  const status = this.safeString(message, 'status');
202071
- if (status !== undefined && status !== '200') {
202302
+ const error = this.safeValue(message, 'error');
202303
+ if ((error !== undefined) || (status !== undefined && status !== '200')) {
202072
202304
  return this.handleWsError(client, message);
202073
202305
  }
202074
202306
  const id = this.safeString(message, 'id');
@@ -205806,6 +206038,9 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
205806
206038
  /**
205807
206039
  * @method
205808
206040
  * @name bitget#watchOrders
206041
+ * @see https://bitgetlimited.github.io/apidoc/en/spot/#order-channel
206042
+ * @see https://bitgetlimited.github.io/apidoc/en/mix/#order-channel
206043
+ * @see https://bitgetlimited.github.io/apidoc/en/mix/#plan-order-channel
205809
206044
  * @description watches information on multiple orders made by the user
205810
206045
  * @param {string} symbol unified market symbol of the market orders were made in
205811
206046
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -205816,7 +206051,9 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
205816
206051
  await this.loadMarkets();
205817
206052
  let market = undefined;
205818
206053
  let marketId = undefined;
205819
- let messageHash = 'order';
206054
+ const isStop = this.safeValue(params, 'stop', false);
206055
+ params = this.omit(params, 'stop');
206056
+ let messageHash = (isStop) ? 'triggerOrder' : 'order';
205820
206057
  let subscriptionHash = 'order:trades';
205821
206058
  if (symbol !== undefined) {
205822
206059
  market = this.market(symbol);
@@ -205824,8 +206061,6 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
205824
206061
  marketId = market['id'];
205825
206062
  messageHash = messageHash + ':' + symbol;
205826
206063
  }
205827
- const isStop = this.safeValue(params, 'stop', false);
205828
- params = this.omit(params, 'stop');
205829
206064
  let type = undefined;
205830
206065
  [type, params] = this.handleMarketTypeAndParams('watchOrders', market, params);
205831
206066
  if ((type === 'spot') && (symbol === undefined)) {
@@ -205848,6 +206083,9 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
205848
206083
  instType = 'SUMCBL';
205849
206084
  }
205850
206085
  }
206086
+ if (isStop) {
206087
+ subscriptionHash = subscriptionHash + ':stop'; // we don't want to re-use the same subscription hash for stop orders
206088
+ }
205851
206089
  const instId = (type === 'spot') ? marketId : 'default'; // different from other streams here the 'rest' id is required for spot markets, contract markets require default here
205852
206090
  const channel = isStop ? 'ordersAlgo' : 'orders';
205853
206091
  const args = {
@@ -205889,7 +206127,42 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
205889
206127
  // ]
205890
206128
  // }
205891
206129
  //
206130
+ // {
206131
+ // action: 'snapshot',
206132
+ // arg: { instType: 'umcbl', channel: 'ordersAlgo', instId: 'default' },
206133
+ // data: [
206134
+ // {
206135
+ // actualPx: '55.000000000',
206136
+ // actualSz: '0.000000000',
206137
+ // cOid: '1104372235724890112',
206138
+ // cTime: '1699028779917',
206139
+ // eps: 'web',
206140
+ // hM: 'double_hold',
206141
+ // id: '1104372235724890113',
206142
+ // instId: 'BTCUSDT_UMCBL',
206143
+ // key: '1104372235724890113',
206144
+ // ordPx: '55.000000000',
206145
+ // ordType: 'limit',
206146
+ // planType: 'pl',
206147
+ // posSide: 'long',
206148
+ // side: 'buy',
206149
+ // state: 'not_trigger',
206150
+ // sz: '3.557000000',
206151
+ // tS: 'open_long',
206152
+ // tgtCcy: 'USDT',
206153
+ // triggerPx: '55.000000000',
206154
+ // triggerPxType: 'last',
206155
+ // triggerTime: '1699028779917',
206156
+ // uTime: '1699028779917',
206157
+ // userId: '3704614084',
206158
+ // version: 1104372235586478100
206159
+ // }
206160
+ // ],
206161
+ // ts: 1699028780327
206162
+ // }
206163
+ //
205892
206164
  const arg = this.safeValue(message, 'arg', {});
206165
+ const channel = this.safeString(arg, 'channel');
205893
206166
  const instType = this.safeString(arg, 'instType');
205894
206167
  const sandboxMode = this.safeValue(this.options, 'sandboxMode', false);
205895
206168
  const isContractUpdate = (!sandboxMode) ? (instType === 'umcbl') : (instType === 'sumcbl');
@@ -205897,8 +206170,10 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
205897
206170
  if (this.orders === undefined) {
205898
206171
  const limit = this.safeInteger(this.options, 'ordersLimit', 1000);
205899
206172
  this.orders = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_2__/* .ArrayCacheBySymbolById */ .hl(limit);
206173
+ this.triggerOrders = new _base_ws_Cache_js__WEBPACK_IMPORTED_MODULE_2__/* .ArrayCacheBySymbolById */ .hl(limit);
205900
206174
  }
205901
- const stored = this.orders;
206175
+ const stored = (channel === 'ordersAlgo') ? this.triggerOrders : this.orders;
206176
+ const messageHash = (channel === 'ordersAlgo') ? 'triggerOrder' : 'order';
205902
206177
  const marketSymbols = {};
205903
206178
  for (let i = 0; i < data.length; i++) {
205904
206179
  const order = data[i];
@@ -205915,10 +206190,10 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
205915
206190
  const keys = Object.keys(marketSymbols);
205916
206191
  for (let i = 0; i < keys.length; i++) {
205917
206192
  const symbol = keys[i];
205918
- const messageHash = 'order:' + symbol;
205919
- client.resolve(stored, messageHash);
206193
+ const innerMessageHash = messageHash + ':' + symbol;
206194
+ client.resolve(stored, innerMessageHash);
205920
206195
  }
205921
- client.resolve(stored, 'order');
206196
+ client.resolve(stored, messageHash);
205922
206197
  }
205923
206198
  parseWsOrder(order, market = undefined) {
205924
206199
  //
@@ -265957,14 +266232,23 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
265957
266232
  'swap': false,
265958
266233
  'future': false,
265959
266234
  'option': false,
266235
+ 'addMargin': false,
266236
+ 'borrowMargin': false,
265960
266237
  'cancelAllOrders': true,
265961
266238
  'cancelOrder': true,
265962
266239
  'createOrder': true,
266240
+ 'createReduceOnlyOrder': false,
265963
266241
  'createStopLimitOrder': true,
265964
266242
  'createStopMarketOrder': true,
265965
266243
  'createStopOrder': true,
265966
266244
  'fetchBalance': true,
265967
266245
  'fetchBidsAsks': false,
266246
+ 'fetchBorrowInterest': false,
266247
+ 'fetchBorrowRate': false,
266248
+ 'fetchBorrowRateHistories': false,
266249
+ 'fetchBorrowRateHistory': false,
266250
+ 'fetchBorrowRates': false,
266251
+ 'fetchBorrowRatesPerSymbol': false,
265968
266252
  'fetchClosedOrders': false,
265969
266253
  'fetchCurrencies': false,
265970
266254
  'fetchDepositAddress': false,
@@ -265976,7 +266260,11 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
265976
266260
  'fetchFundingRateHistory': false,
265977
266261
  'fetchFundingRates': false,
265978
266262
  'fetchIndexOHLCV': false,
266263
+ 'fetchIsolatedPositions': false,
266264
+ 'fetchLeverage': false,
266265
+ 'fetchLeverageTiers': false,
265979
266266
  'fetchMarginMode': false,
266267
+ 'fetchMarketLeverageTiers': false,
265980
266268
  'fetchMarkets': true,
265981
266269
  'fetchMarkOHLCV': false,
265982
266270
  'fetchMyTrades': false,
@@ -265986,7 +266274,10 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
265986
266274
  'fetchOrder': false,
265987
266275
  'fetchOrderBook': true,
265988
266276
  'fetchOrders': true,
266277
+ 'fetchPosition': false,
265989
266278
  'fetchPositionMode': false,
266279
+ 'fetchPositions': false,
266280
+ 'fetchPositionsRisk': false,
265990
266281
  'fetchPremiumIndexOHLCV': false,
265991
266282
  'fetchStatus': true,
265992
266283
  'fetchTicker': true,
@@ -265999,6 +266290,12 @@ class wazirx extends _abstract_wazirx_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
265999
266290
  'fetchTransactions': false,
266000
266291
  'fetchTransfers': false,
266001
266292
  'fetchWithdrawals': false,
266293
+ 'reduceMargin': false,
266294
+ 'repayMargin': false,
266295
+ 'setLeverage': false,
266296
+ 'setMargin': false,
266297
+ 'setMarginMode': false,
266298
+ 'setPositionMode': false,
266002
266299
  'transfer': false,
266003
266300
  'withdraw': false,
266004
266301
  },
@@ -281318,7 +281615,7 @@ SOFTWARE.
281318
281615
 
281319
281616
  //-----------------------------------------------------------------------------
281320
281617
  // this is updated by vss.js when building
281321
- const version = '4.1.37';
281618
+ const version = '4.1.39';
281322
281619
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
281323
281620
  //-----------------------------------------------------------------------------
281324
281621