ccxt 4.0.70 → 4.0.72

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
@@ -18,6 +18,11 @@ Current feature list:
18
18
  - an out of the box unified API that is extremely easy to integrate
19
19
  - works in Node 10.4+, Python 3, PHP 8.1+, netstandard2.0/2.1 and web browsers
20
20
 
21
+ ## Sponsored Promotion
22
+
23
+ [![CCXT x Gate.io Upgrading Trading Campaign](https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/261965226-7278c686-4ed1-4c6e-81aa-81f90a284cbe.jpg)](https://github.com/ccxt/ccxt/issues/18963)
24
+
25
+
21
26
  ## See Also
22
27
 
23
28
  - <sub>[![TabTrader](https://user-images.githubusercontent.com/1294454/66755907-9c3e8880-eea1-11e9-846e-0bff349ceb87.png)](https://tab-trader.com/?utm_source=ccxt)</sub> **[TabTrader](https://tab-trader.com/?utm_source=ccxt)** – trading on all exchanges in one app. Available on **[Android](https://play.google.com/store/apps/details?id=com.tabtrader.android&referrer=utm_source%3Dccxt)** and **[iOS](https://itunes.apple.com/app/apple-store/id1095716562?mt=8)**!
@@ -210,13 +215,13 @@ console.log(version, Object.keys(exchanges));
210
215
 
211
216
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
212
217
 
213
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.70/dist/ccxt.browser.js
214
- * unpkg: https://unpkg.com/ccxt@4.0.70/dist/ccxt.browser.js
218
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.72/dist/ccxt.browser.js
219
+ * unpkg: https://unpkg.com/ccxt@4.0.72/dist/ccxt.browser.js
215
220
 
216
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.
217
222
 
218
223
  ```HTML
219
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.70/dist/ccxt.browser.js"></script>
224
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.72/dist/ccxt.browser.js"></script>
220
225
  ```
221
226
 
222
227
  Creates a global `ccxt` object:
@@ -7544,11 +7544,13 @@ class Exchange {
7544
7544
  }
7545
7545
  async close() {
7546
7546
  const clients = Object.values(this.clients || {});
7547
+ const closedClients = [];
7547
7548
  for (let i = 0; i < clients.length; i++) {
7548
7549
  const client = clients[i];
7549
7550
  delete this.clients[client.url];
7550
- await client.close();
7551
+ closedClients.push(client.close());
7551
7552
  }
7553
+ return Promise.all(closedClients);
7552
7554
  }
7553
7555
  async loadOrderBook(client, messageHash, symbol, limit = undefined, params = {}) {
7554
7556
  if (!(symbol in this.orderbooks)) {
@@ -13006,6 +13008,9 @@ class Client {
13006
13008
  // todo: exception types for server-side disconnects
13007
13009
  this.reset(new _base_errors_js__WEBPACK_IMPORTED_MODULE_3__.NetworkError('connection closed by remote server, closing code ' + String(event.code)));
13008
13010
  }
13011
+ if (this.disconnected !== undefined) {
13012
+ this.disconnected.resolve(true);
13013
+ }
13009
13014
  this.onCloseCallback(this, event);
13010
13015
  }
13011
13016
  // this method is not used at this time
@@ -13535,6 +13540,8 @@ class IndexedBids extends IndexedOrderBookSide {
13535
13540
  /* harmony import */ var _base_functions_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1621);
13536
13541
  /* harmony import */ var ws__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(7026);
13537
13542
  /* harmony import */ var ws__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(ws__WEBPACK_IMPORTED_MODULE_0__);
13543
+ /* harmony import */ var _Future_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2367);
13544
+
13538
13545
 
13539
13546
 
13540
13547
 
@@ -13583,8 +13590,12 @@ class WsClient extends _Client_js__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */
13583
13590
  }
13584
13591
  close() {
13585
13592
  if (this.connection instanceof WebSocketPlatform) {
13586
- return this.connection.close();
13593
+ if (this.disconnected === undefined) {
13594
+ this.disconnected = (0,_Future_js__WEBPACK_IMPORTED_MODULE_4__/* .createFuture */ .N)();
13595
+ }
13596
+ this.connection.close();
13587
13597
  }
13598
+ return this.disconnected;
13588
13599
  }
13589
13600
  }
13590
13601
  ;
@@ -16402,6 +16413,21 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
16402
16413
  'cm/openOrder': 1,
16403
16414
  'cm/openOrders': 1,
16404
16415
  'cm/allOrders': 20,
16416
+ 'um/conditional/openOrder': 1,
16417
+ 'um/conditional/openOrders': 40,
16418
+ 'um/conditional/orderHistory': 1,
16419
+ 'um/conditional/allOrders': 40,
16420
+ 'cm/conditional/openOrder': 1,
16421
+ 'cm/conditional/openOrders': 40,
16422
+ 'cm/conditional/orderHistory': 1,
16423
+ 'cm/conditional/allOrders': 40,
16424
+ 'margin/order': 5,
16425
+ 'margin/openOrders': 5,
16426
+ 'margin/allOrders': 100,
16427
+ 'margin/orderList': 5,
16428
+ 'margin/allOrderList': 100,
16429
+ 'margin/openOrderList': 5,
16430
+ 'margin/myTrades': 5,
16405
16431
  'balance': 20,
16406
16432
  'account': 20,
16407
16433
  'margin/maxBorrowable': 5,
@@ -16420,6 +16446,10 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
16420
16446
  'um/apiTradingStatus': 1,
16421
16447
  'um/commissionRate': 20,
16422
16448
  'cm/commissionRate': 20,
16449
+ 'margin/marginLoan': 10,
16450
+ 'margin/repayLoan': 10,
16451
+ 'margin/marginInterestHistory': 1,
16452
+ 'portfolio/interest-history': 50,
16423
16453
  'um/income': 30,
16424
16454
  'cm/income ': 30,
16425
16455
  'um/account': 5,
@@ -16427,10 +16457,6 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
16427
16457
  'portfolio/repay-futures-switch': 3,
16428
16458
  'um/adlQuantile': 5,
16429
16459
  'cm/adlQuantile': 5,
16430
- 'margin/marginLoan': 0.0667,
16431
- 'margin/repayLoan': 0.0667,
16432
- 'margin/marginInterestHistory': 0.1,
16433
- 'portfolio/interest-history': 50, // 50
16434
16460
  },
