ccxt 4.3.13 → 4.3.14

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
@@ -213,13 +213,13 @@ console.log(version, Object.keys(exchanges));
213
213
 
214
214
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
215
215
 
216
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.13/dist/ccxt.browser.js
217
- * unpkg: https://unpkg.com/ccxt@4.3.13/dist/ccxt.browser.js
216
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.14/dist/ccxt.browser.js
217
+ * unpkg: https://unpkg.com/ccxt@4.3.14/dist/ccxt.browser.js
218
218
 
219
219
  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.
220
220
 
221
221
  ```HTML
222
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.13/dist/ccxt.browser.js"></script>
222
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.14/dist/ccxt.browser.js"></script>
223
223
  ```
224
224
 
225
225
  Creates a global `ccxt` object:
package/dist/cjs/ccxt.js CHANGED
@@ -182,7 +182,7 @@ var woo$1 = require('./src/pro/woo.js');
182
182
 
183
183
  //-----------------------------------------------------------------------------
184
184
  // this is updated by vss.js when building
185
- const version = '4.3.13';
185
+ const version = '4.3.14';
186
186
  Exchange["default"].ccxtVersion = version;
187
187
  const exchanges = {
188
188
  'ace': ace,
@@ -347,6 +347,10 @@ class Exchange {
347
347
  }
348
348
  this.newUpdates = (this.options.newUpdates !== undefined) ? this.options.newUpdates : true;
349
349
  this.afterConstruct();
350
+ const isSandbox = this.safeBool2(this.options, 'sandbox', 'testnet', false);
351
+ if (isSandbox) {
352
+ this.setSandboxMode(isSandbox);
353
+ }
350
354
  }
