ccxt 4.3.15 → 4.3.16

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.
Files changed (64) hide show
  1. package/README.md +3 -3
  2. package/dist/cjs/ccxt.js +1 -1
  3. package/dist/cjs/src/alpaca.js +1 -0
  4. package/dist/cjs/src/ascendex.js +1 -0
  5. package/dist/cjs/src/base/Exchange.js +24 -15
  6. package/dist/cjs/src/base/ws/WsClient.js +4 -0
  7. package/dist/cjs/src/binance.js +1 -0
  8. package/dist/cjs/src/bingx.js +1 -0
  9. package/dist/cjs/src/bitmex.js +1 -0
  10. package/dist/cjs/src/bybit.js +1 -0
  11. package/dist/cjs/src/coinbaseinternational.js +1 -0
  12. package/dist/cjs/src/coinmetro.js +1 -0
  13. package/dist/cjs/src/cryptocom.js +1 -0
  14. package/dist/cjs/src/currencycom.js +1 -0
  15. package/dist/cjs/src/deribit.js +1 -0
  16. package/dist/cjs/src/gate.js +1 -0
  17. package/dist/cjs/src/gemini.js +1 -0
  18. package/dist/cjs/src/hitbtc.js +1 -0
  19. package/dist/cjs/src/hollaex.js +1 -0
  20. package/dist/cjs/src/hyperliquid.js +5 -0
  21. package/dist/cjs/src/idex.js +1 -0
  22. package/dist/cjs/src/krakenfutures.js +1 -0
  23. package/dist/cjs/src/ndax.js +1 -0
  24. package/dist/cjs/src/okx.js +1 -0
  25. package/dist/cjs/src/phemex.js +1 -0
  26. package/dist/cjs/src/poloniex.js +1 -0
  27. package/dist/cjs/src/probit.js +1 -0
  28. package/dist/cjs/src/wavesexchange.js +1 -0
  29. package/dist/cjs/src/woo.js +1 -0
  30. package/dist/cjs/src/zaif.js +1 -1
  31. package/js/ccxt.d.ts +1 -1
  32. package/js/ccxt.js +1 -1
  33. package/js/src/alpaca.js +1 -0
  34. package/js/src/ascendex.js +1 -0
  35. package/js/src/base/Exchange.d.ts +1 -0
  36. package/js/src/base/Exchange.js +24 -15
  37. package/js/src/base/errors.d.ts +37 -37
  38. package/js/src/base/ws/WsClient.d.ts +1 -1
  39. package/js/src/base/ws/WsClient.js +4 -0
  40. package/js/src/binance.js +1 -0
  41. package/js/src/bingx.js +1 -0
  42. package/js/src/bitmex.js +1 -0
  43. package/js/src/bybit.js +1 -0
  44. package/js/src/coinbaseinternational.js +1 -0
  45. package/js/src/coinmetro.js +1 -0
  46. package/js/src/cryptocom.js +1 -0
  47. package/js/src/currencycom.js +1 -0
  48. package/js/src/deribit.js +1 -0
  49. package/js/src/gate.js +1 -0
  50. package/js/src/gemini.js +1 -0
  51. package/js/src/hitbtc.js +1 -0
  52. package/js/src/hollaex.js +1 -0
  53. package/js/src/hyperliquid.js +5 -0
  54. package/js/src/idex.js +1 -0
  55. package/js/src/krakenfutures.js +1 -0
  56. package/js/src/ndax.js +1 -0
  57. package/js/src/okx.js +1 -0
  58. package/js/src/phemex.js +1 -0
  59. package/js/src/poloniex.js +1 -0
  60. package/js/src/probit.js +1 -0
  61. package/js/src/wavesexchange.js +1 -0
  62. package/js/src/woo.js +1 -0
  63. package/js/src/zaif.js +1 -1
  64. package/package.json +1 -1
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.15/dist/ccxt.browser.js
217
- * unpkg: https://unpkg.com/ccxt@4.3.15/dist/ccxt.browser.js
216
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.16/dist/ccxt.browser.js
217
+ * unpkg: https://unpkg.com/ccxt@4.3.16/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.15/dist/ccxt.browser.js"></script>
222
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.16/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.15';
185
+ const version = '4.3.16';
186
186
  Exchange["default"].ccxtVersion = version;
