ccxt 4.2.65 → 4.2.67

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
@@ -210,13 +210,13 @@ console.log(version, Object.keys(exchanges));
210
210
 
211
211
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
212
212
 
213
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.65/dist/ccxt.browser.js
214
- * unpkg: https://unpkg.com/ccxt@4.2.65/dist/ccxt.browser.js
213
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.67/dist/ccxt.browser.js
214
+ * unpkg: https://unpkg.com/ccxt@4.2.67/dist/ccxt.browser.js
215
215
 
216
216
  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.
217
217
 
218
218
  ```HTML
219
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.65/dist/ccxt.browser.js"></script>
219
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.67/dist/ccxt.browser.js"></script>
220
220
  ```
221
221
 
222
222
  Creates a global `ccxt` object:
package/build.sh CHANGED
@@ -76,7 +76,7 @@ build_and_test_all () {
76
76
  # cd python
77
77
  # if ! tox run-parallel; then
78
78
  # exit 1
79
- # fi
79
+ # fi
80
80
  # cd ..
81
81
  # fi
82
82
  fi
@@ -12356,7 +12356,10 @@ class Exchange {
12356
12356
  const response = await this[method](symbol, undefined, maxEntriesPerRequest, params);
12357
12357
  const responseLength = response.length;
12358
12358
  if (this.verbose) {
12359
- const backwardMessage = 'Dynamic pagination call ' + calls + ' method ' + method + ' response length ' + responseLength + ' timestamp ' + paginationTimestamp;
12359
+ let backwardMessage = 'Dynamic pagination call ' + this.numberToString(calls) + ' method ' + method + ' response length ' + this.numberToString(responseLength);
12360
+ if (paginationTimestamp !== undefined) {
12361
+ backwardMessage += ' timestamp ' + this.numberToString(paginationTimestamp);
12362
+ }
12360
12363
  this.log(backwardMessage);
12361
12364
  }
12362
12365
  if (responseLength === 0) {
@@ -12375,7 +12378,10 @@ class Exchange {
12375
12378
  const response = await this[method](symbol, paginationTimestamp, maxEntriesPerRequest, params);
12376
12379
  const responseLength = response.length;
12377
12380
  if (this.verbose) {
12378
- const forwardMessage = 'Dynamic pagination call ' + calls + ' method ' + method + ' response length ' + responseLength + ' timestamp ' + paginationTimestamp;
12381
+ let forwardMessage = 'Dynamic pagination call ' + this.numberToString(calls) + ' method ' + method + ' response length ' + this.numberToString(responseLength);
12382
+ if (paginationTimestamp !== undefined) {
12383
+ forwardMessage += ' timestamp ' + this.numberToString(paginationTimestamp);
12384
+ }
12379
12385
  this.log(forwardMessage);
12380
12386
  }
12381
12387
  if (responseLength === 0) {
@@ -17481,7 +17487,11 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
17481
17487
  }
17482
17488
  }
17483
17489
  request['type'] = uppercaseType;
17484
- params = this.omit(params, ['stop_price', 'stopPrice', 'triggerPrice', 'timeInForce']);
17490
+ const clientOrderId = this.safeString(params, 'clientOrderId');
17491
+ if (clientOrderId !== undefined) {
17492
+ request['client_order_id'] = clientOrderId;
17493
+ }
17494
+ params = this.omit(params, ['stop_price', 'stopPrice', 'triggerPrice', 'timeInForce', 'clientOrderId']);
17485
17495
  const response = await this.privatePostOrders(this.extend(request, params));
17486
17496
  //
17487
17497
  // {
@@ -17762,7 +17772,7 @@ class bigone extends _abstract_bigone_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
17762
17772
  }
17763
17773
  else if (method === 'POST') {
17764
17774
  headers['Content-Type'] = 'application/json';
17765
- body = query;
17775
+ body = this.json(query);
17766
17776
  }
17767
17777
  }
17768
17778
  headers['User-Agent'] = 'ccxt/' + this.id + '-' + this.version;
@@ -41498,9 +41508,11 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
41498
41508
  'symbol': market['id'],
41499
41509
  'timeframe': this.safeString(this.timeframes, timeframe, timeframe),
41500
41510
  'sort': 1,
41501
- 'start': since,
41502
41511
  'limit': limit,
41503
41512
  };
41513
+ if (since !== undefined) {
41514
+ request['start'] = since;
41515
+ }
41504
41516
  [request, params] = this.handleUntilOption('end', request, params);
41505
41517
  const response = await this.publicGetCandlesTradeTimeframeSymbolHist(this.extend(request, params));
41506
41518
  //
@@ -43073,7 +43085,7 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
43073
43085
  * @param {object} [params] extra parameters specific to the exchange API endpoint
43074
43086
  * @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
43075
43087
  */
43076
- return this.fetchFundingRates([symbol], params);
43088
+ return await this.fetchFundingRates([symbol], params);
43077
43089
  }
