ccxt 4.3.74 → 4.3.75

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/dist/cjs/ccxt.js CHANGED
@@ -194,7 +194,7 @@ var xt$1 = require('./src/pro/xt.js');
194
194
 
195
195
  //-----------------------------------------------------------------------------
196
196
  // this is updated by vss.js when building
197
- const version = '4.3.74';
197
+ const version = '4.3.75';
198
198
  Exchange["default"].ccxtVersion = version;
199
199
  const exchanges = {
200
200
  'ace': ace,
@@ -9803,7 +9803,7 @@ class binance extends binance$1 {
9803
9803
  const liquidationPrice = this.parseNumber(liquidationPriceString);
9804
9804
  let collateralString = undefined;
9805
9805
  let marginMode = this.safeString(position, 'marginType');
9806
- if (marginMode === undefined && isolatedMarginString) {
9806
+ if (marginMode === undefined && isolatedMarginString !== undefined) {
9807
9807
  marginMode = Precise["default"].stringEq(isolatedMarginString, '0') ? 'cross' : 'isolated';
9808
9808
  }
9809
9809
  let side = undefined;
@@ -240,6 +240,7 @@ class bybit extends bybit$1 {
240
240
  },
241
241
  'private': {
242
242
  'get': {
243
+ 'v5/market/instruments-info': 5,
243
244
  // Legacy inverse swap
244
245
  'v2/private/wallet/fund/records': 25,
245
246
  // spot
@@ -985,6 +986,7 @@ class bybit extends bybit$1 {
985
986
  },
986
987
  'precisionMode': number.TICK_SIZE,
987
988
  'options': {
989
+ 'usePrivateInstrumentsInfo': false,
988
990
  'sandboxMode': false,
989
991
  'enableDemoTrading': false,
990
992
  'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
@@ -1479,7 +1481,14 @@ class bybit extends bybit$1 {
1479
1481
  const request = {
1480
1482
  'category': 'spot',
1481
1483
  };
1482
- const response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1484
+ const usePrivateInstrumentsInfo = this.safeBool(this.options, 'usePrivateInstrumentsInfo', false);
1485
+ let response = undefined;
1486
+ if (usePrivateInstrumentsInfo) {
1487
+ response = await this.privateGetV5MarketInstrumentsInfo(this.extend(request, params));
1488
+ }
1489
+ else {
1490
+ response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1491
+ }
1483
1492
  //
1484
1493
  // {
1485
1494
  // "retCode": 0,
@@ -1589,14 +1598,27 @@ class bybit extends bybit$1 {
1589
1598
  async fetchFutureMarkets(params) {
1590
1599
  params = this.extend(params);
1591
1600
  params['limit'] = 1000; // minimize number of requests
1592
- const response = await this.publicGetV5MarketInstrumentsInfo(params);
1601
+ const usePrivateInstrumentsInfo = this.safeBool(this.options, 'usePrivateInstrumentsInfo', false);
1602
+ let response = undefined;
1603
+ if (usePrivateInstrumentsInfo) {
1604
+ response = await this.privateGetV5MarketInstrumentsInfo(params);
1605
+ }
1606
+ else {
1607
+ response = await this.publicGetV5MarketInstrumentsInfo(params);
1608
+ }
1593
1609
  const data = this.safeDict(response, 'result', {});
1594
1610
  let markets = this.safeList(data, 'list', []);
1595
1611
  let paginationCursor = this.safeString(data, 'nextPageCursor');
1596
1612
  if (paginationCursor !== undefined) {
1597
1613
  while (paginationCursor !== undefined) {
1598
1614
  params['cursor'] = paginationCursor;
1599
- const responseInner = await this.publicGetV5MarketInstrumentsInfo(params);
1615
+ let responseInner = undefined;
1616
+ if (usePrivateInstrumentsInfo) {
1617
+ responseInner = await this.privateGetV5MarketInstrumentsInfo(params);
1618
+ }
1619
+ else {
1620
+ responseInner = await this.publicGetV5MarketInstrumentsInfo(params);
1621
+ }
1600
1622
  const dataNew = this.safeDict(responseInner, 'result', {});
1601
1623
  const rawMarkets = this.safeList(dataNew, 'list', []);
1602
1624
  const rawMarketsLength = rawMarkets.length;
@@ -1765,7 +1787,14 @@ class bybit extends bybit$1 {
1765
1787
  const request = {
1766
1788
  'category': 'option',
1767
1789
  };
1768
- const response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1790
+ const usePrivateInstrumentsInfo = this.safeBool(this.options, 'usePrivateInstrumentsInfo', false);
1791
+ let response = undefined;
1792
+ if (usePrivateInstrumentsInfo) {
1793
+ response = await this.privateGetV5MarketInstrumentsInfo(this.extend(request, params));
1794
+ }
1795
+ else {
1796
+ response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1797
+ }
1769
1798
  const data = this.safeDict(response, 'result', {});
1770
1799
  let markets = this.safeList(data, 'list', []);
1771
1800
  if (this.options['loadAllOptions']) {
@@ -1774,7 +1803,13 @@ class bybit extends bybit$1 {
1774
1803
  if (paginationCursor !== undefined) {
1775
1804
  while (paginationCursor !== undefined) {
1776
1805
  request['cursor'] = paginationCursor;
1777
- const responseInner = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1806
+ let responseInner = undefined;
1807
+ if (usePrivateInstrumentsInfo) {
1808
+ responseInner = await this.privateGetV5MarketInstrumentsInfo(this.extend(request, params));
1809
+ }
1810
+ else {
1811
+ responseInner = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1812
+ }
1778
1813
  const dataNew = this.safeDict(responseInner, 'result', {});
1779
1814
  const rawMarkets = this.safeList(dataNew, 'list', []);
1780
1815
  const rawMarketsLength = rawMarkets.length;
@@ -5235,7 +5235,7 @@ class mexc extends mexc$1 {
5235
5235
  const networks = this.safeDict(this.options, 'networks', {});
5236
5236
  let network = this.safeString2(params, 'network', 'netWork'); // this line allows the user to specify either ERC20 or ETH
5237
5237
  network = this.safeString(networks, network, network); // handle ETH > ERC-20 alias
5238
- network = this.networkCodeToId(network);
5238
+ network = this.networkIdToCode(network);
5239
5239
  this.checkAddress(address);
5240
5240
  await this.loadMarkets();
5241
5241
  const currency = this.currency(code);
@@ -804,8 +804,23 @@ class whitebit extends whitebit$1 {
804
804
  // "change": "2.12" // in percent
805
805
  // }
806
806
  //
807
+ // WS market_update
808
+ //
809
+ // {
810
+ // "open": "52853.04",
811
+ // "close": "55913.88",
812
+ // "high": "56272",
813
+ // "low": "49549.67",
814
+ // "volume": "57331.067185",
815
+ // "deal": "3063860382.42985338",
816
+ // "last": "55913.88",
817
+ // "period": 86400
818
+ // }
807
819
  market = this.safeMarket(undefined, market);
808
- const last = this.safeString(ticker, 'last_price');
820
+ // last price is provided as "last" or "last_price"
821
+ const last = this.safeString2(ticker, 'last', 'last_price');
822
+ // if "close" is provided, use it, otherwise use <last>
823
+ const close = this.safeString(ticker, 'close', last);
809
824
  return this.safeTicker({
810
825
  'symbol': market['symbol'],
811
826
  'timestamp': undefined,
@@ -818,7 +833,7 @@ class whitebit extends whitebit$1 {
818
833
  'askVolume': undefined,
819
834
  'vwap': undefined,
820
835
  'open': this.safeString(ticker, 'open'),
821
- 'close': last,
836
+ 'close': close,
822
837
  'last': last,
823
838
  'previousClose': undefined,
824
839
  'change': undefined,
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 { Int, int, Str, Strings, Num, Bool, IndexType, OrderSide, OrderType, MarketType, SubType, Dict, NullableDict, List, NullableList, Fee, OHLCV, OHLCVC, implicitReturnType, Market, Currency, Dictionary, MinMax, FeeInterface, TradingFeeInterface, MarketInterface, Trade, Order, OrderBook, Ticker, Transaction, Tickers, CurrencyInterface, Balance, BalanceAccount, Account, PartialBalances, Balances, DepositAddress, WithdrawalResponse, DepositAddressResponse, FundingRate, FundingRates, Position, BorrowInterest, LeverageTier, LedgerEntry, DepositWithdrawFeeNetwork, DepositWithdrawFee, TransferEntry, CrossBorrowRate, IsolatedBorrowRate, FundingRateHistory, OpenInterest, Liquidation, OrderRequest, CancellationRequest, FundingHistory, MarginMode, Greeks, Conversion, Option, LastPrice, Leverage, MarginModification, Leverages, LastPrices, Currencies, TradingFees, MarginModes, OptionChain, IsolatedBorrowRates, CrossBorrowRates, LeverageTiers } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending } from './src/base/errors.js';
7
- declare const version = "4.3.73";
7
+ declare const version = "4.3.74";
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, MarketClosed, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, InvalidProxySettings, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, ChecksumError, RequestTimeout, BadResponse, NullResponse, CancelPending } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.3.74';
41
+ const version = '4.3.75';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -52,6 +52,7 @@ interface Exchange {
52
52
  publicGetV5SpotCrossMarginTradeBorrowToken(params?: {}): Promise<implicitReturnType>;
53
53
  publicGetV5InsLoanProductInfos(params?: {}): Promise<implicitReturnType>;
54
54
  publicGetV5InsLoanEnsureTokensConvert(params?: {}): Promise<implicitReturnType>;
55
+ privateGetV5MarketInstrumentsInfo(params?: {}): Promise<implicitReturnType>;
55
56
  privateGetV2PrivateWalletFundRecords(params?: {}): Promise<implicitReturnType>;
56
57
  privateGetSpotV3PrivateOrder(params?: {}): Promise<implicitReturnType>;
57
58
  privateGetSpotV3PrivateOpenOrders(params?: {}): Promise<implicitReturnType>;
package/js/src/binance.js CHANGED
@@ -9806,7 +9806,7 @@ export default class binance extends Exchange {
9806
9806
  const liquidationPrice = this.parseNumber(liquidationPriceString);
9807
9807
  let collateralString = undefined;
9808
9808
  let marginMode = this.safeString(position, 'marginType');
9809
- if (marginMode === undefined && isolatedMarginString) {
9809
+ if (marginMode === undefined && isolatedMarginString !== undefined) {
9810
9810
  marginMode = Precise.stringEq(isolatedMarginString, '0') ? 'cross' : 'isolated';
9811
9811
  }
9812
9812
  let side = undefined;
package/js/src/bybit.js CHANGED
@@ -243,6 +243,7 @@ export default class bybit extends Exchange {
243
243
  },
244
244
  'private': {
245
245
  'get': {
246
+ 'v5/market/instruments-info': 5,
246
247
  // Legacy inverse swap
247
248
  'v2/private/wallet/fund/records': 25,
248
249
  // spot
@@ -988,6 +989,7 @@ export default class bybit extends Exchange {
988
989
  },
989
990
  'precisionMode': TICK_SIZE,
990
991
  'options': {
992
+ 'usePrivateInstrumentsInfo': false,
991
993
  'sandboxMode': false,
992
994
  'enableDemoTrading': false,
993
995
  'fetchMarkets': ['spot', 'linear', 'inverse', 'option'],
@@ -1482,7 +1484,14 @@ export default class bybit extends Exchange {
1482
1484
  const request = {
1483
1485
  'category': 'spot',
1484
1486
  };
1485
- const response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1487
+ const usePrivateInstrumentsInfo = this.safeBool(this.options, 'usePrivateInstrumentsInfo', false);
1488
+ let response = undefined;
1489
+ if (usePrivateInstrumentsInfo) {
1490
+ response = await this.privateGetV5MarketInstrumentsInfo(this.extend(request, params));
1491
+ }
1492
+ else {
1493
+ response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1494
+ }
1486
1495
  //
1487
1496
  // {
1488
1497
  // "retCode": 0,
@@ -1592,14 +1601,27 @@ export default class bybit extends Exchange {
1592
1601
  async fetchFutureMarkets(params) {
1593
1602
  params = this.extend(params);
1594
1603
  params['limit'] = 1000; // minimize number of requests
1595
- const response = await this.publicGetV5MarketInstrumentsInfo(params);
1604
+ const usePrivateInstrumentsInfo = this.safeBool(this.options, 'usePrivateInstrumentsInfo', false);
1605
+ let response = undefined;
1606
+ if (usePrivateInstrumentsInfo) {
1607
+ response = await this.privateGetV5MarketInstrumentsInfo(params);
1608
+ }
1609
+ else {
1610
+ response = await this.publicGetV5MarketInstrumentsInfo(params);
1611
+ }
1596
1612
  const data = this.safeDict(response, 'result', {});
1597
1613
  let markets = this.safeList(data, 'list', []);
1598
1614
  let paginationCursor = this.safeString(data, 'nextPageCursor');
1599
1615
  if (paginationCursor !== undefined) {
1600
1616
  while (paginationCursor !== undefined) {
1601
1617
  params['cursor'] = paginationCursor;
1602
- const responseInner = await this.publicGetV5MarketInstrumentsInfo(params);
1618
+ let responseInner = undefined;
1619
+ if (usePrivateInstrumentsInfo) {
1620
+ responseInner = await this.privateGetV5MarketInstrumentsInfo(params);
1621
+ }
1622
+ else {
1623
+ responseInner = await this.publicGetV5MarketInstrumentsInfo(params);
1624
+ }
1603
1625
  const dataNew = this.safeDict(responseInner, 'result', {});
1604
1626
  const rawMarkets = this.safeList(dataNew, 'list', []);
1605
1627
  const rawMarketsLength = rawMarkets.length;
@@ -1768,7 +1790,14 @@ export default class bybit extends Exchange {
1768
1790
  const request = {
1769
1791
  'category': 'option',
1770
1792
  };
1771
- const response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1793
+ const usePrivateInstrumentsInfo = this.safeBool(this.options, 'usePrivateInstrumentsInfo', false);
1794
+ let response = undefined;
1795
+ if (usePrivateInstrumentsInfo) {
1796
+ response = await this.privateGetV5MarketInstrumentsInfo(this.extend(request, params));
1797
+ }
1798
+ else {
1799
+ response = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1800
+ }
1772
1801
  const data = this.safeDict(response, 'result', {});
1773
1802
  let markets = this.safeList(data, 'list', []);
1774
1803
  if (this.options['loadAllOptions']) {
@@ -1777,7 +1806,13 @@ export default class bybit extends Exchange {
1777
1806
  if (paginationCursor !== undefined) {
1778
1807
  while (paginationCursor !== undefined) {
1779
1808
  request['cursor'] = paginationCursor;
1780
- const responseInner = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1809
+ let responseInner = undefined;
1810
+ if (usePrivateInstrumentsInfo) {
1811
+ responseInner = await this.privateGetV5MarketInstrumentsInfo(this.extend(request, params));
1812
+ }
1813
+ else {
1814
+ responseInner = await this.publicGetV5MarketInstrumentsInfo(this.extend(request, params));
1815
+ }
1781
1816
  const dataNew = this.safeDict(responseInner, 'result', {});
1782
1817
  const rawMarkets = this.safeList(dataNew, 'list', []);
1783
1818
  const rawMarketsLength = rawMarkets.length;
package/js/src/mexc.js CHANGED
@@ -5239,7 +5239,7 @@ export default class mexc extends Exchange {
5239
5239
  const networks = this.safeDict(this.options, 'networks', {});
5240
5240
  let network = this.safeString2(params, 'network', 'netWork'); // this line allows the user to specify either ERC20 or ETH
5241
5241
  network = this.safeString(networks, network, network); // handle ETH > ERC-20 alias
5242
- network = this.networkCodeToId(network);
5242
+ network = this.networkIdToCode(network);
5243
5243
  this.checkAddress(address);
5244
5244
  await this.loadMarkets();
5245
5245
  const currency = this.currency(code);
@@ -807,8 +807,23 @@ export default class whitebit extends Exchange {
807
807
  // "change": "2.12" // in percent
808
808
  // }
809
809
  //
810
+ // WS market_update
811
+ //
812
+ // {
813
+ // "open": "52853.04",
814
+ // "close": "55913.88",
815
+ // "high": "56272",
816
+ // "low": "49549.67",
817
+ // "volume": "57331.067185",
818
+ // "deal": "3063860382.42985338",
819
+ // "last": "55913.88",
820
+ // "period": 86400
821
+ // }
810
822
  market = this.safeMarket(undefined, market);
811
- const last = this.safeString(ticker, 'last_price');
823
+ // last price is provided as "last" or "last_price"
824
+ const last = this.safeString2(ticker, 'last', 'last_price');
825
+ // if "close" is provided, use it, otherwise use <last>
826
+ const close = this.safeString(ticker, 'close', last);
812
827
  return this.safeTicker({
813
828
  'symbol': market['symbol'],
814
829
  'timestamp': undefined,
@@ -821,7 +836,7 @@ export default class whitebit extends Exchange {
821
836
  'askVolume': undefined,
822
837
  'vwap': undefined,
823
838
  'open': this.safeString(ticker, 'open'),
824
- 'close': last,
839
+ 'close': close,
825
840
  'last': last,
826
841
  'previousClose': undefined,
827
842
  'change': undefined,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.74",
3
+ "version": "4.3.75",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",