187
187
  const exchanges = {
188
188
  'ace': ace,
@@ -89,6 +89,7 @@ class alpaca extends alpaca$1 {
89
89
  'fetchTransactions': false,
90
90
  'fetchTransfers': false,
91
91
  'fetchWithdrawals': false,
92
+ 'sandbox': true,
92
93
  'setLeverage': false,
93
94
  'setMarginMode': false,
94
95
  'transfer': false,
@@ -91,6 +91,7 @@ class ascendex extends ascendex$1 {
91
91
  'fetchWithdrawal': false,
92
92
  'fetchWithdrawals': true,
93
93
  'reduceMargin': true,
94
+ 'sandbox': true,
94
95
  'setLeverage': true,
95
96
  'setMarginMode': true,
96
97
  'setPositionMode': false,
@@ -366,6 +366,7 @@ class Exchange {
366
366
  'publicAPI': true,
367
367
  'privateAPI': true,
368
368
  'CORS': undefined,
369
+ 'sandbox': undefined,
369
370
  'spot': undefined,
370
371
  'margin': undefined,
371
372
  'swap': undefined,
@@ -5848,24 +5849,26 @@ class Exchange {
5848
5849
  let maxRetries = undefined;
5849
5850
  [maxRetries, params] = this.handleOptionAndParams(params, method, 'maxRetries', 3);
5850
5851
  let errors$1 = 0;
5851
- try {
5852
- if (timeframe && method !== 'fetchFundingRateHistory') {
5853
- return await this[method](symbol, timeframe, since, limit, params);
5854
- }
5855
- else {
5856
- return await this[method](symbol, since, limit, params);
5857
- }
5858
- }
5859
- catch (e) {
5860
- if (e instanceof errors.RateLimitExceeded) {
5861
- throw e; // if we are rate limited, we should not retry and fail fast
5852
+ while (errors$1 <= maxRetries) {
5853
+ try {
5854
+ if (timeframe && method !== 'fetchFundingRateHistory') {
5855
+ return await this[method](symbol, timeframe, since, limit, params);
5856
+ }
5857
+ else {
5858
+ return await this[method](symbol, since, limit, params);
5859
+ }
5862
5860
  }
5863
- errors$1 += 1;
5864
- if (errors$1 > maxRetries) {
5865
- throw e;
5861
+ catch (e) {
5862
+ if (e instanceof errors.RateLimitExceeded) {
5863
+ throw e; // if we are rate limited, we should not retry and fail fast
5864
+ }
5865
+ errors$1 += 1;
5866
+ if (errors$1 > maxRetries) {
5867
+ throw e;
5868
+ }
5866
5869
  }
5867
5870
  }
5868
- return undefined;
5871
+ return [];
5869
5872
  }
5870
5873
  async fetchPaginatedCallDeterministic(method, symbol = undefined, since = undefined, limit = undefined, timeframe = undefined, params = {}, maxEntriesPerRequest = undefined) {
5871
5874
  let maxCalls = undefined;
@@ -5879,6 +5882,9 @@ class Exchange {
5879
5882
  if (since !== undefined) {
5880
5883
  currentSince = Math.max(currentSince, since);
5881
5884
  }
5885
+ else {
5886
+ currentSince = Math.max(currentSince, 1241440531000); // avoid timestamps older than 2009
5887
+ }
5882
5888
  const until = this.safeInteger2(params, 'until', 'till'); // do not omit it here
5883
5889
  if (until !== undefined) {
5884
5890
  const requiredCalls = Math.ceil((until - since) / step);
@@ -5890,6 +5896,9 @@ class Exchange {
5890
5896
  if ((until !== undefined) && (currentSince >= until)) {
5891
5897
  break;
5892
5898
  }
5899
+ if (currentSince >= current) {
5900
+ break;
5901
+ }
5893
5902
  tasks.push(this.safeDeterministicCall(method, symbol, currentSince, maxEntriesPerRequest, timeframe, params));
5894
5903
  currentSince = this.sum(currentSince, step) - 1;
5895
5904
  }
@@ -16,6 +16,10 @@ var WebSocket__default = /*#__PURE__*/_interopDefaultLegacy(WebSocket);
16
16
  // eslint-disable-next-line no-restricted-globals
17
17
  const WebSocketPlatform = platform.isNode ? WebSocket__default["default"] : self.WebSocket;
18
18
  class WsClient extends Client {
19
+ constructor() {
20
+ super(...arguments);
21
+ this.startedConnecting = false;
22
+ }
19
23
  createConnection() {
20
24
  if (this.verbose) {
21
25
  this.log(new Date(), 'connecting to', this.url);
@@ -154,6 +154,7 @@ class binance extends binance$1 {
154
154
  'reduceMargin': true,
155
155
  'repayCrossMargin': true,
156
156
  'repayIsolatedMargin': true,
157
+ 'sandbox': true,
157
158
  'setLeverage': true,
158
159
  'setMargin': false,
159
160
  'setMarginMode': true,
@@ -83,6 +83,7 @@ class bingx extends bingx$1 {
83
83
  'fetchTransfers': true,
84
84
  'fetchWithdrawals': true,
85
85
  'reduceMargin': true,
86
+ 'sandbox': true,
86
87
  'setLeverage': true,
87
88
  'setMargin': true,
88
89
  'setMarginMode': true,
@@ -88,6 +88,7 @@ class bitmex extends bitmex$1 {
88
88
  'fetchTransfer': false,
89
89
  'fetchTransfers': false,
90
90
  'reduceMargin': undefined,
91
+ 'sandbox': true,
91
92
  'setLeverage': true,
92
93
  'setMargin': undefined,
93
94
  'setMarginMode': true,
@@ -119,6 +119,7 @@ class bybit extends bybit$1 {
119
119
  'fetchVolatilityHistory': true,
120
120
  'fetchWithdrawals': true,
121
121
  'repayCrossMargin': true,
122
+ 'sandbox': true,
122
123
  'setLeverage': true,
123
124
  'setMarginMode': true,
124
125
  'setPositionMode': true,
@@ -104,6 +104,7 @@ class coinbaseinternational extends coinbaseinternational$1 {
104
104
  'fetchTradingFees': false,
105
105
  'fetchWithdrawals': true,
106
106
  'reduceMargin': false,
107
+ 'sandbox': true,
107
108
  'setLeverage': false,
108
109
  'setMargin': true,
109
110
  'setMarginMode': false,
@@ -112,6 +112,7 @@ class coinmetro extends coinmetro$1 {
112
112
  'reduceMargin': false,
113
113
  'repayCrossMargin': false,
114
114
  'repayIsolatedMargin': false,
115
+ 'sandbox': true,
115
116
  'setLeverage': false,
116
117
  'setMargin': false,
117
118
  'setMarginMode': false,
@@ -102,6 +102,7 @@ class cryptocom extends cryptocom$1 {
102
102
  'reduceMargin': false,
103
103
  'repayCrossMargin': false,
104
104
  'repayIsolatedMargin': false,
105
+ 'sandbox': true,
105
106
  'setLeverage': false,
106
107
  'setMarginMode': false,
107
108
  'setPositionMode': false,
@@ -101,6 +101,7 @@ class currencycom extends currencycom$1 {
101
101
  'fetchWithdrawal': undefined,
102
102
  'fetchWithdrawals': true,
103
103
  'reduceMargin': undefined,
104
+ 'sandbox': true,
104
105
  'setLeverage': undefined,
105
106
  'setMarginMode': undefined,
106
107
  'setPositionMode': undefined,
@@ -94,6 +94,7 @@ class deribit extends deribit$1 {
94
94
  'fetchVolatilityHistory': true,
95
95
  'fetchWithdrawal': false,
96
96
  'fetchWithdrawals': true,
97
+ 'sandbox': true,
97
98
  'transfer': true,
98
99
  'withdraw': true,
99
100
  },
@@ -157,6 +157,7 @@ class gate extends gate$1 {
157
157
  'reduceMargin': true,
158
158
  'repayCrossMargin': true,
159
159
  'repayIsolatedMargin': true,
160
+ 'sandbox': true,
160
161
  'setLeverage': true,
161
162
  'setMarginMode': false,
162
163
  'setPositionMode': true,
@@ -81,6 +81,7 @@ class gemini extends gemini$1 {
81
81
  'fetchTransactions': 'emulated',
82
82
  'postOnly': true,
83
83
  'reduceMargin': false,
84
+ 'sandbox': true,
84
85
  'setLeverage': false,
85
86
  'setMarginMode': false,
86
87
  'setPositionMode': false,
@@ -91,6 +91,7 @@ class hitbtc extends hitbtc$1 {
91
91
  'fetchTransactions': 'emulated',
92
92
  'fetchWithdrawals': true,
93
93
  'reduceMargin': true,
94
+ 'sandbox': true,
94
95
  'setLeverage': true,
95
96
  'setMargin': false,
96
97
  'setMarginMode': false,
@@ -88,6 +88,7 @@ class hollaex extends hollaex$1 {
88
88
  'fetchWithdrawal': true,
89
89
  'fetchWithdrawals': true,
90
90
  'reduceMargin': false,
91
+ 'sandbox': true,
91
92
  'setLeverage': false,
92
93
  'setMarginMode': false,
93
94
  'setPositionMode': false,
@@ -106,6 +106,7 @@ class hyperliquid extends hyperliquid$1 {
106
106
  'reduceMargin': true,
107
107
  'repayCrossMargin': false,
108
108
  'repayIsolatedMargin': false,
109
+ 'sandbox': true,
109
110
  'setLeverage': true,
110
111
  'setMarginMode': true,
111
112
  'setPositionMode': false,
@@ -440,6 +441,10 @@ class hyperliquid extends hyperliquid$1 {
440
441
  for (let i = 0; i < meta.length; i++) {
441
442
  const market = this.safeDict(meta, i, {});
442
443
  const marketName = this.safeString(market, 'name');
444
+ if (marketName.indexOf('/') < 0) {
445
+ // there are some weird spot markets in testnet, eg @2
446
+ continue;
447
+ }
443
448
  const marketParts = marketName.split('/');
444
449
  const baseName = this.safeString(marketParts, 0);
445
450
  const quoteId = this.safeString(marketParts, 1);
@@ -95,6 +95,7 @@ class idex extends idex$1 {
95
95
  'fetchWithdrawal': true,
96
96
  'fetchWithdrawals': true,
97
97
  'reduceMargin': false,
98
+ 'sandbox': true,
98
99
  'setLeverage': false,
99
100
  'setMarginMode': false,
100
101
  'setPositionMode': false,
@@ -71,6 +71,7 @@ class krakenfutures extends krakenfutures$1 {
71
71
  'fetchPremiumIndexOHLCV': false,
72
72
  'fetchTickers': true,
73
73
  'fetchTrades': true,
74
+ 'sandbox': true,
74
75
  'setLeverage': true,
75
76
  'setMarginMode': false,
76
77
  'transfer': true,
@@ -85,6 +85,7 @@ class ndax extends ndax$1 {
85
85
  'fetchTradingFees': false,
86
86
  'fetchWithdrawals': true,
87
87
  'reduceMargin': false,
88
+ 'sandbox': true,
88
89
  'setLeverage': false,
89
90
  'setMarginMode': false,
90
91
  'setPositionMode': false,
@@ -138,6 +138,7 @@ class okx extends okx$1 {
138
138
  'fetchWithdrawalWhitelist': false,
139
139
  'reduceMargin': true,
140
140
  'repayCrossMargin': true,
141
+ 'sandbox': true,
141
142
  'setLeverage': true,
142
143
  'setMargin': false,
143
144
  'setMarginMode': true,
@@ -79,6 +79,7 @@ class phemex extends phemex$1 {
79
79
  'fetchTransfers': true,
80
80
  'fetchWithdrawals': true,
81
81
  'reduceMargin': false,
82
+ 'sandbox': true,
82
83
  'setLeverage': true,
83
84
  'setMargin': true,
84
85
  'setMarginMode': true,
@@ -69,6 +69,7 @@ class poloniex extends poloniex$1 {
69
69
  'fetchTransfer': false,
70
70
  'fetchTransfers': false,
71
71
  'fetchWithdrawals': true,
72
+ 'sandbox': true,
72
73
  'transfer': true,
73
74
  'withdraw': true,
74
75
  },
@@ -86,6 +86,7 @@ class probit extends probit$1 {
86
86
  'fetchWithdrawal': false,
87
87
  'fetchWithdrawals': true,
88
88
  'reduceMargin': false,
89
+ 'sandbox': true,
89
90
  'setLeverage': false,
90
91
  'setMarginMode': false,
91
92
  'setPositionMode': false,
@@ -79,6 +79,7 @@ class wavesexchange extends wavesexchange$1 {
79
79
  'fetchTransfer': false,
80
80
  'fetchTransfers': false,
81
81
  'reduceMargin': false,
82
+ 'sandbox': true,
82
83
  'setLeverage': false,
83
84
  'setMarginMode': false,
84
85
  'setPositionMode': false,
@@ -104,6 +104,7 @@ class woo extends woo$1 {
104
104
  'fetchTransfers': true,
105
105
  'fetchWithdrawals': true,
106
106
  'reduceMargin': false,
107
+ 'sandbox': true,
107
108
  'setLeverage': true,
108
109
  'setMargin': false,
109
110
  'setPositionMode': true,
@@ -675,7 +675,7 @@ class zaif extends zaif$1 {
675
675
  };
676
676
  }
677
677
  customNonce() {
678
- const num = (this.milliseconds() / 1000).toString();
678
+ const num = this.numberToString(this.milliseconds() / 1000);
679
679
  const nonce = parseFloat(num);
680
680
  return nonce.toFixed(8);
681
681
  }
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, MarketClosed, 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.14";
7
+ declare const version = "4.3.15";
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, 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.15';
41
+ const version = '4.3.16';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
package/js/src/alpaca.js CHANGED
@@ -92,6 +92,7 @@ export default class alpaca extends Exchange {
92
92
  'fetchTransactions': false,
93
93
  'fetchTransfers': false,
94
94
  'fetchWithdrawals': false,
95
+ 'sandbox': true,
95
96
  'setLeverage': false,
96
97
  'setMarginMode': false,
97
98
  'transfer': false,
@@ -94,6 +94,7 @@ export default class ascendex extends Exchange {
94
94
  'fetchWithdrawal': false,
95
95
  'fetchWithdrawals': true,
96
96
  'reduceMargin': true,
97
+ 'sandbox': true,
97
98
  'setLeverage': true,
98
99
  'setMarginMode': true,
99
100
  'setPositionMode': false,
@@ -289,6 +289,7 @@ export default class Exchange {
289
289
  publicAPI: boolean;
290
290
  privateAPI: boolean;
291
291
  CORS: any;
292
+ sandbox: any;
292
293
  spot: any;
293
294
  margin: any;
294
295
  swap: any;
@@ -351,6 +351,7 @@ export default class Exchange {
351
351
  'publicAPI': true,
352
352
  'privateAPI': true,
353
353
  'CORS': undefined,
354
+ 'sandbox': undefined,
354
355
  'spot': undefined,
355
356
  'margin': undefined,
356
357
  'swap': undefined,
@@ -5835,24 +5836,26 @@ export default class Exchange {
5835
5836
  let maxRetries = undefined;
5836
5837
  [maxRetries, params] = this.handleOptionAndParams(params, method, 'maxRetries', 3);
5837
5838
  let errors = 0;
5838
- try {
5839
- if (timeframe && method !== 'fetchFundingRateHistory') {
5840
- return await this[method](symbol, timeframe, since, limit, params);
5841
- }
5842
- else {
5843
- return await this[method](symbol, since, limit, params);
5844
- }
5845
- }
5846
- catch (e) {
5847
- if (e instanceof RateLimitExceeded) {
5848
- throw e; // if we are rate limited, we should not retry and fail fast
5839
+ while (errors <= maxRetries) {
5840
+ try {
5841
+ if (timeframe && method !== 'fetchFundingRateHistory') {
5842
+ return await this[method](symbol, timeframe, since, limit, params);
5843
+ }
5844
+ else {
5845
+ return await this[method](symbol, since, limit, params);
5846
+ }
5849
5847
  }
5850
- errors += 1;
5851
- if (errors > maxRetries) {
5852
- throw e;
5848
+ catch (e) {
5849
+ if (e instanceof RateLimitExceeded) {
5850
+ throw e; // if we are rate limited, we should not retry and fail fast
5851
+ }
5852
+ errors += 1;
5853
+ if (errors > maxRetries) {
5854
+ throw e;
5855
+ }
5853
5856
  }
5854
5857
  }
5855
- return undefined;
5858
+ return [];
5856
5859
  }
5857
5860
  async fetchPaginatedCallDeterministic(method, symbol = undefined, since = undefined, limit = undefined, timeframe = undefined, params = {}, maxEntriesPerRequest = undefined) {
5858
5861
  let maxCalls = undefined;
@@ -5866,6 +5869,9 @@ export default class Exchange {
5866
5869
  if (since !== undefined) {
5867
5870
  currentSince = Math.max(currentSince, since);
5868
5871
  }
5872
+ else {
5873
+ currentSince = Math.max(currentSince, 1241440531000); // avoid timestamps older than 2009
5874
+ }
5869
5875
  const until = this.safeInteger2(params, 'until', 'till'); // do not omit it here
5870
5876
  if (until !== undefined) {
5871
5877
  const requiredCalls = Math.ceil((until - since) / step);
@@ -5877,6 +5883,9 @@ export default class Exchange {
5877
5883
  if ((until !== undefined) && (currentSince >= until)) {
5878
5884
  break;
5879
5885
  }
5886
+ if (currentSince >= current) {
5887
+ break;
5888
+ }
5880
5889
  tasks.push(this.safeDeterministicCall(method, symbol, currentSince, maxEntriesPerRequest, timeframe, params));
5881
5890
  currentSince = this.sum(currentSince, step) - 1;
5882
5891
  }
@@ -1,113 +1,113 @@
1
1
  declare class BaseError extends Error {
2
- constructor(message: any);
2
+ constructor(message: string);
3
3
  }
4
4
  declare class ExchangeError extends BaseError {
5
- constructor(message: any);
5
+ constructor(message: string);
6
6
  }
7
7
  declare class AuthenticationError extends ExchangeError {
8
- constructor(message: any);
8
+ constructor(message: string);
9
9
  }
10
10
  declare class PermissionDenied extends AuthenticationError {
11
- constructor(message: any);
11
+ constructor(message: string);
12
12
  }
13
13
  declare class AccountNotEnabled extends PermissionDenied {
14
- constructor(message: any);
14
+ constructor(message: string);
15
15
  }
16
16
  declare class AccountSuspended extends AuthenticationError {
17
- constructor(message: any);
17
+ constructor(message: string);
18
18
  }
19
19
  declare class ArgumentsRequired extends ExchangeError {
20
- constructor(message: any);
20
+ constructor(message: string);
21
21
  }
22
22
  declare class BadRequest extends ExchangeError {
23
- constructor(message: any);
23
+ constructor(message: string);
24
24
  }
25
25
  declare class BadSymbol extends BadRequest {
26
- constructor(message: any);
26
+ constructor(message: string);
27
27
  }
28
28
  declare class OperationRejected extends ExchangeError {
29
- constructor(message: any);
29
+ constructor(message: string);
30
30
  }
31
31
  declare class NoChange extends OperationRejected {
32
- constructor(message: any);
32
+ constructor(message: string);
33
33
  }
34
34
  declare class MarginModeAlreadySet extends NoChange {
35
- constructor(message: any);
35
+ constructor(message: string);
36
36
  }
37
37
  declare class MarketClosed extends OperationRejected {
38
- constructor(message: any);
38
+ constructor(message: string);
39
39
  }
40
40
  declare class BadResponse extends ExchangeError {
41
- constructor(message: any);
41
+ constructor(message: string);
42
42
  }
43
43
  declare class NullResponse extends BadResponse {
44
- constructor(message: any);
44
+ constructor(message: string);
45
45
  }
46
46
  declare class InsufficientFunds extends ExchangeError {
47
- constructor(message: any);
47
+ constructor(message: string);
48
48
  }
49
49
  declare class InvalidAddress extends ExchangeError {
50
- constructor(message: any);
50
+ constructor(message: string);
51
51
  }
52
52
  declare class AddressPending extends InvalidAddress {
53
- constructor(message: any);
53
+ constructor(message: string);
54
54
  }
55
55
  declare class InvalidOrder extends ExchangeError {
56
- constructor(message: any);
56
+ constructor(message: string);
57
57
  }
58
58
  declare class OrderNotFound extends InvalidOrder {
59
- constructor(message: any);
59
+ constructor(message: string);
60
60
  }
61
61
  declare class OrderNotCached extends InvalidOrder {
62
- constructor(message: any);
62
+ constructor(message: string);
63
63
  }
64
64
  declare class CancelPending extends InvalidOrder {
65
- constructor(message: any);
65
+ constructor(message: string);
66
66
  }
67
67
  declare class OrderImmediatelyFillable extends InvalidOrder {
68
- constructor(message: any);
68
+ constructor(message: string);
69
69
  }
70
70
  declare class OrderNotFillable extends InvalidOrder {
71
- constructor(message: any);
71
+ constructor(message: string);
72
72
  }
73
73
  declare class DuplicateOrderId extends InvalidOrder {
74
- constructor(message: any);
74
+ constructor(message: string);
75
75
  }
76
76
  declare class ContractUnavailable extends InvalidOrder {
77
- constructor(message: any);
77
+ constructor(message: string);
78
78
  }
79
79
  declare class NotSupported extends ExchangeError {
80
- constructor(message: any);
80
+ constructor(message: string);
81
81
  }
82
82
  declare class ProxyError extends ExchangeError {
83
- constructor(message: any);
83
+ constructor(message: string);
84
84
  }
85
85
  declare class ExchangeClosedByUser extends ExchangeError {
86
- constructor(message: any);
86
+ constructor(message: string);
87
87
  }
88
88
  declare class OperationFailed extends BaseError {
89
- constructor(message: any);
89
+ constructor(message: string);
90
90
  }
91
91
  declare class NetworkError extends OperationFailed {
92
- constructor(message: any);
92
+ constructor(message: string);
93
93
  }
94
94
  declare class DDoSProtection extends NetworkError {
95
- constructor(message: any);
95
+ constructor(message: string);
96
96
  }
97
97
  declare class RateLimitExceeded extends NetworkError {
98
- constructor(message: any);
98
+ constructor(message: string);
99
99
  }
100
100
  declare class ExchangeNotAvailable extends NetworkError {
101
- constructor(message: any);
101
+ constructor(message: string);
102
102
  }
103
103
  declare class OnMaintenance extends ExchangeNotAvailable {
104
- constructor(message: any);
104
+ constructor(message: string);
105
105
  }
106
106
  declare class InvalidNonce extends NetworkError {
107
- constructor(message: any);
107
+ constructor(message: string);
108
108
  }
109
109
  declare class RequestTimeout extends NetworkError {
110
- constructor(message: any);
110
+ constructor(message: string);
111
111
  }
112
112
  export { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout };
113
113
  declare const _default: {
@@ -1,6 +1,6 @@
1
1
  import Client from './Client.js';
2
2
  export default class WsClient extends Client {
3
- connectionStarted: number;
3
+ connectionStarted: number | undefined;
4
4
  protocols: any;
5
5
  options: any;
6
6
  startedConnecting: boolean;
@@ -12,6 +12,10 @@ import { Future } from './Future.js';
12
12
  // eslint-disable-next-line no-restricted-globals
13
13
  const WebSocketPlatform = isNode ? WebSocket : self.WebSocket;
14
14
  export default class WsClient extends Client {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.startedConnecting = false;
18
+ }
15
19
  createConnection() {
16
20
  if (this.verbose) {
17
21
  this.log(new Date(), 'connecting to', this.url);
package/js/src/binance.js CHANGED
@@ -157,6 +157,7 @@ export default class binance extends Exchange {
157
157
  'reduceMargin': true,
158
158
  'repayCrossMargin': true,
159
159
  'repayIsolatedMargin': true,
160
+ 'sandbox': true,
160
161
  'setLeverage': true,
161
162
  'setMargin': false,
162
163
  'setMarginMode': true,
package/js/src/bingx.js CHANGED
@@ -86,6 +86,7 @@ export default class bingx extends Exchange {
86
86
  'fetchTransfers': true,
87
87
  'fetchWithdrawals': true,
88
88
  'reduceMargin': true,
89
+ 'sandbox': true,
89
90
  'setLeverage': true,
90
91
  'setMargin': true,
91
92
  'setMarginMode': true,
package/js/src/bitmex.js CHANGED
@@ -91,6 +91,7 @@ export default class bitmex extends Exchange {
91
91
  'fetchTransfer': false,
92
92
  'fetchTransfers': false,
93
93
  'reduceMargin': undefined,
94
+ 'sandbox': true,
94
95
  'setLeverage': true,
95
96
  'setMargin': undefined,
96
97
  'setMarginMode': true,
package/js/src/bybit.js CHANGED
@@ -122,6 +122,7 @@ export default class bybit extends Exchange {
122
122
  'fetchVolatilityHistory': true,
123
123
  'fetchWithdrawals': true,
124
124
  'repayCrossMargin': true,
125
+ 'sandbox': true,
125
126
  'setLeverage': true,
126
127
  'setMarginMode': true,
127
128
  'setPositionMode': true,
@@ -107,6 +107,7 @@ export default class coinbaseinternational extends Exchange {
107
107
  'fetchTradingFees': false,
108
108
  'fetchWithdrawals': true,
109
109
  'reduceMargin': false,
110
+ 'sandbox': true,
110
111
  'setLeverage': false,
111
112
  'setMargin': true,
112
113
  'setMarginMode': false,
@@ -115,6 +115,7 @@ export default class coinmetro extends Exchange {
115
115
  'reduceMargin': false,
116
116
  'repayCrossMargin': false,
117
117
  'repayIsolatedMargin': false,
118
+ 'sandbox': true,
118
119
  'setLeverage': false,
119
120
  'setMargin': false,
120
121
  'setMarginMode': false,
@@ -105,6 +105,7 @@ export default class cryptocom extends Exchange {
105
105
  'reduceMargin': false,
106
106
  'repayCrossMargin': false,
107
107
  'repayIsolatedMargin': false,
108
+ 'sandbox': true,
108
109
  'setLeverage': false,
109
110
  'setMarginMode': false,
110
111
  'setPositionMode': false,
@@ -104,6 +104,7 @@ export default class currencycom extends Exchange {
104
104
  'fetchWithdrawal': undefined,
105
105
  'fetchWithdrawals': true,
106
106
  'reduceMargin': undefined,
107
+ 'sandbox': true,
107
108
  'setLeverage': undefined,
108
109
  'setMarginMode': undefined,
109
110
  'setPositionMode': undefined,
package/js/src/deribit.js CHANGED
@@ -97,6 +97,7 @@ export default class deribit extends Exchange {
97
97
  'fetchVolatilityHistory': true,
98
98
  'fetchWithdrawal': false,
99
99
  'fetchWithdrawals': true,
100
+ 'sandbox': true,
100
101
  'transfer': true,
101
102
  'withdraw': true,
102
103
  },
package/js/src/gate.js CHANGED
@@ -160,6 +160,7 @@ export default class gate extends Exchange {
160
160
  'reduceMargin': true,
161
161
  'repayCrossMargin': true,
162
162
  'repayIsolatedMargin': true,
163
+ 'sandbox': true,
163
164
  'setLeverage': true,
164
165
  'setMarginMode': false,
165
166
  'setPositionMode': true,
package/js/src/gemini.js CHANGED
@@ -84,6 +84,7 @@ export default class gemini extends Exchange {
84
84
  'fetchTransactions': 'emulated',
85
85
  'postOnly': true,
86
86
  'reduceMargin': false,
87
+ 'sandbox': true,
87
88
  'setLeverage': false,
88
89
  'setMarginMode': false,
89
90
  'setPositionMode': false,
package/js/src/hitbtc.js CHANGED
@@ -94,6 +94,7 @@ export default class hitbtc extends Exchange {
94
94
  'fetchTransactions': 'emulated',
95
95
  'fetchWithdrawals': true,
96
96
  'reduceMargin': true,
97
+ 'sandbox': true,
97
98
  'setLeverage': true,
98
99
  'setMargin': false,
99
100
  'setMarginMode': false,
package/js/src/hollaex.js CHANGED
@@ -91,6 +91,7 @@ export default class hollaex extends Exchange {
91
91
  'fetchWithdrawal': true,
92
92
  'fetchWithdrawals': true,
93
93
  'reduceMargin': false,
94
+ 'sandbox': true,
94
95
  'setLeverage': false,
95
96
  'setMarginMode': false,
96
97
  'setPositionMode': false,
@@ -109,6 +109,7 @@ export default class hyperliquid extends Exchange {
109
109
  'reduceMargin': true,
110
110
  'repayCrossMargin': false,
111
111
  'repayIsolatedMargin': false,
112
+ 'sandbox': true,
112
113
  'setLeverage': true,
113
114
  'setMarginMode': true,
114
115
  'setPositionMode': false,
@@ -443,6 +444,10 @@ export default class hyperliquid extends Exchange {
443
444
  for (let i = 0; i < meta.length; i++) {
444
445
  const market = this.safeDict(meta, i, {});
445
446
  const marketName = this.safeString(market, 'name');
447
+ if (marketName.indexOf('/') < 0) {
448
+ // there are some weird spot markets in testnet, eg @2
449
+ continue;
450
+ }
446
451
  const marketParts = marketName.split('/');
447
452
  const baseName = this.safeString(marketParts, 0);
448
453
  const quoteId = this.safeString(marketParts, 1);
package/js/src/idex.js CHANGED
@@ -98,6 +98,7 @@ export default class idex extends Exchange {
98
98
  'fetchWithdrawal': true,
99
99
  'fetchWithdrawals': true,
100
100
  'reduceMargin': false,
101
+ 'sandbox': true,
101
102
  'setLeverage': false,
102
103
  'setMarginMode': false,
103
104
  'setPositionMode': false,
@@ -74,6 +74,7 @@ export default class krakenfutures extends Exchange {
74
74
  'fetchPremiumIndexOHLCV': false,
75
75
  'fetchTickers': true,
76
76
  'fetchTrades': true,
77
+ 'sandbox': true,
77
78
  'setLeverage': true,
78
79
  'setMarginMode': false,
79
80
  'transfer': true,
package/js/src/ndax.js CHANGED
@@ -88,6 +88,7 @@ export default class ndax extends Exchange {
88
88
  'fetchTradingFees': false,
89
89
  'fetchWithdrawals': true,
90
90
  'reduceMargin': false,
91
+ 'sandbox': true,
91
92
  'setLeverage': false,
92
93
  'setMarginMode': false,
93
94
  'setPositionMode': false,
package/js/src/okx.js CHANGED
@@ -141,6 +141,7 @@ export default class okx extends Exchange {
141
141
  'fetchWithdrawalWhitelist': false,
142
142
  'reduceMargin': true,
143
143
  'repayCrossMargin': true,
144
+ 'sandbox': true,
144
145
  'setLeverage': true,
145
146
  'setMargin': false,
146
147
  'setMarginMode': true,
package/js/src/phemex.js CHANGED
@@ -82,6 +82,7 @@ export default class phemex extends Exchange {
82
82
  'fetchTransfers': true,
83
83
  'fetchWithdrawals': true,
84
84
  'reduceMargin': false,
85
+ 'sandbox': true,
85
86
  'setLeverage': true,
86
87
  'setMargin': true,
87
88
  'setMarginMode': true,
@@ -72,6 +72,7 @@ export default class poloniex extends Exchange {
72
72
  'fetchTransfer': false,
73
73
  'fetchTransfers': false,
74
74
  'fetchWithdrawals': true,
75
+ 'sandbox': true,
75
76
  'transfer': true,
76
77
  'withdraw': true,
77
78
  },
package/js/src/probit.js CHANGED
@@ -89,6 +89,7 @@ export default class probit extends Exchange {
89
89
  'fetchWithdrawal': false,
90
90
  'fetchWithdrawals': true,
91
91
  'reduceMargin': false,
92
+ 'sandbox': true,
92
93
  'setLeverage': false,
93
94
  'setMarginMode': false,
94
95
  'setPositionMode': false,
@@ -82,6 +82,7 @@ export default class wavesexchange extends Exchange {
82
82
  'fetchTransfer': false,
83
83
  'fetchTransfers': false,
84
84
  'reduceMargin': false,
85
+ 'sandbox': true,
85
86
  'setLeverage': false,
86
87
  'setMarginMode': false,
87
88
  'setPositionMode': false,
package/js/src/woo.js CHANGED
@@ -107,6 +107,7 @@ export default class woo extends Exchange {
107
107
  'fetchTransfers': true,
108
108
  'fetchWithdrawals': true,
109
109
  'reduceMargin': false,
110
+ 'sandbox': true,
110
111
  'setLeverage': true,
111
112
  'setMargin': false,
112
113
  'setPositionMode': true,
package/js/src/zaif.js CHANGED
@@ -678,7 +678,7 @@ export default class zaif extends Exchange {
678
678
  };
679
679
  }
680
680
  customNonce() {
681
- const num = (this.milliseconds() / 1000).toString();
681
+ const num = this.numberToString(this.milliseconds() / 1000);
682
682
  const nonce = parseFloat(num);
683
683
  return nonce.toFixed(8);
684
684
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.15",
3
+ "version": "4.3.16",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",