43078
43090
  async fetchFundingRates(symbols = undefined, params = {}) {
43079
43091
  /**
@@ -43196,10 +43208,10 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
43196
43208
  }
43197
43209
  const reversedArray = [];
43198
43210
  const rawRates = this.filterBySymbolSinceLimit(rates, symbol, since, limit);
43199
- const rawRatesLength = rawRates.length;
43200
- const ratesLength = Math.max(rawRatesLength - 1, 0);
43201
- for (let i = ratesLength; i >= 0; i--) {
43202
- const valueAtIndex = rawRates[i];
43211
+ const ratesLength = rawRates.length;
43212
+ for (let i = 0; i < ratesLength; i++) {
43213
+ const index = ratesLength - i - 1;
43214
+ const valueAtIndex = rawRates[index];
43203
43215
  reversedArray.push(valueAtIndex);
43204
43216
  }
43205
43217
  return reversedArray;
@@ -45259,6 +45271,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
45259
45271
  'v2/spot/wallet/transfer': 2,
45260
45272
  'v2/spot/wallet/subaccount-transfer': 2,
45261
45273
  'v2/spot/wallet/withdrawal': 2,
45274
+ 'v2/spot/wallet/cancel-withdrawal': 2,
45275
+ 'v2/spot/wallet/modify-deposit-account': 2,
45262
45276
  },
45263
45277
  },
45264
45278
  'mix': {
@@ -45603,9 +45617,12 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
45603
45617
  'v2/convert/currencies': 2,
45604
45618
  'v2/convert/quoted-price': 2,
45605
45619
  'v2/convert/convert-record': 2,
45620
+ 'v2/convert/bgb-convert-coin-list': 2,
45621
+ 'v2/convert/bgb-convert-records': 2,
45606
45622
  },
45607
45623
  'post': {
45608
45624
  'v2/convert/trade': 2,
45625
+ 'v2/convert/bgb-convert': 2,
45609
45626
  },
45610
45627
  },
45611
45628
  'earn': {
@@ -49810,6 +49827,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
49810
49827
  * @name bitget#cancelAllOrders
49811
49828
  * @description cancel all open orders
49812
49829
  * @see https://www.bitget.com/api-doc/spot/trade/Cancel-Symbol-Orders
49830
+ * @see https://www.bitget.com/api-doc/spot/plan/Batch-Cancel-Plan-Order
49813
49831
  * @see https://www.bitget.com/api-doc/contract/trade/Batch-Cancel-Orders
49814
49832
  * @see https://bitgetlimited.github.io/apidoc/en/margin/#isolated-batch-cancel-orders
49815
49833
  * @see https://bitgetlimited.github.io/apidoc/en/margin/#cross-batch-cancel-order
@@ -49837,7 +49855,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
49837
49855
  const request = {
49838
49856
  'symbol': market['id'],
49839
49857
  };
49840
- const stop = this.safeValue2(params, 'stop', 'trigger');
49858
+ const stop = this.safeBool2(params, 'stop', 'trigger');
49841
49859
  params = this.omit(params, ['stop', 'trigger']);
49842
49860
  let response = undefined;
49843
49861
  if (market['spot']) {
@@ -49850,7 +49868,15 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
49850
49868
  }
49851
49869
  }
49852
49870
  else {
49853
- response = await this.privateSpotPostV2SpotTradeCancelSymbolOrder(this.extend(request, params));
49871
+ if (stop) {
49872
+ const stopRequest = {
49873
+ 'symbolList': [market['id']],
49874
+ };
49875
+ response = await this.privateSpotPostV2SpotTradeBatchCancelPlanOrder(this.extend(stopRequest, params));
49876
+ }
49877
+ else {
49878
+ response = await this.privateSpotPostV2SpotTradeCancelSymbolOrder(this.extend(request, params));
49879
+ }
49854
49880
  }
49855
49881
  }
49856
49882
  else {
@@ -135464,7 +135490,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
135464
135490
  const [request, requestParams] = this.prepareRequest(market, type, query);
135465
135491
  request['type'] = 'fund'; // 'dnw' 'pnl' 'fee' 'refr' 'fund' 'point_dnw' 'point_fee' 'point_refr'
135466
135492
  if (since !== undefined) {
135467
- request['from'] = since / 1000;
135493
+ // from should be integer
135494
+ request['from'] = this.parseToInt(since / 1000);
135468
135495
  }
135469
135496
  if (limit !== undefined) {
135470
135497
  request['limit'] = limit;
@@ -143845,10 +143872,10 @@ class hitbtc extends _abstract_hitbtc_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
143845
143872
  'symbol': market['id'],
143846
143873
  'period': this.safeString(this.timeframes, timeframe, timeframe),
143847
143874
  };
143848
- [request, params] = this.handleUntilOption('till', request, params);
143849
143875
  if (since !== undefined) {
143850
143876
  request['from'] = this.iso8601(since);
143851
143877
  }
143878
+ [request, params] = this.handleUntilOption('till', request, params);
143852
143879
  if (limit !== undefined) {
143853
143880
  request['limit'] = limit;
143854
143881
  }
@@ -228658,11 +228685,12 @@ class bitfinex2 extends _bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
228658
228685
  const messageLength = message.length;
228659
228686
  if (messageLength === 2) {
228660
228687
  // initial snapshot
228661
- let trades = this.safeList(message, 1, []);
228688
+ const trades = this.safeList(message, 1, []);
228662
228689
  // needs to be reversed to make chronological order
228663
- trades = trades.reverse();
228664
- for (let i = 0; i < trades.length; i++) {
228665
- const parsed = this.parseWsTrade(trades[i], market);
228690
+ const length = trades.length;
228691
+ for (let i = 0; i < length; i++) {
228692
+ const index = length - i - 1;
228693
+ const parsed = this.parseWsTrade(trades[index], market);
228666
228694
  stored.append(parsed);
228667
228695
  }
228668
228696
  }
@@ -230176,10 +230204,10 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
230176
230204
  }
230177
230205
  const data = this.safeList(message, 'data', []);
230178
230206
  const length = data.length;
230179
- const maxLength = Math.max(length - 1, 0);
230180
230207
  // fix chronological order by reversing
230181
- for (let i = maxLength; i >= 0; i--) {
230182
- const rawTrade = data[i];
230208
+ for (let i = 0; i < length; i++) {
230209
+ const index = length - i - 1;
230210
+ const rawTrade = data[index];
230183
230211
  const parsed = this.parseWsTrade(rawTrade, market);
230184
230212
  stored.append(parsed);
230185
230213
  }
@@ -232098,9 +232126,9 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
232098
232126
  const isSwap = ('group' in message);
232099
232127
  if (isSwap) {
232100
232128
  // in swap, chronologically decreasing: 1709536849322, 1709536848954,
232101
- const maxLen = Math.max(length - 1, 0);
232102
- for (let i = maxLen; i >= 0; i--) {
232103
- symbol = this.handleTradeLoop(data[i]);
232129
+ for (let i = 0; i < length; i++) {
232130
+ const index = length - i - 1;
232131
+ symbol = this.handleTradeLoop(data[index]);
232104
232132
  }
232105
232133
  }
232106
232134
  else {
@@ -232742,7 +232770,17 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
232742
232770
  }
232743
232771
  //
232744
232772
  // {"event":"error","message":"Unrecognized request: {\"event\":\"subscribe\",\"channel\":\"spot/depth:BTC-USDT\"}","errorCode":30039}
232745
- // {"event":"subscribe","channel":"spot/depth:BTC-USDT"}
232773
+ //
232774
+ // subscribe events on spot:
232775
+ //
232776
+ // {"event":"subscribe", "topic":"spot/kline1m:BTC_USDT" }
232777
+ //
232778
+ // subscribe on contracts:
232779
+ //
232780
+ // {"action":"subscribe", "group":"futures/klineBin1m:BTCUSDT", "success":true, "request":{"action":"subscribe", "args":[ "futures/klineBin1m:BTCUSDT" ] } }
232781
+ //
232782
+ // regular updates - spot
232783
+ //
232746
232784
  // {
232747
232785
  // "table": "spot/depth",
232748
232786
  // "action": "partial",
@@ -232763,10 +232801,21 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
232763
232801
  // ]
232764
232802
  // }
232765
232803
  //
232804
+ // regular updates - contracts
232805
+ //
232806
+ // {
232807
+ // group: "futures/klineBin1m:BTCUSDT",
232808
+ // data: {
232809
+ // symbol: "BTCUSDT",
232810
+ // items: [ { o: "67944.7", "h": .... } ],
232811
+ // },
232812
+ // }
232813
+ //
232766
232814
  // { data: '', table: "spot/user/order" }
232767
232815
  //
232768
- const channel = this.safeString2(message, 'table', 'group');
232769
- if (channel === undefined) {
232816
+ // the only realiable way (for both spot & swap) is to check 'data' key
232817
+ const isDataUpdate = ('data' in message);
232818
+ if (!isDataUpdate) {
232770
232819
  const event = this.safeString2(message, 'event', 'action');
232771
232820
  if (event !== undefined) {
232772
232821
  const methods = {
@@ -232782,6 +232831,7 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
232782
232831
  }
232783
232832
  }
232784
232833
  else {
232834
+ const channel = this.safeString2(message, 'table', 'group');
232785
232835
  const methods = {
232786
232836
  'depth': this.handleOrderBook,
232787
232837
  'ticker': this.handleTicker,
@@ -316764,7 +316814,7 @@ SOFTWARE.
316764
316814
 
316765
316815
  //-----------------------------------------------------------------------------
316766
316816
  // this is updated by vss.js when building
316767
- const version = '4.2.65';
316817
+ const version = '4.2.67';
316768
316818
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
316769
316819
  //-----------------------------------------------------------------------------
316770
316820