351
355
  describe() {
352
356
  return {
@@ -800,6 +804,10 @@ class Exchange {
800
804
  }
801
805
  setProxyAgents(httpProxy, httpsProxy, socksProxy) {
802
806
  let chosenAgent = undefined;
807
+ // in browser-side, proxy modules are not supported in 'fetch/ws' methods
808
+ if (!isNode && (httpProxy || httpsProxy || socksProxy)) {
809
+ throw new errors.NotSupported(this.id + ' - proxies in browser-side projects are not supported. You have several choices: [A] Use `exchange.proxyUrl` property to redirect requests through local/remote cors-proxy server (find sample file named "sample-local-proxy-server-with-cors" in https://github.com/ccxt/ccxt/tree/master/examples/ folder, which can be used for REST requests only) [B] override `exchange.fetch` && `exchange.watch` methods to send requests through your custom proxy');
810
+ }
803
811
  if (httpProxy) {
804
812
  if (this.httpProxyAgentModule === undefined) {
805
813
  throw new errors.NotSupported(this.id + ' you need to load JS proxy modules with `.loadProxyModules()` method at first to use proxies');
@@ -93,8 +93,8 @@ class binance extends binance$1 {
93
93
  'fetchFundingRates': true,
94
94
  'fetchGreeks': true,
95
95
  'fetchIndexOHLCV': true,
96
- 'fetchIsolatedBorrowRate': false,
97
- 'fetchIsolatedBorrowRates': false,
96
+ 'fetchIsolatedBorrowRate': 'emulated',
97
+ 'fetchIsolatedBorrowRates': true,
98
98
  'fetchL3OrderBook': false,
99
99
  'fetchLastPrices': true,
100
100
  'fetchLedger': true,
@@ -11337,6 +11337,70 @@ class binance extends binance$1 {
11337
11337
  const rate = this.safeDict(response, 0);
11338
11338
  return this.parseBorrowRate(rate);
11339
11339
  }
11340
+ async fetchIsolatedBorrowRate(symbol, params = {}) {
11341
+ /**
11342
+ * @method
11343
+ * @name binance#fetchIsolatedBorrowRate
11344
+ * @description fetch the rate of interest to borrow a currency for margin trading
11345
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data
11346
+ * @param {string} symbol unified market symbol
11347
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
11348
+ *
11349
+ * EXCHANGE SPECIFIC PARAMETERS
11350
+ * @param {object} [params.vipLevel] user's current specific margin data will be returned if viplevel is omitted
11351
+ * @returns {object} an [isolated borrow rate structure]{@link https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure}
11352
+ */
11353
+ const request = {
11354
+ 'symbol': symbol,
11355
+ };
11356
+ const borrowRates = await this.fetchIsolatedBorrowRates(this.extend(request, params));
11357
+ return this.safeDict(borrowRates, symbol);
11358
+ }
11359
+ async fetchIsolatedBorrowRates(params = {}) {
11360
+ /**
11361
+ * @method
11362
+ * @name binance#fetchIsolatedBorrowRates
11363
+ * @description fetch the borrow interest rates of all currencies
11364
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data
11365
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
11366
+ * @param {object} [params.symbol] unified market symbol
11367
+ *
11368
+ * EXCHANGE SPECIFIC PARAMETERS
11369
+ * @param {object} [params.vipLevel] user's current specific margin data will be returned if viplevel is omitted
11370
+ * @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
11371
+ */
11372
+ await this.loadMarkets();
11373
+ const request = {};
11374
+ const symbol = this.safeString(params, 'symbol');
11375
+ params = this.omit(params, 'symbol');
11376
+ if (symbol !== undefined) {
11377
+ const market = this.market(symbol);
11378
+ request['symbol'] = market['id'];
11379
+ }
11380
+ const response = await this.sapiGetMarginIsolatedMarginData(this.extend(request, params));
11381
+ //
11382
+ // [
11383
+ // {
11384
+ // "vipLevel": 0,
11385
+ // "symbol": "BTCUSDT",
11386
+ // "leverage": "10",
11387
+ // "data": [
11388
+ // {
11389
+ // "coin": "BTC",
11390
+ // "dailyInterest": "0.00026125",
11391
+ // "borrowLimit": "270"
11392
+ // },
11393
+ // {
11394
+ // "coin": "USDT",
11395
+ // "dailyInterest": "0.000475",
11396
+ // "borrowLimit": "2100000"
11397
+ // }
11398
+ // ]
11399
+ // }
11400
+ // ]
11401
+ //
11402
+ return this.parseIsolatedBorrowRates(response);
11403
+ }
11340
11404
  async fetchBorrowRateHistory(code, since = undefined, limit = undefined, params = {}) {
11341
11405
  /**
11342
11406
  * @method
@@ -11411,6 +11475,43 @@ class binance extends binance$1 {
11411
11475
  'info': info,
11412
11476
  };
11413
11477
  }
11478
+ parseIsolatedBorrowRate(info, market = undefined) {
11479
+ //
11480
+ // {
11481
+ // "vipLevel": 0,
11482
+ // "symbol": "BTCUSDT",
11483
+ // "leverage": "10",
11484
+ // "data": [
11485
+ // {
11486
+ // "coin": "BTC",
11487
+ // "dailyInterest": "0.00026125",
11488
+ // "borrowLimit": "270"
11489
+ // },
11490
+ // {
11491
+ // "coin": "USDT",
11492
+ // "dailyInterest": "0.000475",
11493
+ // "borrowLimit": "2100000"
11494
+ // }
11495
+ // ]
11496
+ // }
11497
+ //
11498
+ const marketId = this.safeString(info, 'symbol');
11499
+ market = this.safeMarket(marketId, market, undefined, 'spot');
11500
+ const data = this.safeList(info, 'data');
11501
+ const baseInfo = this.safeDict(data, 0);
11502
+ const quoteInfo = this.safeDict(data, 1);
11503
+ return {
11504
+ 'info': info,
11505
+ 'symbol': this.safeString(market, 'symbol'),
11506
+ 'base': this.safeString(baseInfo, 'coin'),
11507
+ 'baseRate': this.safeNumber(baseInfo, 'dailyInterest'),
11508
+ 'quote': this.safeString(quoteInfo, 'coin'),
11509
+ 'quoteRate': this.safeNumber(quoteInfo, 'dailyInterest'),
11510
+ 'period': 86400000,
11511
+ 'timestamp': undefined,
11512
+ 'datetime': undefined,
11513
+ };
11514
+ }
11414
11515
  async createGiftCode(code, amount, params = {}) {
11415
11516
  /**
11416
11517
  * @method