ccxt 4.2.41 → 4.2.43

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
@@ -177,7 +177,7 @@ var woo$1 = require('./src/pro/woo.js');
177
177
 
178
178
  //-----------------------------------------------------------------------------
179
179
  // this is updated by vss.js when building
180
- const version = '4.2.41';
180
+ const version = '4.2.43';
181
181
  Exchange["default"].ccxtVersion = version;
182
182
  const exchanges = {
183
183
  'ace': ace,
@@ -1942,6 +1942,15 @@ class Exchange {
1942
1942
  async setPositionMode(hedged, symbol = undefined, params = {}) {
1943
1943
  throw new errors.NotSupported(this.id + ' setPositionMode() is not supported yet');
1944
1944
  }
1945
+ async addMargin(symbol, amount, params = {}) {
1946
+ throw new errors.NotSupported(this.id + ' addMargin() is not supported yet');
1947
+ }
1948
+ async reduceMargin(symbol, amount, params = {}) {
1949
+ throw new errors.NotSupported(this.id + ' reduceMargin() is not supported yet');
1950
+ }
1951
+ async setMargin(symbol, amount, params = {}) {
1952
+ throw new errors.NotSupported(this.id + ' setMargin() is not supported yet');
1953
+ }
1945
1954
  async setMarginMode(marginMode, symbol = undefined, params = {}) {
1946
1955
  throw new errors.NotSupported(this.id + ' setMarginMode() is not supported yet');
1947
1956
  }
@@ -6212,8 +6212,9 @@ class binance extends binance$1 {
6212
6212
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6213
6213
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
6214
6214
  */
6215
- const orders = await this.fetchOrders(symbol, since, limit, params);
6216
- return this.filterBy(orders, 'status', 'closed');
6215
+ const orders = await this.fetchOrders(symbol, since, undefined, params);
6216
+ const filteredOrders = this.filterBy(orders, 'status', 'closed');
6217
+ return this.filterBySinceLimit(filteredOrders, since, limit);
6217
6218
  }
6218
6219
  async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
6219
6220
  /**
@@ -2418,7 +2418,10 @@ class bitget extends bitget$1 {
2418
2418
  await this.loadMarkets();
2419
2419
  const networkCode = this.safeString2(params, 'chain', 'network');
2420
2420
  params = this.omit(params, 'network');
2421
- const networkId = this.networkCodeToId(networkCode, code);
2421
+ let networkId = undefined;
2422
+ if (networkCode !== undefined) {
2423
+ networkId = this.networkCodeToId(networkCode, code);
2424
+ }
2422
2425
  const currency = this.currency(code);
2423
2426
  const request = {
2424
2427
  'coin': currency['code'],
@@ -2457,11 +2460,15 @@ class bitget extends bitget$1 {
2457
2460
  const currencyId = this.safeString(depositAddress, 'coin');
2458
2461
  const networkId = this.safeString(depositAddress, 'chain');
2459
2462
  const parsedCurrency = this.safeCurrencyCode(currencyId, currency);
2463
+ let network = undefined;
2464
+ if (networkId !== undefined) {
2465
+ network = this.networkIdToCode(networkId, parsedCurrency);
2466
+ }
2460
2467
  return {
2461
2468
  'currency': parsedCurrency,
2462
2469
  'address': this.safeString(depositAddress, 'address'),
2463
2470
  'tag': this.safeString(depositAddress, 'tag'),
2464
- 'network': this.networkIdToCode(networkId, parsedCurrency),
2471
+ 'network': network,
2465
2472
  'info': depositAddress,
2466
2473
  };
2467
2474
  }
@@ -2777,28 +2777,20 @@ class bitrue extends bitrue$1 {
2777
2777
  this.checkAddress(address);
2778
2778
  await this.loadMarkets();
2779
2779
  const currency = this.currency(code);
2780
- let chainName = this.safeString2(params, 'network', 'chainName');
2781
- if (chainName === undefined) {
2782
- const networks = this.safeValue(currency, 'networks', {});
2783
- const optionsNetworks = this.safeValue(this.options, 'networks', {});
2784
- let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
2785
- network = this.safeString(optionsNetworks, network, network);
2786
- const networkEntry = this.safeValue(networks, network, {});
2787
- chainName = this.safeString(networkEntry, 'id'); // handle ERC20>ETH alias
2788
- if (chainName === undefined) {
2789
- throw new errors.ArgumentsRequired(this.id + ' withdraw() requires a network parameter or a chainName parameter');
2790
- }
2791
- params = this.omit(params, 'network');
2792
- }
2793
2780
  const request = {
2794
- 'coin': currency['id'].toUpperCase(),
2781
+ 'coin': currency['id'],
2795
2782
  'amount': amount,
2796
2783
  'addressTo': address,
2797
- 'chainName': chainName, // 'ERC20', 'TRC20', 'SOL'
2784
+ // 'chainName': chainName, // 'ERC20', 'TRC20', 'SOL'
2798
2785
  // 'addressMark': '', // mark of address
2799
2786
  // 'addrType': '', // type of address
2800
2787
  // 'tag': tag,
2801
2788
  };
2789
+ let networkCode = undefined;
2790
+ [networkCode, params] = this.handleNetworkCodeAndParams(params);
2791
+ if (networkCode !== undefined) {
2792
+ request['chainName'] = this.networkCodeToId(networkCode);
2793
+ }
2802
2794
  if (tag !== undefined) {
2803
2795
  request['tag'] = tag;
2804
2796
  }
@@ -412,7 +412,10 @@ class digifinex extends digifinex$1 {
412
412
  const minFoundPrecision = Precise["default"].stringMin(feeString, Precise["default"].stringMin(minDepositString, minWithdrawString));
413
413
  const precision = this.parseNumber(minFoundPrecision);
414
414
  const networkId = this.safeString(currency, 'chain');
415
- const networkCode = this.networkIdToCode(networkId);
415
+ let networkCode = undefined;
416
+ if (networkId !== undefined) {
417
+ networkCode = this.networkIdToCode(networkId);
418
+ }
416
419
  const network = {
417
420
  'info': currency,
418
421
  'id': networkId,
@@ -1587,7 +1587,10 @@ class gate extends gate$1 {
1587
1587
  const currency = parts[0];
1588
1588
  const code = this.safeCurrencyCode(currency);
1589
1589
  const networkId = this.safeString(entry, 'chain');
1590
- const networkCode = this.networkIdToCode(networkId, code);
1590
+ let networkCode = undefined;
1591
+ if (networkId !== undefined) {
1592
+ networkCode = this.networkIdToCode(networkId, code);
1593
+ }
1591
1594
  const delisted = this.safeValue(entry, 'delisted');
1592
1595
  const withdrawDisabled = this.safeBool(entry, 'withdraw_disabled', false);
1593
1596
  const depositDisabled = this.safeBool(entry, 'deposit_disabled', false);
@@ -343,7 +343,10 @@ class gemini extends gemini$1 {
343
343
  const precision = this.parseNumber(this.parsePrecision(this.safeString(currency, 5)));
344
344
  const networks = {};
345
345
  const networkId = this.safeString(currency, 9);
346
- const networkCode = this.networkIdToCode(networkId);
346
+ let networkCode = undefined;
347
+ if (networkId !== undefined) {
348
+ networkCode = this.networkIdToCode(networkId);
349
+ }
347
350
  if (networkCode !== undefined) {
348
351
  networks[networkCode] = {
349
352
  'info': currency,
@@ -4326,7 +4326,10 @@ class mexc extends mexc$1 {
4326
4326
  'coin': currency['id'],
4327
4327
  };
4328
4328
  const networkCode = this.safeString(params, 'network');
4329
- const networkId = this.networkCodeToId(networkCode, code);
4329
+ let networkId = undefined;
4330
+ if (networkCode !== undefined) {
4331
+ networkId = this.networkCodeToId(networkCode, code);
4332
+ }
4330
4333
  if (networkId !== undefined) {
4331
4334
  request['network'] = networkId;
4332
4335
  }
@@ -4663,7 +4663,10 @@ class phemex extends phemex$1 {
4663
4663
  const currency = this.currency(code);
4664
4664
  let networkCode = undefined;
4665
4665
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
4666
- let networkId = this.networkCodeToId(networkCode);
4666
+ let networkId = undefined;
4667
+ if (networkCode !== undefined) {
4668
+ networkId = this.networkCodeToId(networkCode);
4669
+ }
4667
4670
  const stableCoins = this.safeValue(this.options, 'stableCoins');
4668
4671
  if (networkId === undefined) {
4669
4672
  if (!(this.inArray(code, stableCoins))) {
@@ -711,7 +711,10 @@ class poloniex extends poloniex$1 {
711
711
  const code = this.safeCurrencyCode(id);
712
712
  const name = this.safeString(currency, 'name');
713
713
  const networkId = this.safeString(currency, 'blockchain');
714
- const networkCode = this.networkIdToCode(networkId, code);
714
+ let networkCode = undefined;
715
+ if (networkId !== undefined) {
716
+ networkCode = this.networkIdToCode(networkId, code);
717
+ }
715
718
  const delisted = this.safeValue(currency, 'delisted');
716
719
  const walletEnabled = this.safeString(currency, 'walletState') === 'ENABLED';
717
720
  const depositEnabled = this.safeString(currency, 'walletDepositState') === 'ENABLED';
@@ -10,7 +10,7 @@ class binanceus extends binance {
10
10
  // eslint-disable-next-line new-cap
11
11
  const restInstance = new binanceus$1();
12
12
  const restDescribe = restInstance.describe();
13
- const extended = this.deepExtend(super.describe(), restDescribe);
13
+ const extended = this.deepExtend(restDescribe, super.describe());
14
14
  return this.deepExtend(extended, {
15
15
  'id': 'binanceus',
16
16
  'name': 'Binance US',
@@ -171,7 +171,7 @@ class hitbtc extends hitbtc$1 {
171
171
  await this.loadMarkets();
172
172
  await this.authenticate();
173
173
  const url = this.urls['api']['ws']['private'];
174
- const messageHash = this.nonce();
174
+ const messageHash = this.nonce().toString();
175
175
  const subscribe = {
176
176
  'method': name,
177
177
  'params': params,
@@ -172,7 +172,7 @@ class poloniex extends poloniex$1 {
172
172
  * @returns {object} data from the websocket stream
173
173
  */
174
174
  const url = this.urls['api']['ws']['private'];
175
- const messageHash = this.nonce();
175
+ const messageHash = this.nonce().toString();
176
176
  const subscribe = {
177
177
  'id': messageHash,
178
178
  'event': name,
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 } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.2.40";
7
+ declare const version = "4.2.42";
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, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.2.41';
41
+ const version = '4.2.43';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -557,14 +557,14 @@ export default class Exchange {
557
557
  countedOrderBook(snapshot?: {}, depth?: number): CountedOrderBook;
558
558
  handleMessage(client: any, message: any): void;
559
559
  ping(client: any): any;
560
- client(url: any): WsClient;
561
- watchMultiple(url: any, messageHashes: any, message?: any, subscribeHashes?: any, subscription?: any): import("./ws/Future.js").FutureInterface;
562
- watch(url: any, messageHash: any, message?: any, subscribeHash?: any, subscription?: any): any;
560
+ client(url: string): WsClient;
561
+ watchMultiple(url: string, messageHashes: string[], message?: any, subscribeHashes?: any, subscription?: any): import("./ws/Future.js").FutureInterface;
562
+ watch(url: string, messageHash: string, message?: any, subscribeHash?: any, subscription?: any): any;
563
563
  onConnected(client: any, message?: any): void;
564
564
  onError(client: any, error: any): void;
565
565
  onClose(client: any, error: any): void;
566
566
  close(): Promise<void>;
567
- loadOrderBook(client: any, messageHash: any, symbol: any, limit?: any, params?: {}): Promise<void>;
567
+ loadOrderBook(client: any, messageHash: string, symbol: string, limit?: Int, params?: {}): Promise<void>;
568
568
  convertToBigInt(value: string): bigint;
569
569
  stringToCharsArray(value: any): any;
570
570
  valueIsDefined(value: any): boolean;
@@ -572,7 +572,7 @@ export default class Exchange {
572
572
  getProperty(obj: any, property: any, defaultValue?: any): any;
573
573
  setProperty(obj: any, property: any, defaultValue?: any): void;
574
574
  axolotl(payload: any, hexKey: any, ed25519: any): string;
575
- fixStringifiedJsonMembers(content: any): any;
575
+ fixStringifiedJsonMembers(content: string): any;
576
576
  safeBoolN(dictionaryOrList: any, keys: IndexType[], defaultValue?: boolean): boolean | undefined;
577
577
  safeBool2(dictionary: any, key1: IndexType, key2: IndexType, defaultValue?: boolean): boolean | undefined;
578
578
  safeBool(dictionary: any, key: IndexType, defaultValue?: boolean): boolean | undefined;
@@ -586,8 +586,8 @@ export default class Exchange {
586
586
  handleDelta(bookside: any, delta: any): void;
587
587
  getCacheIndex(orderbook: any, deltas: any): number;
588
588
  findTimeframe(timeframe: any, timeframes?: any): string;
589
- checkProxyUrlSettings(url?: any, method?: any, headers?: any, body?: any): any;
590
- checkProxySettings(url?: any, method?: any, headers?: any, body?: any): any[];
589
+ checkProxyUrlSettings(url?: string, method?: string, headers?: any, body?: any): any;
590
+ checkProxySettings(url?: string, method?: string, headers?: any, body?: any): any[];
591
591
  checkWsProxySettings(): any[];
592
592
  checkConflictingProxies(proxyAgentSet: any, proxyUrlSet: any): void;
593
593
  findMessageHashes(client: any, element: string): string[];
@@ -640,6 +640,9 @@ export default class Exchange {
640
640
  setLeverage(leverage: Int, symbol?: string, params?: {}): Promise<{}>;
641
641
  fetchLeverage(symbol: string, params?: {}): Promise<{}>;
642
642
  setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<{}>;
643
+ addMargin(symbol: string, amount: number, params?: {}): Promise<{}>;
644
+ reduceMargin(symbol: string, amount: number, params?: {}): Promise<{}>;
645
+ setMargin(symbol: string, amount: number, params?: {}): Promise<{}>;
643
646
  setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<{}>;
644
647
  fetchDepositAddressesByNetwork(code: string, params?: {}): Promise<{}>;
645
648
  fetchOpenInterestHistory(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OpenInterest[]>;
@@ -718,8 +721,8 @@ export default class Exchange {
718
721
  fetchL2OrderBook(symbol: string, limit?: Int, params?: {}): Promise<any>;
719
722
  filterBySymbol(objects: any, symbol?: string): any;
720
723
  parseOHLCV(ohlcv: any, market?: Market): OHLCV;
721
- networkCodeToId(networkCode: any, currencyCode?: any): string;
722
- networkIdToCode(networkId: any, currencyCode?: any): string;
724
+ networkCodeToId(networkCode: string, currencyCode?: string): string;
725
+ networkIdToCode(networkId: string, currencyCode?: string): string;
723
726
  handleNetworkCodeAndParams(params: any): any[];
724
727
  defaultNetworkCode(currencyCode: string): any;
725
728
  selectNetworkCodeFromUnifiedNetworks(currencyCode: any, networkCode: any, indexedNetworkEntries: any): any;
@@ -728,14 +731,14 @@ export default class Exchange {
728
731
  safeNumber2(dictionary: object, key1: IndexType, key2: IndexType, d?: any): number;
729
732
  parseOrderBook(orderbook: object, symbol: string, timestamp?: Int, bidsKey?: string, asksKey?: string, priceKey?: IndexType, amountKey?: IndexType, countOrIdKey?: IndexType): OrderBook;
730
733
  parseOHLCVs(ohlcvs: object[], market?: any, timeframe?: string, since?: Int, limit?: Int): OHLCV[];
731
- parseLeverageTiers(response: any, symbols?: string[], marketIdKey?: any): {};
734
+ parseLeverageTiers(response: object[], symbols?: string[], marketIdKey?: any): {};
732
735
  loadTradingLimits(symbols?: string[], reload?: boolean, params?: {}): Promise<Dictionary<any>>;
733
736
  safePosition(position: any): Position;
734
- parsePositions(positions: any, symbols?: string[], params?: {}): Position[];
735
- parseAccounts(accounts: any, params?: {}): any[];
736
- parseTrades(trades: any, market?: Market, since?: Int, limit?: Int, params?: {}): Trade[];
737
- parseTransactions(transactions: any, currency?: Currency, since?: Int, limit?: Int, params?: {}): Transaction[];
738
- parseTransfers(transfers: any, currency?: Currency, since?: Int, limit?: Int, params?: {}): any;
737
+ parsePositions(positions: any[], symbols?: string[], params?: {}): Position[];
738
+ parseAccounts(accounts: any[], params?: {}): any[];
739
+ parseTrades(trades: any[], market?: Market, since?: Int, limit?: Int, params?: {}): Trade[];
740
+ parseTransactions(transactions: any[], currency?: Currency, since?: Int, limit?: Int, params?: {}): Transaction[];
741
+ parseTransfers(transfers: any[], currency?: Currency, since?: Int, limit?: Int, params?: {}): any;
739
742
  parseLedger(data: any, currency?: Currency, since?: Int, limit?: Int, params?: {}): any;
740
743
  nonce(): number;
741
744
  setHeaders(headers: any): any;
@@ -748,9 +751,9 @@ export default class Exchange {
748
751
  loadAccounts(reload?: boolean, params?: {}): Promise<any>;
749
752
  buildOHLCVC(trades: Trade[], timeframe?: string, since?: number, limit?: number): OHLCVC[];
750
753
  parseTradingViewOHLCV(ohlcvs: any, market?: any, timeframe?: string, since?: Int, limit?: Int): OHLCV[];
751
- editLimitBuyOrder(id: any, symbol: any, amount: number, price?: number, params?: {}): Promise<Order>;
752
- editLimitSellOrder(id: any, symbol: any, amount: number, price?: number, params?: {}): Promise<Order>;
753
- editLimitOrder(id: any, symbol: any, side: any, amount: number, price?: number, params?: {}): Promise<Order>;
754
+ editLimitBuyOrder(id: string, symbol: string, amount: number, price?: number, params?: {}): Promise<Order>;
755
+ editLimitSellOrder(id: string, symbol: string, amount: number, price?: number, params?: {}): Promise<Order>;
756
+ editLimitOrder(id: string, symbol: string, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
754
757
  editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: number, price?: number, params?: {}): Promise<Order>;
755
758
  editOrderWs(id: string, symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
756
759
  fetchPermissions(params?: {}): Promise<{}>;
@@ -912,7 +915,7 @@ export default class Exchange {
912
915
  fetchPremiumIndexOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
913
916
  handleTimeInForce(params?: {}): string;
914
917
  convertTypeToAccount(account: any): any;
915
- checkRequiredArgument(methodName: any, argument: any, argumentName: any, options?: any[]): void;
918
+ checkRequiredArgument(methodName: string, argument: any, argumentName: any, options?: any[]): void;
916
919
  checkRequiredMarginArgument(methodName: string, symbol: Str, marginMode: string): void;
917
920
  parseDepositWithdrawFees(response: any, codes?: string[], currencyIdKey?: any): any;
918
921
  parseDepositWithdrawFee(fee: any, currency?: Currency): any;
@@ -934,7 +937,7 @@ export default class Exchange {
934
937
  fetchPaginatedCallIncremental(method: string, symbol?: string, since?: any, limit?: any, params?: {}, pageKey?: any, maxEntriesPerRequest?: any): Promise<any>;
935
938
  sortCursorPaginatedResult(result: any): any;
936
939
  removeRepeatedElementsFromArray(input: any): any;
937
- handleUntilOption(key: any, request: any, params: any, multiplier?: number): any[];
940
+ handleUntilOption(key: string, request: any, params: any, multiplier?: number): any[];
938
941
  safeOpenInterest(interest: any, market?: Market): OpenInterest;
939
942
  parseLiquidation(liquidation: any, market?: Market): Liquidation;
940
943
  parseLiquidations(liquidations: any, market?: any, since?: Int, limit?: Int): Liquidation[];
@@ -1938,6 +1938,15 @@ export default class Exchange {
1938
1938
  async setPositionMode(hedged, symbol = undefined, params = {}) {
1939
1939
  throw new NotSupported(this.id + ' setPositionMode() is not supported yet');
1940
1940
  }
1941
+ async addMargin(symbol, amount, params = {}) {
1942
+ throw new NotSupported(this.id + ' addMargin() is not supported yet');
1943
+ }
1944
+ async reduceMargin(symbol, amount, params = {}) {
1945
+ throw new NotSupported(this.id + ' reduceMargin() is not supported yet');
1946
+ }
1947
+ async setMargin(symbol, amount, params = {}) {
1948
+ throw new NotSupported(this.id + ' setMargin() is not supported yet');
1949
+ }
1941
1950
  async setMarginMode(marginMode, symbol = undefined, params = {}) {
1942
1951
  throw new NotSupported(this.id + ' setMarginMode() is not supported yet');
1943
1952
  }
package/js/src/binance.js CHANGED
@@ -6215,8 +6215,9 @@ export default class binance extends Exchange {
6215
6215
  * @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
6216
6216
  * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
6217
6217
  */
6218
- const orders = await this.fetchOrders(symbol, since, limit, params);
6219
- return this.filterBy(orders, 'status', 'closed');
6218
+ const orders = await this.fetchOrders(symbol, since, undefined, params);
6219
+ const filteredOrders = this.filterBy(orders, 'status', 'closed');
6220
+ return this.filterBySinceLimit(filteredOrders, since, limit);
6220
6221
  }
6221
6222
  async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
6222
6223
  /**
package/js/src/bingx.d.ts CHANGED
@@ -108,7 +108,7 @@ export default class bingx extends Exchange {
108
108
  parseTransaction(transaction: any, currency?: Currency): Transaction;
109
109
  parseTransactionStatus(status: any): string;
110
110
  setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
111
- setMargin(symbol: string, amount: any, params?: {}): Promise<any>;
111
+ setMargin(symbol: string, amount: number, params?: {}): Promise<any>;
112
112
  fetchLeverage(symbol: string, params?: {}): Promise<any>;
113
113
  setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
114
114
  fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
@@ -154,7 +154,7 @@ export default class bitfinex2 extends Exchange {
154
154
  parseOpenInterest(interest: any, market?: Market): OpenInterest;
155
155
  fetchLiquidations(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Liquidation[]>;
156
156
  parseLiquidation(liquidation: any, market?: Market): Liquidation;
157
- setMargin(symbol: string, amount: any, params?: {}): Promise<{
157
+ setMargin(symbol: string, amount: number, params?: {}): Promise<{
158
158
  info: any;
159
159
  type: any;
160
160
  amount: any;
@@ -25,14 +25,14 @@ export default class bitget extends Exchange {
25
25
  currency: string;
26
26
  address: string;
27
27
  tag: string;
28
- network: string;
28
+ network: any;
29
29
  info: any;
30
30
  }>;
31
31
  parseDepositAddress(depositAddress: any, currency?: Currency): {
32
32
  currency: string;
33
33
  address: string;
34
34
  tag: string;
35
- network: string;
35
+ network: any;
36
36
  info: any;
37
37
  };
38
38
  fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
package/js/src/bitget.js CHANGED
@@ -2421,7 +2421,10 @@ export default class bitget extends Exchange {
2421
2421
  await this.loadMarkets();
2422
2422
  const networkCode = this.safeString2(params, 'chain', 'network');
2423
2423
  params = this.omit(params, 'network');
2424
- const networkId = this.networkCodeToId(networkCode, code);
2424
+ let networkId = undefined;
2425
+ if (networkCode !== undefined) {
2426
+ networkId = this.networkCodeToId(networkCode, code);
2427
+ }
2425
2428
  const currency = this.currency(code);
2426
2429
  const request = {
2427
2430
  'coin': currency['code'],
@@ -2460,11 +2463,15 @@ export default class bitget extends Exchange {
2460
2463
  const currencyId = this.safeString(depositAddress, 'coin');
2461
2464
  const networkId = this.safeString(depositAddress, 'chain');
2462
2465
  const parsedCurrency = this.safeCurrencyCode(currencyId, currency);
2466
+ let network = undefined;
2467
+ if (networkId !== undefined) {
2468
+ network = this.networkIdToCode(networkId, parsedCurrency);
2469
+ }
2463
2470
  return {
2464
2471
  'currency': parsedCurrency,
2465
2472
  'address': this.safeString(depositAddress, 'address'),
2466
2473
  'tag': this.safeString(depositAddress, 'tag'),
2467
- 'network': this.networkIdToCode(networkId, parsedCurrency),
2474
+ 'network': network,
2468
2475
  'info': depositAddress,
2469
2476
  };
2470
2477
  }
@@ -81,7 +81,7 @@ export default class bitrue extends Exchange {
81
81
  symbol: any;
82
82
  status: any;
83
83
  };
84
- setMargin(symbol: string, amount: any, params?: {}): Promise<{
84
+ setMargin(symbol: string, amount: number, params?: {}): Promise<{
85
85
  info: any;
86
86
  type: any;
87
87
  amount: any;
package/js/src/bitrue.js CHANGED
@@ -2780,28 +2780,20 @@ export default class bitrue extends Exchange {
2780
2780
  this.checkAddress(address);
2781
2781
  await this.loadMarkets();
2782
2782
  const currency = this.currency(code);
2783
- let chainName = this.safeString2(params, 'network', 'chainName');
2784
- if (chainName === undefined) {
2785
- const networks = this.safeValue(currency, 'networks', {});
2786
- const optionsNetworks = this.safeValue(this.options, 'networks', {});
2787
- let network = this.safeStringUpper(params, 'network'); // this line allows the user to specify either ERC20 or ETH
2788
- network = this.safeString(optionsNetworks, network, network);
2789
- const networkEntry = this.safeValue(networks, network, {});
2790
- chainName = this.safeString(networkEntry, 'id'); // handle ERC20>ETH alias
2791
- if (chainName === undefined) {
2792
- throw new ArgumentsRequired(this.id + ' withdraw() requires a network parameter or a chainName parameter');
2793
- }
2794
- params = this.omit(params, 'network');
2795
- }
2796
2783
  const request = {
2797
- 'coin': currency['id'].toUpperCase(),
2784
+ 'coin': currency['id'],
2798
2785
  'amount': amount,
2799
2786
  'addressTo': address,
2800
- 'chainName': chainName, // 'ERC20', 'TRC20', 'SOL'
2787
+ // 'chainName': chainName, // 'ERC20', 'TRC20', 'SOL'
2801
2788
  // 'addressMark': '', // mark of address
2802
2789
  // 'addrType': '', // type of address
2803
2790
  // 'tag': tag,
2804
2791
  };
2792
+ let networkCode = undefined;
2793
+ [networkCode, params] = this.handleNetworkCodeAndParams(params);
2794
+ if (networkCode !== undefined) {
2795
+ request['chainName'] = this.networkCodeToId(networkCode);
2796
+ }
2805
2797
  if (tag !== undefined) {
2806
2798
  request['tag'] = tag;
2807
2799
  }
@@ -62,7 +62,7 @@ export default class coinbasepro extends Exchange {
62
62
  fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
63
63
  fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
64
64
  fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
65
- parseTransactionStatus(transaction: any): "ok" | "canceled" | "failed" | "pending";
65
+ parseTransactionStatus(transaction: any): "ok" | "failed" | "canceled" | "pending";
66
66
  parseTransaction(transaction: any, currency?: Currency): Transaction;
67
67
  createDepositAddress(code: string, params?: {}): Promise<{
68
68
  currency: string;
@@ -415,7 +415,10 @@ export default class digifinex extends Exchange {
415
415
  const minFoundPrecision = Precise.stringMin(feeString, Precise.stringMin(minDepositString, minWithdrawString));
416
416
  const precision = this.parseNumber(minFoundPrecision);
417
417
  const networkId = this.safeString(currency, 'chain');
418
- const networkCode = this.networkIdToCode(networkId);
418
+ let networkCode = undefined;
419
+ if (networkId !== undefined) {
420
+ networkCode = this.networkIdToCode(networkId);
421
+ }
419
422
  const network = {
420
423
  'info': currency,
421
424
  'id': networkId,
package/js/src/gate.js CHANGED
@@ -1590,7 +1590,10 @@ export default class gate extends Exchange {
1590
1590
  const currency = parts[0];
1591
1591
  const code = this.safeCurrencyCode(currency);
1592
1592
  const networkId = this.safeString(entry, 'chain');
1593
- const networkCode = this.networkIdToCode(networkId, code);
1593
+ let networkCode = undefined;
1594
+ if (networkId !== undefined) {
1595
+ networkCode = this.networkIdToCode(networkId, code);
1596
+ }
1594
1597
  const delisted = this.safeValue(entry, 'delisted');
1595
1598
  const withdrawDisabled = this.safeBool(entry, 'withdraw_disabled', false);
1596
1599
  const depositDisabled = this.safeBool(entry, 'deposit_disabled', false);
package/js/src/gemini.js CHANGED
@@ -346,7 +346,10 @@ export default class gemini extends Exchange {
346
346
  const precision = this.parseNumber(this.parsePrecision(this.safeString(currency, 5)));
347
347
  const networks = {};
348
348
  const networkId = this.safeString(currency, 9);
349
- const networkCode = this.networkIdToCode(networkId);
349
+ let networkCode = undefined;
350
+ if (networkId !== undefined) {
351
+ networkCode = this.networkIdToCode(networkId);
352
+ }
350
353
  if (networkCode !== undefined) {
351
354
  networks[networkCode] = {
352
355
  'info': currency,
package/js/src/mexc.js CHANGED
@@ -4330,7 +4330,10 @@ export default class mexc extends Exchange {
4330
4330
  'coin': currency['id'],
4331
4331
  };
4332
4332
  const networkCode = this.safeString(params, 'network');
4333
- const networkId = this.networkCodeToId(networkCode, code);
4333
+ let networkId = undefined;
4334
+ if (networkCode !== undefined) {
4335
+ networkId = this.networkCodeToId(networkCode, code);
4336
+ }
4334
4337
  if (networkId !== undefined) {
4335
4338
  request['network'] = networkId;
4336
4339
  }
@@ -99,7 +99,7 @@ export default class phemex extends Exchange {
99
99
  previousFundingTimestamp: any;
100
100
  previousFundingDatetime: any;
101
101
  };
102
- setMargin(symbol: string, amount: any, params?: {}): Promise<any>;
102
+ setMargin(symbol: string, amount: number, params?: {}): Promise<any>;
103
103
  parseMarginStatus(status: any): string;
104
104
  parseMarginModification(data: any, market?: Market): {
105
105
  info: any;
package/js/src/phemex.js CHANGED
@@ -4666,7 +4666,10 @@ export default class phemex extends Exchange {
4666
4666
  const currency = this.currency(code);
4667
4667
  let networkCode = undefined;
4668
4668
  [networkCode, params] = this.handleNetworkCodeAndParams(params);
4669
- let networkId = this.networkCodeToId(networkCode);
4669
+ let networkId = undefined;
4670
+ if (networkCode !== undefined) {
4671
+ networkId = this.networkCodeToId(networkCode);
4672
+ }
4670
4673
  const stableCoins = this.safeValue(this.options, 'stableCoins');
4671
4674
  if (networkId === undefined) {
4672
4675
  if (!(this.inArray(code, stableCoins))) {
@@ -714,7 +714,10 @@ export default class poloniex extends Exchange {
714
714
  const code = this.safeCurrencyCode(id);
715
715
  const name = this.safeString(currency, 'name');
716
716
  const networkId = this.safeString(currency, 'blockchain');
717
- const networkCode = this.networkIdToCode(networkId, code);
717
+ let networkCode = undefined;
718
+ if (networkId !== undefined) {
719
+ networkCode = this.networkIdToCode(networkId, code);
720
+ }
718
721
  const delisted = this.safeValue(currency, 'delisted');
719
722
  const walletEnabled = this.safeString(currency, 'walletState') === 'ENABLED';
720
723
  const depositEnabled = this.safeString(currency, 'walletDepositState') === 'ENABLED';
@@ -13,7 +13,7 @@ export default class binanceus extends binance {
13
13
  // eslint-disable-next-line new-cap
14
14
  const restInstance = new binanceusRest();
15
15
  const restDescribe = restInstance.describe();
16
- const extended = this.deepExtend(super.describe(), restDescribe);
16
+ const extended = this.deepExtend(restDescribe, super.describe());
17
17
  return this.deepExtend(extended, {
18
18
  'id': 'binanceus',
19
19
  'name': 'Binance US',
@@ -174,7 +174,7 @@ export default class hitbtc extends hitbtcRest {
174
174
  await this.loadMarkets();
175
175
  await this.authenticate();
176
176
  const url = this.urls['api']['ws']['private'];
177
- const messageHash = this.nonce();
177
+ const messageHash = this.nonce().toString();
178
178
  const subscribe = {
179
179
  'method': name,
180
180
  'params': params,