ccxt 4.3.73 → 4.3.74

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.
@@ -57,6 +57,7 @@ class bitfinex extends bitfinex$1 {
57
57
  * @method
58
58
  * @name bitfinex#watchTrades
59
59
  * @description get the list of most recent trades for a particular symbol
60
+ * @see https://docs.bitfinex.com/v1/reference/ws-public-trades
60
61
  * @param {string} symbol unified symbol of the market to fetch trades for
61
62
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
62
63
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -76,6 +77,7 @@ class bitfinex extends bitfinex$1 {
76
77
  * @method
77
78
  * @name bitfinex#watchTicker
78
79
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
80
+ * @see https://docs.bitfinex.com/v1/reference/ws-public-ticker
79
81
  * @param {string} symbol unified symbol of the market to fetch the ticker for
80
82
  * @param {object} [params] extra parameters specific to the exchange API endpoint
81
83
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -248,6 +250,7 @@ class bitfinex extends bitfinex$1 {
248
250
  * @method
249
251
  * @name bitfinex#watchOrderBook
250
252
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
253
+ * @see https://docs.bitfinex.com/v1/reference/ws-public-order-books
251
254
  * @param {string} symbol unified symbol of the market to fetch the order book for
252
255
  * @param {int} [limit] the maximum amount of order book entries to return
253
256
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -458,6 +461,8 @@ class bitfinex extends bitfinex$1 {
458
461
  * @method
459
462
  * @name bitfinex#watchOrders
460
463
  * @description watches information on multiple orders made by the user
464
+ * @see https://docs.bitfinex.com/v1/reference/ws-auth-order-updates
465
+ * @see https://docs.bitfinex.com/v1/reference/ws-auth-order-snapshots
461
466
  * @param {string} symbol unified market symbol of the market orders were made in
462
467
  * @param {int} [since] the earliest time in ms to fetch orders for
463
468
  * @param {int} [limit] the maximum number of order structures to retrieve
@@ -144,7 +144,7 @@ class woo extends woo$1 {
144
144
  'https://support.woo.org/hc/en-001/articles/4404611795353--Trading-Fees',
145
145
  ],
146
146
  'referral': {
147
- 'url': 'https://x.woo.org/register?ref=YWOWC96B',
147
+ 'url': 'https://x.woo.org/register?ref=DIJT0CNL',
148
148
  'discount': 0.35,
149
149
  },
150
150
  },
@@ -547,6 +547,22 @@ class yobit extends yobit$1 {
547
547
  'info': ticker,
548
548
  }, market);
549
549
  }
550
+ async fetchTickersHelper(idsString, params = {}) {
551
+ const request = {
552
+ 'pair': idsString,
553
+ };
554
+ const tickers = await this.publicGetTickerPair(this.extend(request, params));
555
+ const result = {};
556
+ const keys = Object.keys(tickers);
557
+ for (let k = 0; k < keys.length; k++) {
558
+ const id = keys[k];
559
+ const ticker = tickers[id];
560
+ const market = this.safeMarket(id);
561
+ const symbol = market['symbol'];
562
+ result[symbol] = this.parseTicker(ticker, market);
563
+ }
564
+ return result;
565
+ }
550
566
  async fetchTickers(symbols = undefined, params = {}) {
551
567
  /**
552
568
  * @method
@@ -555,43 +571,53 @@ class yobit extends yobit$1 {
555
571
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
556
572
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
557
573
  * @param {object} [params] extra parameters specific to the exchange API endpoint
574
+ * @param {object} [params.all] you can set to `true` for convenience to fetch all tickers from this exchange by sending multiple requests
558
575
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
559
576
  */
560
- if (symbols === undefined) {
561
- throw new errors.ArgumentsRequired(this.id + ' fetchTickers() requires "symbols" argument');
577
+ let allSymbols = undefined;
578
+ [allSymbols, params] = this.handleParamBool(params, 'all', false);
579
+ if (symbols === undefined && !allSymbols) {
580
+ throw new errors.ArgumentsRequired(this.id + ' fetchTickers() requires "symbols" argument or use `params["all"] = true` to send multiple requests for all markets');
562
581
  }
563
582
  await this.loadMarkets();
564
- symbols = this.marketSymbols(symbols);
565
- let ids = undefined;
566
- if (symbols === undefined) {
567
- ids = this.ids;
568
- }
569
- else {
570
- ids = this.marketIds(symbols);
571
- }
572
- const idsLength = ids.length;
573
- const idsString = ids.join('-');
583
+ const promises = [];
574
584
  const maxLength = this.safeInteger(this.options, 'maxUrlLength', 2048);
575
585
  // max URL length is 2048 symbols, including http schema, hostname, tld, etc...
576
- const lenghtOfBaseUrl = 30; // the url including api-base and endpoint dir is 30 chars
577
- const actualLength = idsString.length + lenghtOfBaseUrl;
578
- if (actualLength > maxLength) {
579
- throw new errors.ArgumentsRequired(this.id + ' fetchTickers() is being requested for ' + idsLength.toString() + ' markets (which has an URL length of ' + actualLength.toString() + ' characters), but it exceedes max URL length (' + maxLength.toString() + '), please pass limisted symbols array to fetchTickers to fit in one request');
586
+ const lenghtOfBaseUrl = 40; // safe space for the url including api-base and endpoint dir is 30 chars
587
+ if (allSymbols) {
588
+ symbols = this.symbols;
589
+ let ids = '';
590
+ for (let i = 0; i < this.ids.length; i++) {
591
+ const id = this.ids[i];
592
+ const prefix = (ids === '') ? '' : '-';
593
+ ids += prefix + id;
594
+ if (ids.length > maxLength) {
595
+ promises.push(this.fetchTickersHelper(ids, params));
596
+ ids = '';
597
+ }
598
+ }
599
+ if (ids !== '') {
600
+ promises.push(this.fetchTickersHelper(ids, params));
601
+ }
580
602
  }
581
- const request = {
582
- 'pair': idsString,
583
- };
584
- const tickers = await this.publicGetTickerPair(this.extend(request, params));
585
- const result = {};
586
- const keys = Object.keys(tickers);
587
- for (let k = 0; k < keys.length; k++) {
588
- const id = keys[k];
589
- const ticker = tickers[id];
590
- const market = this.safeMarket(id);
591
- const symbol = market['symbol'];
592
- result[symbol] = this.parseTicker(ticker, market);
603
+ else {
604
+ symbols = this.marketSymbols(symbols);
605
+ const ids = this.marketIds(symbols);
606
+ const idsLength = ids.length;
607
+ const idsString = ids.join('-');
608
+ const actualLength = idsString.length + lenghtOfBaseUrl;
609
+ if (actualLength > maxLength) {
610
+ throw new errors.ArgumentsRequired(this.id + ' fetchTickers() is being requested for ' + idsLength.toString() + ' markets (which has an URL length of ' + actualLength.toString() + ' characters), but it exceedes max URL length (' + maxLength.toString() + '), please pass limisted symbols array to fetchTickers to fit in one request');
611
+ }
612
+ promises.push(this.fetchTickersHelper(idsString, params));
613
+ }
614
+ const resultAll = await Promise.all(promises);
615
+ let finalResult = {};
616
+ for (let i = 0; i < resultAll.length; i++) {
617
+ const result = this.filterByArrayTickers(resultAll[i], 'symbol', symbols);
618
+ finalResult = this.extend(finalResult, result);
593
619
  }
594
- return this.filterByArrayTickers(result, 'symbol', symbols);
620
+ return finalResult;
595
621
  }
596
622
  async fetchTicker(symbol, params = {}) {
597
623
  /**
@@ -38,6 +38,7 @@ let [processPath, , exchangeId, methodName, ... params] = process.argv.filter (x
38
38
  , shouldCreateResponseReport = process.argv.includes ('--response')
39
39
  , shouldCreateBoth = process.argv.includes ('--static')
40
40
  , raw = process.argv.includes ('--raw')
41
+ , noKeys = process.argv.includes ('--no-keys')
41
42
 
42
43
  //-----------------------------------------------------------------------------
43
44
  if (!raw) {
@@ -107,17 +108,19 @@ try {
107
108
  exchange.options['defaultType'] = 'option';
108
109
  }
109
110
 
110
- // check auth keys in env var
111
- const requiredCredentials = exchange.requiredCredentials;
112
- for (const [credential, isRequired] of Object.entries (requiredCredentials)) {
113
- if (isRequired && exchange[credential] === undefined) {
114
- const credentialEnvName = (exchangeId + '_' + credential).toUpperCase () // example: KRAKEN_APIKEY
115
- let credentialValue = process.env[credentialEnvName]
116
- if (credentialValue) {
117
- if (credentialValue.indexOf('---BEGIN') > -1) {
118
- credentialValue = credentialValue.replaceAll('\\n', '\n');
111
+ if (!noKeys) {
112
+ // check auth keys in env var
113
+ const requiredCredentials = exchange.requiredCredentials;
114
+ for (const [credential, isRequired] of Object.entries (requiredCredentials)) {
115
+ if (isRequired && exchange[credential] === undefined) {
116
+ const credentialEnvName = (exchangeId + '_' + credential).toUpperCase () // example: KRAKEN_APIKEY
117
+ let credentialValue = process.env[credentialEnvName]
118
+ if (credentialValue) {
119
+ if (credentialValue.indexOf('---BEGIN') > -1) {
120
+ credentialValue = credentialValue.replaceAll('\\n', '\n');
121
+ }
122
+ exchange[credential] = credentialValue
119
123
  }
120
- exchange[credential] = credentialValue
121
124
  }
122
125
  }
123
126
  }
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.72";
7
+ declare const version = "4.3.73";
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.73';
41
+ const version = '4.3.74';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -522,6 +522,8 @@ interface Exchange {
522
522
  fapiPrivateGetTradeAsyn(params?: {}): Promise<implicitReturnType>;
523
523
  fapiPrivateGetTradeAsynId(params?: {}): Promise<implicitReturnType>;
524
524
  fapiPrivateGetFeeBurn(params?: {}): Promise<implicitReturnType>;
525
+ fapiPrivateGetSymbolConfig(params?: {}): Promise<implicitReturnType>;
526
+ fapiPrivateGetAccountConfig(params?: {}): Promise<implicitReturnType>;
525
527
  fapiPrivatePostBatchOrders(params?: {}): Promise<implicitReturnType>;
526
528
  fapiPrivatePostPositionSideDual(params?: {}): Promise<implicitReturnType>;
527
529
  fapiPrivatePostPositionMargin(params?: {}): Promise<implicitReturnType>;
@@ -545,6 +547,9 @@ interface Exchange {
545
547
  fapiPrivateV2GetAccount(params?: {}): Promise<implicitReturnType>;
546
548
  fapiPrivateV2GetBalance(params?: {}): Promise<implicitReturnType>;
547
549
  fapiPrivateV2GetPositionRisk(params?: {}): Promise<implicitReturnType>;
550
+ fapiPrivateV3GetAccount(params?: {}): Promise<implicitReturnType>;
551
+ fapiPrivateV3GetBalance(params?: {}): Promise<implicitReturnType>;
552
+ fapiPrivateV3GetPositionRisk(params?: {}): Promise<implicitReturnType>;
548
553
  eapiPublicGetPing(params?: {}): Promise<implicitReturnType>;
549
554
  eapiPublicGetTime(params?: {}): Promise<implicitReturnType>;
550
555
  eapiPublicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
@@ -522,6 +522,8 @@ interface binance {
522
522
  fapiPrivateGetTradeAsyn(params?: {}): Promise<implicitReturnType>;
523
523
  fapiPrivateGetTradeAsynId(params?: {}): Promise<implicitReturnType>;
524
524
  fapiPrivateGetFeeBurn(params?: {}): Promise<implicitReturnType>;
525
+ fapiPrivateGetSymbolConfig(params?: {}): Promise<implicitReturnType>;
526
+ fapiPrivateGetAccountConfig(params?: {}): Promise<implicitReturnType>;
525
527
  fapiPrivatePostBatchOrders(params?: {}): Promise<implicitReturnType>;
526
528
  fapiPrivatePostPositionSideDual(params?: {}): Promise<implicitReturnType>;
527
529
  fapiPrivatePostPositionMargin(params?: {}): Promise<implicitReturnType>;
@@ -545,6 +547,9 @@ interface binance {
545
547
  fapiPrivateV2GetAccount(params?: {}): Promise<implicitReturnType>;
546
548
  fapiPrivateV2GetBalance(params?: {}): Promise<implicitReturnType>;
547
549
  fapiPrivateV2GetPositionRisk(params?: {}): Promise<implicitReturnType>;
550
+ fapiPrivateV3GetAccount(params?: {}): Promise<implicitReturnType>;
551
+ fapiPrivateV3GetBalance(params?: {}): Promise<implicitReturnType>;
552
+ fapiPrivateV3GetPositionRisk(params?: {}): Promise<implicitReturnType>;
548
553
  eapiPublicGetPing(params?: {}): Promise<implicitReturnType>;
549
554
  eapiPublicGetTime(params?: {}): Promise<implicitReturnType>;
550
555
  eapiPublicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
@@ -574,6 +574,8 @@ interface binance {
574
574
  fapiPrivateGetTradeAsyn(params?: {}): Promise<implicitReturnType>;
575
575
  fapiPrivateGetTradeAsynId(params?: {}): Promise<implicitReturnType>;
576
576
  fapiPrivateGetFeeBurn(params?: {}): Promise<implicitReturnType>;
577
+ fapiPrivateGetSymbolConfig(params?: {}): Promise<implicitReturnType>;
578
+ fapiPrivateGetAccountConfig(params?: {}): Promise<implicitReturnType>;
577
579
  fapiPrivatePostBatchOrders(params?: {}): Promise<implicitReturnType>;
578
580
  fapiPrivatePostPositionSideDual(params?: {}): Promise<implicitReturnType>;
579
581
  fapiPrivatePostPositionMargin(params?: {}): Promise<implicitReturnType>;
@@ -597,6 +599,9 @@ interface binance {
597
599
  fapiPrivateV2GetAccount(params?: {}): Promise<implicitReturnType>;
598
600
  fapiPrivateV2GetBalance(params?: {}): Promise<implicitReturnType>;
599
601
  fapiPrivateV2GetPositionRisk(params?: {}): Promise<implicitReturnType>;
602
+ fapiPrivateV3GetAccount(params?: {}): Promise<implicitReturnType>;
603
+ fapiPrivateV3GetBalance(params?: {}): Promise<implicitReturnType>;
604
+ fapiPrivateV3GetPositionRisk(params?: {}): Promise<implicitReturnType>;
600
605
  eapiPublicGetPing(params?: {}): Promise<implicitReturnType>;
601
606
  eapiPublicGetTime(params?: {}): Promise<implicitReturnType>;
602
607
  eapiPublicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
@@ -522,6 +522,8 @@ interface binance {
522
522
  fapiPrivateGetTradeAsyn(params?: {}): Promise<implicitReturnType>;
523
523
  fapiPrivateGetTradeAsynId(params?: {}): Promise<implicitReturnType>;
524
524
  fapiPrivateGetFeeBurn(params?: {}): Promise<implicitReturnType>;
525
+ fapiPrivateGetSymbolConfig(params?: {}): Promise<implicitReturnType>;
526
+ fapiPrivateGetAccountConfig(params?: {}): Promise<implicitReturnType>;
525
527
  fapiPrivatePostBatchOrders(params?: {}): Promise<implicitReturnType>;
526
528
  fapiPrivatePostPositionSideDual(params?: {}): Promise<implicitReturnType>;
527
529
  fapiPrivatePostPositionMargin(params?: {}): Promise<implicitReturnType>;
@@ -545,6 +547,9 @@ interface binance {
545
547
  fapiPrivateV2GetAccount(params?: {}): Promise<implicitReturnType>;
546
548
  fapiPrivateV2GetBalance(params?: {}): Promise<implicitReturnType>;
547
549
  fapiPrivateV2GetPositionRisk(params?: {}): Promise<implicitReturnType>;
550
+ fapiPrivateV3GetAccount(params?: {}): Promise<implicitReturnType>;
551
+ fapiPrivateV3GetBalance(params?: {}): Promise<implicitReturnType>;
552
+ fapiPrivateV3GetPositionRisk(params?: {}): Promise<implicitReturnType>;
548
553
  eapiPublicGetPing(params?: {}): Promise<implicitReturnType>;
549
554
  eapiPublicGetTime(params?: {}): Promise<implicitReturnType>;
550
555
  eapiPublicGetExchangeInfo(params?: {}): Promise<implicitReturnType>;
package/js/src/ace.js CHANGED
@@ -355,7 +355,7 @@ export default class ace extends Exchange {
355
355
  for (let i = 0; i < pairs.length; i++) {
356
356
  const marketId = pairs[i];
357
357
  const market = this.safeMarket(marketId);
358
- const rawTicker = this.safeDict(response, marketId);
358
+ const rawTicker = this.safeDict(response, marketId, {});
359
359
  const ticker = this.parseTicker(rawTicker, market);
360
360
  tickers.push(ticker);
361
361
  }