ccxt 4.0.67 → 4.0.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.js +153 -54
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +1 -1
- package/dist/cjs/src/binance.js +1 -0
- package/dist/cjs/src/bybit.js +10 -0
- package/dist/cjs/src/lykke.js +1 -1
- package/dist/cjs/src/phemex.js +2 -1
- package/dist/cjs/src/pro/binance.js +1 -1
- package/dist/cjs/src/pro/bitfinex2.js +7 -6
- package/dist/cjs/src/pro/bitget.js +10 -7
- package/dist/cjs/src/pro/bitmart.js +7 -6
- package/dist/cjs/src/pro/bittrex.js +2 -3
- package/dist/cjs/src/pro/coinbasepro.js +71 -9
- package/dist/cjs/src/pro/huobi.js +4 -2
- package/dist/cjs/src/pro/idex.js +1 -1
- package/dist/cjs/src/wavesexchange.js +34 -15
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.js +1 -1
- package/js/src/binance.js +1 -0
- package/js/src/bybit.js +10 -0
- package/js/src/lykke.js +1 -1
- package/js/src/phemex.js +2 -1
- package/js/src/pro/binance.js +1 -1
- package/js/src/pro/bitfinex2.d.ts +1 -1
- package/js/src/pro/bitfinex2.js +7 -6
- package/js/src/pro/bitget.d.ts +1 -1
- package/js/src/pro/bitget.js +10 -7
- package/js/src/pro/bitmart.d.ts +1 -1
- package/js/src/pro/bitmart.js +7 -6
- package/js/src/pro/bittrex.js +2 -3
- package/js/src/pro/coinbasepro.d.ts +3 -1
- package/js/src/pro/coinbasepro.js +71 -9
- package/js/src/pro/huobi.js +4 -2
- package/js/src/pro/idex.js +1 -1
- package/js/src/wavesexchange.d.ts +2 -1
- package/js/src/wavesexchange.js +34 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -210,13 +210,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
210
210
|
|
|
211
211
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
212
212
|
|
|
213
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.
|
|
214
|
-
* unpkg: https://unpkg.com/ccxt@4.0.
|
|
213
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.68/dist/ccxt.browser.js
|
|
214
|
+
* unpkg: https://unpkg.com/ccxt@4.0.68/dist/ccxt.browser.js
|
|
215
215
|
|
|
216
216
|
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.
|
|
217
217
|
|
|
218
218
|
```HTML
|
|
219
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.
|
|
219
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.68/dist/ccxt.browser.js"></script>
|
|
220
220
|
```
|
|
221
221
|
|
|
222
222
|
Creates a global `ccxt` object:
|
package/dist/ccxt.browser.js
CHANGED
|
@@ -7841,7 +7841,7 @@ class Exchange {
|
|
|
7841
7841
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' fetchOrderBook() is not supported yet');
|
|
7842
7842
|
}
|
|
7843
7843
|
async fetchRestOrderBookSafe(symbol, limit = undefined, params = {}) {
|
|
7844
|
-
const fetchSnapshotMaxRetries = this.handleOption('watchOrderBook', '
|
|
7844
|
+
const fetchSnapshotMaxRetries = this.handleOption('watchOrderBook', 'maxRetries', 3);
|
|
7845
7845
|
for (let i = 0; i < fetchSnapshotMaxRetries; i++) {
|
|
7846
7846
|
try {
|
|
7847
7847
|
const orderBook = await this.fetchOrderBook(symbol, limit, params);
|
|
@@ -17020,6 +17020,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
17020
17020
|
'-4045': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError,
|
|
17021
17021
|
'-4046': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.AuthenticationError,
|
|
17022
17022
|
'-4047': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
17023
|
+
'-4054': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
17023
17024
|
'-5001': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadRequest,
|
|
17024
17025
|
'-5002': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
|
|
17025
17026
|
'-5003': _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InsufficientFunds,
|
|
@@ -72418,6 +72419,16 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
72418
72419
|
}
|
|
72419
72420
|
else if (symbol in this.markets_by_id) {
|
|
72420
72421
|
const markets = this.markets_by_id[symbol];
|
|
72422
|
+
let defaultType = this.safeString2(this.options, 'defaultType', 'defaultSubType', 'spot');
|
|
72423
|
+
if (defaultType === 'future') {
|
|
72424
|
+
defaultType = 'contract';
|
|
72425
|
+
}
|
|
72426
|
+
for (let i = 0; i < markets.length; i++) {
|
|
72427
|
+
const market = markets[i];
|
|
72428
|
+
if (market[defaultType]) {
|
|
72429
|
+
return market;
|
|
72430
|
+
}
|
|
72431
|
+
}
|
|
72421
72432
|
return markets[0];
|
|
72422
72433
|
}
|
|
72423
72434
|
else if ((symbol.indexOf('-C') > -1) || (symbol.indexOf('-P') > -1)) {
|
|
@@ -159694,7 +159705,7 @@ class lykke extends _abstract_lykke_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
159694
159705
|
'fetchMarkets': true,
|
|
159695
159706
|
'fetchMarkOHLCV': false,
|
|
159696
159707
|
'fetchMyTrades': true,
|
|
159697
|
-
'fetchOHLCV':
|
|
159708
|
+
'fetchOHLCV': undefined,
|
|
159698
159709
|
'fetchOpenInterestHistory': false,
|
|
159699
159710
|
'fetchOpenOrders': true,
|
|
159700
159711
|
'fetchOrder': true,
|
|
@@ -186958,6 +186969,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
186958
186969
|
}
|
|
186959
186970
|
const unrealizedPnl = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(_base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringMul */ .O.stringMul(priceDiff, contracts), contractSizeString);
|
|
186960
186971
|
const marginRatio = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringDiv */ .O.stringDiv(maintenanceMarginString, collateral);
|
|
186972
|
+
const isCross = this.safeValue(position, 'crossMargin');
|
|
186961
186973
|
return this.safePosition({
|
|
186962
186974
|
'info': position,
|
|
186963
186975
|
'id': undefined,
|
|
@@ -186980,7 +186992,7 @@ class phemex extends _abstract_phemex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
186980
186992
|
'maintenanceMarginPercentage': this.parseNumber(maintenanceMarginPercentageString),
|
|
186981
186993
|
'marginRatio': this.parseNumber(marginRatio),
|
|
186982
186994
|
'datetime': undefined,
|
|
186983
|
-
'marginMode':
|
|
186995
|
+
'marginMode': isCross ? 'cross' : 'isolated',
|
|
186984
186996
|
'side': side,
|
|
186985
186997
|
'hedged': false,
|
|
186986
186998
|
'percentage': undefined,
|
|
@@ -193637,7 +193649,7 @@ class binance extends _binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
193637
193649
|
'name': 'kline', // or indexPriceKline or markPriceKline (coin-m futures)
|
|
193638
193650
|
},
|
|
193639
193651
|
'watchOrderBook': {
|
|
193640
|
-
'
|
|
193652
|
+
'maxRetries': 3,
|
|
193641
193653
|
},
|
|
193642
193654
|
'watchBalance': {
|
|
193643
193655
|
'fetchBalanceSnapshot': false,
|
|
@@ -197669,12 +197681,13 @@ class bitfinex2 extends _bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
197669
197681
|
client.subscriptions[channelId] = message;
|
|
197670
197682
|
return message;
|
|
197671
197683
|
}
|
|
197672
|
-
authenticate(params = {}) {
|
|
197684
|
+
async authenticate(params = {}) {
|
|
197673
197685
|
const url = this.urls['api']['ws']['private'];
|
|
197674
197686
|
const client = this.client(url);
|
|
197675
197687
|
const messageHash = 'authenticated';
|
|
197676
|
-
|
|
197677
|
-
|
|
197688
|
+
const future = client.future(messageHash);
|
|
197689
|
+
const authenticated = this.safeValue(client.subscriptions, messageHash);
|
|
197690
|
+
if (authenticated === undefined) {
|
|
197678
197691
|
const nonce = this.milliseconds();
|
|
197679
197692
|
const payload = 'AUTH' + nonce.toString();
|
|
197680
197693
|
const signature = this.hmac(this.encode(payload), this.encode(this.secret), _static_dependencies_noble_hashes_sha512_js__WEBPACK_IMPORTED_MODULE_4__/* .sha384 */ .iC, 'hex');
|
|
@@ -197687,8 +197700,7 @@ class bitfinex2 extends _bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
197687
197700
|
'event': event,
|
|
197688
197701
|
};
|
|
197689
197702
|
const message = this.extend(request, params);
|
|
197690
|
-
|
|
197691
|
-
client.subscriptions[messageHash] = future;
|
|
197703
|
+
this.watch(url, messageHash, message, messageHash);
|
|
197692
197704
|
}
|
|
197693
197705
|
return future;
|
|
197694
197706
|
}
|
|
@@ -197697,7 +197709,8 @@ class bitfinex2 extends _bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
197697
197709
|
const status = this.safeString(message, 'status');
|
|
197698
197710
|
if (status === 'OK') {
|
|
197699
197711
|
// we resolve the future here permanently so authentication only happens once
|
|
197700
|
-
client.
|
|
197712
|
+
const future = this.safeValue(client.futures, messageHash);
|
|
197713
|
+
future.resolve(true);
|
|
197701
197714
|
}
|
|
197702
197715
|
else {
|
|
197703
197716
|
const error = new _base_errors_js__WEBPACK_IMPORTED_MODULE_3__.AuthenticationError(this.json(message));
|
|
@@ -198053,7 +198066,9 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
198053
198066
|
'ws': {
|
|
198054
198067
|
'exact': {
|
|
198055
198068
|
'30001': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
|
|
198056
|
-
'30015': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
|
|
198069
|
+
'30015': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError,
|
|
198070
|
+
'30016': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.BadRequest,
|
|
198071
|
+
'30011': _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticationError, // { event: 'error', code: 30011, msg: 'Invalid ACCESS_KEY' }
|
|
198057
198072
|
},
|
|
198058
198073
|
},
|
|
198059
198074
|
},
|
|
@@ -199087,13 +199102,14 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
199087
199102
|
const message = this.extend(request, params);
|
|
199088
199103
|
return await this.watch(url, messageHash, message, messageHash);
|
|
199089
199104
|
}
|
|
199090
|
-
authenticate(params = {}) {
|
|
199105
|
+
async authenticate(params = {}) {
|
|
199091
199106
|
this.checkRequiredCredentials();
|
|
199092
199107
|
const url = this.urls['api']['ws'];
|
|
199093
199108
|
const client = this.client(url);
|
|
199094
199109
|
const messageHash = 'authenticated';
|
|
199095
|
-
|
|
199096
|
-
|
|
199110
|
+
const future = client.future(messageHash);
|
|
199111
|
+
const authenticated = this.safeValue(client.subscriptions, messageHash);
|
|
199112
|
+
if (authenticated === undefined) {
|
|
199097
199113
|
const timestamp = this.seconds().toString();
|
|
199098
199114
|
const auth = timestamp + 'GET' + '/user/verify';
|
|
199099
199115
|
const signature = this.hmac(this.encode(auth), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__/* .sha256 */ .J, 'base64');
|
|
@@ -199110,8 +199126,7 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
199110
199126
|
],
|
|
199111
199127
|
};
|
|
199112
199128
|
const message = this.extend(request, params);
|
|
199113
|
-
|
|
199114
|
-
client.subscriptions[messageHash] = future;
|
|
199129
|
+
this.watch(url, messageHash, message, messageHash);
|
|
199115
199130
|
}
|
|
199116
199131
|
return future;
|
|
199117
199132
|
}
|
|
@@ -199130,7 +199145,8 @@ class bitget extends _bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
199130
199145
|
// { event: 'login', code: 0 }
|
|
199131
199146
|
//
|
|
199132
199147
|
const messageHash = 'authenticated';
|
|
199133
|
-
client.
|
|
199148
|
+
const future = this.safeValue(client.futures, messageHash);
|
|
199149
|
+
future.resolve(true);
|
|
199134
199150
|
}
|
|
199135
199151
|
handleErrorMessage(client, message) {
|
|
199136
199152
|
//
|
|
@@ -199744,13 +199760,14 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
199744
199760
|
}
|
|
199745
199761
|
return message;
|
|
199746
199762
|
}
|
|
199747
|
-
authenticate(params = {}) {
|
|
199763
|
+
async authenticate(params = {}) {
|
|
199748
199764
|
this.checkRequiredCredentials();
|
|
199749
199765
|
const url = this.implodeHostname(this.urls['api']['ws']['private']);
|
|
199750
199766
|
const messageHash = 'authenticated';
|
|
199751
199767
|
const client = this.client(url);
|
|
199752
|
-
|
|
199753
|
-
|
|
199768
|
+
const future = client.future(messageHash);
|
|
199769
|
+
const authenticated = this.safeValue(client.subscriptions, messageHash);
|
|
199770
|
+
if (authenticated === undefined) {
|
|
199754
199771
|
const timestamp = this.milliseconds().toString();
|
|
199755
199772
|
const memo = this.uid;
|
|
199756
199773
|
const path = 'bitmart.WebSocket';
|
|
@@ -199766,8 +199783,7 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
199766
199783
|
],
|
|
199767
199784
|
};
|
|
199768
199785
|
const message = this.extend(request, params);
|
|
199769
|
-
|
|
199770
|
-
client.subscriptions[messageHash] = future;
|
|
199786
|
+
this.watch(url, messageHash, message, messageHash);
|
|
199771
199787
|
}
|
|
199772
199788
|
return future;
|
|
199773
199789
|
}
|
|
@@ -199782,7 +199798,8 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
199782
199798
|
// { event: 'login' }
|
|
199783
199799
|
//
|
|
199784
199800
|
const messageHash = 'authenticated';
|
|
199785
|
-
client.
|
|
199801
|
+
const future = this.safeValue(client.futures, messageHash);
|
|
199802
|
+
future.resolve(true);
|
|
199786
199803
|
}
|
|
199787
199804
|
handleErrorMessage(client, message) {
|
|
199788
199805
|
//
|
|
@@ -204017,7 +204034,7 @@ class bittrex extends _bittrex_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */
|
|
|
204017
204034
|
'hub': 'c3',
|
|
204018
204035
|
'I': this.milliseconds(),
|
|
204019
204036
|
'watchOrderBook': {
|
|
204020
|
-
'
|
|
204037
|
+
'maxRetries': 3,
|
|
204021
204038
|
},
|
|
204022
204039
|
},
|
|
204023
204040
|
});
|
|
@@ -204603,8 +204620,7 @@ class bittrex extends _bittrex_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */
|
|
|
204603
204620
|
// then we cannot align it with the cached deltas and we need to
|
|
204604
204621
|
// retry synchronizing in maxAttempts
|
|
204605
204622
|
if ((sequence !== undefined) && (nonce < sequence)) {
|
|
204606
|
-
const
|
|
204607
|
-
const maxAttempts = this.safeInteger(options, 'maxAttempts', 3);
|
|
204623
|
+
const maxAttempts = this.handleOption('watchOrderBook', 'maxRetries', 3);
|
|
204608
204624
|
let numAttempts = this.safeInteger(subscription, 'numAttempts', 0);
|
|
204609
204625
|
// retry to syncrhonize if we haven't reached maxAttempts yet
|
|
204610
204626
|
if (numAttempts < maxAttempts) {
|
|
@@ -209833,7 +209849,7 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
209833
209849
|
'watchOHLCV': false,
|
|
209834
209850
|
'watchOrderBook': true,
|
|
209835
209851
|
'watchTicker': true,
|
|
209836
|
-
'watchTickers':
|
|
209852
|
+
'watchTickers': true,
|
|
209837
209853
|
'watchTrades': true,
|
|
209838
209854
|
'watchBalance': false,
|
|
209839
209855
|
'watchStatus': false,
|
|
@@ -209868,10 +209884,16 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
209868
209884
|
'passphrase': this.password,
|
|
209869
209885
|
};
|
|
209870
209886
|
}
|
|
209871
|
-
async subscribe(name, symbol, messageHashStart, params = {}) {
|
|
209887
|
+
async subscribe(name, symbol = undefined, messageHashStart = undefined, params = {}) {
|
|
209872
209888
|
await this.loadMarkets();
|
|
209873
|
-
|
|
209874
|
-
|
|
209889
|
+
let market = undefined;
|
|
209890
|
+
let messageHash = messageHashStart;
|
|
209891
|
+
const productIds = [];
|
|
209892
|
+
if (symbol !== undefined) {
|
|
209893
|
+
market = this.market(symbol);
|
|
209894
|
+
messageHash += ':' + market['id'];
|
|
209895
|
+
productIds.push(market['id']);
|
|
209896
|
+
}
|
|
209875
209897
|
let url = this.urls['api']['ws'];
|
|
209876
209898
|
if ('signature' in params) {
|
|
209877
209899
|
// need to distinguish between public trades and user trades
|
|
@@ -209879,9 +209901,33 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
209879
209901
|
}
|
|
209880
209902
|
const subscribe = {
|
|
209881
209903
|
'type': 'subscribe',
|
|
209882
|
-
'product_ids':
|
|
209883
|
-
|
|
209904
|
+
'product_ids': productIds,
|
|
209905
|
+
'channels': [
|
|
209906
|
+
name,
|
|
209884
209907
|
],
|
|
209908
|
+
};
|
|
209909
|
+
const request = this.extend(subscribe, params);
|
|
209910
|
+
return await this.watch(url, messageHash, request, messageHash);
|
|
209911
|
+
}
|
|
209912
|
+
async subscribeMultiple(name, symbols = [], messageHashStart = undefined, params = {}) {
|
|
209913
|
+
await this.loadMarkets();
|
|
209914
|
+
let market = undefined;
|
|
209915
|
+
symbols = this.marketSymbols(symbols);
|
|
209916
|
+
const messageHash = messageHashStart + symbols.join(',');
|
|
209917
|
+
const productIds = [];
|
|
209918
|
+
for (let i = 0; i < symbols.length; i++) {
|
|
209919
|
+
const symbol = symbols[i];
|
|
209920
|
+
market = this.market(symbol);
|
|
209921
|
+
productIds.push(market['id']);
|
|
209922
|
+
}
|
|
209923
|
+
let url = this.urls['api']['ws'];
|
|
209924
|
+
if ('signature' in params) {
|
|
209925
|
+
// need to distinguish between public trades and user trades
|
|
209926
|
+
url = url + '?';
|
|
209927
|
+
}
|
|
209928
|
+
const subscribe = {
|
|
209929
|
+
'type': 'subscribe',
|
|
209930
|
+
'product_ids': productIds,
|
|
209885
209931
|
'channels': [
|
|
209886
209932
|
name,
|
|
209887
209933
|
],
|
|
@@ -209901,6 +209947,30 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
209901
209947
|
const name = 'ticker';
|
|
209902
209948
|
return await this.subscribe(name, symbol, name, params);
|
|
209903
209949
|
}
|
|
209950
|
+
async watchTickers(symbols = undefined, params = {}) {
|
|
209951
|
+
/**
|
|
209952
|
+
* @method
|
|
209953
|
+
* @name okx#watchTickers
|
|
209954
|
+
* @see https://www.okx.com/docs-v5/en/#order-book-trading-market-data-ws-tickers-channel
|
|
209955
|
+
* @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
|
209956
|
+
* @param {string[]} [symbols] unified symbol of the market to fetch the ticker for
|
|
209957
|
+
* @param {object} [params] extra parameters specific to the okx api endpoint
|
|
209958
|
+
* @param {string} [params.channel] the channel to subscribe to, tickers by default. Can be tickers, sprd-tickers, index-tickers, block-tickers
|
|
209959
|
+
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
209960
|
+
*/
|
|
209961
|
+
await this.loadMarkets();
|
|
209962
|
+
const symbolsLength = symbols.length;
|
|
209963
|
+
if (symbolsLength === 0) {
|
|
209964
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol(this.id + ' watchTickers requires a non-empty symbols array');
|
|
209965
|
+
}
|
|
209966
|
+
const channel = 'ticker';
|
|
209967
|
+
const messageHash = 'tickers::';
|
|
209968
|
+
const newTickers = await this.subscribeMultiple(channel, symbols, messageHash, params);
|
|
209969
|
+
if (this.newUpdates) {
|
|
209970
|
+
return newTickers;
|
|
209971
|
+
}
|
|
209972
|
+
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
209973
|
+
}
|
|
209904
209974
|
async watchTrades(symbol, since = undefined, limit = undefined, params = {}) {
|
|
209905
209975
|
/**
|
|
209906
209976
|
* @method
|
|
@@ -209932,9 +210002,7 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
209932
210002
|
* @param {object} [params] extra parameters specific to the coinbasepro api endpoint
|
|
209933
210003
|
* @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure
|
|
209934
210004
|
*/
|
|
209935
|
-
|
|
209936
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol(this.id + ' watchMyTrades requires a symbol');
|
|
209937
|
-
}
|
|
210005
|
+
this.checkRequiredSymbol('watchMyTrades', symbol);
|
|
209938
210006
|
await this.loadMarkets();
|
|
209939
210007
|
symbol = this.symbol(symbol);
|
|
209940
210008
|
const name = 'user';
|
|
@@ -210390,6 +210458,16 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
210390
210458
|
const type = this.safeString(message, 'type');
|
|
210391
210459
|
const messageHash = type + ':' + marketId;
|
|
210392
210460
|
client.resolve(ticker, messageHash);
|
|
210461
|
+
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
210462
|
+
for (let i = 0; i < messageHashes.length; i++) {
|
|
210463
|
+
const messageHash = messageHashes[i];
|
|
210464
|
+
const parts = messageHash.split('::');
|
|
210465
|
+
const symbolsString = parts[1];
|
|
210466
|
+
const symbols = symbolsString.split(',');
|
|
210467
|
+
if (this.inArray(symbol, symbols)) {
|
|
210468
|
+
client.resolve(ticker, messageHash);
|
|
210469
|
+
}
|
|
210470
|
+
}
|
|
210393
210471
|
}
|
|
210394
210472
|
return message;
|
|
210395
210473
|
}
|
|
@@ -217428,7 +217506,9 @@ class huobi extends _huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
217428
217506
|
'tradesLimit': 1000,
|
|
217429
217507
|
'OHLCVLimit': 1000,
|
|
217430
217508
|
'api': 'api',
|
|
217431
|
-
'
|
|
217509
|
+
'watchOrderBook': {
|
|
217510
|
+
'maxRetries': 3,
|
|
217511
|
+
},
|
|
217432
217512
|
'ws': {
|
|
217433
217513
|
'gunzip': true,
|
|
217434
217514
|
},
|
|
@@ -217726,7 +217806,7 @@ class huobi extends _huobi_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
217726
217806
|
const snapshotOrderBook = this.orderBook(snapshot, snapshotLimit);
|
|
217727
217807
|
client.resolve(snapshotOrderBook, id);
|
|
217728
217808
|
if ((sequence !== undefined) && (nonce < sequence)) {
|
|
217729
|
-
const maxAttempts = this.
|
|
217809
|
+
const maxAttempts = this.handleOption('watchOrderBook', 'maxRetries', 3);
|
|
217730
217810
|
let numAttempts = this.safeInteger(subscription, 'numAttempts', 0);
|
|
217731
217811
|
// retry to synchronize if we have not reached maxAttempts yet
|
|
217732
217812
|
if (numAttempts < maxAttempts) {
|
|
@@ -220205,7 +220285,7 @@ class idex extends _idex_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
220205
220285
|
'orderBookSubscriptions': {},
|
|
220206
220286
|
'token': undefined,
|
|
220207
220287
|
'watchOrderBook': {
|
|
220208
|
-
'
|
|
220288
|
+
'maxRetries': 3,
|
|
220209
220289
|
},
|
|
220210
220290
|
'fetchOrderBookSnapshotMaxAttempts': 10,
|
|
220211
220291
|
'fetchOrderBookSnapshotMaxDelay': 10000, // throw if there are no orders in 10 seconds
|
|
@@ -254915,19 +254995,32 @@ class wavesexchange extends _abstract_wavesexchange_js__WEBPACK_IMPORTED_MODULE_
|
|
|
254915
254995
|
}
|
|
254916
254996
|
parseOrderBookSide(bookSide, market = undefined, limit = undefined) {
|
|
254917
254997
|
const precision = market['precision'];
|
|
254918
|
-
const wavesPrecision = this.
|
|
254919
|
-
const amountPrecision =
|
|
254920
|
-
const
|
|
254921
|
-
const
|
|
254998
|
+
const wavesPrecision = this.safeString(this.options, 'wavesPrecision', '8');
|
|
254999
|
+
const amountPrecision = '1e' + this.numberToString(precision['amount']);
|
|
255000
|
+
const amountPrecisionString = this.numberToString(precision['amount']);
|
|
255001
|
+
const pricePrecisionString = this.numberToString(precision['price']);
|
|
255002
|
+
const difference = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringSub */ .O.stringSub(amountPrecisionString, pricePrecisionString);
|
|
255003
|
+
const pricePrecision = '1e' + _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringSub */ .O.stringSub(wavesPrecision, difference);
|
|
254922
255004
|
const result = [];
|
|
254923
255005
|
for (let i = 0; i < bookSide.length; i++) {
|
|
254924
255006
|
const entry = bookSide[i];
|
|
254925
|
-
const
|
|
254926
|
-
const
|
|
255007
|
+
const entryPrice = this.safeString(entry, 'price', '0');
|
|
255008
|
+
const entryAmount = this.safeString(entry, 'amount', '0');
|
|
255009
|
+
let price = undefined;
|
|
255010
|
+
let amount = undefined;
|
|
255011
|
+
if ((pricePrecision !== undefined) && (entryPrice !== undefined)) {
|
|
255012
|
+
price = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringDiv */ .O.stringDiv(entryPrice, pricePrecision);
|
|
255013
|
+
}
|
|
255014
|
+
if ((amountPrecision !== undefined) && (entryAmount !== undefined)) {
|
|
255015
|
+
amount = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringDiv */ .O.stringDiv(entryAmount, amountPrecision);
|
|
255016
|
+
}
|
|
254927
255017
|
if ((limit !== undefined) && (i > limit)) {
|
|
254928
255018
|
break;
|
|
254929
255019
|
}
|
|
254930
|
-
result.push([
|
|
255020
|
+
result.push([
|
|
255021
|
+
this.parseNumber(price),
|
|
255022
|
+
this.parseNumber(amount),
|
|
255023
|
+
]);
|
|
254931
255024
|
}
|
|
254932
255025
|
return result;
|
|
254933
255026
|
}
|
|
@@ -255507,15 +255600,21 @@ class wavesexchange extends _abstract_wavesexchange_js__WEBPACK_IMPORTED_MODULE_
|
|
|
255507
255600
|
}
|
|
255508
255601
|
customPriceToPrecision(symbol, price) {
|
|
255509
255602
|
const market = this.markets[symbol];
|
|
255510
|
-
const wavesPrecision = this.
|
|
255511
|
-
const
|
|
255512
|
-
|
|
255603
|
+
const wavesPrecision = this.safeString(this.options, 'wavesPrecision', '8');
|
|
255604
|
+
const amount = this.numberToString(market['precision']['amount']);
|
|
255605
|
+
const precisionPrice = this.numberToString(market['precision']['price']);
|
|
255606
|
+
const difference = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringSub */ .O.stringSub(amount, precisionPrice);
|
|
255607
|
+
const precision = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringSub */ .O.stringSub(wavesPrecision, difference);
|
|
255608
|
+
const pricePrecision = this.toPrecision(price, precision).toString();
|
|
255609
|
+
return this.parseToInt(parseFloat(pricePrecision));
|
|
255513
255610
|
}
|
|
255514
255611
|
customAmountToPrecision(symbol, amount) {
|
|
255515
|
-
|
|
255612
|
+
const amountPrecision = this.numberToString(this.toPrecision(amount, this.numberToString(this.markets[symbol]['precision']['amount'])));
|
|
255613
|
+
return this.parseToInt(parseFloat(amountPrecision));
|
|
255516
255614
|
}
|
|
255517
255615
|
currencyToPrecision(code, amount, networkCode = undefined) {
|
|
255518
|
-
|
|
255616
|
+
const amountPrecision = this.numberToString(this.toPrecision(amount, this.currencies[code]['precision']));
|
|
255617
|
+
return this.parseToInt(parseFloat(amountPrecision));
|
|
255519
255618
|
}
|
|
255520
255619
|
fromPrecision(amount, scale) {
|
|
255521
255620
|
if (amount === undefined) {
|
|
@@ -255527,11 +255626,11 @@ class wavesexchange extends _abstract_wavesexchange_js__WEBPACK_IMPORTED_MODULE_
|
|
|
255527
255626
|
return precise.toString();
|
|
255528
255627
|
}
|
|
255529
255628
|
toPrecision(amount, scale) {
|
|
255530
|
-
const amountString =
|
|
255629
|
+
const amountString = this.numberToString(amount);
|
|
255531
255630
|
const precise = new _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O(amountString);
|
|
255532
|
-
precise.decimals = precise.decimals
|
|
255631
|
+
precise.decimals = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise.stringSub */ .O.stringSub(precise.decimals, scale);
|
|
255533
255632
|
precise.reduce();
|
|
255534
|
-
return precise
|
|
255633
|
+
return precise;
|
|
255535
255634
|
}
|
|
255536
255635
|
currencyFromPrecision(currency, amount) {
|
|
255537
255636
|
const scale = this.currencies[currency]['precision'];
|
|
@@ -272226,7 +272325,7 @@ SOFTWARE.
|
|
|
272226
272325
|
|
|
272227
272326
|
//-----------------------------------------------------------------------------
|
|
272228
272327
|
// this is updated by vss.js when building
|
|
272229
|
-
const version = '4.0.
|
|
272328
|
+
const version = '4.0.68';
|
|
272230
272329
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
|
|
272231
272330
|
//-----------------------------------------------------------------------------
|
|
272232
272331
|
|