ccxt 4.3.7 → 4.3.8

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.7/dist/ccxt.browser.js
217
- * unpkg: https://unpkg.com/ccxt@4.3.7/dist/ccxt.browser.js
216
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.8/dist/ccxt.browser.js
217
+ * unpkg: https://unpkg.com/ccxt@4.3.8/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.7/dist/ccxt.browser.js"></script>
222
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.8/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.7';
185
+ const version = '4.3.8';
186
186
  Exchange["default"].ccxtVersion = version;
187
187
  const exchanges = {
188
188
  'ace': ace,
@@ -6104,7 +6104,7 @@ class Exchange {
6104
6104
  parseLeverage(leverage, market = undefined) {
6105
6105
  throw new errors.NotSupported(this.id + ' parseLeverage () is not supported yet');
6106
6106
  }
6107
- parseConversions(conversions, fromCurrencyKey = undefined, toCurrencyKey = undefined, since = undefined, limit = undefined, params = {}) {
6107
+ parseConversions(conversions, code = undefined, fromCurrencyKey = undefined, toCurrencyKey = undefined, since = undefined, limit = undefined, params = {}) {
6108
6108
  conversions = this.toArray(conversions);
6109
6109
  const result = [];
6110
6110
  let fromCurrency = undefined;
@@ -6123,8 +6123,18 @@ class Exchange {
6123
6123
  result.push(conversion);
6124
6124
  }
6125
6125
  const sorted = this.sortBy(result, 'timestamp');
6126
- const code = (fromCurrency !== undefined) ? fromCurrency['code'] : undefined;
6127
- return this.filterByCurrencySinceLimit(sorted, code, since, limit);
6126
+ let currency = undefined;
6127
+ if (code !== undefined) {
6128
+ currency = this.currency(code);
6129
+ code = currency['code'];
6130
+ }
6131
+ if (code === undefined) {
6132
+ return this.filterBySinceLimit(sorted, since, limit);
6133
+ }
6134
+ const fromConversion = this.filterBy(sorted, 'fromCurrency', code);
6135
+ const toConversion = this.filterBy(sorted, 'toCurrency', code);
6136
+ const both = this.arrayConcat(fromConversion, toConversion);
6137
+ return this.filterBySinceLimit(both, since, limit);
6128
6138
  }
6129
6139
  parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
6130
6140
  throw new errors.NotSupported(this.id + ' parseConversion () is not supported yet');
@@ -12919,7 +12919,7 @@ class binance extends binance$1 {
12919
12919
  //
12920
12920
  }
12921
12921
  const rows = this.safeList(response, responseQuery, []);
12922
- return this.parseConversions(rows, fromCurrencyKey, toCurrencyKey, since, limit);
12922
+ return this.parseConversions(rows, code, fromCurrencyKey, toCurrencyKey, since, limit);
12923
12923
  }
12924
12924
  parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
12925
12925
  //
@@ -2463,7 +2463,7 @@ class bingx extends bingx$1 {
2463
2463
  return this.safeOrder({
2464
2464
  'info': info,
2465
2465
  'id': this.safeString2(order, 'orderId', 'i'),
2466
- 'clientOrderId': this.safeStringN(order, ['clientOrderID', 'origClientOrderId', 'c']),
2466
+ 'clientOrderId': this.safeStringN(order, ['clientOrderID', 'clientOrderId', 'origClientOrderId', 'c']),
2467
2467
  'symbol': this.safeSymbol(marketId, market, '-', marketType),
2468
2468
  'timestamp': timestamp,
2469
2469
  'datetime': this.iso8601(timestamp),
@@ -8672,7 +8672,7 @@ class bitget extends bitget$1 {
8672
8672
  //
8673
8673
  const data = this.safeDict(response, 'data', {});
8674
8674
  const dataList = this.safeList(data, 'dataList', []);
8675
- return this.parseConversions(dataList, 'fromCoin', 'toCoin', since, limit);
8675
+ return this.parseConversions(dataList, code, 'fromCoin', 'toCoin', since, limit);
8676
8676
  }
8677
8677
  parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
8678
8678
  //
@@ -1529,190 +1529,144 @@ class coinex extends coinex$1 {
1529
1529
  }
1530
1530
  async fetchMarginBalance(params = {}) {
1531
1531
  await this.loadMarkets();
1532
- const symbol = this.safeString(params, 'symbol');
1533
- let marketId = this.safeString(params, 'market');
1534
- let market = undefined;
1535
- if (symbol !== undefined) {
1536
- market = this.market(symbol);
1537
- marketId = market['id'];
1538
- }
1539
- else if (marketId === undefined) {
1540
- throw new errors.ArgumentsRequired(this.id + ' fetchMarginBalance() fetching a margin account requires a market parameter or a symbol parameter');
1541
- }
1542
- params = this.omit(params, ['symbol', 'market']);
1543
- const request = {
1544
- 'market': marketId,
1545
- };
1546
- const response = await this.v1PrivateGetMarginAccount(this.extend(request, params));
1532
+ const response = await this.v2PrivateGetAssetsMarginBalance(params);
1547
1533
  //
1548
- // {
1549
- // "code": 0,
1550
- // "data": {
1551
- // "account_id": 126,
1552
- // "leverage": 3,
1553
- // "market_type": "AAVEUSDT",
1554
- // "sell_asset_type": "AAVE",
1555
- // "buy_asset_type": "USDT",
1556
- // "balance": {
1557
- // "sell_type": "0.3", // borrowed
1558
- // "buy_type": "30"
1559
- // },
1560
- // "frozen": {
1561
- // "sell_type": "0",
1562
- // "buy_type": "0"
1563
- // },
1564
- // "loan": {
1565
- // "sell_type": "0.3", // loan
1566
- // "buy_type": "0"
1567
- // },
1568
- // "interest": {
1569
- // "sell_type": "0.0000125",
1570
- // "buy_type": "0"
1571
- // },
1572
- // "can_transfer": {
1573
- // "sell_type": "0.02500646",
1574
- // "buy_type": "4.28635738"
1575
- // },
1576
- // "warn_rate": "",
1577
- // "liquidation_price": ""
1578
- // },
1579
- // "message": "Success"
1580
- // }
1534
+ // {
1535
+ // "data": [
1536
+ // {
1537
+ // "margin_account": "BTCUSDT",
1538
+ // "base_ccy": "BTC",
1539
+ // "quote_ccy": "USDT",
1540
+ // "available": {
1541
+ // "base_ccy": "0.00000026",
1542
+ // "quote_ccy": "0"
1543
+ // },
1544
+ // "frozen": {
1545
+ // "base_ccy": "0",
1546
+ // "quote_ccy": "0"
1547
+ // },
1548
+ // "repaid": {
1549
+ // "base_ccy": "0",
1550
+ // "quote_ccy": "0"
1551
+ // },
1552
+ // "interest": {
1553
+ // "base_ccy": "0",
1554
+ // "quote_ccy": "0"
1555
+ // },
1556
+ // "rik_rate": "",
1557
+ // "liq_price": ""
1558
+ // },
1559
+ // ],
1560
+ // "code": 0,
1561
+ // "message": "OK"
1562
+ // }
1581
1563
  //
1582
1564
  const result = { 'info': response };
1583
- const data = this.safeValue(response, 'data', {});
1584
- const free = this.safeValue(data, 'can_transfer', {});
1585
- const total = this.safeValue(data, 'balance', {});
1586
- const loan = this.safeValue(data, 'loan', {});
1587
- const interest = this.safeValue(data, 'interest', {});
1588
- //
1589
- const sellAccount = this.account();
1590
- const sellCurrencyId = this.safeString(data, 'sell_asset_type');
1591
- const sellCurrencyCode = this.safeCurrencyCode(sellCurrencyId);
1592
- sellAccount['free'] = this.safeString(free, 'sell_type');
1593
- sellAccount['total'] = this.safeString(total, 'sell_type');
1594
- const sellDebt = this.safeString(loan, 'sell_type');
1595
- const sellInterest = this.safeString(interest, 'sell_type');
1596
- sellAccount['debt'] = Precise["default"].stringAdd(sellDebt, sellInterest);
1597
- result[sellCurrencyCode] = sellAccount;
1598
- //
1599
- const buyAccount = this.account();
1600
- const buyCurrencyId = this.safeString(data, 'buy_asset_type');
1601
- const buyCurrencyCode = this.safeCurrencyCode(buyCurrencyId);
1602
- buyAccount['free'] = this.safeString(free, 'buy_type');
1603
- buyAccount['total'] = this.safeString(total, 'buy_type');
1604
- const buyDebt = this.safeString(loan, 'buy_type');
1605
- const buyInterest = this.safeString(interest, 'buy_type');
1606
- buyAccount['debt'] = Precise["default"].stringAdd(buyDebt, buyInterest);
1607
- result[buyCurrencyCode] = buyAccount;
1608
- //
1565
+ const balances = this.safeList(response, 'data', []);
1566
+ for (let i = 0; i < balances.length; i++) {
1567
+ const entry = balances[i];
1568
+ const free = this.safeDict(entry, 'available', {});
1569
+ const used = this.safeDict(entry, 'frozen', {});
1570
+ const loan = this.safeDict(entry, 'repaid', {});
1571
+ const interest = this.safeDict(entry, 'interest', {});
1572
+ const baseAccount = this.account();
1573
+ const baseCurrencyId = this.safeString(entry, 'base_ccy');
1574
+ const baseCurrencyCode = this.safeCurrencyCode(baseCurrencyId);
1575
+ baseAccount['free'] = this.safeString(free, 'base_ccy');
1576
+ baseAccount['used'] = this.safeString(used, 'base_ccy');
1577
+ const baseDebt = this.safeString(loan, 'base_ccy');
1578
+ const baseInterest = this.safeString(interest, 'base_ccy');
1579
+ baseAccount['debt'] = Precise["default"].stringAdd(baseDebt, baseInterest);
1580
+ result[baseCurrencyCode] = baseAccount;
1581
+ }
1609
1582
  return this.safeBalance(result);
1610
1583
  }
1611
1584
  async fetchSpotBalance(params = {}) {
1612
1585
  await this.loadMarkets();
1613
- const response = await this.v1PrivateGetBalanceInfo(params);
1586
+ const response = await this.v2PrivateGetAssetsSpotBalance(params);
1614
1587
  //
1615
1588
  // {
1616
- // "code": 0,
1617
- // "data": {
1618
- // "BCH": { # BCH account
1619
- // "available": "13.60109", # Available BCH
1620
- // "frozen": "0.00000" # Frozen BCH
1621
- // },
1622
- // "BTC": { # BTC account
1623
- // "available": "32590.16", # Available BTC
1624
- // "frozen": "7000.00" # Frozen BTC
1625
- // },
1626
- // "ETH": { # ETH account
1627
- // "available": "5.06000", # Available ETH
1628
- // "frozen": "0.00000" # Frozen ETH
1629
- // }
1630
- // },
1631
- // "message": "Ok"
1589
+ // "code": 0,
1590
+ // "data": [
1591
+ // {
1592
+ // "available": "0.00000046",
1593
+ // "ccy": "USDT",
1594
+ // "frozen": "0"
1595
+ // }
1596
+ // ],
1597
+ // "message": "OK"
1632
1598
  // }
1633
1599
  //
1634
1600
  const result = { 'info': response };
1635
- const balances = this.safeValue(response, 'data', {});
1636
- const currencyIds = Object.keys(balances);
1637
- for (let i = 0; i < currencyIds.length; i++) {
1638
- const currencyId = currencyIds[i];
1601
+ const balances = this.safeList(response, 'data', []);
1602
+ for (let i = 0; i < balances.length; i++) {
1603
+ const entry = balances[i];
1604
+ const currencyId = this.safeString(entry, 'ccy');
1639
1605
  const code = this.safeCurrencyCode(currencyId);
1640
- const balance = this.safeValue(balances, currencyId, {});
1641
1606
  const account = this.account();
1642
- account['free'] = this.safeString(balance, 'available');
1643
- account['used'] = this.safeString(balance, 'frozen');
1607
+ account['free'] = this.safeString(entry, 'available');
1608
+ account['used'] = this.safeString(entry, 'frozen');
1644
1609
  result[code] = account;
1645
1610
  }
1646
1611
  return this.safeBalance(result);
1647
1612
  }
1648
1613
  async fetchSwapBalance(params = {}) {
1649
1614
  await this.loadMarkets();
1650
- const response = await this.v1PerpetualPrivateGetAssetQuery(params);
1615
+ const response = await this.v2PrivateGetAssetsFuturesBalance(params);
1651
1616
  //
1652
1617
  // {
1653
1618
  // "code": 0,
1654
- // "data": {
1655
- // "USDT": {
1656
- // "available": "37.24817690383456000000",
1657
- // "balance_total": "37.24817690383456000000",
1658
- // "frozen": "0.00000000000000000000",
1659
- // "margin": "0.00000000000000000000",
1660
- // "profit_unreal": "0.00000000000000000000",
1661
- // "transfer": "37.24817690383456000000"
1619
+ // "data": [
1620
+ // {
1621
+ // "available": "0.00000046",
1622
+ // "ccy": "USDT",
1623
+ // "frozen": "0",
1624
+ // "margin": "0",
1625
+ // "transferrable": "0.00000046",
1626
+ // "unrealized_pnl": "0"
1662
1627
  // }
1663
- // },
1628
+ // ],
1664
1629
  // "message": "OK"
1665
1630
  // }
1666
1631
  //
1667
1632
  const result = { 'info': response };
1668
- const balances = this.safeValue(response, 'data', {});
1669
- const currencyIds = Object.keys(balances);
1670
- for (let i = 0; i < currencyIds.length; i++) {
1671
- const currencyId = currencyIds[i];
1633
+ const balances = this.safeList(response, 'data', []);
1634
+ for (let i = 0; i < balances.length; i++) {
1635
+ const entry = balances[i];
1636
+ const currencyId = this.safeString(entry, 'ccy');
1672
1637
  const code = this.safeCurrencyCode(currencyId);
1673
- const balance = this.safeValue(balances, currencyId, {});
1674
1638
  const account = this.account();
1675
- account['free'] = this.safeString(balance, 'available');
1676
- account['used'] = this.safeString(balance, 'frozen');
1677
- account['total'] = this.safeString(balance, 'balance_total');
1639
+ account['free'] = this.safeString(entry, 'available');
1640
+ account['used'] = this.safeString(entry, 'frozen');
1678
1641
  result[code] = account;
1679
1642
  }
1680
1643
  return this.safeBalance(result);
1681
1644
  }
1682
1645
  async fetchFinancialBalance(params = {}) {
1683
1646
  await this.loadMarkets();
1684
- const response = await this.v1PrivateGetAccountInvestmentBalance(params);
1647
+ const response = await this.v2PrivateGetAssetsFinancialBalance(params);
1685
1648
  //
1686
1649
  // {
1687
- // "code": 0,
1688
- // "data": [
1689
- // {
1690
- // "asset": "CET",
1691
- // "available": "0",
1692
- // "frozen": "0",
1693
- // "lock": "0",
1694
- // },
1695
- // {
1696
- // "asset": "USDT",
1697
- // "available": "999900",
1698
- // "frozen": "0",
1699
- // "lock": "0"
1700
- // }
1701
- // ],
1702
- // "message": "Success"
1703
- // }
1650
+ // "code": 0,
1651
+ // "data": [
1652
+ // {
1653
+ // "available": "0.00000046",
1654
+ // "ccy": "USDT",
1655
+ // "frozen": "0"
1656
+ // }
1657
+ // ],
1658
+ // "message": "OK"
1659
+ // }
1704
1660
  //
1705
1661
  const result = { 'info': response };
1706
- const balances = this.safeValue(response, 'data', {});
1662
+ const balances = this.safeList(response, 'data', []);
1707
1663
  for (let i = 0; i < balances.length; i++) {
1708
- const balance = balances[i];
1709
- const currencyId = this.safeString(balance, 'asset');
1664
+ const entry = balances[i];
1665
+ const currencyId = this.safeString(entry, 'ccy');
1710
1666
  const code = this.safeCurrencyCode(currencyId);
1711
1667
  const account = this.account();
1712
- account['free'] = this.safeString(balance, 'available');
1713
- const frozen = this.safeString(balance, 'frozen');
1714
- const locked = this.safeString(balance, 'lock');
1715
- account['used'] = Precise["default"].stringAdd(frozen, locked);
1668
+ account['free'] = this.safeString(entry, 'available');
1669
+ account['used'] = this.safeString(entry, 'frozen');
1716
1670
  result[code] = account;
1717
1671
  }
1718
1672
  return this.safeBalance(result);
@@ -1722,10 +1676,10 @@ class coinex extends coinex$1 {
1722
1676
  * @method
1723
1677
  * @name coinex#fetchBalance
1724
1678
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
1725
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account001_account_info // spot
1726
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account004_investment_balance // financial
1727
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account006_margin_account // margin
1728
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http016_asset_query // swap
1679
+ * @see https://docs.coinex.com/api/v2/assets/balance/http/get-spot-balance // spot
1680
+ * @see https://docs.coinex.com/api/v2/assets/balance/http/get-futures-balance // swap
1681
+ * @see https://docs.coinex.com/api/v2/assets/balance/http/get-marigin-balance // margin
1682
+ * @see https://docs.coinex.com/api/v2/assets/balance/http/get-financial-balance // financial
1729
1683
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1730
1684
  * @param {string} [params.type] 'margin', 'swap', 'financial', or 'spot'
1731
1685
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
@@ -5821,7 +5775,11 @@ class coinex extends coinex$1 {
5821
5775
  this.checkRequiredCredentials();
5822
5776
  query = this.keysort(query);
5823
5777
  const urlencoded = this.rawencode(query);
5824
- const preparedString = method + '/' + version + '/' + path + '?' + urlencoded + nonce + this.secret;
5778
+ let preparedString = method + '/' + version + '/' + path;
5779
+ if (urlencoded) {
5780
+ preparedString += '?' + urlencoded;
5781
+ }
5782
+ preparedString += nonce + this.secret;
5825
5783
  const signature = this.hash(this.encode(preparedString), sha256.sha256);
5826
5784
  headers = {
5827
5785
  'X-COINEX-KEY': this.apiKey,
@@ -5829,7 +5787,9 @@ class coinex extends coinex$1 {
5829
5787
  'X-COINEX-TIMESTAMP': nonce,
5830
5788
  };
5831
5789
  if ((method === 'GET') || (method === 'DELETE') || (method === 'PUT')) {
5832
- url += '?' + urlencoded;
5790
+ if (urlencoded) {
5791
+ url += '?' + urlencoded;
5792
+ }
5833
5793
  }
5834
5794
  else {
5835
5795
  body = this.json(query);
@@ -7925,7 +7925,7 @@ class okx extends okx$1 {
7925
7925
  // }
7926
7926
  //
7927
7927
  const rows = this.safeList(response, 'data', []);
7928
- return this.parseConversions(rows, 'baseCcy', 'quoteCcy', since, limit);
7928
+ return this.parseConversions(rows, code, 'baseCcy', 'quoteCcy', since, limit);
7929
7929
  }
7930
7930
  parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
7931
7931
  //
@@ -3182,7 +3182,7 @@ class woo extends woo$1 {
3182
3182
  //
3183
3183
  const data = this.safeDict(response, 'data', {});
3184
3184
  const rows = this.safeList(data, 'tradeVos', []);
3185
- return this.parseConversions(rows, 'sellAsset', 'buyAsset', since, limit);
3185
+ return this.parseConversions(rows, code, 'sellAsset', 'buyAsset', since, limit);
3186
3186
  }
3187
3187
  parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
3188
3188
  //
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.6";
7
+ declare const version = "4.3.7";
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.7';
41
+ const version = '4.3.8';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -166,21 +166,21 @@ export default class Exchange {
166
166
  newUpdates: boolean;
167
167
  streaming: {};
168
168
  alias: boolean;
169
- deepExtend: (...xs: any[]) => any;
169
+ deepExtend: (...xs: any) => any;
170
170
  isNode: boolean;
171
171
  keys: {
172
172
  (o: object): string[];
173
173
  (o: {}): string[];
174
174
  };
175
- values: (x: any) => any[];
175
+ values: (x: any[] | Dictionary<any>) => any[];
176
176
  extend: (...args: any[]) => any;
177
177
  clone: (x: any) => any;
178
- flatten: (x: any, out?: any[]) => any[];
179
- unique: (x: any) => any[];
180
- indexBy: (x: any, k: any, out?: {}) => {};
181
- sortBy: (array: any, key: any, descending?: boolean, defaultValue?: any, direction?: number) => any;
182
- sortBy2: (array: any, key1: any, key2: any, descending?: boolean, direction?: number) => any;
183
- groupBy: (x: any, k: any, out?: {}) => {};
178
+ flatten: (x: any[], out?: any[]) => any[];
179
+ unique: (x: any[]) => any[];
180
+ indexBy: (x: Dictionary<any>, k: IndexType, out?: Dictionary<any>) => Dictionary<any>;
181
+ sortBy: (array: any[], key: IndexType, descending?: boolean, defaultValue?: any, direction?: number) => any[];
182
+ sortBy2: (array: any[], key1: IndexType, key2: IndexType, descending?: boolean, direction?: number) => any[];
183
+ groupBy: (x: Dictionary<any>, k: string, out?: Dictionary<any>) => Dictionary<any>;
184
184
  aggregate: typeof functions.aggregate;
185
185
  uuid: (a?: any) => string;
186
186
  unCamelCase: (s: string) => string;
@@ -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: 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;
@@ -209,7 +209,7 @@ export default class Exchange {
209
209
  extractParams: (string: any) => any[];
210
210
  json: (data: any, params?: any) => string;
211
211
  vwap: typeof functions.vwap;
212
- merge: (target: any, ...args: any[]) => any;
212
+ merge: (target: Dictionary<any>, ...args: any) => Dictionary<any>;
213
213
  binaryConcat: typeof import("../static_dependencies/noble-curves/abstract/utils.js").concatBytes;
214
214
  hash: (request: import("../static_dependencies/noble-hashes/utils.js").Input, hash: {
215
215
  (message: import("../static_dependencies/noble-hashes/utils.js").Input): Uint8Array;
@@ -217,7 +217,7 @@ export default class Exchange {
217
217
  blockLen: number;
218
218
  create(): import("../static_dependencies/noble-hashes/utils.js").Hash<import("../static_dependencies/noble-hashes/utils.js").Hash<any>>;
219
219
  }, digest?: "binary" | "hex" | "base64") => any;
220
- arrayConcat: (a: any, b: any) => any;
220
+ arrayConcat: (a: any[], b: any[]) => any[];
221
221
  encode: (str: string) => Uint8Array;
222
222
  urlencode: (object: object) => string;
223
223
  hmac: (request: import("../static_dependencies/noble-hashes/utils.js").Input, secret: import("../static_dependencies/noble-hashes/utils.js").Input, hash: {
@@ -249,19 +249,19 @@ export default class Exchange {
249
249
  base64ToBinary: (str: string) => Uint8Array;
250
250
  safeTimestamp2: (o: any, k1: IndexType, k2: IndexType, $default?: any) => number;
251
251
  rawencode: (object: object) => string;
252
- keysort: (x: any, out?: {}) => {};
253
- inArray: (needle: any, haystack: any) => any;
252
+ keysort: (x: Dictionary<any>, out?: Dictionary<any>) => Dictionary<any>;
253
+ inArray: (needle: any, haystack: any[]) => boolean;
254
254
  safeStringLower2: (o: any, k1: IndexType, k2: IndexType, $default?: string) => string;
255
255
  safeStringUpper2: (o: any, k1: IndexType, k2: IndexType, $default?: string) => string;
256
- isEmpty: (object: any) => boolean;
257
- ordered: (x: any) => any;
258
- filterBy: (x: any, k: any, value?: any, out?: any[]) => any[];
256
+ isEmpty: (object: any[] | Dictionary<any>) => boolean;
257
+ ordered: (x: any[] | Dictionary<any>) => any[] | Dictionary<any>;
258
+ filterBy: (x: Dictionary<any>, k: string, value?: any, out?: Dictionary<any>[]) => Dictionary<any>[];
259
259
  uuid16: (a?: any) => string;
260
260
  urlencodeWithArrayRepeat: (object: object) => string;
261
261
  microseconds: () => number;
262
262
  binaryToBase64: (data: Uint8Array) => string;
263
263
  strip: (s: string) => string;
264
- toArray: (object: any) => unknown[];
264
+ toArray: (object: any[] | Dictionary<any>) => any[];
265
265
  safeFloatN: (o: any, k: IndexType[], $default?: number) => number;
266
266
  safeIntegerN: (o: any, k: IndexType[], $default?: number) => number;
267
267
  safeIntegerProductN: (o: any, k: IndexType[], $factor: number, $default?: number) => number;
@@ -1017,7 +1017,7 @@ export default class Exchange {
1017
1017
  filterBySymbolsSinceLimit(array: any, symbols?: string[], since?: Int, limit?: Int, tail?: boolean): any;
1018
1018
  parseLastPrices(pricesData: any, symbols?: string[], params?: {}): LastPrices;
1019
1019
  parseTickers(tickers: any, symbols?: string[], params?: {}): Dictionary<Ticker>;
1020
- parseDepositAddresses(addresses: any, codes?: string[], indexed?: boolean, params?: {}): {};
1020
+ parseDepositAddresses(addresses: any, codes?: string[], indexed?: boolean, params?: {}): Dictionary<any>;
1021
1021
  parseBorrowInterests(response: any, market?: Market): any[];
1022
1022
  parseFundingRateHistories(response: any, market?: any, since?: Int, limit?: Int): FundingRateHistory[];
1023
1023
  safeSymbol(marketId: Str, market?: Market, delimiter?: Str, marketType?: Str): string;
@@ -1072,7 +1072,7 @@ export default class Exchange {
1072
1072
  parseMarginMode(marginMode: any, market?: Market): MarginMode;
1073
1073
  parseLeverages(response: object[], symbols?: string[], symbolKey?: Str, marketType?: MarketType): Leverages;
1074
1074
  parseLeverage(leverage: any, market?: Market): Leverage;
1075
- parseConversions(conversions: any[], fromCurrencyKey?: Str, toCurrencyKey?: Str, since?: Int, limit?: Int, params?: {}): Conversion[];
1075
+ parseConversions(conversions: any[], code?: Str, fromCurrencyKey?: Str, toCurrencyKey?: Str, since?: Int, limit?: Int, params?: {}): Conversion[];
1076
1076
  parseConversion(conversion: any, fromCurrency?: Currency, toCurrency?: Currency): Conversion;
1077
1077
  convertExpireDate(date: string): string;
1078
1078
  convertExpireDateToMarketIdDate(date: string): string;
@@ -6091,7 +6091,7 @@ export default class Exchange {
6091
6091
  parseLeverage(leverage, market = undefined) {
6092
6092
  throw new NotSupported(this.id + ' parseLeverage () is not supported yet');
6093
6093
  }
6094
- parseConversions(conversions, fromCurrencyKey = undefined, toCurrencyKey = undefined, since = undefined, limit = undefined, params = {}) {
6094
+ parseConversions(conversions, code = undefined, fromCurrencyKey = undefined, toCurrencyKey = undefined, since = undefined, limit = undefined, params = {}) {
6095
6095
  conversions = this.toArray(conversions);
6096
6096
  const result = [];
6097
6097
  let fromCurrency = undefined;
@@ -6110,8 +6110,18 @@ export default class Exchange {
6110
6110
  result.push(conversion);
6111
6111
  }
6112
6112
  const sorted = this.sortBy(result, 'timestamp');
6113
- const code = (fromCurrency !== undefined) ? fromCurrency['code'] : undefined;
6114
- return this.filterByCurrencySinceLimit(sorted, code, since, limit);
6113
+ let currency = undefined;
6114
+ if (code !== undefined) {
6115
+ currency = this.currency(code);
6116
+ code = currency['code'];
6117
+ }
6118
+ if (code === undefined) {
6119
+ return this.filterBySinceLimit(sorted, since, limit);
6120
+ }
6121
+ const fromConversion = this.filterBy(sorted, 'fromCurrency', code);
6122
+ const toConversion = this.filterBy(sorted, 'toCurrency', code);
6123
+ const both = this.arrayConcat(fromConversion, toConversion);
6124
+ return this.filterBySinceLimit(both, since, limit);
6115
6125
  }
6116
6126
  parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
6117
6127
  throw new NotSupported(this.id + ' parseConversion () is not supported yet');