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.
@@ -5575,7 +5575,7 @@ class okx extends okx$1 {
5575
5575
  // }
5576
5576
  //
5577
5577
  const marketId = this.safeString(position, 'instId');
5578
- market = this.safeMarket(marketId, market);
5578
+ market = this.safeMarket(marketId, market, undefined, 'contract');
5579
5579
  const symbol = market['symbol'];
5580
5580
  const pos = this.safeString(position, 'pos'); // 'pos' field: One way mode: 0 if position is not open, 1 if open | Two way (hedge) mode: -1 if short, 1 if long, 0 if position is not open
5581
5581
  const contractsAbs = Precise["default"].stringAbs(pos);
@@ -14,7 +14,7 @@ class woo extends woo$1 {
14
14
  'has': {
15
15
  'ws': true,
16
16
  'watchBalance': true,
17
- 'watchMyTrades': false,
17
+ 'watchMyTrades': true,
18
18
  'watchOHLCV': true,
19
19
  'watchOrderBook': true,
20
20
  'watchOrders': true,
@@ -84,6 +84,7 @@ class woo extends woo$1 {
84
84
  /**
85
85
  * @method
86
86
  * @name woo#watchOrderBook
87
+ * @see https://docs.woo.org/#orderbook
87
88
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
88
89
  * @param {string} symbol unified symbol of the market to fetch the order book for
89
90
  * @param {int} [limit] the maximum amount of order book entries to return.
@@ -228,6 +229,7 @@ class woo extends woo$1 {
228
229
  /**
229
230
  * @method
230
231
  * @name woo#watchTickers
232
+ * @see https://docs.woo.org/#24h-tickers
231
233
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
232
234
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
233
235
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -289,6 +291,18 @@ class woo extends woo$1 {
289
291
  client.resolve(result, topic);
290
292
  }
291
293
  async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
294
+ /**
295
+ * @method
296
+ * @name woo#watchOHLCV
297
+ * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
298
+ * @see https://docs.woo.org/#k-line
299
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
300
+ * @param {string} timeframe the length of time each candle represents
301
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
302
+ * @param {int} [limit] the maximum amount of candles to fetch
303
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
304
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
305
+ */
292
306
  await this.loadMarkets();
293
307
  if ((timeframe !== '1m') && (timeframe !== '5m') && (timeframe !== '15m') && (timeframe !== '30m') && (timeframe !== '1h') && (timeframe !== '1d') && (timeframe !== '1w') && (timeframe !== '1M')) {
294
308
  throw new errors.ExchangeError(this.id + ' watchOHLCV timeframe argument must be 1m, 5m, 15m, 30m, 1h, 1d, 1w, 1M');
@@ -357,6 +371,7 @@ class woo extends woo$1 {
357
371
  * @method
358
372
  * @name woo#watchTrades
359
373
  * @description watches information on multiple trades made in a market
374
+ * @see https://docs.woo.org/#trade
360
375
  * @param {string} symbol unified market symbol of the market trades were made in
361
376
  * @param {int} [since] the earliest time in ms to fetch trades for
362
377
  * @param {int} [limit] the maximum number of trade structures to retrieve
@@ -418,17 +433,60 @@ class woo extends woo$1 {
418
433
  // "side":"BUY",
419
434
  // "source":0
420
435
  // }
436
+ // private trade
437
+ // {
438
+ // "msgType": 0, // execution report
439
+ // "symbol": "SPOT_BTC_USDT",
440
+ // "clientOrderId": 0,
441
+ // "orderId": 54774393,
442
+ // "type": "MARKET",
443
+ // "side": "BUY",
444
+ // "quantity": 0.0,
445
+ // "price": 0.0,
446
+ // "tradeId": 56201985,
447
+ // "executedPrice": 23534.06,
448
+ // "executedQuantity": 0.00040791,
449
+ // "fee": 2.1E-7,
450
+ // "feeAsset": "BTC",
451
+ // "totalExecutedQuantity": 0.00040791,
452
+ // "avgPrice": 23534.06,
453
+ // "status": "FILLED",
454
+ // "reason": "",
455
+ // "orderTag": "default",
456
+ // "totalFee": 2.1E-7,
457
+ // "feeCurrency": "BTC",
458
+ // "totalRebate": 0,
459
+ // "rebateCurrency": "USDT",
460
+ // "visible": 0.0,
461
+ // "timestamp": 1675406261689,
462
+ // "reduceOnly": false,
463
+ // "maker": false
464
+ // }
421
465
  //
422
466
  const marketId = this.safeString(trade, 'symbol');
423
467
  market = this.safeMarket(marketId, market);
424
468
  const symbol = market['symbol'];
425
- const price = this.safeString(trade, 'price');
426
- const amount = this.safeString(trade, 'size');
469
+ const price = this.safeString(trade, 'executedPrice', 'price');
470
+ const amount = this.safeString2(trade, 'executedQuantity', 'size');
427
471
  const cost = Precise["default"].stringMul(price, amount);
428
472
  const side = this.safeStringLower(trade, 'side');
429
473
  const timestamp = this.safeInteger(trade, 'timestamp');
474
+ const maker = this.safeBool(trade, 'marker');
475
+ let takerOrMaker = undefined;
476
+ if (maker !== undefined) {
477
+ takerOrMaker = maker ? 'maker' : 'taker';
478
+ }
479
+ const type = this.safeStringLower(trade, 'type');
480
+ let fee = undefined;
481
+ const feeCost = this.safeNumber(trade, 'fee');
482
+ if (feeCost !== undefined) {
483
+ fee = {
484
+ 'cost': feeCost,
485
+ 'currency': this.safeCurrencyCode(this.safeString(trade, 'feeCurrency')),
486
+ };
487
+ }
430
488
  return this.safeTrade({
431
- 'id': undefined,
489
+ 'id': this.safeString(trade, 'tradeId'),
432
490
  'timestamp': timestamp,
433
491
  'datetime': this.iso8601(timestamp),
434
492
  'symbol': symbol,
@@ -436,10 +494,10 @@ class woo extends woo$1 {
436
494
  'price': price,
437
495
  'amount': amount,
438
496
  'cost': cost,
439
- 'order': undefined,
440
- 'takerOrMaker': undefined,
441
- 'type': undefined,
442
- 'fee': undefined,
497
+ 'order': this.safeString(trade, 'orderId'),
498
+ 'takerOrMaker': takerOrMaker,
499
+ 'type': type,
500
+ 'fee': fee,
443
501
  'info': trade,
444
502
  }, market);
445
503
  }
@@ -493,6 +551,8 @@ class woo extends woo$1 {
493
551
  /**
494
552
  * @method
495
553
  * @name woo#watchOrders
554
+ * @see https://docs.woo.org/#executionreport
555
+ * @see https://docs.woo.org/#algoexecutionreportv2
496
556
  * @description watches information on multiple orders made by the user
497
557
  * @param {string} symbol unified market symbol of the market orders were made in
498
558
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -519,6 +579,37 @@ class woo extends woo$1 {
519
579
  }
520
580
  return this.filterBySymbolSinceLimit(orders, symbol, since, limit, true);
521
581
  }
582
+ async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
583
+ /**
584
+ * @method
585
+ * @name woo#watchOrders
586
+ * @see https://docs.woo.org/#executionreport
587
+ * @description watches information on multiple trades made by the user
588
+ * @param {string} symbol unified market symbol of the market orders were made in
589
+ * @param {int} [since] the earliest time in ms to fetch orders for
590
+ * @param {int} [limit] the maximum number of order structures to retrieve
591
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
592
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
593
+ */
594
+ await this.loadMarkets();
595
+ const topic = 'executionreport';
596
+ let messageHash = 'myTrades';
597
+ if (symbol !== undefined) {
598
+ const market = this.market(symbol);
599
+ symbol = market['symbol'];
600
+ messageHash += ':' + symbol;
601
+ }
602
+ const request = {
603
+ 'event': 'subscribe',
604
+ 'topic': topic,
605
+ };
606
+ const message = this.extend(request, params);
607
+ const trades = await this.watchPrivate(messageHash, message);
608
+ if (this.newUpdates) {
609
+ limit = trades.getLimit(symbol, limit);
610
+ }
611
+ return this.filterBySymbolSinceLimit(trades, symbol, since, limit, true);
612
+ }
522
613
  parseWsOrder(order, market = undefined) {
523
614
  //
524
615
  // {
@@ -627,7 +718,11 @@ class woo extends woo$1 {
627
718
  // }
628
719
  // }
629
720
  //
630
- const order = this.safeValue(message, 'data');
721
+ const order = this.safeDict(message, 'data');
722
+ const tradeId = this.safeString(order, 'tradeId');
723
+ if ((tradeId !== undefined) && (tradeId !== '0')) {
724
+ this.handleMyTrade(client, order);
725
+ }
631
726
  this.handleOrder(client, order);
632
727
  }
633
728
  handleOrder(client, message) {
@@ -662,6 +757,49 @@ class woo extends woo$1 {
662
757
  client.resolve(this.orders, messageHashSymbol);
663
758
  }
664
759
  }
760
+ handleMyTrade(client, message) {
761
+ //
762
+ // {
763
+ // "msgType": 0, // execution report
764
+ // "symbol": "SPOT_BTC_USDT",
765
+ // "clientOrderId": 0,
766
+ // "orderId": 54774393,
767
+ // "type": "MARKET",
768
+ // "side": "BUY",
769
+ // "quantity": 0.0,
770
+ // "price": 0.0,
771
+ // "tradeId": 56201985,
772
+ // "executedPrice": 23534.06,
773
+ // "executedQuantity": 0.00040791,
774
+ // "fee": 2.1E-7,
775
+ // "feeAsset": "BTC",
776
+ // "totalExecutedQuantity": 0.00040791,
777
+ // "avgPrice": 23534.06,
778
+ // "status": "FILLED",
779
+ // "reason": "",
780
+ // "orderTag": "default",
781
+ // "totalFee": 2.1E-7,
782
+ // "feeCurrency": "BTC",
783
+ // "totalRebate": 0,
784
+ // "rebateCurrency": "USDT",
785
+ // "visible": 0.0,
786
+ // "timestamp": 1675406261689,
787
+ // "reduceOnly": false,
788
+ // "maker": false
789
+ // }
790
+ //
791
+ let myTrades = this.myTrades;
792
+ if (myTrades === undefined) {
793
+ const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
794
+ myTrades = new Cache.ArrayCacheBySymbolById(limit);
795
+ }
796
+ const trade = this.parseWsTrade(message);
797
+ myTrades.append(trade);
798
+ let messageHash = 'myTrades:' + trade['symbol'];
799
+ client.resolve(myTrades, messageHash);
800
+ messageHash = 'myTrades';
801
+ client.resolve(myTrades, messageHash);
802
+ }
665
803
  async watchPositions(symbols = undefined, since = undefined, limit = undefined, params = {}) {
666
804
  /**
667
805
  * @method
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, 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.12";
7
+ declare const version = "4.3.13";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, 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';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.3.13';
41
+ const version = '4.3.14';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -200,7 +200,7 @@ export default class Exchange {
200
200
  numberToBE: (n: number, padding: number) => Uint8Array;
201
201
  base16ToBinary: (str: string) => Uint8Array;
202
202
  iso8601: (timestamp: any) => string;
203
- omit: (x: Dictionary<any>, ...args: any[]) => any;
203
+ omit: (x: Dictionary<any>, ...args: any) => any;
204
204
  isJsonEncodedObject: (object: any) => boolean;
205
205
  safeInteger: (o: any, k: IndexType, $default?: number) => number;
206
206
  sum: (...xs: any[]) => any;
@@ -332,6 +332,10 @@ export default class Exchange {
332
332
  }
333
333
  this.newUpdates = (this.options.newUpdates !== undefined) ? this.options.newUpdates : true;
334
334
  this.afterConstruct();
335
+ const isSandbox = this.safeBool2(this.options, 'sandbox', 'testnet', false);
336
+ if (isSandbox) {
337
+ this.setSandboxMode(isSandbox);
338
+ }
335
339
  }
336
340
  describe() {
337
341
  return {
@@ -785,6 +789,10 @@ export default class Exchange {
785
789
  }
786
790
  setProxyAgents(httpProxy, httpsProxy, socksProxy) {
787
791
  let chosenAgent = undefined;
792
+ // in browser-side, proxy modules are not supported in 'fetch/ws' methods
793
+ if (!isNode && (httpProxy || httpsProxy || socksProxy)) {
794
+ throw new 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');
795
+ }
788
796
  if (httpProxy) {
789
797
  if (this.httpProxyAgentModule === undefined) {
790
798
  throw new NotSupported(this.id + ' you need to load JS proxy modules with `.loadProxyModules()` method at first to use proxies');
@@ -21,7 +21,7 @@ declare const sortBy: (array: any[], key: IndexType, descending?: boolean, defau
21
21
  declare const sortBy2: (array: any[], key1: IndexType, key2: IndexType, descending?: boolean, direction?: number) => any[];
22
22
  declare const flatten: (x: any[], out?: any[]) => any[];
23
23
  declare const pluck: (x: Dictionary<any>, k: any) => any[];
24
- declare const omit: (x: Dictionary<any>, ...args: any[]) => any;
24
+ declare const omit: (x: Dictionary<any>, ...args: any) => any;
25
25
  declare const sum: (...xs: any[]) => any;
26
26
  declare const deepExtend: (...xs: any) => any;
27
27
  declare const merge: (target: Dictionary<any>, ...args: any) => Dictionary<any>;
@@ -1,4 +1,5 @@
1
1
  import { CHash } from '../../static_dependencies/noble-hashes/utils.js';
2
+ import { Dictionary } from "../types.js";
2
3
  declare function rsa(request: string, secret: string, hash: CHash): string;
3
- declare function jwt(request: {}, secret: Uint8Array, hash: CHash, isRSA?: boolean, opts?: {}): string;
4
+ declare function jwt(request: Dictionary<any>, secret: Uint8Array, hash: CHash, isRSA?: boolean, opts?: Dictionary<any>): string;
4
5
  export { rsa, jwt };
@@ -1,3 +1,3 @@
1
- declare function totp(secret: any): string;
1
+ declare function totp(secret: string): string;
2
2
  export { totp };
3
3
  export default totp;
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/binance.js';
2
- import type { TransferEntry, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Market, Greeks, Strings, Currency, MarketInterface, MarginMode, MarginModes, Leverage, Leverages, Num, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CrossBorrowRate } from './base/types.js';
2
+ import type { TransferEntry, Int, OrderSide, Balances, OrderType, Trade, OHLCV, Order, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, Str, Transaction, Ticker, OrderBook, Tickers, Market, Greeks, Strings, Currency, MarketInterface, MarginMode, MarginModes, Leverage, Leverages, Num, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CrossBorrowRate, IsolatedBorrowRates, IsolatedBorrowRate } from './base/types.js';
3
3
  /**
4
4
  * @class binance
5
5
  * @augments Exchange
@@ -304,6 +304,8 @@ export default class binance extends Exchange {
304
304
  reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
305
305
  addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
306
306
  fetchCrossBorrowRate(code: string, params?: {}): Promise<CrossBorrowRate>;
307
+ fetchIsolatedBorrowRate(symbol: string, params?: {}): Promise<IsolatedBorrowRate>;
308
+ fetchIsolatedBorrowRates(params?: {}): Promise<IsolatedBorrowRates>;
307
309
  fetchBorrowRateHistory(code: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
308
310
  parseBorrowRateHistory(response: any, code: any, since: any, limit: any): any;
309
311
  parseBorrowRate(info: any, currency?: Currency): {
@@ -314,6 +316,17 @@ export default class binance extends Exchange {
314
316
  datetime: string;
315
317
  info: any;
316
318
  };
319
+ parseIsolatedBorrowRate(info: any, market?: Market): {
320
+ info: any;
321
+ symbol: string;
322
+ base: string;
323
+ baseRate: number;
324
+ quote: string;
325
+ quoteRate: number;
326
+ period: number;
327
+ timestamp: any;
328
+ datetime: any;
329
+ };
317
330
  createGiftCode(code: string, amount: any, params?: {}): Promise<{
318
331
  info: any;
319
332
  id: string;
package/js/src/binance.js CHANGED
@@ -96,8 +96,8 @@ export default class binance extends Exchange {
96
96
  'fetchFundingRates': true,
97
97
  'fetchGreeks': true,
98
98
  'fetchIndexOHLCV': true,
99
- 'fetchIsolatedBorrowRate': false,
100
- 'fetchIsolatedBorrowRates': false,
99
+ 'fetchIsolatedBorrowRate': 'emulated',
100
+ 'fetchIsolatedBorrowRates': true,
101
101
  'fetchL3OrderBook': false,
102
102
  'fetchLastPrices': true,
103
103
  'fetchLedger': true,
@@ -11340,6 +11340,70 @@ export default class binance extends Exchange {
11340
11340
  const rate = this.safeDict(response, 0);
11341
11341
  return this.parseBorrowRate(rate);
11342
11342
  }
11343
+ async fetchIsolatedBorrowRate(symbol, params = {}) {
11344
+ /**
11345
+ * @method
11346
+ * @name binance#fetchIsolatedBorrowRate
11347
+ * @description fetch the rate of interest to borrow a currency for margin trading
11348
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data
11349
+ * @param {string} symbol unified market symbol
11350
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
11351
+ *
11352
+ * EXCHANGE SPECIFIC PARAMETERS
11353
+ * @param {object} [params.vipLevel] user's current specific margin data will be returned if viplevel is omitted
11354
+ * @returns {object} an [isolated borrow rate structure]{@link https://docs.ccxt.com/#/?id=isolated-borrow-rate-structure}
11355
+ */
11356
+ const request = {
11357
+ 'symbol': symbol,
11358
+ };
11359
+ const borrowRates = await this.fetchIsolatedBorrowRates(this.extend(request, params));
11360
+ return this.safeDict(borrowRates, symbol);
11361
+ }
11362
+ async fetchIsolatedBorrowRates(params = {}) {
11363
+ /**
11364
+ * @method
11365
+ * @name binance#fetchIsolatedBorrowRates
11366
+ * @description fetch the borrow interest rates of all currencies
11367
+ * @see https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-fee-data-user_data
11368
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
11369
+ * @param {object} [params.symbol] unified market symbol
11370
+ *
11371
+ * EXCHANGE SPECIFIC PARAMETERS
11372
+ * @param {object} [params.vipLevel] user's current specific margin data will be returned if viplevel is omitted
11373
+ * @returns {object} a [borrow rate structure]{@link https://docs.ccxt.com/#/?id=borrow-rate-structure}
11374
+ */
11375
+ await this.loadMarkets();
11376
+ const request = {};
11377
+ const symbol = this.safeString(params, 'symbol');
11378
+ params = this.omit(params, 'symbol');
11379
+ if (symbol !== undefined) {
11380
+ const market = this.market(symbol);
11381
+ request['symbol'] = market['id'];
11382
+ }
11383
+ const response = await this.sapiGetMarginIsolatedMarginData(this.extend(request, params));
11384
+ //
11385
+ // [
11386
+ // {
11387
+ // "vipLevel": 0,
11388
+ // "symbol": "BTCUSDT",
11389
+ // "leverage": "10",
11390
+ // "data": [
11391
+ // {
11392
+ // "coin": "BTC",
11393
+ // "dailyInterest": "0.00026125",
11394
+ // "borrowLimit": "270"
11395
+ // },
11396
+ // {
11397
+ // "coin": "USDT",
11398
+ // "dailyInterest": "0.000475",
11399
+ // "borrowLimit": "2100000"
11400
+ // }
11401
+ // ]
11402
+ // }
11403
+ // ]
11404
+ //
11405
+ return this.parseIsolatedBorrowRates(response);
11406
+ }
11343
11407
  async fetchBorrowRateHistory(code, since = undefined, limit = undefined, params = {}) {
11344
11408
  /**
11345
11409
  * @method
@@ -11414,6 +11478,43 @@ export default class binance extends Exchange {
11414
11478
  'info': info,
11415
11479
  };
11416
11480
  }
11481
+ parseIsolatedBorrowRate(info, market = undefined) {
11482
+ //
11483
+ // {
11484
+ // "vipLevel": 0,
11485
+ // "symbol": "BTCUSDT",
11486
+ // "leverage": "10",
11487
+ // "data": [
11488
+ // {
11489
+ // "coin": "BTC",
11490
+ // "dailyInterest": "0.00026125",
11491
+ // "borrowLimit": "270"
11492
+ // },
11493
+ // {
11494
+ // "coin": "USDT",
11495
+ // "dailyInterest": "0.000475",
11496
+ // "borrowLimit": "2100000"
11497
+ // }
11498
+ // ]
11499
+ // }
11500
+ //
11501
+ const marketId = this.safeString(info, 'symbol');
11502
+ market = this.safeMarket(marketId, market, undefined, 'spot');
11503
+ const data = this.safeList(info, 'data');
11504
+ const baseInfo = this.safeDict(data, 0);
11505
+ const quoteInfo = this.safeDict(data, 1);
11506
+ return {
11507
+ 'info': info,
11508
+ 'symbol': this.safeString(market, 'symbol'),
11509
+ 'base': this.safeString(baseInfo, 'coin'),
11510
+ 'baseRate': this.safeNumber(baseInfo, 'dailyInterest'),
11511
+ 'quote': this.safeString(quoteInfo, 'coin'),
11512
+ 'quoteRate': this.safeNumber(quoteInfo, 'dailyInterest'),
11513
+ 'period': 86400000,
11514
+ 'timestamp': undefined,
11515
+ 'datetime': undefined,
11516
+ };
11517
+ }
11417
11518
  async createGiftCode(code, amount, params = {}) {
11418
11519
  /**
11419
11520
  * @method