16435
16461
  'post': {
16436
16462
  'um/order': 1,
@@ -37023,6 +37049,8 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
37023
37049
  'market/depth': 1,
37024
37050
  'market/spot-vip-level': 2,
37025
37051
  'market/history-candles': 1,
37052
+ 'public/loan/coinInfos': 2,
37053
+ 'public/loan/hour-interest': 2, // 10 times/1s (IP) => 20/10 = 2
37026
37054
  },
37027
37055
  },
37028
37056
  'mix': {
@@ -37071,6 +37099,11 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
37071
37099
  'account/transferRecords': 1,
37072
37100
  'convert/currencies': 2,
37073
37101
  'convert/convert-record': 2,
37102
+ 'loan/ongoing-orders': 2,
37103
+ 'loan/repay-history': 2,
37104
+ 'loan/revise-history': 2,
37105
+ 'loan/borrow-history': 2,
37106
+ 'loan/debts': 2, // 10 times/1s (UID) => 20/10 = 2
37074
37107
  },
37075
37108
  'post': {
37076
37109
  'wallet/transfer': 4,
@@ -37101,6 +37134,9 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
37101
37134
  'plan/batchCancelPlan': 2,
37102
37135
  'convert/quoted-price': 4,
37103
37136
  'convert/trade': 4,
37137
+ 'loan/borrow': 2,
37138
+ 'loan/repay': 2,
37139
+ 'loan/revise-pledge': 2,
37104
37140
  'trace/order/orderCurrentList': 2,
37105
37141
  'trace/order/orderHistoryList': 2,
37106
37142
  'trace/order/closeTrackingOrder': 2,
@@ -37236,6 +37272,9 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
37236
37272
  'account/sub-email': 20,
37237
37273
  'account/sub-spot-assets': 2,
37238
37274
  'account/sub-future-assets': 2,
37275
+ 'account/subaccount-transfer': 1,
37276
+ 'account/subaccount-deposit': 1,
37277
+ 'account/subaccount-withdrawal': 1,
37239
37278
  'account/sub-api-list': 2, // 10 times/1s (UID) => 20/10 = 2
37240
37279
  },
