ccxt 4.3.36 → 4.3.38

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/dist/cjs/ccxt.js CHANGED
@@ -185,7 +185,7 @@ var woofipro$1 = require('./src/pro/woofipro.js');
185
185
 
186
186
  //-----------------------------------------------------------------------------
187
187
  // this is updated by vss.js when building
188
- const version = '4.3.36';
188
+ const version = '4.3.38';
189
189
  Exchange["default"].ccxtVersion = version;
190
190
  const exchanges = {
191
191
  'ace': ace,
@@ -2733,7 +2733,9 @@ class bingx extends bingx$1 {
2733
2733
  else {
2734
2734
  throw new errors.BadRequest(this.id + ' cancelAllOrders is only supported for spot and swap markets.');
2735
2735
  }
2736
- return response;
2736
+ const data = this.safeDict(response, 'data', {});
2737
+ const orders = this.safeList2(data, 'success', 'orders', []);
2738
+ return this.parseOrders(orders);
2737
2739
  }
2738
2740
  async cancelOrders(ids, symbol = undefined, params = {}) {
2739
2741
  /**
@@ -2774,6 +2776,32 @@ class bingx extends bingx$1 {
2774
2776
  const spotReqKey = areClientOrderIds ? 'clientOrderIDs' : 'orderIds';
2775
2777
  request[spotReqKey] = parsedIds.join(',');
2776
2778
  response = await this.spotV1PrivatePostTradeCancelOrders(this.extend(request, params));
2779
+ //
2780
+ // {
2781
+ // "code": 0,
2782
+ // "msg": "",
2783
+ // "debugMsg": "",
2784
+ // "data": {
2785
+ // "orders": [
2786
+ // {
2787
+ // "symbol": "SOL-USDT",
2788
+ // "orderId": 1795970045910614016,
2789
+ // "transactTime": 1717027601111,
2790
+ // "price": "180.25",
2791
+ // "stopPrice": "0",
2792
+ // "origQty": "0.03",
2793
+ // "executedQty": "0",
2794
+ // "cummulativeQuoteQty": "0",
2795
+ // "status": "CANCELED",
2796
+ // "type": "LIMIT",
2797
+ // "side": "SELL",
2798
+ // "clientOrderID": ""
2799
+ // },
2800
+ // ...
2801
+ // ]
2802
+ // }
2803
+ // }
2804
+ //
2777
2805
  }
2778
2806
  else {
2779
2807
  if (areClientOrderIds) {
@@ -2783,37 +2811,39 @@ class bingx extends bingx$1 {
2783
2811
  request['orderIdList'] = parsedIds;
2784
2812
  }
2785
2813
  response = await this.swapV2PrivateDeleteTradeBatchOrders(this.extend(request, params));
2814
+ //
2815
+ // {
2816
+ // "code": 0,
2817
+ // "msg": "",
2818
+ // "data": {
2819
+ // "success": [
2820
+ // {
2821
+ // "symbol": "LINK-USDT",
2822
+ // "orderId": 1597783850786750464,
2823
+ // "side": "BUY",
2824
+ // "positionSide": "LONG",
2825
+ // "type": "TRIGGER_MARKET",
2826
+ // "origQty": "5.0",
2827
+ // "price": "5.5710",
2828
+ // "executedQty": "0.0",
2829
+ // "avgPrice": "0.0000",
2830
+ // "cumQuote": "0",
2831
+ // "stopPrice": "5.0000",
2832
+ // "profit": "0.0000",
2833
+ // "commission": "0.000000",
2834
+ // "status": "CANCELLED",
2835
+ // "time": 1669776330000,
2836
+ // "updateTime": 1672370837000
2837
+ // }
2838
+ // ],
2839
+ // "failed": null
2840
+ // }
2841
+ // }
2842
+ //
2786
2843
  }
2787
- //
2788
- // {
2789
- // "code": 0,
2790
- // "msg": "",
2791
- // "data": {
2792
- // "success": [
2793
- // {
2794
- // "symbol": "LINK-USDT",
2795
- // "orderId": 1597783850786750464,
2796
- // "side": "BUY",
2797
- // "positionSide": "LONG",
2798
- // "type": "TRIGGER_MARKET",
2799
- // "origQty": "5.0",
2800
- // "price": "5.5710",
2801
- // "executedQty": "0.0",
2802
- // "avgPrice": "0.0000",
2803
- // "cumQuote": "0",
2804
- // "stopPrice": "5.0000",
2805
- // "profit": "0.0000",
2806
- // "commission": "0.000000",
2807
- // "status": "CANCELLED",
2808
- // "time": 1669776330000,
2809
- // "updateTime": 1672370837000
2810
- // }
2811
- // ],
2812
- // "failed": null
2813
- // }
2814
- // }
2815
- //
2816
- return response;
2844
+ const data = this.safeDict(response, 'data', {});
2845
+ const success = this.safeList2(data, 'success', 'orders', []);
2846
+ return this.parseOrders(success);
2817
2847
  }
2818
2848
  async cancelAllOrdersAfter(timeout, params = {}) {
2819
2849
  /**
@@ -685,8 +685,31 @@ class bitbank extends bitbank$1 {
685
685
  'pair': market['id'],
686
686
  };
687
687
  const response = await this.privatePostUserSpotCancelOrder(this.extend(request, params));
688
+ //
689
+ // {
690
+ // "success": 1,
691
+ // "data": {
692
+ // "order_id": 0,
693
+ // "pair": "string",
694
+ // "side": "string",
695
+ // "type": "string",
696
+ // "start_amount": "string",
697
+ // "remaining_amount": "string",
698
+ // "executed_amount": "string",
699
+ // "price": "string",
700
+ // "post_only": false,
701
+ // "average_price": "string",
702
+ // "ordered_at": 0,
703
+ // "expire_at": 0,
704
+ // "canceled_at": 0,
705
+ // "triggered_at": 0,
706
+ // "trigger_price": "string",
707
+ // "status": "string"
708
+ // }
709
+ // }
710
+ //
688
711
  const data = this.safeValue(response, 'data');
689
- return data;
712
+ return this.parseOrder(data);
690
713
  }
691
714
  async fetchOrder(id, symbol = undefined, params = {}) {
692
715
  /**
@@ -705,6 +728,28 @@ class bitbank extends bitbank$1 {
705
728
  'pair': market['id'],
706
729
  };
707
730
  const response = await this.privateGetUserSpotOrder(this.extend(request, params));
731
+ //
732
+ // {
733
+ // "success": 1,
734
+ // "data": {
735
+ // "order_id": 0,
736
+ // "pair": "string",
737
+ // "side": "string",
738
+ // "type": "string",
739
+ // "start_amount": "string",
740
+ // "remaining_amount": "string",
741
+ // "executed_amount": "string",
742
+ // "price": "string",
743
+ // "post_only": false,
744
+ // "average_price": "string",
745
+ // "ordered_at": 0,
746
+ // "expire_at": 0,
747
+ // "triggered_at": 0,
748
+ // "triger_price": "string",
749
+ // "status": "string"
750
+ // }
751
+ // }
752
+ //
708
753
  const data = this.safeDict(response, 'data');
709
754
  return this.parseOrder(data, market);
710
755
  }
@@ -1182,9 +1182,9 @@ class bitmart extends bitmart$1 {
1182
1182
  market = this.safeMarket(marketId, market);
1183
1183
  const symbol = market['symbol'];
1184
1184
  const last = this.safeString2(ticker, 'close_24h', 'last_price');
1185
- let percentage = Precise["default"].stringAbs(this.safeString(ticker, 'price_change_percent_24h'));
1185
+ let percentage = this.safeString(ticker, 'price_change_percent_24h');
1186
1186
  if (percentage === undefined) {
1187
- percentage = Precise["default"].stringAbs(Precise["default"].stringMul(this.safeString(ticker, 'fluctuation'), '100'));
1187
+ percentage = Precise["default"].stringMul(this.safeString(ticker, 'fluctuation'), '100');
1188
1188
  }
1189
1189
  let baseVolume = this.safeString(ticker, 'base_volume_24h');
1190
1190
  let quoteVolume = this.safeString(ticker, 'quote_volume_24h');
@@ -1438,13 +1438,13 @@ class bitmart extends bitmart$1 {
1438
1438
  //
1439
1439
  // public fetchTrades spot ( amount = count * price )
1440
1440
  //
1441
- // {
1442
- // "amount": "818.94",
1443
- // "order_time": "1637601839035", // ETH/USDT
1444
- // "price": "4221.99",
1445
- // "count": "0.19397",
1446
- // "type": "buy"
1447
- // }
1441
+ // [
1442
+ // "BTC_USDT", // symbol
1443
+ // "1717212457302", // timestamp
1444
+ // "67643.11", // price
1445
+ // "0.00106", // size
1446
+ // "sell" // side
1447
+ // ]
1448
1448
  //
1449
1449
  // spot: fetchMyTrades
1450
1450
  //
@@ -1491,16 +1491,17 @@ class bitmart extends bitmart$1 {
1491
1491
  // 'lastTradeID': 6802340762
1492
1492
  // }
1493
1493
  //
1494
- const timestamp = this.safeIntegerN(trade, ['order_time', 'createTime', 'create_time']);
1495
- const isPublicTrade = ('order_time' in trade);
1494
+ const timestamp = this.safeIntegerN(trade, ['createTime', 'create_time', 1]);
1495
+ const isPublic = this.safeString(trade, 0);
1496
+ const isPublicTrade = (isPublic !== undefined);
1496
1497
  let amount = undefined;
1497
1498
  let cost = undefined;
1498
1499
  let type = undefined;
1499
1500
  let side = undefined;
1500
1501
  if (isPublicTrade) {
1501
- amount = this.safeString(trade, 'count');
1502
+ amount = this.safeString2(trade, 'count', 3);
1502
1503
  cost = this.safeString(trade, 'amount');
1503
- side = this.safeString(trade, 'type');
1504
+ side = this.safeString2(trade, 'type', 4);
1504
1505
  }
1505
1506
  else {
1506
1507
  amount = this.safeStringN(trade, ['size', 'vol', 'fillQty']);
@@ -1508,7 +1509,7 @@ class bitmart extends bitmart$1 {
1508
1509
  type = this.safeString(trade, 'type');
1509
1510
  side = this.parseOrderSide(this.safeString(trade, 'side'));
1510
1511
  }
1511
- const marketId = this.safeString(trade, 'symbol');
1512
+ const marketId = this.safeString2(trade, 'symbol', 0);
1512
1513
  market = this.safeMarket(marketId, market);
1513
1514
  const feeCostString = this.safeString2(trade, 'fee', 'paid_fees');
1514
1515
  let fee = undefined;
@@ -1532,7 +1533,7 @@ class bitmart extends bitmart$1 {
1532
1533
  'symbol': market['symbol'],
1533
1534
  'type': type,
1534
1535
  'side': side,
1535
- 'price': this.safeString2(trade, 'price', 'fillPrice'),
1536
+ 'price': this.safeStringN(trade, ['price', 'fillPrice', 2]),
1536
1537
  'amount': amount,
1537
1538
  'cost': cost,
1538
1539
  'takerOrMaker': this.safeStringLower2(trade, 'tradeRole', 'exec_type'),
@@ -1543,10 +1544,11 @@ class bitmart extends bitmart$1 {
1543
1544
  /**
1544
1545
  * @method
1545
1546
  * @name bitmart#fetchTrades
1546
- * @description get the list of most recent trades for a particular symbol
1547
+ * @description get a list of the most recent trades for a particular symbol
1548
+ * @see https://developer-pro.bitmart.com/en/spot/#get-recent-trades-v3
1547
1549
  * @param {string} symbol unified symbol of the market to fetch trades for
1548
1550
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
1549
- * @param {int} [limit] the maximum amount of trades to fetch
1551
+ * @param {int} [limit] the maximum number of trades to fetch
1550
1552
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1551
1553
  * @returns {Trade[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=public-trades}
1552
1554
  */
@@ -1558,30 +1560,28 @@ class bitmart extends bitmart$1 {
1558
1560
  const request = {
1559
1561
  'symbol': market['id'],
1560
1562
  };
1561
- const response = await this.publicGetSpotV1SymbolsTrades(this.extend(request, params));
1562
- //
1563
- // spot
1563
+ if (limit !== undefined) {
1564
+ request['limit'] = limit;
1565
+ }
1566
+ const response = await this.publicGetSpotQuotationV3Trades(this.extend(request, params));
1564
1567
  //
1565
1568
  // {
1566
- // "message":"OK",
1567
- // "code":1000,
1568
- // "trace":"222d74c0-8f6d-49d9-8e1b-98118c50eeba",
1569
- // "data":{
1570
- // "trades":[
1571
- // {
1572
- // "amount":"0.005703",
1573
- // "order_time":1599652045394,
1574
- // "price":"0.034029",
1575
- // "count":"0.1676",
1576
- // "type":"sell"
1577
- // },
1578
- // ]
1579
- // }
1569
+ // "code": 1000,
1570
+ // "trace": "58031f9a5bd.111.17117",
1571
+ // "message": "success",
1572
+ // "data": [
1573
+ // [
1574
+ // "BTC_USDT",
1575
+ // "1717212457302",
1576
+ // "67643.11",
1577
+ // "0.00106",
1578
+ // "sell"
1579
+ // ],
1580
+ // ]
1580
1581
  // }
1581
1582
  //
1582
- const data = this.safeValue(response, 'data', {});
1583
- const trades = this.safeList(data, 'trades', []);
1584
- return this.parseTrades(trades, market, since, limit);
1583
+ const data = this.safeList(response, 'data', []);
1584
+ return this.parseTrades(data, market, since, limit);
1585
1585
  }
1586
1586
  parseOHLCV(ohlcv, market = undefined) {
1587
1587
  //
@@ -428,7 +428,13 @@ class bl3p extends bl3p$1 {
428
428
  const request = {
429
429
  'order_id': id,
430
430
  };
431
- return await this.privatePostMarketMoneyOrderCancel(this.extend(request, params));
431
+ const response = await this.privatePostMarketMoneyOrderCancel(this.extend(request, params));
432
+ //
433
+ // "success"
434
+ //
435
+ return this.safeOrder({
436
+ 'info': response,
437
+ });
432
438
  }
433
439
  async createDepositAddress(code, params = {}) {
434
440
  /**
@@ -703,7 +703,7 @@ class btcalpha extends btcalpha$1 {
703
703
  const filled = this.safeString(order, 'amount_filled');
704
704
  const amount = this.safeString(order, 'amount_original');
705
705
  const status = this.parseOrderStatus(this.safeString(order, 'status'));
706
- const id = this.safeString2(order, 'oid', 'id');
706
+ const id = this.safeStringN(order, ['oid', 'id', 'order']);
707
707
  const trades = this.safeValue(order, 'trades');
708
708
  const side = this.safeString2(order, 'my_side', 'type');
709
709
  return this.safeOrder({
@@ -781,7 +781,12 @@ class btcalpha extends btcalpha$1 {
781
781
  'order': id,
782
782
  };
783
783
  const response = await this.privatePostOrderCancel(this.extend(request, params));
784
- return response;
784
+ //
785
+ // {
786
+ // "order": 63568
787
+ // }
788
+ //
789
+ return this.parseOrder(response);
785
790
  }
786
791
  async fetchOrder(id, symbol = undefined, params = {}) {
787
792
  /**
@@ -711,7 +711,17 @@ class btcturk extends btcturk$1 {
711
711
  const request = {
712
712
  'id': id,
713
713
  };
714
- return await this.privateDeleteOrder(this.extend(request, params));
714
+ const response = await this.privateDeleteOrder(this.extend(request, params));
715
+ //
716
+ // {
717
+ // "success": true,
718
+ // "message": "SUCCESS",
719
+ // "code": 0
720
+ // }
721
+ //
722
+ return this.safeOrder({
723
+ 'info': response,
724
+ });
715
725
  }
716
726
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
717
727
  /**
@@ -501,10 +501,10 @@ class coinbase extends coinbase$1 {
501
501
  let paginate = false;
502
502
  [paginate, params] = this.handleOptionAndParams(params, 'fetchAccounts', 'paginate');
503
503
  if (paginate) {
504
- return await this.fetchPaginatedCallCursor('fetchAccounts', undefined, undefined, undefined, params, 'cursor', 'cursor', undefined, 100);
504
+ return await this.fetchPaginatedCallCursor('fetchAccounts', undefined, undefined, undefined, params, 'cursor', 'cursor', undefined, 250);
505
505
  }
506
506
  const request = {
507
- 'limit': 100,
507
+ 'limit': 250,
508
508
  };
509
509
  const response = await this.v3PrivateGetBrokerageAccounts(this.extend(request, params));
510
510
  //
@@ -623,7 +623,14 @@ class coincheck extends coincheck$1 {
623
623
  const request = {
624
624
  'id': id,
625
625
  };
626
- return await this.privateDeleteExchangeOrdersId(this.extend(request, params));
626
+ const response = await this.privateDeleteExchangeOrdersId(this.extend(request, params));
627
+ //
628
+ // {
629
+ // "success": true,
630
+ // "id": 12345
631
+ // }
632
+ //
633
+ return this.parseOrder(response);
627
634
  }
628
635
  async fetchDeposits(code = undefined, since = undefined, limit = undefined, params = {}) {
629
636
  /**
@@ -1673,17 +1673,16 @@ class coinex extends coinex$1 {
1673
1673
  [marketType, params] = this.handleMarketTypeAndParams('fetchBalance', undefined, params);
1674
1674
  let marginMode = undefined;
1675
1675
  [marginMode, params] = this.handleMarginModeAndParams('fetchBalance', params);
1676
- marketType = (marginMode !== undefined) ? 'margin' : marketType;
1677
- params = this.omit(params, 'margin');
1678
- if (marketType === 'margin') {
1679
- return await this.fetchMarginBalance(params);
1680
- }
1681
- else if (marketType === 'swap') {
1676
+ const isMargin = (marginMode !== undefined) || (marketType === 'margin');
1677
+ if (marketType === 'swap') {
1682
1678
  return await this.fetchSwapBalance(params);
1683
1679
  }
1684
1680
  else if (marketType === 'financial') {
1685
1681
  return await this.fetchFinancialBalance(params);
1686
1682
  }
1683
+ else if (isMargin) {
1684
+ return await this.fetchMarginBalance(params);
1685
+ }
1687
1686
  else {
1688
1687
  return await this.fetchSpotBalance(params);
1689
1688
  }
@@ -3230,7 +3229,11 @@ class coinex extends coinex$1 {
3230
3229
  // {"code":0,"data":{},"message":"OK"}
3231
3230
  //
3232
3231
  }
3233
- return response;
3232
+ return [
3233
+ this.safeOrder({
3234
+ 'info': response,
3235
+ }),
3236
+ ];
3234
3237
  }
3235
3238
  async fetchOrder(id, symbol = undefined, params = {}) {
3236
3239
  /**
@@ -38,6 +38,8 @@ class htx extends htx$1 {
38
38
  'cancelAllOrdersAfter': true,
39
39
  'cancelOrder': true,
40
40
  'cancelOrders': true,
41
+ 'closeAllPositions': false,
42
+ 'closePosition': true,
41
43
  'createDepositAddress': undefined,
42
44
  'createMarketBuyOrderWithCost': true,
43
45
  'createMarketOrderWithCost': false,
@@ -5386,7 +5388,7 @@ class htx extends htx$1 {
5386
5388
  * @param {float} [params.stopLossPrice] *contract only* the price a stop-loss order is triggered at
5387
5389
  * @param {float} [params.takeProfitPrice] *contract only* the price a take-profit order is triggered at
5388
5390
  * @param {string} [params.operator] *spot and margin only* gte or lte, trigger price condition
5389
- * @param {string} [params.offset] *contract only* 'open', 'close', or 'both', required in hedge mode
5391
+ * @param {string} [params.offset] *contract only* 'both' (linear only), 'open', or 'close', required in hedge mode and for inverse markets
5390
5392
  * @param {bool} [params.postOnly] *contract only* true or false
5391
5393
  * @param {int} [params.leverRate] *contract only* required for all contract orders except tpsl, leverage greater than 20x requires prior approval of high-leverage agreement
5392
5394
  * @param {string} [params.timeInForce] supports 'IOC' and 'FOK'
@@ -5449,6 +5451,10 @@ class htx extends htx$1 {
5449
5451
  }
5450
5452
  }
5451
5453
  else if (market['inverse']) {
5454
+ const offset = this.safeString(params, 'offset');
5455
+ if (offset === undefined) {
5456
+ throw new errors.ArgumentsRequired(this.id + ' createOrder () requires an extra parameter params["offset"] to be set to "open" or "close" when placing orders in inverse markets');
5457
+ }
5452
5458
  if (market['swap']) {
5453
5459
  if (isStop) {
5454
5460
  response = await this.contractPrivatePostSwapApiV1SwapTriggerOrder(contractRequest);
@@ -7595,14 +7601,20 @@ class htx extends htx$1 {
7595
7601
  * @description fetch all open positions
7596
7602
  * @param {string[]|undefined} symbols list of unified market symbols
7597
7603
  * @param {object} [params] extra parameters specific to the exchange API endpoint
7604
+ * @param {string} [params.subType] 'linear' or 'inverse'
7605
+ * @param {string} [params.type] *inverse only* 'future', or 'swap'
7606
+ * @param {string} [params.marginMode] *linear only* 'cross' or 'isolated'
7598
7607
  * @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/#/?id=position-structure}
7599
7608
  */
7600
7609
  await this.loadMarkets();
7601
7610
  symbols = this.marketSymbols(symbols);
7602
7611
  let market = undefined;
7603
7612
  if (symbols !== undefined) {
7604
- const first = this.safeString(symbols, 0);
7605
- market = this.market(first);
7613
+ const symbolsLength = symbols.length;
7614
+ if (symbolsLength > 0) {
7615
+ const first = this.safeString(symbols, 0);
7616
+ market = this.market(first);
7617
+ }
7606
7618
  }
7607
7619
  let marginMode = undefined;
7608
7620
  [marginMode, params] = this.handleMarginModeAndParams('fetchPositions', params, 'cross');
@@ -9143,6 +9155,69 @@ class htx extends htx$1 {
9143
9155
  'datetime': this.iso8601(timestamp),
9144
9156
  });
9145
9157
  }
9158
+ async closePosition(symbol, side = undefined, params = {}) {
9159
+ /**
9160
+ * @method
9161
+ * @name htx#closePositions
9162
+ * @description closes open positions for a contract market, requires 'amount' in params, unlike other exchanges
9163
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#isolated-place-lightning-close-order // USDT-M (isolated)
9164
+ * @see https://huobiapi.github.io/docs/usdt_swap/v1/en/#cross-place-lightning-close-position // USDT-M (cross)
9165
+ * @see https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#place-lightning-close-order // Coin-M swap
9166
+ * @see https://huobiapi.github.io/docs/dm/v1/en/#place-flash-close-order // Coin-M futures
9167
+ * @param {string} symbol unified CCXT market symbol
9168
+ * @param {string} side 'buy' or 'sell', the side of the closing order, opposite side as position side
9169
+ * @param {object} [params] extra parameters specific to the okx api endpoint
9170
+ * @param {string} [params.clientOrderId] client needs to provide unique API and have to maintain the API themselves afterwards. [1, 9223372036854775807]
9171
+ * @param {object} [params.marginMode] 'cross' or 'isolated', required for linear markets
9172
+ *
9173
+ * EXCHANGE SPECIFIC PARAMETERS
9174
+ * @param {number} [params.amount] order quantity
9175
+ * @param {string} [params.order_price_type] 'lightning' by default, 'lightning_fok': lightning fok type, 'lightning_ioc': lightning ioc type 'market' by default, 'market': market order type, 'lightning_fok': lightning
9176
+ * @returns {object} [an order structure]{@link https://docs.ccxt.com/#/?id=position-structure}
9177
+ */
9178
+ await this.loadMarkets();
9179
+ const market = this.market(symbol);
9180
+ const clientOrderId = this.safeString(params, 'clientOrderId');
9181
+ if (!market['contract']) {
9182
+ throw new errors.BadRequest(this.id + ' closePosition() symbol supports contract markets only');
9183
+ }
9184
+ this.checkRequiredArgument('closePosition', side, 'side');
9185
+ const request = {
9186
+ 'contract_code': market['id'],
9187
+ 'direction': side,
9188
+ };
9189
+ if (clientOrderId !== undefined) {
9190
+ request['client_order_id'] = clientOrderId;
9191
+ }
9192
+ if (market['inverse']) {
9193
+ const amount = this.safeString2(params, 'volume', 'amount');
9194
+ if (amount === undefined) {
9195
+ throw new errors.ArgumentsRequired(this.id + ' closePosition () requires an extra argument params["amount"] for inverse markets');
9196
+ }
9197
+ request['volume'] = this.amountToPrecision(symbol, amount);
9198
+ }
9199
+ params = this.omit(params, ['clientOrderId', 'volume', 'amount']);
9200
+ let response = undefined;
9201
+ if (market['inverse']) { // Coin-M
9202
+ if (market['swap']) {
9203
+ response = await this.contractPrivatePostSwapApiV1SwapLightningClosePosition(this.extend(request, params));
9204
+ }
9205
+ else { // future
9206
+ response = await this.contractPrivatePostApiV1LightningClosePosition(this.extend(request, params));
9207
+ }
9208
+ }
9209
+ else { // USDT-M
9210
+ let marginMode = undefined;
9211
+ [marginMode, params] = this.handleMarginModeAndParams('closePosition', params, 'cross');
9212
+ if (marginMode === 'cross') {
9213
+ response = await this.contractPrivatePostLinearSwapApiV1SwapCrossLightningClosePosition(this.extend(request, params));
9214
+ }
9215
+ else { // isolated
9216
+ response = await this.contractPrivatePostLinearSwapApiV1SwapLightningClosePosition(this.extend(request, params));
9217
+ }
9218
+ }
9219
+ return this.parseOrder(response, market);
9220
+ }
9146
9221
  async setPositionMode(hedged, symbol = undefined, params = {}) {
9147
9222
  /**
9148
9223
  * @method
@@ -161,13 +161,13 @@ class kraken extends kraken$1 {
161
161
  // rate-limits explained in comment in the top of this file
162
162
  'Assets': 1,
163
163
  'AssetPairs': 1,
164
- 'Depth': 1,
165
- 'OHLC': 1,
164
+ 'Depth': 1.2,
165
+ 'OHLC': 1.2,
166
166
  'Spread': 1,
167
167
  'SystemStatus': 1,
168
168
  'Ticker': 1,
169
169
  'Time': 1,
170
- 'Trades': 1,
170
+ 'Trades': 1.2,
171
171
  },
172
172
  },
173
173
  'private': {
@@ -758,8 +758,8 @@ class kraken extends kraken$1 {
758
758
  return {
759
759
  'info': response,
760
760
  'symbol': market['symbol'],
761
- 'maker': this.safeNumber(symbolMakerFee, 'fee'),
762
- 'taker': this.safeNumber(symbolTakerFee, 'fee'),
761
+ 'maker': this.parseNumber(Precise["default"].stringDiv(this.safeString(symbolMakerFee, 'fee'), '100')),
762
+ 'taker': this.parseNumber(Precise["default"].stringDiv(this.safeString(symbolTakerFee, 'fee'), '100')),
763
763
  'percentage': true,
764
764
  'tierBased': true,
765
765
  };
@@ -255,6 +255,9 @@ class okx extends okx$1 {
255
255
  'finance/staking-defi/eth/apy-history': 5 / 3,
256
256
  'finance/savings/lending-rate-summary': 5 / 3,
257
257
  'finance/savings/lending-rate-history': 5 / 3,
258
+ 'finance/fixed-loan/lending-offers': 10 / 3,
259
+ 'finance/fixed-loan/lending-apy-history': 10 / 3,
260
+ 'finance/fixed-loan/pending-lending-volume': 10 / 3,
258
261
  // public broker
259
262
  'finance/sfp/dcd/products': 2 / 3,
260
263
  // copytrading
@@ -2277,8 +2277,10 @@ class woofipro extends woofipro$1 {
2277
2277
  }
2278
2278
  signHash(hash, privateKey) {
2279
2279
  const signature = crypto.ecdsa(hash.slice(-64), privateKey.slice(-64), secp256k1.secp256k1, undefined);
2280
+ const r = signature['r'];
2281
+ const s = signature['s'];
2280
2282
  const v = this.intToBase16(this.sum(27, signature['v']));
2281
- return '0x' + signature['r'].padStart(64, '0') + signature['s'].padStart(64, '0') + v;
2283
+ return '0x' + r.padStart(64, '0') + s.padStart(64, '0') + v;
2282
2284
  }
2283
2285
  signMessage(message, privateKey) {
2284
2286
  return this.signHash(this.hashMessage(message), privateKey.slice(-64));
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain, Conversion } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
7
- declare const version = "4.3.35";
7
+ declare const version = "4.3.37";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';