ccxt 4.2.9 → 4.2.10
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 +267 -143
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +37 -8
- package/dist/cjs/src/binance.js +6 -1
- package/dist/cjs/src/bl3p.js +1 -1
- package/dist/cjs/src/btcalpha.js +1 -1
- package/dist/cjs/src/cryptocom.js +3 -1
- package/dist/cjs/src/deribit.js +39 -22
- package/dist/cjs/src/kraken.js +1 -1
- package/dist/cjs/src/kucoin.js +1 -1
- package/dist/cjs/src/lykke.js +1 -1
- package/dist/cjs/src/ndax.js +1 -1
- package/dist/cjs/src/pro/bitmart.js +49 -27
- package/dist/cjs/src/pro/blockchaincom.js +2 -28
- package/dist/cjs/src/pro/coinbasepro.js +9 -16
- package/dist/cjs/src/pro/cryptocom.js +110 -28
- package/dist/cjs/src/pro/luno.js +5 -5
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +4 -3
- package/js/src/base/Exchange.js +37 -8
- package/js/src/binance.js +6 -1
- package/js/src/bl3p.d.ts +2 -2
- package/js/src/bl3p.js +1 -1
- package/js/src/btcalpha.d.ts +2 -2
- package/js/src/btcalpha.js +1 -1
- package/js/src/cryptocom.js +3 -1
- package/js/src/deribit.js +39 -22
- package/js/src/kraken.d.ts +2 -2
- package/js/src/kraken.js +1 -1
- package/js/src/kucoin.js +1 -1
- package/js/src/lykke.d.ts +2 -2
- package/js/src/lykke.js +1 -1
- package/js/src/ndax.d.ts +2 -2
- package/js/src/ndax.js +1 -1
- package/js/src/pro/bitmart.d.ts +1 -0
- package/js/src/pro/bitmart.js +49 -27
- package/js/src/pro/blockchaincom.d.ts +1 -11
- package/js/src/pro/blockchaincom.js +2 -28
- package/js/src/pro/coinbasepro.js +9 -16
- package/js/src/pro/cryptocom.d.ts +3 -1
- package/js/src/pro/cryptocom.js +111 -29
- package/js/src/pro/luno.d.ts +4 -4
- package/js/src/pro/luno.js +5 -5
- package/package.json +1 -1
package/dist/ccxt.browser.js
CHANGED
|
@@ -9851,11 +9851,11 @@ class Exchange {
|
|
|
9851
9851
|
}
|
|
9852
9852
|
return result;
|
|
9853
9853
|
}
|
|
9854
|
-
parseBidsAsks(bidasks, priceKey = 0, amountKey = 1) {
|
|
9854
|
+
parseBidsAsks(bidasks, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
|
|
9855
9855
|
bidasks = this.toArray(bidasks);
|
|
9856
9856
|
const result = [];
|
|
9857
9857
|
for (let i = 0; i < bidasks.length; i++) {
|
|
9858
|
-
result.push(this.parseBidAsk(bidasks[i], priceKey, amountKey));
|
|
9858
|
+
result.push(this.parseBidAsk(bidasks[i], priceKey, amountKey, countOrIdKey));
|
|
9859
9859
|
}
|
|
9860
9860
|
return result;
|
|
9861
9861
|
}
|
|
@@ -10024,9 +10024,9 @@ class Exchange {
|
|
|
10024
10024
|
const value = this.safeString2(dictionary, key1, key2);
|
|
10025
10025
|
return this.parseNumber(value, d);
|
|
10026
10026
|
}
|
|
10027
|
-
parseOrderBook(orderbook, symbol, timestamp = undefined, bidsKey = 'bids', asksKey = 'asks', priceKey = 0, amountKey = 1) {
|
|
10028
|
-
const bids = this.parseBidsAsks(this.safeValue(orderbook, bidsKey, []), priceKey, amountKey);
|
|
10029
|
-
const asks = this.parseBidsAsks(this.safeValue(orderbook, asksKey, []), priceKey, amountKey);
|
|
10027
|
+
parseOrderBook(orderbook, symbol, timestamp = undefined, bidsKey = 'bids', asksKey = 'asks', priceKey = 0, amountKey = 1, countOrIdKey = 2) {
|
|
10028
|
+
const bids = this.parseBidsAsks(this.safeValue(orderbook, bidsKey, []), priceKey, amountKey, countOrIdKey);
|
|
10029
|
+
const asks = this.parseBidsAsks(this.safeValue(orderbook, asksKey, []), priceKey, amountKey, countOrIdKey);
|
|
10030
10030
|
return {
|
|
10031
10031
|
'symbol': symbol,
|
|
10032
10032
|
'bids': this.sortBy(bids, 0, true),
|
|
@@ -10341,10 +10341,15 @@ class Exchange {
|
|
|
10341
10341
|
async fetchBidsAsks(symbols = undefined, params = {}) {
|
|
10342
10342
|
throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupported(this.id + ' fetchBidsAsks() is not supported yet');
|
|
10343
10343
|
}
|
|
10344
|
-
parseBidAsk(bidask, priceKey = 0, amountKey = 1) {
|
|
10344
|
+
parseBidAsk(bidask, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
|
|
10345
10345
|
const price = this.safeNumber(bidask, priceKey);
|
|
10346
10346
|
const amount = this.safeNumber(bidask, amountKey);
|
|
10347
|
-
|
|
10347
|
+
const countOrId = this.safeInteger(bidask, countOrIdKey);
|
|
10348
|
+
const bidAsk = [price, amount];
|
|
10349
|
+
if (countOrId !== undefined) {
|
|
10350
|
+
bidAsk.push(countOrId);
|
|
10351
|
+
}
|
|
10352
|
+
return bidAsk;
|
|
10348
10353
|
}
|
|
10349
10354
|
safeCurrency(currencyId, currency = undefined) {
|
|
10350
10355
|
if ((currencyId === undefined) && (currency !== undefined)) {
|
|
@@ -10392,7 +10397,7 @@ class Exchange {
|
|
|
10392
10397
|
}
|
|
10393
10398
|
}
|
|
10394
10399
|
}
|
|
10395
|
-
else if (delimiter !== undefined) {
|
|
10400
|
+
else if (delimiter !== undefined && delimiter !== '') {
|
|
10396
10401
|
const parts = marketId.split(delimiter);
|
|
10397
10402
|
const partsLength = parts.length;
|
|
10398
10403
|
if (partsLength === 2) {
|
|
@@ -10553,6 +10558,30 @@ class Exchange {
|
|
|
10553
10558
|
}
|
|
10554
10559
|
return [value, params];
|
|
10555
10560
|
}
|
|
10561
|
+
handleOptionAndParams2(params, methodName, methodName2, optionName, defaultValue = undefined) {
|
|
10562
|
+
// This method can be used to obtain method specific properties, i.e: this.handleOptionAndParams (params, 'fetchPosition', 'marginMode', 'isolated')
|
|
10563
|
+
const defaultOptionName = 'default' + this.capitalize(optionName); // we also need to check the 'defaultXyzWhatever'
|
|
10564
|
+
// check if params contain the key
|
|
10565
|
+
let value = this.safeValue2(params, optionName, defaultOptionName);
|
|
10566
|
+
if (value !== undefined) {
|
|
10567
|
+
params = this.omit(params, [optionName, defaultOptionName]);
|
|
10568
|
+
}
|
|
10569
|
+
else {
|
|
10570
|
+
// check if exchange has properties for this method
|
|
10571
|
+
const exchangeWideMethodOptions = this.safeValue2(this.options, methodName, methodName2);
|
|
10572
|
+
if (exchangeWideMethodOptions !== undefined) {
|
|
10573
|
+
// check if the option is defined inside this method's props
|
|
10574
|
+
value = this.safeValue2(exchangeWideMethodOptions, optionName, defaultOptionName);
|
|
10575
|
+
}
|
|
10576
|
+
if (value === undefined) {
|
|
10577
|
+
// if it's still undefined, check if global exchange-wide option exists
|
|
10578
|
+
value = this.safeValue2(this.options, optionName, defaultOptionName);
|
|
10579
|
+
}
|
|
10580
|
+
// if it's still undefined, use the default value
|
|
10581
|
+
value = (value !== undefined) ? value : defaultValue;
|
|
10582
|
+
}
|
|
10583
|
+
return [value, params];
|
|
10584
|
+
}
|
|
10556
10585
|
handleOption(methodName, optionName, defaultValue = undefined) {
|
|
10557
10586
|
// eslint-disable-next-line no-unused-vars
|
|
10558
10587
|
const [result, empty] = this.handleOptionAndParams({}, methodName, optionName, defaultValue);
|
|
@@ -20305,7 +20334,12 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
20305
20334
|
response = await this.dapiPublicGetTickerBookTicker(params);
|
|
20306
20335
|
}
|
|
20307
20336
|
else {
|
|
20308
|
-
|
|
20337
|
+
const request = {};
|
|
20338
|
+
if (symbols !== undefined) {
|
|
20339
|
+
const marketIds = this.marketIds(symbols);
|
|
20340
|
+
request['symbols'] = this.json(marketIds);
|
|
20341
|
+
}
|
|
20342
|
+
response = await this.publicGetTickerBookTicker(this.extend(request, params));
|
|
20309
20343
|
}
|
|
20310
20344
|
return this.parseTickers(response, symbols);
|
|
20311
20345
|
}
|
|
@@ -72790,7 +72824,7 @@ class bl3p extends _abstract_bl3p_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
72790
72824
|
const response = await this.privatePostGENMKTMoneyInfo(params);
|
|
72791
72825
|
return this.parseBalance(response);
|
|
72792
72826
|
}
|
|
72793
|
-
parseBidAsk(bidask, priceKey = 0, amountKey = 1) {
|
|
72827
|
+
parseBidAsk(bidask, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
|
|
72794
72828
|
const price = this.safeString(bidask, priceKey);
|
|
72795
72829
|
const size = this.safeString(bidask, amountKey);
|
|
72796
72830
|
return [
|
|
@@ -74629,7 +74663,7 @@ class btcalpha extends _abstract_btcalpha_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
74629
74663
|
const response = await this.publicGetOrderbookPairName(this.extend(request, params));
|
|
74630
74664
|
return this.parseOrderBook(response, market['symbol'], undefined, 'buy', 'sell', 'price', 'amount');
|
|
74631
74665
|
}
|
|
74632
|
-
parseBidsAsks(bidasks, priceKey = 0, amountKey = 1) {
|
|
74666
|
+
parseBidsAsks(bidasks, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
|
|
74633
74667
|
const result = [];
|
|
74634
74668
|
for (let i = 0; i < bidasks.length; i++) {
|
|
74635
74669
|
const bidask = bidasks[i];
|
|
@@ -106575,6 +106609,7 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
106575
106609
|
// "p": "26386.00",
|
|
106576
106610
|
// "q": "0.00453",
|
|
106577
106611
|
// "t": 1686944282062,
|
|
106612
|
+
// "tn" : 1704476468851524373,
|
|
106578
106613
|
// "d": "4611686018455979970",
|
|
106579
106614
|
// "i": "BTC_USD"
|
|
106580
106615
|
// },
|
|
@@ -107745,7 +107780,8 @@ class cryptocom extends _abstract_cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
107745
107780
|
// "s": "sell",
|
|
107746
107781
|
// "p": "26386.00",
|
|
107747
107782
|
// "q": "0.00453",
|
|
107748
|
-
// "
|
|
107783
|
+
// "tn": 1686944282062,
|
|
107784
|
+
// "tn": 1704476468851524373,
|
|
107749
107785
|
// "d": "4611686018455979970",
|
|
107750
107786
|
// "i": "BTC_USD"
|
|
107751
107787
|
// }
|
|
@@ -115835,27 +115871,18 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
115835
115871
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
115836
115872
|
* @param {string} type 'market' or 'limit'
|
|
115837
115873
|
* @param {string} side 'buy' or 'sell'
|
|
115838
|
-
* @param {float} amount how much
|
|
115874
|
+
* @param {float} amount how much you want to trade in units of the base currency. For inverse perpetual and futures the amount is in the quote currency USD. For options it is in the underlying assets base currency.
|
|
115839
115875
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
115840
115876
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
115877
|
+
* @param {string} [params.trigger] the trigger type 'index_price', 'mark_price', or 'last_price', default is 'last_price'
|
|
115878
|
+
* @param {float} [params.trailingAmount] the quote amount to trail away from the current market price
|
|
115841
115879
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
115842
115880
|
*/
|
|
115843
115881
|
await this.loadMarkets();
|
|
115844
115882
|
const market = this.market(symbol);
|
|
115845
|
-
if (market['inverse']) {
|
|
115846
|
-
amount = this.amountToPrecision(symbol, amount);
|
|
115847
|
-
}
|
|
115848
|
-
else if (market['settle'] === 'USDC') {
|
|
115849
|
-
amount = this.amountToPrecision(symbol, amount);
|
|
115850
|
-
}
|
|
115851
|
-
else {
|
|
115852
|
-
amount = this.currencyToPrecision(symbol, amount);
|
|
115853
|
-
}
|
|
115854
115883
|
const request = {
|
|
115855
115884
|
'instrument_name': market['id'],
|
|
115856
|
-
|
|
115857
|
-
// for options it is in corresponding cryptocurrency contracts, e.g., BTC or ETH
|
|
115858
|
-
'amount': amount,
|
|
115885
|
+
'amount': this.amountToPrecision(symbol, amount),
|
|
115859
115886
|
'type': type, // limit, stop_limit, market, stop_market, default is limit
|
|
115860
115887
|
// 'label': 'string', // user-defined label for the order (maximum 64 characters)
|
|
115861
115888
|
// 'price': this.priceToPrecision (symbol, 123.45), // only for limit and stop_limit orders
|
|
@@ -115868,12 +115895,15 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
115868
115895
|
// 'trigger': 'index_price', // mark_price, last_price, required for stop_limit orders
|
|
115869
115896
|
// 'advanced': 'usd', // 'implv', advanced option order type, options only
|
|
115870
115897
|
};
|
|
115898
|
+
const trigger = this.safeString(params, 'trigger', 'last_price');
|
|
115871
115899
|
const timeInForce = this.safeStringUpper(params, 'timeInForce');
|
|
115872
115900
|
const reduceOnly = this.safeValue2(params, 'reduceOnly', 'reduce_only');
|
|
115873
115901
|
// only stop loss sell orders are allowed when price crossed from above
|
|
115874
115902
|
const stopLossPrice = this.safeValue(params, 'stopLossPrice');
|
|
115875
115903
|
// only take profit buy orders are allowed when price crossed from below
|
|
115876
115904
|
const takeProfitPrice = this.safeValue(params, 'takeProfitPrice');
|
|
115905
|
+
const trailingAmount = this.safeString2(params, 'trailingAmount', 'trigger_offset');
|
|
115906
|
+
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
115877
115907
|
const isStopLimit = type === 'stop_limit';
|
|
115878
115908
|
const isStopMarket = type === 'stop_market';
|
|
115879
115909
|
const isTakeLimit = type === 'take_limit';
|
|
@@ -115895,10 +115925,15 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
115895
115925
|
else {
|
|
115896
115926
|
request['type'] = 'market';
|
|
115897
115927
|
}
|
|
115898
|
-
if (
|
|
115928
|
+
if (isTrailingAmountOrder) {
|
|
115929
|
+
request['trigger'] = trigger;
|
|
115930
|
+
request['type'] = 'trailing_stop';
|
|
115931
|
+
request['trigger_offset'] = this.parseToNumeric(trailingAmount);
|
|
115932
|
+
}
|
|
115933
|
+
else if (isStopOrder) {
|
|
115899
115934
|
const triggerPrice = (stopLossPrice !== undefined) ? stopLossPrice : takeProfitPrice;
|
|
115900
115935
|
request['trigger_price'] = this.priceToPrecision(symbol, triggerPrice);
|
|
115901
|
-
request['trigger'] =
|
|
115936
|
+
request['trigger'] = trigger;
|
|
115902
115937
|
if (isStopLossOrder) {
|
|
115903
115938
|
if (isMarketOrder) {
|
|
115904
115939
|
// stop_market (sell only)
|
|
@@ -115938,7 +115973,7 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
115938
115973
|
request['time_in_force'] = 'fill_or_kill';
|
|
115939
115974
|
}
|
|
115940
115975
|
}
|
|
115941
|
-
params = this.omit(params, ['timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'reduceOnly']);
|
|
115976
|
+
params = this.omit(params, ['timeInForce', 'stopLossPrice', 'takeProfitPrice', 'postOnly', 'reduceOnly', 'trailingAmount']);
|
|
115942
115977
|
let response = undefined;
|
|
115943
115978
|
if (this.capitalize(side) === 'Buy') {
|
|
115944
115979
|
response = await this.privateGetBuy(this.extend(request, params));
|
|
@@ -116005,25 +116040,43 @@ class deribit extends _abstract_deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
116005
116040
|
return this.parseOrder(order, market);
|
|
116006
116041
|
}
|
|
116007
116042
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
116043
|
+
/**
|
|
116044
|
+
* @method
|
|
116045
|
+
* @name deribit#editOrder
|
|
116046
|
+
* @description edit a trade order
|
|
116047
|
+
* @see https://docs.deribit.com/#private-edit
|
|
116048
|
+
* @param {string} id edit order id
|
|
116049
|
+
* @param {string} [symbol] unified symbol of the market to edit an order in
|
|
116050
|
+
* @param {string} [type] 'market' or 'limit'
|
|
116051
|
+
* @param {string} [side] 'buy' or 'sell'
|
|
116052
|
+
* @param {float} amount how much you want to trade in units of the base currency, inverse swap and future use the quote currency
|
|
116053
|
+
* @param {float} [price] the price at which the order is to be fullfilled, in units of the base currency, ignored in market orders
|
|
116054
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
116055
|
+
* @param {float} [params.trailingAmount] the quote amount to trail away from the current market price
|
|
116056
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
116057
|
+
*/
|
|
116008
116058
|
if (amount === undefined) {
|
|
116009
116059
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' editOrder() requires an amount argument');
|
|
116010
116060
|
}
|
|
116011
|
-
if (price === undefined) {
|
|
116012
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' editOrder() requires a price argument');
|
|
116013
|
-
}
|
|
116014
116061
|
await this.loadMarkets();
|
|
116015
116062
|
const request = {
|
|
116016
116063
|
'order_id': id,
|
|
116017
|
-
// for perpetual and futures the amount is in USD
|
|
116018
|
-
// for options it is in corresponding cryptocurrency contracts, e.g., BTC or ETH
|
|
116019
116064
|
'amount': this.amountToPrecision(symbol, amount),
|
|
116020
|
-
'price': this.priceToPrecision(symbol, price), // required
|
|
116021
116065
|
// 'post_only': false, // if the new price would cause the order to be filled immediately (as taker), the price will be changed to be just below the spread.
|
|
116022
116066
|
// 'reject_post_only': false, // if true the order is put to order book unmodified or request is rejected
|
|
116023
116067
|
// 'reduce_only': false, // if true, the order is intended to only reduce a current position
|
|
116024
116068
|
// 'stop_price': false, // stop price, required for stop_limit orders
|
|
116025
116069
|
// 'advanced': 'usd', // 'implv', advanced option order type, options only
|
|
116026
116070
|
};
|
|
116071
|
+
if (price !== undefined) {
|
|
116072
|
+
request['price'] = this.priceToPrecision(symbol, price);
|
|
116073
|
+
}
|
|
116074
|
+
const trailingAmount = this.safeString2(params, 'trailingAmount', 'trigger_offset');
|
|
116075
|
+
const isTrailingAmountOrder = trailingAmount !== undefined;
|
|
116076
|
+
if (isTrailingAmountOrder) {
|
|
116077
|
+
request['trigger_offset'] = this.parseToNumeric(trailingAmount);
|
|
116078
|
+
params = this.omit(params, 'trigger_offset');
|
|
116079
|
+
}
|
|
116027
116080
|
const response = await this.privateGetEdit(this.extend(request, params));
|
|
116028
116081
|
const result = this.safeValue(response, 'result', {});
|
|
116029
116082
|
const order = this.safeValue(result, 'order');
|
|
@@ -154284,7 +154337,7 @@ class kraken extends _abstract_kraken_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
154284
154337
|
'tierBased': true,
|
|
154285
154338
|
};
|
|
154286
154339
|
}
|
|
154287
|
-
parseBidAsk(bidask, priceKey = 0, amountKey = 1) {
|
|
154340
|
+
parseBidAsk(bidask, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
|
|
154288
154341
|
const price = this.safeNumber(bidask, priceKey);
|
|
154289
154342
|
const amount = this.safeNumber(bidask, amountKey);
|
|
154290
154343
|
const timestamp = this.safeInteger(bidask, 2);
|
|
@@ -161240,7 +161293,7 @@ class kucoin extends _abstract_kucoin_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
161240
161293
|
// }
|
|
161241
161294
|
// }
|
|
161242
161295
|
const responseData = this.safeValue(response, 'data', {});
|
|
161243
|
-
const orders = this.safeValue(responseData, 'items',
|
|
161296
|
+
const orders = this.safeValue(responseData, 'items', responseData);
|
|
161244
161297
|
return this.parseOrders(orders, market, since, limit);
|
|
161245
161298
|
}
|
|
161246
161299
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -174445,7 +174498,7 @@ class lykke extends _abstract_lykke_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
174445
174498
|
//
|
|
174446
174499
|
return this.parseTrades(payload, market, since, limit);
|
|
174447
174500
|
}
|
|
174448
|
-
parseBidAsk(bidask, priceKey = 0, amountKey = 1) {
|
|
174501
|
+
parseBidAsk(bidask, priceKey = 0, amountKey = 1, countOrIdKey = 2) {
|
|
174449
174502
|
const price = this.safeString(bidask, priceKey);
|
|
174450
174503
|
const amount = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringAbs(this.safeString(bidask, amountKey));
|
|
174451
174504
|
return [this.parseNumber(price), this.parseNumber(amount)];
|
|
@@ -181522,7 +181575,7 @@ class ndax extends _abstract_ndax_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
181522
181575
|
'info': market,
|
|
181523
181576
|
};
|
|
181524
181577
|
}
|
|
181525
|
-
parseOrderBook(orderbook, symbol, timestamp = undefined, bidsKey = 'bids', asksKey = 'asks', priceKey = 6, amountKey = 8) {
|
|
181578
|
+
parseOrderBook(orderbook, symbol, timestamp = undefined, bidsKey = 'bids', asksKey = 'asks', priceKey = 6, amountKey = 8, countOrIdKey = 2) {
|
|
181526
181579
|
let nonce = undefined;
|
|
181527
181580
|
const result = {
|
|
181528
181581
|
'symbol': symbol,
|
|
@@ -216710,25 +216763,39 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
216710
216763
|
const market = this.getMarketFromSymbols(symbols);
|
|
216711
216764
|
let type = 'spot';
|
|
216712
216765
|
[type, params] = this.handleMarketTypeAndParams('watchTickers', market, params);
|
|
216713
|
-
symbols = this.marketSymbols(symbols);
|
|
216714
|
-
if (type === 'spot') {
|
|
216715
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupported(this.id + ' watchTickers() does not support ' + type + ' markets. Use watchTicker() instead');
|
|
216716
|
-
}
|
|
216717
216766
|
const url = this.implodeHostname(this.urls['api']['ws'][type]['public']);
|
|
216718
|
-
|
|
216719
|
-
|
|
216720
|
-
}
|
|
216721
|
-
let messageHash = 'tickers';
|
|
216767
|
+
symbols = this.marketSymbols(symbols);
|
|
216768
|
+
let messageHash = 'tickers::' + type;
|
|
216722
216769
|
if (symbols !== undefined) {
|
|
216723
216770
|
messageHash += '::' + symbols.join(',');
|
|
216724
216771
|
}
|
|
216725
|
-
|
|
216726
|
-
|
|
216727
|
-
|
|
216728
|
-
|
|
216729
|
-
|
|
216772
|
+
let request = undefined;
|
|
216773
|
+
let tickers = undefined;
|
|
216774
|
+
const isSpot = (type === 'spot');
|
|
216775
|
+
if (isSpot) {
|
|
216776
|
+
if (symbols === undefined) {
|
|
216777
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' watchTickers() for ' + type + ' market type requires symbols argument to be provided');
|
|
216778
|
+
}
|
|
216779
|
+
const marketIds = this.marketIds(symbols);
|
|
216780
|
+
const finalArray = [];
|
|
216781
|
+
for (let i = 0; i < marketIds.length; i++) {
|
|
216782
|
+
finalArray.push('spot/ticker:' + marketIds[i]);
|
|
216783
|
+
}
|
|
216784
|
+
request = {
|
|
216785
|
+
'op': 'subscribe',
|
|
216786
|
+
'args': finalArray,
|
|
216787
|
+
};
|
|
216788
|
+
tickers = await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
|
|
216789
|
+
}
|
|
216790
|
+
else {
|
|
216791
|
+
request = {
|
|
216792
|
+
'action': 'subscribe',
|
|
216793
|
+
'args': ['futures/ticker'],
|
|
216794
|
+
};
|
|
216795
|
+
tickers = await this.watch(url, messageHash, this.deepExtend(request, params), messageHash);
|
|
216796
|
+
}
|
|
216730
216797
|
if (this.newUpdates) {
|
|
216731
|
-
return
|
|
216798
|
+
return tickers;
|
|
216732
216799
|
}
|
|
216733
216800
|
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
216734
216801
|
}
|
|
@@ -217313,28 +217380,36 @@ class bitmart extends _bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
217313
217380
|
const messageHash = table + ':' + marketId;
|
|
217314
217381
|
this.tickers[symbol] = ticker;
|
|
217315
217382
|
client.resolve(ticker, messageHash);
|
|
217383
|
+
this.resolveMessageHashesForSymbol(client, symbol, ticker, 'tickers::');
|
|
217316
217384
|
}
|
|
217317
217385
|
}
|
|
217318
217386
|
else {
|
|
217387
|
+
// on each update for contract markets, single ticker is provided
|
|
217319
217388
|
const ticker = this.parseWsSwapTicker(data);
|
|
217320
217389
|
const symbol = this.safeString(ticker, 'symbol');
|
|
217321
217390
|
this.tickers[symbol] = ticker;
|
|
217322
|
-
client.resolve(ticker, 'tickers');
|
|
217323
|
-
|
|
217324
|
-
for (let i = 0; i < messageHashes.length; i++) {
|
|
217325
|
-
const messageHash = messageHashes[i];
|
|
217326
|
-
const parts = messageHash.split('::');
|
|
217327
|
-
const symbolsString = parts[1];
|
|
217328
|
-
const symbols = symbolsString.split(',');
|
|
217329
|
-
if (this.inArray(symbol, symbols)) {
|
|
217330
|
-
const response = {};
|
|
217331
|
-
response[symbol] = ticker;
|
|
217332
|
-
client.resolve(response, messageHash);
|
|
217333
|
-
}
|
|
217334
|
-
}
|
|
217391
|
+
client.resolve(ticker, 'tickers::swap');
|
|
217392
|
+
this.resolveMessageHashesForSymbol(client, symbol, ticker, 'tickers::');
|
|
217335
217393
|
}
|
|
217336
217394
|
return message;
|
|
217337
217395
|
}
|
|
217396
|
+
resolveMessageHashesForSymbol(client, symbol, result, prexif) {
|
|
217397
|
+
const prefixSeparator = '::';
|
|
217398
|
+
const symbolsSeparator = ',';
|
|
217399
|
+
const messageHashes = this.findMessageHashes(client, prexif);
|
|
217400
|
+
for (let i = 0; i < messageHashes.length; i++) {
|
|
217401
|
+
const messageHash = messageHashes[i];
|
|
217402
|
+
const parts = messageHash.split(prefixSeparator);
|
|
217403
|
+
const length = parts.length;
|
|
217404
|
+
const symbolsString = parts[length - 1];
|
|
217405
|
+
const symbols = symbolsString.split(symbolsSeparator);
|
|
217406
|
+
if (this.inArray(symbol, symbols)) {
|
|
217407
|
+
const response = {};
|
|
217408
|
+
response[symbol] = result;
|
|
217409
|
+
client.resolve(response, messageHash);
|
|
217410
|
+
}
|
|
217411
|
+
}
|
|
217412
|
+
}
|
|
217338
217413
|
parseWsSwapTicker(ticker, market = undefined) {
|
|
217339
217414
|
//
|
|
217340
217415
|
// {
|
|
@@ -223594,7 +223669,7 @@ class blockchaincom extends _blockchaincom_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
|
|
|
223594
223669
|
return message;
|
|
223595
223670
|
}
|
|
223596
223671
|
else if (event === 'snapshot') {
|
|
223597
|
-
const snapshot = this.
|
|
223672
|
+
const snapshot = this.parseOrderBook(message, symbol, timestamp, 'bids', 'asks', 'px', 'qty', 'num');
|
|
223598
223673
|
storedOrderBook.reset(snapshot);
|
|
223599
223674
|
}
|
|
223600
223675
|
else if (event === 'updated') {
|
|
@@ -223610,34 +223685,8 @@ class blockchaincom extends _blockchaincom_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
|
|
|
223610
223685
|
}
|
|
223611
223686
|
client.resolve(storedOrderBook, messageHash);
|
|
223612
223687
|
}
|
|
223613
|
-
parseCountedBidAsk(bidAsk, priceKey = 0, amountKey = 1, countKey = 2) {
|
|
223614
|
-
const price = this.safeNumber(bidAsk, priceKey);
|
|
223615
|
-
const amount = this.safeNumber(bidAsk, amountKey);
|
|
223616
|
-
const count = this.safeNumber(bidAsk, countKey);
|
|
223617
|
-
return [price, amount, count];
|
|
223618
|
-
}
|
|
223619
|
-
parseCountedBidsAsks(bidasks, priceKey = 0, amountKey = 1, countKey = 2) {
|
|
223620
|
-
bidasks = this.toArray(bidasks);
|
|
223621
|
-
const result = [];
|
|
223622
|
-
for (let i = 0; i < bidasks.length; i++) {
|
|
223623
|
-
result.push(this.parseCountedBidAsk(bidasks[i], priceKey, amountKey, countKey));
|
|
223624
|
-
}
|
|
223625
|
-
return result;
|
|
223626
|
-
}
|
|
223627
|
-
parseCountedOrderBook(orderbook, symbol, timestamp = undefined, bidsKey = 'bids', asksKey = 'asks', priceKey = 0, amountKey = 1, countKey = 2) {
|
|
223628
|
-
const bids = this.parseCountedBidsAsks(this.safeValue(orderbook, bidsKey, []), priceKey, amountKey, countKey);
|
|
223629
|
-
const asks = this.parseCountedBidsAsks(this.safeValue(orderbook, asksKey, []), priceKey, amountKey, countKey);
|
|
223630
|
-
return {
|
|
223631
|
-
'symbol': symbol,
|
|
223632
|
-
'bids': this.sortBy(bids, 0, true),
|
|
223633
|
-
'asks': this.sortBy(asks, 0),
|
|
223634
|
-
'timestamp': timestamp,
|
|
223635
|
-
'datetime': this.iso8601(timestamp),
|
|
223636
|
-
'nonce': undefined,
|
|
223637
|
-
};
|
|
223638
|
-
}
|
|
223639
223688
|
handleDelta(bookside, delta) {
|
|
223640
|
-
const bookArray = this.
|
|
223689
|
+
const bookArray = this.parseBidAsk(delta, 'px', 'qty', 'num');
|
|
223641
223690
|
bookside.storeArray(bookArray);
|
|
223642
223691
|
}
|
|
223643
223692
|
handleDeltas(bookside, deltas) {
|
|
@@ -227756,7 +227805,7 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
227756
227805
|
const symbol = symbols[i];
|
|
227757
227806
|
market = this.market(symbol);
|
|
227758
227807
|
productIds.push(market['id']);
|
|
227759
|
-
messageHashes.push(messageHashStart + ':' + market['
|
|
227808
|
+
messageHashes.push(messageHashStart + ':' + market['symbol']);
|
|
227760
227809
|
}
|
|
227761
227810
|
let url = this.urls['api']['ws'];
|
|
227762
227811
|
if ('signature' in params) {
|
|
@@ -227801,10 +227850,12 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
227801
227850
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.BadSymbol(this.id + ' watchTickers requires a non-empty symbols array');
|
|
227802
227851
|
}
|
|
227803
227852
|
const channel = 'ticker';
|
|
227804
|
-
const messageHash = '
|
|
227805
|
-
const
|
|
227853
|
+
const messageHash = 'ticker';
|
|
227854
|
+
const ticker = await this.subscribeMultiple(channel, symbols, messageHash, params);
|
|
227806
227855
|
if (this.newUpdates) {
|
|
227807
|
-
|
|
227856
|
+
const result = {};
|
|
227857
|
+
result[ticker['symbol']] = ticker;
|
|
227858
|
+
return result;
|
|
227808
227859
|
}
|
|
227809
227860
|
return this.filterByArray(this.tickers, 'symbol', symbols);
|
|
227810
227861
|
}
|
|
@@ -228416,19 +228467,10 @@ class coinbasepro extends _coinbasepro_js__WEBPACK_IMPORTED_MODULE_0__/* ["defau
|
|
|
228416
228467
|
const ticker = this.parseTicker(message);
|
|
228417
228468
|
const symbol = ticker['symbol'];
|
|
228418
228469
|
this.tickers[symbol] = ticker;
|
|
228419
|
-
const
|
|
228420
|
-
const
|
|
228470
|
+
const messageHash = 'ticker:' + symbol;
|
|
228471
|
+
const idMessageHash = 'ticker:' + marketId;
|
|
228421
228472
|
client.resolve(ticker, messageHash);
|
|
228422
|
-
|
|
228423
|
-
for (let i = 0; i < messageHashes.length; i++) {
|
|
228424
|
-
const currentMessageHash = messageHashes[i];
|
|
228425
|
-
const parts = currentMessageHash.split('::');
|
|
228426
|
-
const symbolsString = parts[1];
|
|
228427
|
-
const symbols = symbolsString.split(',');
|
|
228428
|
-
if (this.inArray(symbol, symbols)) {
|
|
228429
|
-
client.resolve(ticker, currentMessageHash);
|
|
228430
|
-
}
|
|
228431
|
-
}
|
|
228473
|
+
client.resolve(ticker, idMessageHash);
|
|
228432
228474
|
}
|
|
228433
228475
|
return message;
|
|
228434
228476
|
}
|
|
@@ -229828,6 +229870,8 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
229828
229870
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
229829
229871
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
229830
229872
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
229873
|
+
* @param {string} [params.bookSubscriptionType] The subscription type. Allowed values: SNAPSHOT full snapshot. This is the default if not specified. SNAPSHOT_AND_UPDATE delta updates
|
|
229874
|
+
* @param {int} [params.bookUpdateFrequency] Book update interval in ms. Allowed values: 100 for snapshot subscription 10 for delta subscription
|
|
229831
229875
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
229832
229876
|
*/
|
|
229833
229877
|
return await this.watchOrderBookForSymbols([symbol], limit, params);
|
|
@@ -229841,6 +229885,8 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
229841
229885
|
* @param {string[]} symbols unified array of symbols
|
|
229842
229886
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
229843
229887
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
229888
|
+
* @param {string} [params.bookSubscriptionType] The subscription type. Allowed values: SNAPSHOT full snapshot. This is the default if not specified. SNAPSHOT_AND_UPDATE delta updates
|
|
229889
|
+
* @param {int} [params.bookUpdateFrequency] Book update interval in ms. Allowed values: 100 for snapshot subscription 10 for delta subscription
|
|
229844
229890
|
* @returns {object} A dictionary of [order book structures]{@link https://docs.ccxt.com/#/?id=order-book-structure} indexed by market symbols
|
|
229845
229891
|
*/
|
|
229846
229892
|
await this.loadMarkets();
|
|
@@ -229848,12 +229894,26 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
229848
229894
|
const topics = [];
|
|
229849
229895
|
const messageHashes = [];
|
|
229850
229896
|
if (!limit) {
|
|
229851
|
-
limit =
|
|
229897
|
+
limit = 50;
|
|
229898
|
+
}
|
|
229899
|
+
const topicParams = this.safeValue(params, 'params');
|
|
229900
|
+
if (topicParams === undefined) {
|
|
229901
|
+
params['params'] = {};
|
|
229902
|
+
}
|
|
229903
|
+
let bookSubscriptionType = undefined;
|
|
229904
|
+
[bookSubscriptionType, params] = this.handleOptionAndParams2(params, 'watchOrderBook', 'watchOrderBookForSymbols', 'bookSubscriptionType', 'SNAPSHOT_AND_UPDATE');
|
|
229905
|
+
if (bookSubscriptionType !== undefined) {
|
|
229906
|
+
params['params']['bookSubscriptionType'] = bookSubscriptionType;
|
|
229907
|
+
}
|
|
229908
|
+
let bookUpdateFrequency = undefined;
|
|
229909
|
+
[bookUpdateFrequency, params] = this.handleOptionAndParams2(params, 'watchOrderBook', 'watchOrderBookForSymbols', 'bookUpdateFrequency');
|
|
229910
|
+
if (bookUpdateFrequency !== undefined) {
|
|
229911
|
+
params['params']['bookSubscriptionType'] = bookSubscriptionType;
|
|
229852
229912
|
}
|
|
229853
229913
|
for (let i = 0; i < symbols.length; i++) {
|
|
229854
229914
|
const symbol = symbols[i];
|
|
229855
229915
|
const market = this.market(symbol);
|
|
229856
|
-
const currentTopic = 'book' + '.' + market['id'] + '.' + limit;
|
|
229916
|
+
const currentTopic = 'book' + '.' + market['id'] + '.' + limit.toString();
|
|
229857
229917
|
const messageHash = 'orderbook:' + market['symbol'];
|
|
229858
229918
|
messageHashes.push(messageHash);
|
|
229859
229919
|
topics.push(currentTopic);
|
|
@@ -229861,27 +229921,72 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
229861
229921
|
const orderbook = await this.watchPublicMultiple(messageHashes, topics, params);
|
|
229862
229922
|
return orderbook.limit();
|
|
229863
229923
|
}
|
|
229864
|
-
|
|
229865
|
-
|
|
229924
|
+
handleDelta(bookside, delta) {
|
|
229925
|
+
const price = this.safeFloat(delta, 0);
|
|
229926
|
+
const amount = this.safeFloat(delta, 1);
|
|
229927
|
+
const count = this.safeInteger(delta, 2);
|
|
229928
|
+
bookside.store(price, amount, count);
|
|
229929
|
+
}
|
|
229930
|
+
handleDeltas(bookside, deltas) {
|
|
229931
|
+
for (let i = 0; i < deltas.length; i++) {
|
|
229932
|
+
this.handleDelta(bookside, deltas[i]);
|
|
229933
|
+
}
|
|
229934
|
+
}
|
|
229935
|
+
handleOrderBook(client, message) {
|
|
229866
229936
|
//
|
|
229867
|
-
//
|
|
229868
|
-
//
|
|
229869
|
-
//
|
|
229870
|
-
//
|
|
229871
|
-
//
|
|
229872
|
-
//
|
|
229873
|
-
//
|
|
229874
|
-
//
|
|
229875
|
-
//
|
|
229876
|
-
//
|
|
229877
|
-
//
|
|
229878
|
-
//
|
|
229879
|
-
//
|
|
229880
|
-
//
|
|
229881
|
-
//
|
|
229882
|
-
//
|
|
229883
|
-
//
|
|
229884
|
-
//
|
|
229937
|
+
// snapshot
|
|
229938
|
+
// {
|
|
229939
|
+
// "instrument_name":"LTC_USDT",
|
|
229940
|
+
// "subscription":"book.LTC_USDT.150",
|
|
229941
|
+
// "channel":"book",
|
|
229942
|
+
// "depth":150,
|
|
229943
|
+
// "data": [
|
|
229944
|
+
// {
|
|
229945
|
+
// "bids": [
|
|
229946
|
+
// [122.21, 0.74041, 4]
|
|
229947
|
+
// ],
|
|
229948
|
+
// "asks": [
|
|
229949
|
+
// [122.29, 0.00002, 1]
|
|
229950
|
+
// ]
|
|
229951
|
+
// "t": 1648123943803,
|
|
229952
|
+
// "s":754560122
|
|
229953
|
+
// }
|
|
229954
|
+
// ]
|
|
229955
|
+
// }
|
|
229956
|
+
// update
|
|
229957
|
+
// {
|
|
229958
|
+
// "instrument_name":"BTC_USDT",
|
|
229959
|
+
// "subscription":"book.BTC_USDT.50",
|
|
229960
|
+
// "channel":"book.update",
|
|
229961
|
+
// "depth":50,
|
|
229962
|
+
// "data":[
|
|
229963
|
+
// {
|
|
229964
|
+
// "update":{
|
|
229965
|
+
// "asks":[
|
|
229966
|
+
// [
|
|
229967
|
+
// "43755.46",
|
|
229968
|
+
// "0.10000",
|
|
229969
|
+
// "1"
|
|
229970
|
+
// ],
|
|
229971
|
+
// ...
|
|
229972
|
+
// ],
|
|
229973
|
+
// "bids":[
|
|
229974
|
+
// [
|
|
229975
|
+
// "43737.46",
|
|
229976
|
+
// "0.14096",
|
|
229977
|
+
// "1"
|
|
229978
|
+
// ],
|
|
229979
|
+
// ...
|
|
229980
|
+
// ]
|
|
229981
|
+
// },
|
|
229982
|
+
// "t":1704484068898,
|
|
229983
|
+
// "tt":1704484068892,
|
|
229984
|
+
// "u":78795598253024,
|
|
229985
|
+
// "pu":78795598162080,
|
|
229986
|
+
// "cs":-781431132
|
|
229987
|
+
// }
|
|
229988
|
+
// ]
|
|
229989
|
+
// }
|
|
229885
229990
|
//
|
|
229886
229991
|
const marketId = this.safeString(message, 'instrument_name');
|
|
229887
229992
|
const market = this.safeMarket(marketId);
|
|
@@ -229889,14 +229994,32 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
229889
229994
|
let data = this.safeValue(message, 'data');
|
|
229890
229995
|
data = this.safeValue(data, 0);
|
|
229891
229996
|
const timestamp = this.safeInteger(data, 't');
|
|
229892
|
-
const snapshot = this.parseOrderBook(data, symbol, timestamp);
|
|
229893
|
-
snapshot['nonce'] = this.safeInteger(data, 's');
|
|
229894
229997
|
let orderbook = this.safeValue(this.orderbooks, symbol);
|
|
229895
229998
|
if (orderbook === undefined) {
|
|
229896
229999
|
const limit = this.safeInteger(message, 'depth');
|
|
229897
|
-
orderbook = this.
|
|
230000
|
+
orderbook = this.countedOrderBook({}, limit);
|
|
229898
230001
|
}
|
|
229899
|
-
|
|
230002
|
+
const channel = this.safeString(message, 'channel');
|
|
230003
|
+
const nonce = this.safeInteger2(data, 'u', 's');
|
|
230004
|
+
let books = data;
|
|
230005
|
+
if (channel === 'book') { // snapshot
|
|
230006
|
+
orderbook.reset({});
|
|
230007
|
+
orderbook['symbol'] = symbol;
|
|
230008
|
+
orderbook['timestamp'] = timestamp;
|
|
230009
|
+
orderbook['datetime'] = this.iso8601(timestamp);
|
|
230010
|
+
orderbook['nonce'] = nonce;
|
|
230011
|
+
}
|
|
230012
|
+
else {
|
|
230013
|
+
books = this.safeValue(data, 'update', {});
|
|
230014
|
+
const previousNonce = this.safeInteger(data, 'pu');
|
|
230015
|
+
const currentNonce = orderbook['nonce'];
|
|
230016
|
+
if (currentNonce !== previousNonce) {
|
|
230017
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidNonce(this.id + ' watchOrderBook() ' + symbol + ' ' + previousNonce + ' != ' + nonce);
|
|
230018
|
+
}
|
|
230019
|
+
}
|
|
230020
|
+
this.handleDeltas(orderbook['asks'], this.safeValue(books, 'asks', []));
|
|
230021
|
+
this.handleDeltas(orderbook['bids'], this.safeValue(books, 'bids', []));
|
|
230022
|
+
orderbook['nonce'] = nonce;
|
|
229900
230023
|
this.orderbooks[symbol] = orderbook;
|
|
229901
230024
|
const messageHash = 'orderbook:' + symbol;
|
|
229902
230025
|
client.resolve(orderbook, messageHash);
|
|
@@ -230518,7 +230641,7 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
230518
230641
|
},
|
|
230519
230642
|
'nonce': id,
|
|
230520
230643
|
};
|
|
230521
|
-
const message = this.
|
|
230644
|
+
const message = this.deepExtend(request, params);
|
|
230522
230645
|
return await this.watchMultiple(url, messageHashes, message, messageHashes);
|
|
230523
230646
|
}
|
|
230524
230647
|
async watchPrivateRequest(nonce, params = {}) {
|
|
@@ -230585,7 +230708,8 @@ class cryptocom extends _cryptocom_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
230585
230708
|
'candlestick': this.handleOHLCV,
|
|
230586
230709
|
'ticker': this.handleTicker,
|
|
230587
230710
|
'trade': this.handleTrades,
|
|
230588
|
-
'book': this.
|
|
230711
|
+
'book': this.handleOrderBook,
|
|
230712
|
+
'book.update': this.handleOrderBook,
|
|
230589
230713
|
'user.order': this.handleOrders,
|
|
230590
230714
|
'user.trade': this.handleTrades,
|
|
230591
230715
|
'user.balance': this.handleBalance,
|
|
@@ -245872,9 +245996,9 @@ class luno extends _luno_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
245872
245996
|
storedOrderBook['nonce'] = nonce;
|
|
245873
245997
|
client.resolve(storedOrderBook, messageHash);
|
|
245874
245998
|
}
|
|
245875
|
-
customParseOrderBook(orderbook, symbol, timestamp = undefined, bidsKey = 'bids', asksKey = 'asks', priceKey = 'price', amountKey = 'volume',
|
|
245876
|
-
const bids = this.parseBidsAsks(this.safeValue(orderbook, bidsKey, []), priceKey, amountKey,
|
|
245877
|
-
const asks = this.parseBidsAsks(this.safeValue(orderbook, asksKey, []), priceKey, amountKey,
|
|
245999
|
+
customParseOrderBook(orderbook, symbol, timestamp = undefined, bidsKey = 'bids', asksKey = 'asks', priceKey = 'price', amountKey = 'volume', countOrIdKey = 2) {
|
|
246000
|
+
const bids = this.parseBidsAsks(this.safeValue(orderbook, bidsKey, []), priceKey, amountKey, countOrIdKey);
|
|
246001
|
+
const asks = this.parseBidsAsks(this.safeValue(orderbook, asksKey, []), priceKey, amountKey, countOrIdKey);
|
|
245878
246002
|
return {
|
|
245879
246003
|
'symbol': symbol,
|
|
245880
246004
|
'bids': this.sortBy(bids, 0, true),
|
|
@@ -245884,7 +246008,7 @@ class luno extends _luno_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
245884
246008
|
'nonce': undefined,
|
|
245885
246009
|
};
|
|
245886
246010
|
}
|
|
245887
|
-
parseBidsAsks(bidasks, priceKey = 'price', amountKey = 'volume', thirdKey =
|
|
246011
|
+
parseBidsAsks(bidasks, priceKey = 'price', amountKey = 'volume', thirdKey = 2) {
|
|
245888
246012
|
bidasks = this.toArray(bidasks);
|
|
245889
246013
|
const result = [];
|
|
245890
246014
|
for (let i = 0; i < bidasks.length; i++) {
|
|
@@ -245892,7 +246016,7 @@ class luno extends _luno_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
245892
246016
|
}
|
|
245893
246017
|
return result;
|
|
245894
246018
|
}
|
|
245895
|
-
customParseBidAsk(bidask, priceKey = 'price', amountKey = 'volume', thirdKey =
|
|
246019
|
+
customParseBidAsk(bidask, priceKey = 'price', amountKey = 'volume', thirdKey = 2) {
|
|
245896
246020
|
const price = this.safeNumber(bidask, priceKey);
|
|
245897
246021
|
const amount = this.safeNumber(bidask, amountKey);
|
|
245898
246022
|
const result = [price, amount];
|
|
@@ -292117,7 +292241,7 @@ SOFTWARE.
|
|
|
292117
292241
|
|
|
292118
292242
|
//-----------------------------------------------------------------------------
|
|
292119
292243
|
// this is updated by vss.js when building
|
|
292120
|
-
const version = '4.2.
|
|
292244
|
+
const version = '4.2.10';
|
|
292121
292245
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
292122
292246
|
//-----------------------------------------------------------------------------
|
|
292123
292247
|
|