37241
37280
  'post': {
@@ -150444,6 +150483,7 @@ class kucoinfutures extends _abstract_kucoinfutures_js__WEBPACK_IMPORTED_MODULE_
150444
150483
  'fetchTrades': true,
150445
150484
  'fetchTransactionFee': false,
150446
150485
  'fetchWithdrawals': true,
150486
+ 'setLeverage': false,
150447
150487
  'setMarginMode': false,
150448
150488
  'transfer': true,
150449
150489
  'withdraw': undefined,
@@ -210517,29 +210557,29 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
210517
210557
  const marketId = this.safeString(ticker, 'product_id');
210518
210558
  const symbol = this.safeSymbol(marketId, market, '-');
210519
210559
  const timestamp = this.parse8601(this.safeString(ticker, 'time'));
210520
- const last = this.safeNumber(ticker, 'price');
210521
- return {
210560
+ const last = this.safeString(ticker, 'price');
210561
+ return this.safeTicker({
210522
210562
  'symbol': symbol,
210523
210563
  'timestamp': timestamp,
210524
210564
  'datetime': this.iso8601(timestamp),
210525
- 'high': this.safeNumber(ticker, 'high_24h'),
210526
- 'low': this.safeNumber(ticker, 'low_24h'),
210527
- 'bid': this.safeNumber(ticker, 'best_bid'),
210528
- 'bidVolume': this.safeNumber(ticker, 'best_bid_size'),
210529
- 'ask': this.safeNumber(ticker, 'best_ask'),
210530
- 'askVolume': this.safeNumber(ticker, 'best_ask_size'),
210565
+ 'high': this.safeString(ticker, 'high_24h'),
210566
+ 'low': this.safeString(ticker, 'low_24h'),
210567
+ 'bid': this.safeString(ticker, 'best_bid'),
210568
+ 'bidVolume': this.safeString(ticker, 'best_bid_size'),
210569
+ 'ask': this.safeString(ticker, 'best_ask'),
210570
+ 'askVolume': this.safeString(ticker, 'best_ask_size'),
210531
210571
  'vwap': undefined,
210532
- 'open': this.safeNumber(ticker, 'open_24h'),
210572
+ 'open': this.safeString(ticker, 'open_24h'),
210533
210573
  'close': last,
210534
210574
  'last': last,
210535
210575
  'previousClose': undefined,
210536
210576
  'change': undefined,
210537
210577
  'percentage': undefined,
210538
210578
  'average': undefined,
210539
- 'baseVolume': this.safeNumber(ticker, 'volume_24h'),
210579
+ 'baseVolume': this.safeString(ticker, 'volume_24h'),
210540
210580
  'quoteVolume': undefined,
210541
210581
  'info': ticker,
210542
- };
210582
+ });
210543
210583
  }
210544
210584
  handleDelta(bookside, delta) {
210545
210585
  const price = this.safeNumber(delta, 0);
@@ -212199,7 +212239,8 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
212199
212239
  }
212200
212240
  client.resolve(stored, symbolSpecificMessageHash);
212201
212241
  // non-symbol specific
212202
- client.resolve(stored, channel);
212242
+ client.resolve(stored, channel); // channel might have a symbol-specific suffix
212243
+ client.resolve(stored, 'user.order');
212203
212244
  }
212204
212245
  }
212205
212246
  async watchBalance(params = {}) {
@@ -212462,6 +212503,10 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
212462
212503
  // channel might be user.trade.BTC_USDT
212463
212504
  this.handleTrades(client, result);
212464
212505
  }
212506
+ if ((channel !== undefined) && channel.startsWith('user.order')) {
212507
+ // channel might be user.order.BTC_USDT
212508
+ this.handleOrders(client, result);
212509
+ }
212465
212510
  const method = this.safeValue(methods, channel);
212466
212511
  if (method !== undefined) {
212467
212512
  method.call(this, client, result);
@@ -212517,13 +212562,14 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
212517
212562
  callMethod.call(this, client, message);
212518
212563
  }
212519
212564
  }
212520
- authenticate(params = {}) {
212565
+ async authenticate(params = {}) {
212521
212566
  this.checkRequiredCredentials();
212522
212567
  const url = this.urls['api']['ws']['private'];
212523
212568
  const client = this.client(url);
212524
212569
  const messageHash = 'authenticated';
212525
- let future = this.safeValue(client.subscriptions, messageHash);
212526
- if (future === undefined) {
212570
+ const future = client.future(messageHash);
212571
+ const authenticated = this.safeValue(client.subscriptions, messageHash);
212572
+ if (authenticated === undefined) {
212527
212573
  const method = 'public/auth';
212528
212574
  const nonce = this.nonce().toString();
212529
212575
  const auth = method + nonce + this.apiKey + nonce;
@@ -212536,8 +212582,7 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
212536
212582
  'sig': signature,
212537
212583
  };
212538
212584
  const message = this.extend(request, params);
212539
- future = this.watch(url, messageHash, message);
212540
- client.subscriptions[messageHash] = future;
212585
+ this.watch(url, messageHash, message, messageHash);
212541
212586
  }
212542
212587
  return future;
212543
212588
  }
@@ -212548,7 +212593,8 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
212548
212593
  //
212549
212594
  // { id: 1648132625434, method: 'public/auth', code: 0 }
212550
212595
  //
212551
- client.resolve(message, 'authenticated');
212596
+ const future = this.safeValue(client.futures, 'authenticated');
212597
+ future.resolve(true);
212552
212598
  }
212553
212599
  }
212554
212600
 
@@ -272348,7 +272394,7 @@ SOFTWARE.
272348
272394
 
272349
272395
  //-----------------------------------------------------------------------------
272350
272396
  // this is updated by vss.js when building
272351
- const version = '4.0.70';
272397
+ const version = '4.0.72';
272352
272398
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
272353
272399
  //-----------------------------------------------------------------------------
272354
272400