ccxt 4.2.30 → 4.2.34
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/.gitattributes +1 -0
- package/CONTRIBUTING.md +20 -1
- package/README.md +9 -9
- package/build.sh +9 -2
- package/cleanup.sh +3 -0
- package/dist/ccxt.browser.js +1136 -561
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +3 -2
- package/dist/cjs/src/ascendex.js +1 -1
- package/dist/cjs/src/base/Exchange.js +66 -24
- package/dist/cjs/src/bigone.js +21 -1
- package/dist/cjs/src/binance.js +6 -5
- package/dist/cjs/src/bingx.js +4 -3
- package/dist/cjs/src/bit2c.js +12 -0
- package/dist/cjs/src/bitfinex2.js +415 -41
- package/dist/cjs/src/bitforex.js +3 -0
- package/dist/cjs/src/bitget.js +3 -3
- package/dist/cjs/src/bitmart.js +1 -1
- package/dist/cjs/src/bitrue.js +3 -3
- package/dist/cjs/src/blockchaincom.js +1 -1
- package/dist/cjs/src/bybit.js +1 -1
- package/dist/cjs/src/coinbase.js +12 -2
- package/dist/cjs/src/coinex.js +1 -1
- package/dist/cjs/src/cryptocom.js +10 -10
- package/dist/cjs/src/deribit.js +1 -0
- package/dist/cjs/src/gate.js +34 -29
- package/dist/cjs/src/htx.js +1 -1
- package/dist/cjs/src/kraken.js +42 -1
- package/dist/cjs/src/krakenfutures.js +3 -0
- package/dist/cjs/src/kucoin.js +1 -1
- package/dist/cjs/src/lbank.js +27 -26
- package/dist/cjs/src/mexc.js +2 -1
- package/dist/cjs/src/okx.js +20 -5
- package/dist/cjs/src/phemex.js +8 -8
- package/dist/cjs/src/poloniexfutures.js +3 -0
- package/dist/cjs/src/pro/alpaca.js +8 -4
- package/dist/cjs/src/pro/ascendex.js +1 -2
- package/dist/cjs/src/pro/binance.js +14 -10
- package/dist/cjs/src/pro/bingx.js +1 -1
- package/dist/cjs/src/pro/bitfinex.js +21 -24
- package/dist/cjs/src/pro/bitfinex2.js +13 -17
- package/dist/cjs/src/pro/bitget.js +3 -1
- package/dist/cjs/src/pro/bitmart.js +3 -8
- package/dist/cjs/src/pro/bitmex.js +4 -7
- package/dist/cjs/src/pro/bitopro.js +2 -5
- package/dist/cjs/src/pro/bitrue.js +1 -1
- package/dist/cjs/src/pro/bitstamp.js +2 -3
- package/dist/cjs/src/pro/bitvavo.js +12 -5
- package/dist/cjs/src/pro/blockchaincom.js +22 -23
- package/dist/cjs/src/pro/bybit.js +5 -5
- package/dist/cjs/src/pro/cex.js +7 -7
- package/dist/cjs/src/pro/coinbase.js +3 -2
- package/dist/cjs/src/pro/coinbasepro.js +1 -1
- package/dist/cjs/src/pro/coinex.js +15 -13
- package/dist/cjs/src/pro/currencycom.js +5 -7
- package/dist/cjs/src/pro/deribit.js +4 -4
- package/dist/cjs/src/pro/exmo.js +15 -13
- package/dist/cjs/src/pro/gate.js +1 -1
- package/dist/cjs/src/pro/gemini.js +4 -2
- package/dist/cjs/src/pro/hitbtc.js +9 -8
- package/dist/cjs/src/pro/hollaex.js +2 -2
- package/dist/cjs/src/pro/htx.js +6 -7
- package/dist/cjs/src/pro/huobijp.js +3 -5
- package/dist/cjs/src/pro/idex.js +1 -1
- package/dist/cjs/src/pro/independentreserve.js +14 -13
- package/dist/cjs/src/pro/kraken.js +10 -16
- package/dist/cjs/src/pro/krakenfutures.js +10 -6
- package/dist/cjs/src/pro/kucoin.js +10 -11
- package/dist/cjs/src/pro/kucoinfutures.js +12 -11
- package/dist/cjs/src/pro/lbank.js +10 -10
- package/dist/cjs/src/pro/luno.js +12 -14
- package/dist/cjs/src/pro/mexc.js +3 -2
- package/dist/cjs/src/pro/ndax.js +7 -13
- package/dist/cjs/src/pro/okcoin.js +7 -12
- package/dist/cjs/src/pro/okx.js +6 -11
- package/dist/cjs/src/pro/onetrading.js +16 -15
- package/dist/cjs/src/pro/p2b.js +5 -3
- package/dist/cjs/src/pro/phemex.js +16 -11
- package/dist/cjs/src/pro/poloniex.js +6 -4
- package/dist/cjs/src/pro/poloniexfutures.js +14 -9
- package/dist/cjs/src/pro/probit.js +15 -11
- package/dist/cjs/src/pro/upbit.js +8 -8
- package/dist/cjs/src/pro/wazirx.js +6 -3
- package/dist/cjs/src/pro/woo.js +8 -6
- package/dist/cjs/src/probit.js +3 -3
- package/dist/cjs/src/timex.js +1 -1
- package/dist/cjs/src/tokocrypto.js +2 -2
- package/dist/cjs/src/wavesexchange.js +2 -1
- package/dist/cjs/src/whitebit.js +1 -1
- package/dist/cjs/src/woo.js +1 -1
- package/dist/cjs/src/yobit.js +39 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/coinbase.d.ts +10 -0
- package/js/src/abstract/okx.d.ts +12 -1
- package/js/src/ace.d.ts +1 -1
- package/js/src/ace.js +3 -2
- package/js/src/alpaca.d.ts +1 -1
- package/js/src/ascendex.d.ts +5 -15
- package/js/src/ascendex.js +1 -1
- package/js/src/base/Exchange.d.ts +88 -79
- package/js/src/base/Exchange.js +66 -24
- package/js/src/base/types.d.ts +90 -6
- package/js/src/bigone.d.ts +5 -15
- package/js/src/bigone.js +21 -1
- package/js/src/binance.d.ts +13 -23
- package/js/src/binance.js +6 -5
- package/js/src/bingx.d.ts +6 -16
- package/js/src/bingx.js +4 -3
- package/js/src/bit2c.d.ts +1 -1
- package/js/src/bit2c.js +12 -0
- package/js/src/bitbank.d.ts +2 -2
- package/js/src/bitbns.d.ts +1 -1
- package/js/src/bitfinex.d.ts +5 -5
- package/js/src/bitfinex2.d.ts +11 -16
- package/js/src/bitfinex2.js +415 -41
- package/js/src/bitflyer.d.ts +5 -5
- package/js/src/bitforex.d.ts +1 -1
- package/js/src/bitforex.js +3 -0
- package/js/src/bitget.d.ts +8 -38
- package/js/src/bitget.js +3 -3
- package/js/src/bithumb.d.ts +2 -2
- package/js/src/bitmart.d.ts +10 -21
- package/js/src/bitmart.js +1 -1
- package/js/src/bitmex.d.ts +3 -3
- package/js/src/bitopro.d.ts +2 -2
- package/js/src/bitrue.d.ts +5 -15
- package/js/src/bitrue.js +3 -3
- package/js/src/bitso.d.ts +4 -4
- package/js/src/bitstamp.d.ts +2 -2
- package/js/src/bitteam.d.ts +1 -1
- package/js/src/bitvavo.d.ts +3 -3
- package/js/src/bl3p.d.ts +1 -1
- package/js/src/blockchaincom.d.ts +2 -2
- package/js/src/blockchaincom.js +1 -1
- package/js/src/btcalpha.d.ts +1 -1
- package/js/src/btcbox.d.ts +1 -1
- package/js/src/btcmarkets.d.ts +3 -3
- package/js/src/btcturk.d.ts +1 -1
- package/js/src/bybit.d.ts +8 -8
- package/js/src/bybit.js +1 -1
- package/js/src/cex.d.ts +1 -1
- package/js/src/coinbase.d.ts +6 -50
- package/js/src/coinbase.js +12 -2
- package/js/src/coinbasepro.d.ts +2 -2
- package/js/src/coincheck.d.ts +1 -1
- package/js/src/coinex.d.ts +8 -8
- package/js/src/coinex.js +1 -1
- package/js/src/coinlist.d.ts +4 -14
- package/js/src/coinmate.d.ts +2 -2
- package/js/src/coinmetro.d.ts +2 -2
- package/js/src/coinone.d.ts +1 -1
- package/js/src/coinsph.d.ts +2 -2
- package/js/src/coinspot.d.ts +1 -1
- package/js/src/cryptocom.d.ts +4 -4
- package/js/src/cryptocom.js +10 -10
- package/js/src/currencycom.d.ts +2 -2
- package/js/src/delta.d.ts +2 -2
- package/js/src/deribit.d.ts +4 -14
- package/js/src/deribit.js +1 -0
- package/js/src/digifinex.d.ts +10 -38
- package/js/src/exmo.d.ts +2 -2
- package/js/src/gate.d.ts +8 -18
- package/js/src/gate.js +34 -29
- package/js/src/gemini.d.ts +2 -2
- package/js/src/hitbtc.d.ts +6 -16
- package/js/src/hollaex.d.ts +2 -2
- package/js/src/htx.d.ts +11 -21
- package/js/src/htx.js +1 -1
- package/js/src/huobijp.d.ts +4 -4
- package/js/src/idex.d.ts +3 -3
- package/js/src/independentreserve.d.ts +2 -2
- package/js/src/indodax.d.ts +2 -2
- package/js/src/kraken.d.ts +5 -5
- package/js/src/kraken.js +42 -1
- package/js/src/krakenfutures.d.ts +7 -7
- package/js/src/krakenfutures.js +3 -0
- package/js/src/kucoin.d.ts +8 -29
- package/js/src/kucoin.js +1 -1
- package/js/src/kucoinfutures.d.ts +4 -4
- package/js/src/kuna.d.ts +2 -2
- package/js/src/latoken.d.ts +4 -14
- package/js/src/lbank.d.ts +3 -6
- package/js/src/lbank.js +27 -26
- package/js/src/luno.d.ts +1 -1
- package/js/src/lykke.d.ts +2 -2
- package/js/src/mercado.d.ts +2 -2
- package/js/src/mexc.d.ts +6 -6
- package/js/src/mexc.js +2 -1
- package/js/src/ndax.d.ts +2 -2
- package/js/src/novadax.d.ts +4 -15
- package/js/src/oceanex.d.ts +1 -1
- package/js/src/okcoin.d.ts +5 -15
- package/js/src/okx.d.ts +8 -18
- package/js/src/okx.js +20 -5
- package/js/src/onetrading.d.ts +2 -2
- package/js/src/p2b.d.ts +1 -1
- package/js/src/paymium.d.ts +3 -13
- package/js/src/phemex.d.ts +5 -5
- package/js/src/phemex.js +8 -8
- package/js/src/poloniex.d.ts +4 -14
- package/js/src/poloniexfutures.d.ts +1 -1
- package/js/src/poloniexfutures.js +3 -0
- package/js/src/pro/alpaca.d.ts +2 -2
- package/js/src/pro/alpaca.js +8 -4
- package/js/src/pro/ascendex.d.ts +2 -2
- package/js/src/pro/ascendex.js +1 -2
- package/js/src/pro/binance.d.ts +3 -3
- package/js/src/pro/binance.js +14 -10
- package/js/src/pro/bingx.d.ts +1 -1
- package/js/src/pro/bingx.js +1 -1
- package/js/src/pro/bitfinex.d.ts +2 -2
- package/js/src/pro/bitfinex.js +21 -24
- package/js/src/pro/bitfinex2.d.ts +2 -2
- package/js/src/pro/bitfinex2.js +13 -17
- package/js/src/pro/bitget.js +3 -1
- package/js/src/pro/bitmart.d.ts +3 -3
- package/js/src/pro/bitmart.js +3 -8
- package/js/src/pro/bitmex.d.ts +1 -1
- package/js/src/pro/bitmex.js +4 -7
- package/js/src/pro/bitopro.d.ts +1 -1
- package/js/src/pro/bitopro.js +2 -5
- package/js/src/pro/bitrue.js +1 -1
- package/js/src/pro/bitstamp.d.ts +1 -1
- package/js/src/pro/bitstamp.js +2 -3
- package/js/src/pro/bitvavo.d.ts +3 -3
- package/js/src/pro/bitvavo.js +12 -5
- package/js/src/pro/blockchaincom.d.ts +8 -8
- package/js/src/pro/blockchaincom.js +22 -23
- package/js/src/pro/bybit.d.ts +2 -2
- package/js/src/pro/bybit.js +5 -5
- package/js/src/pro/cex.d.ts +1 -1
- package/js/src/pro/cex.js +7 -7
- package/js/src/pro/coinbase.d.ts +1 -1
- package/js/src/pro/coinbase.js +3 -2
- package/js/src/pro/coinbasepro.d.ts +1 -1
- package/js/src/pro/coinbasepro.js +1 -1
- package/js/src/pro/coinex.d.ts +2 -2
- package/js/src/pro/coinex.js +15 -13
- package/js/src/pro/currencycom.d.ts +1 -1
- package/js/src/pro/currencycom.js +5 -7
- package/js/src/pro/deribit.d.ts +2 -2
- package/js/src/pro/deribit.js +4 -4
- package/js/src/pro/exmo.d.ts +2 -2
- package/js/src/pro/exmo.js +15 -13
- package/js/src/pro/gate.js +1 -1
- package/js/src/pro/gemini.d.ts +1 -1
- package/js/src/pro/gemini.js +4 -2
- package/js/src/pro/hitbtc.d.ts +2 -2
- package/js/src/pro/hitbtc.js +9 -8
- package/js/src/pro/hollaex.d.ts +2 -2
- package/js/src/pro/hollaex.js +2 -2
- package/js/src/pro/htx.d.ts +2 -2
- package/js/src/pro/htx.js +6 -7
- package/js/src/pro/huobijp.d.ts +1 -1
- package/js/src/pro/huobijp.js +3 -5
- package/js/src/pro/idex.js +1 -1
- package/js/src/pro/independentreserve.d.ts +1 -1
- package/js/src/pro/independentreserve.js +14 -13
- package/js/src/pro/kraken.d.ts +2 -2
- package/js/src/pro/kraken.js +10 -16
- package/js/src/pro/krakenfutures.d.ts +1 -1
- package/js/src/pro/krakenfutures.js +10 -6
- package/js/src/pro/kucoin.d.ts +3 -3
- package/js/src/pro/kucoin.js +10 -11
- package/js/src/pro/kucoinfutures.d.ts +3 -3
- package/js/src/pro/kucoinfutures.js +12 -11
- package/js/src/pro/lbank.d.ts +1 -1
- package/js/src/pro/lbank.js +10 -10
- package/js/src/pro/luno.d.ts +2 -2
- package/js/src/pro/luno.js +12 -14
- package/js/src/pro/mexc.d.ts +2 -2
- package/js/src/pro/mexc.js +3 -2
- package/js/src/pro/ndax.d.ts +3 -3
- package/js/src/pro/ndax.js +7 -13
- package/js/src/pro/okcoin.d.ts +1 -1
- package/js/src/pro/okcoin.js +7 -12
- package/js/src/pro/okx.d.ts +1 -1
- package/js/src/pro/okx.js +6 -11
- package/js/src/pro/onetrading.d.ts +1 -1
- package/js/src/pro/onetrading.js +16 -15
- package/js/src/pro/p2b.d.ts +1 -1
- package/js/src/pro/p2b.js +5 -3
- package/js/src/pro/phemex.d.ts +3 -3
- package/js/src/pro/phemex.js +16 -11
- package/js/src/pro/poloniex.d.ts +1 -1
- package/js/src/pro/poloniex.js +6 -4
- package/js/src/pro/poloniexfutures.d.ts +4 -4
- package/js/src/pro/poloniexfutures.js +13 -10
- package/js/src/pro/probit.d.ts +1 -1
- package/js/src/pro/probit.js +14 -12
- package/js/src/pro/upbit.js +8 -8
- package/js/src/pro/wazirx.d.ts +1 -1
- package/js/src/pro/wazirx.js +6 -3
- package/js/src/pro/woo.d.ts +3 -3
- package/js/src/pro/woo.js +8 -6
- package/js/src/probit.d.ts +3 -3
- package/js/src/probit.js +3 -3
- package/js/src/timex.d.ts +1 -1
- package/js/src/timex.js +1 -1
- package/js/src/tokocrypto.d.ts +3 -3
- package/js/src/tokocrypto.js +2 -2
- package/js/src/upbit.d.ts +2 -2
- package/js/src/wavesexchange.d.ts +3 -4
- package/js/src/wavesexchange.js +2 -1
- package/js/src/wazirx.d.ts +1 -1
- package/js/src/whitebit.d.ts +5 -15
- package/js/src/whitebit.js +1 -1
- package/js/src/woo.d.ts +5 -15
- package/js/src/woo.js +1 -1
- package/js/src/yobit.d.ts +21 -6
- package/js/src/yobit.js +39 -0
- package/js/src/zaif.d.ts +2 -2
- package/js/src/zonda.d.ts +4 -14
- package/package.json +22 -8
- package/skip-tests.json +9 -1
- package/tests-manager.sh +1 -2
package/dist/cjs/src/pro/exmo.js
CHANGED
|
@@ -512,25 +512,25 @@ class exmo extends exmo$1 {
|
|
|
512
512
|
const orderBook = this.safeValue(message, 'data', {});
|
|
513
513
|
const messageHash = 'orderbook:' + symbol;
|
|
514
514
|
const timestamp = this.safeInteger(message, 'ts');
|
|
515
|
-
let
|
|
516
|
-
if (
|
|
517
|
-
|
|
518
|
-
this.orderbooks[symbol] =
|
|
515
|
+
let orderbook = this.safeValue(this.orderbooks, symbol);
|
|
516
|
+
if (orderbook === undefined) {
|
|
517
|
+
orderbook = this.orderBook({});
|
|
518
|
+
this.orderbooks[symbol] = orderbook;
|
|
519
519
|
}
|
|
520
520
|
const event = this.safeString(message, 'event');
|
|
521
521
|
if (event === 'snapshot') {
|
|
522
522
|
const snapshot = this.parseOrderBook(orderBook, symbol, timestamp, 'bid', 'ask');
|
|
523
|
-
|
|
523
|
+
orderbook.reset(snapshot);
|
|
524
524
|
}
|
|
525
525
|
else {
|
|
526
526
|
const asks = this.safeValue(orderBook, 'ask', []);
|
|
527
527
|
const bids = this.safeValue(orderBook, 'bid', []);
|
|
528
|
-
this.handleDeltas(
|
|
529
|
-
this.handleDeltas(
|
|
530
|
-
|
|
531
|
-
|
|
528
|
+
this.handleDeltas(orderbook['asks'], asks);
|
|
529
|
+
this.handleDeltas(orderbook['bids'], bids);
|
|
530
|
+
orderbook['timestamp'] = timestamp;
|
|
531
|
+
orderbook['datetime'] = this.iso8601(timestamp);
|
|
532
532
|
}
|
|
533
|
-
client.resolve(
|
|
533
|
+
client.resolve(orderbook, messageHash);
|
|
534
534
|
}
|
|
535
535
|
handleDelta(bookside, delta) {
|
|
536
536
|
const bidAsk = this.parseBidAsk(delta, 0, 1);
|
|
@@ -565,7 +565,8 @@ class exmo extends exmo$1 {
|
|
|
565
565
|
};
|
|
566
566
|
const eventHandler = this.safeValue(events, event);
|
|
567
567
|
if (eventHandler !== undefined) {
|
|
568
|
-
|
|
568
|
+
eventHandler.call(this, client, message);
|
|
569
|
+
return;
|
|
569
570
|
}
|
|
570
571
|
if ((event === 'update') || (event === 'snapshot')) {
|
|
571
572
|
const topic = this.safeString(message, 'topic');
|
|
@@ -587,7 +588,8 @@ class exmo extends exmo$1 {
|
|
|
587
588
|
};
|
|
588
589
|
const handler = this.safeValue(handlers, channel);
|
|
589
590
|
if (handler !== undefined) {
|
|
590
|
-
|
|
591
|
+
handler.call(this, client, message);
|
|
592
|
+
return;
|
|
591
593
|
}
|
|
592
594
|
}
|
|
593
595
|
}
|
|
@@ -628,7 +630,7 @@ class exmo extends exmo$1 {
|
|
|
628
630
|
const messageHash = 'authenticated';
|
|
629
631
|
client.resolve(message, messageHash);
|
|
630
632
|
}
|
|
631
|
-
authenticate(params = {}) {
|
|
633
|
+
async authenticate(params = {}) {
|
|
632
634
|
const messageHash = 'authenticated';
|
|
633
635
|
const [type, query] = this.handleMarketTypeAndParams('authenticate', undefined, params);
|
|
634
636
|
const url = this.urls['api']['ws'][type];
|
package/dist/cjs/src/pro/gate.js
CHANGED
|
@@ -207,7 +207,7 @@ class gate extends gate$1 {
|
|
|
207
207
|
// max limit is 100
|
|
208
208
|
const subscription = client.subscriptions[messageHash];
|
|
209
209
|
const limit = this.safeInteger(subscription, 'limit');
|
|
210
|
-
this.spawn(this.loadOrderBook, client, messageHash, symbol, limit);
|
|
210
|
+
this.spawn(this.loadOrderBook, client, messageHash, symbol, limit, {}); // needed for c#, number of args needs to match
|
|
211
211
|
}
|
|
212
212
|
storedOrderBook.cache.push(delta);
|
|
213
213
|
return;
|
|
@@ -588,7 +588,8 @@ class gemini extends gemini$1 {
|
|
|
588
588
|
//
|
|
589
589
|
const isArray = Array.isArray(message);
|
|
590
590
|
if (isArray) {
|
|
591
|
-
|
|
591
|
+
this.handleOrder(client, message);
|
|
592
|
+
return;
|
|
592
593
|
}
|
|
593
594
|
const reason = this.safeString(message, 'reason');
|
|
594
595
|
if (reason === 'error') {
|
|
@@ -602,7 +603,8 @@ class gemini extends gemini$1 {
|
|
|
602
603
|
};
|
|
603
604
|
const type = this.safeString(message, 'type', '');
|
|
604
605
|
if (type.indexOf('candles') >= 0) {
|
|
605
|
-
|
|
606
|
+
this.handleOHLCV(client, message);
|
|
607
|
+
return;
|
|
606
608
|
}
|
|
607
609
|
const method = this.safeValue(methods, type);
|
|
608
610
|
if (method !== undefined) {
|
|
@@ -115,7 +115,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
115
115
|
}
|
|
116
116
|
return future;
|
|
117
117
|
}
|
|
118
|
-
async subscribePublic(name, symbols = undefined, params = {}) {
|
|
118
|
+
async subscribePublic(name, messageHashPrefix, symbols = undefined, params = {}) {
|
|
119
119
|
/**
|
|
120
120
|
* @ignore
|
|
121
121
|
* @method
|
|
@@ -125,7 +125,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
125
125
|
*/
|
|
126
126
|
await this.loadMarkets();
|
|
127
127
|
const url = this.urls['api']['ws']['public'];
|
|
128
|
-
let messageHash =
|
|
128
|
+
let messageHash = messageHashPrefix;
|
|
129
129
|
if (symbols !== undefined) {
|
|
130
130
|
messageHash = messageHash + '::' + symbols.join(',');
|
|
131
131
|
}
|
|
@@ -220,7 +220,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
220
220
|
'symbols': [market['id']],
|
|
221
221
|
},
|
|
222
222
|
};
|
|
223
|
-
const orderbook = await this.subscribePublic(name, [symbol], this.deepExtend(request, params));
|
|
223
|
+
const orderbook = await this.subscribePublic(name, name, [symbol], this.deepExtend(request, params));
|
|
224
224
|
return orderbook.limit();
|
|
225
225
|
}
|
|
226
226
|
handleOrderBook(client, message) {
|
|
@@ -313,7 +313,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
313
313
|
'symbols': [market['id']],
|
|
314
314
|
},
|
|
315
315
|
};
|
|
316
|
-
const result = await this.subscribePublic(name, [symbol], this.deepExtend(request, params));
|
|
316
|
+
const result = await this.subscribePublic(name, 'ticker', [symbol], this.deepExtend(request, params));
|
|
317
317
|
return this.safeValue(result, symbol);
|
|
318
318
|
}
|
|
319
319
|
async watchTickers(symbols = undefined, params = {}) {
|
|
@@ -349,7 +349,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
349
349
|
'symbols': marketIds,
|
|
350
350
|
},
|
|
351
351
|
};
|
|
352
|
-
const tickers = await this.subscribePublic(name, symbols, this.deepExtend(request, params));
|
|
352
|
+
const tickers = await this.subscribePublic(name, 'tickers', symbols, this.deepExtend(request, params));
|
|
353
353
|
if (this.newUpdates) {
|
|
354
354
|
return tickers;
|
|
355
355
|
}
|
|
@@ -408,7 +408,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
408
408
|
const messageHash = channel + '::' + symbol;
|
|
409
409
|
client.resolve(newTickers, messageHash);
|
|
410
410
|
}
|
|
411
|
-
const messageHashes = this.findMessageHashes(client,
|
|
411
|
+
const messageHashes = this.findMessageHashes(client, 'tickers::');
|
|
412
412
|
for (let i = 0; i < messageHashes.length; i++) {
|
|
413
413
|
const messageHash = messageHashes[i];
|
|
414
414
|
const parts = messageHash.split('::');
|
|
@@ -501,7 +501,8 @@ class hitbtc extends hitbtc$1 {
|
|
|
501
501
|
if (limit !== undefined) {
|
|
502
502
|
request['limit'] = limit;
|
|
503
503
|
}
|
|
504
|
-
const
|
|
504
|
+
const name = 'trades';
|
|
505
|
+
const trades = await this.subscribePublic(name, name, [symbol], this.deepExtend(request, params));
|
|
505
506
|
if (this.newUpdates) {
|
|
506
507
|
limit = trades.getLimit(symbol, limit);
|
|
507
508
|
}
|
|
@@ -630,7 +631,7 @@ class hitbtc extends hitbtc$1 {
|
|
|
630
631
|
if (limit !== undefined) {
|
|
631
632
|
request['params']['limit'] = limit;
|
|
632
633
|
}
|
|
633
|
-
const ohlcv = await this.subscribePublic(name, [symbol], this.deepExtend(request, params));
|
|
634
|
+
const ohlcv = await this.subscribePublic(name, name, [symbol], this.deepExtend(request, params));
|
|
634
635
|
if (this.newUpdates) {
|
|
635
636
|
limit = ohlcv.getLimit(symbol, limit);
|
|
636
637
|
}
|
|
@@ -218,7 +218,7 @@ class hollaex extends hollaex$1 {
|
|
|
218
218
|
// when the user does not have any trades yet
|
|
219
219
|
const dataLength = rawTrades.length;
|
|
220
220
|
if (dataLength === 0) {
|
|
221
|
-
return
|
|
221
|
+
return;
|
|
222
222
|
}
|
|
223
223
|
if (this.myTrades === undefined) {
|
|
224
224
|
const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
|
|
@@ -332,7 +332,7 @@ class hollaex extends hollaex$1 {
|
|
|
332
332
|
// usually the first message is an empty array
|
|
333
333
|
const dataLength = data.length;
|
|
334
334
|
if (dataLength === 0) {
|
|
335
|
-
return
|
|
335
|
+
return;
|
|
336
336
|
}
|
|
337
337
|
if (this.orders === undefined) {
|
|
338
338
|
const limit = this.safeInteger(this.options, 'ordersLimit', 1000);
|
package/dist/cjs/src/pro/htx.js
CHANGED
|
@@ -469,6 +469,7 @@ class htx extends htx$1 {
|
|
|
469
469
|
delete client.subscriptions[messageHash];
|
|
470
470
|
client.reject(e, messageHash);
|
|
471
471
|
}
|
|
472
|
+
return undefined;
|
|
472
473
|
}
|
|
473
474
|
handleDelta(bookside, delta) {
|
|
474
475
|
const price = this.safeFloat(delta, 0);
|
|
@@ -1689,14 +1690,14 @@ class htx extends htx$1 {
|
|
|
1689
1690
|
if (subscription !== undefined) {
|
|
1690
1691
|
const method = this.safeValue(subscription, 'method');
|
|
1691
1692
|
if (method !== undefined) {
|
|
1692
|
-
|
|
1693
|
+
method.call(this, client, message, subscription);
|
|
1694
|
+
return;
|
|
1693
1695
|
}
|
|
1694
1696
|
// clean up
|
|
1695
1697
|
if (id in client.subscriptions) {
|
|
1696
1698
|
delete client.subscriptions[id];
|
|
1697
1699
|
}
|
|
1698
1700
|
}
|
|
1699
|
-
return message;
|
|
1700
1701
|
}
|
|
1701
1702
|
handleSystemStatus(client, message) {
|
|
1702
1703
|
//
|
|
@@ -1805,11 +1806,9 @@ class htx extends htx$1 {
|
|
|
1805
1806
|
'kline': this.handleOHLCV,
|
|
1806
1807
|
};
|
|
1807
1808
|
const method = this.safeValue(methods, methodName);
|
|
1808
|
-
if (method
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
else {
|
|
1812
|
-
return method.call(this, client, message);
|
|
1809
|
+
if (method !== undefined) {
|
|
1810
|
+
method.call(this, client, message);
|
|
1811
|
+
return;
|
|
1813
1812
|
}
|
|
1814
1813
|
}
|
|
1815
1814
|
// private spot subjects
|
|
@@ -361,6 +361,7 @@ class huobijp extends huobijp$1 {
|
|
|
361
361
|
delete client.subscriptions[messageHash];
|
|
362
362
|
client.reject(e, messageHash);
|
|
363
363
|
}
|
|
364
|
+
return undefined;
|
|
364
365
|
}
|
|
365
366
|
handleDelta(bookside, delta) {
|
|
366
367
|
const price = this.safeFloat(delta, 0);
|
|
@@ -526,11 +527,8 @@ class huobijp extends huobijp$1 {
|
|
|
526
527
|
// ...
|
|
527
528
|
};
|
|
528
529
|
const method = this.safeValue(methods, methodName);
|
|
529
|
-
if (method
|
|
530
|
-
|
|
531
|
-
}
|
|
532
|
-
else {
|
|
533
|
-
return method.call(this, client, message);
|
|
530
|
+
if (method !== undefined) {
|
|
531
|
+
method.call(this, client, message);
|
|
534
532
|
}
|
|
535
533
|
}
|
|
536
534
|
}
|
package/dist/cjs/src/pro/idex.js
CHANGED
|
@@ -324,7 +324,7 @@ class idex extends idex$1 {
|
|
|
324
324
|
const symbol = this.safeSymbol(marketId);
|
|
325
325
|
if (!(symbol in this.orderbooks)) {
|
|
326
326
|
const orderbook = this.countedOrderBook({});
|
|
327
|
-
orderbook.cache = [];
|
|
327
|
+
// orderbook.cache = []; // cache is never used?
|
|
328
328
|
this.orderbooks[symbol] = orderbook;
|
|
329
329
|
}
|
|
330
330
|
this.spawn(this.fetchOrderBookSnapshot, client, symbol);
|
|
@@ -178,28 +178,28 @@ class independentreserve extends independentreserve$1 {
|
|
|
178
178
|
const subscription = this.safeValue(client.subscriptions, messageHash, {});
|
|
179
179
|
const receivedSnapshot = this.safeBool(subscription, 'receivedSnapshot', false);
|
|
180
180
|
const timestamp = this.safeInteger(message, 'Time');
|
|
181
|
-
let
|
|
182
|
-
if (
|
|
183
|
-
|
|
184
|
-
this.orderbooks[symbol] =
|
|
181
|
+
let orderbook = this.safeValue(this.orderbooks, symbol);
|
|
182
|
+
if (orderbook === undefined) {
|
|
183
|
+
orderbook = this.orderBook({});
|
|
184
|
+
this.orderbooks[symbol] = orderbook;
|
|
185
185
|
}
|
|
186
186
|
if (event === 'OrderBookSnapshot') {
|
|
187
187
|
const snapshot = this.parseOrderBook(orderBook, symbol, timestamp, 'Bids', 'Offers', 'Price', 'Volume');
|
|
188
|
-
|
|
188
|
+
orderbook.reset(snapshot);
|
|
189
189
|
subscription['receivedSnapshot'] = true;
|
|
190
190
|
}
|
|
191
191
|
else {
|
|
192
192
|
const asks = this.safeValue(orderBook, 'Offers', []);
|
|
193
193
|
const bids = this.safeValue(orderBook, 'Bids', []);
|
|
194
|
-
this.handleDeltas(
|
|
195
|
-
this.handleDeltas(
|
|
196
|
-
|
|
197
|
-
|
|
194
|
+
this.handleDeltas(orderbook['asks'], asks);
|
|
195
|
+
this.handleDeltas(orderbook['bids'], bids);
|
|
196
|
+
orderbook['timestamp'] = timestamp;
|
|
197
|
+
orderbook['datetime'] = this.iso8601(timestamp);
|
|
198
198
|
}
|
|
199
199
|
const checksum = this.safeValue(this.options, 'checksum', true);
|
|
200
200
|
if (checksum && receivedSnapshot) {
|
|
201
|
-
const storedAsks =
|
|
202
|
-
const storedBids =
|
|
201
|
+
const storedAsks = orderbook['asks'];
|
|
202
|
+
const storedBids = orderbook['bids'];
|
|
203
203
|
const asksLength = storedAsks.length;
|
|
204
204
|
const bidsLength = storedBids.length;
|
|
205
205
|
let payload = '';
|
|
@@ -221,7 +221,7 @@ class independentreserve extends independentreserve$1 {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
if (receivedSnapshot) {
|
|
224
|
-
client.resolve(
|
|
224
|
+
client.resolve(orderbook, messageHash);
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
valueToChecksum(value) {
|
|
@@ -271,7 +271,8 @@ class independentreserve extends independentreserve$1 {
|
|
|
271
271
|
};
|
|
272
272
|
const handler = this.safeValue(handlers, event);
|
|
273
273
|
if (handler !== undefined) {
|
|
274
|
-
|
|
274
|
+
handler.call(this, client, message);
|
|
275
|
+
return;
|
|
275
276
|
}
|
|
276
277
|
throw new errors.NotSupported(this.id + ' received an unsupported message: ' + this.json(message));
|
|
277
278
|
}
|
|
@@ -656,7 +656,7 @@ class kraken extends kraken$1 {
|
|
|
656
656
|
const side = sides[key];
|
|
657
657
|
const bookside = orderbook[side];
|
|
658
658
|
const deltas = this.safeValue(message[1], key, []);
|
|
659
|
-
timestamp = this.
|
|
659
|
+
timestamp = this.customHandleDeltas(bookside, deltas, timestamp);
|
|
660
660
|
}
|
|
661
661
|
orderbook['symbol'] = symbol;
|
|
662
662
|
orderbook['timestamp'] = timestamp;
|
|
@@ -688,11 +688,11 @@ class kraken extends kraken$1 {
|
|
|
688
688
|
const storedBids = orderbook['bids'];
|
|
689
689
|
let example = undefined;
|
|
690
690
|
if (a !== undefined) {
|
|
691
|
-
timestamp = this.
|
|
691
|
+
timestamp = this.customHandleDeltas(storedAsks, a, timestamp);
|
|
692
692
|
example = this.safeValue(a, 0);
|
|
693
693
|
}
|
|
694
694
|
if (b !== undefined) {
|
|
695
|
-
timestamp = this.
|
|
695
|
+
timestamp = this.customHandleDeltas(storedBids, b, timestamp);
|
|
696
696
|
example = this.safeValue(b, 0);
|
|
697
697
|
}
|
|
698
698
|
// don't remove this line or I will poop on your face
|
|
@@ -747,7 +747,7 @@ class kraken extends kraken$1 {
|
|
|
747
747
|
return joined;
|
|
748
748
|
}
|
|
749
749
|
}
|
|
750
|
-
|
|
750
|
+
customHandleDeltas(bookside, deltas, timestamp = undefined) {
|
|
751
751
|
for (let j = 0; j < deltas.length; j++) {
|
|
752
752
|
const delta = deltas[j];
|
|
753
753
|
const price = this.parseNumber(delta[0]);
|
|
@@ -1292,7 +1292,7 @@ class kraken extends kraken$1 {
|
|
|
1292
1292
|
// "subscription": { name: "ticker" }
|
|
1293
1293
|
// }
|
|
1294
1294
|
//
|
|
1295
|
-
const errorMessage = this.
|
|
1295
|
+
const errorMessage = this.safeString(message, 'errorMessage');
|
|
1296
1296
|
if (errorMessage !== undefined) {
|
|
1297
1297
|
const requestId = this.safeValue(message, 'reqid');
|
|
1298
1298
|
if (requestId !== undefined) {
|
|
@@ -1300,7 +1300,7 @@ class kraken extends kraken$1 {
|
|
|
1300
1300
|
const broadKey = this.findBroadlyMatchedKey(broad, errorMessage);
|
|
1301
1301
|
let exception = undefined;
|
|
1302
1302
|
if (broadKey === undefined) {
|
|
1303
|
-
exception = new errors.ExchangeError(errorMessage);
|
|
1303
|
+
exception = new errors.ExchangeError(errorMessage); // c# requirement to convert the errorMessage to string
|
|
1304
1304
|
}
|
|
1305
1305
|
else {
|
|
1306
1306
|
exception = new broad[broadKey](errorMessage);
|
|
@@ -1330,11 +1330,8 @@ class kraken extends kraken$1 {
|
|
|
1330
1330
|
'ownTrades': this.handleMyTrades,
|
|
1331
1331
|
};
|
|
1332
1332
|
const method = this.safeValue2(methods, name, channelName);
|
|
1333
|
-
if (method
|
|
1334
|
-
|
|
1335
|
-
}
|
|
1336
|
-
else {
|
|
1337
|
-
return method.call(this, client, message, subscription);
|
|
1333
|
+
if (method !== undefined) {
|
|
1334
|
+
method.call(this, client, message, subscription);
|
|
1338
1335
|
}
|
|
1339
1336
|
}
|
|
1340
1337
|
else {
|
|
@@ -1350,11 +1347,8 @@ class kraken extends kraken$1 {
|
|
|
1350
1347
|
'cancelAllStatus': this.handleCancelAllOrders,
|
|
1351
1348
|
};
|
|
1352
1349
|
const method = this.safeValue(methods, event);
|
|
1353
|
-
if (method
|
|
1354
|
-
|
|
1355
|
-
}
|
|
1356
|
-
else {
|
|
1357
|
-
return method.call(this, client, message);
|
|
1350
|
+
if (method !== undefined) {
|
|
1351
|
+
method.call(this, client, message);
|
|
1358
1352
|
}
|
|
1359
1353
|
}
|
|
1360
1354
|
}
|
|
@@ -1064,13 +1064,15 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
1064
1064
|
const bid = bids[i];
|
|
1065
1065
|
const price = this.safeNumber(bid, 'price');
|
|
1066
1066
|
const qty = this.safeNumber(bid, 'qty');
|
|
1067
|
-
orderbook['bids']
|
|
1067
|
+
const bidsSide = orderbook['bids'];
|
|
1068
|
+
bidsSide.store(price, qty);
|
|
1068
1069
|
}
|
|
1069
1070
|
for (let i = 0; i < asks.length; i++) {
|
|
1070
1071
|
const ask = asks[i];
|
|
1071
1072
|
const price = this.safeNumber(ask, 'price');
|
|
1072
1073
|
const qty = this.safeNumber(ask, 'qty');
|
|
1073
|
-
orderbook['asks']
|
|
1074
|
+
const asksSide = orderbook['asks'];
|
|
1075
|
+
asksSide.store(price, qty);
|
|
1074
1076
|
}
|
|
1075
1077
|
orderbook['timestamp'] = timestamp;
|
|
1076
1078
|
orderbook['datetime'] = this.iso8601(timestamp);
|
|
@@ -1099,10 +1101,12 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
1099
1101
|
const qty = this.safeNumber(message, 'qty');
|
|
1100
1102
|
const timestamp = this.safeInteger(message, 'timestamp');
|
|
1101
1103
|
if (side === 'sell') {
|
|
1102
|
-
orderbook['asks']
|
|
1104
|
+
const asks = orderbook['asks'];
|
|
1105
|
+
asks.store(price, qty);
|
|
1103
1106
|
}
|
|
1104
1107
|
else {
|
|
1105
|
-
orderbook['bids']
|
|
1108
|
+
const bids = orderbook['bids'];
|
|
1109
|
+
bids.store(price, qty);
|
|
1106
1110
|
}
|
|
1107
1111
|
orderbook['timestamp'] = timestamp;
|
|
1108
1112
|
orderbook['datetime'] = this.iso8601(timestamp);
|
|
@@ -1438,7 +1442,7 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
1438
1442
|
this.handleAuthenticate(client, message);
|
|
1439
1443
|
}
|
|
1440
1444
|
else if (event === 'alert') {
|
|
1441
|
-
|
|
1445
|
+
this.handleErrorMessage(client, message);
|
|
1442
1446
|
}
|
|
1443
1447
|
else if (event === 'pong') {
|
|
1444
1448
|
client.lastPong = this.milliseconds();
|
|
@@ -1465,7 +1469,7 @@ class krakenfutures extends krakenfutures$1 {
|
|
|
1465
1469
|
};
|
|
1466
1470
|
const method = this.safeValue(methods, feed);
|
|
1467
1471
|
if (method !== undefined) {
|
|
1468
|
-
|
|
1472
|
+
method.call(this, client, message);
|
|
1469
1473
|
}
|
|
1470
1474
|
}
|
|
1471
1475
|
}
|
|
@@ -47,19 +47,20 @@ class kucoin extends kucoin$1 {
|
|
|
47
47
|
},
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
|
-
negotiate(privateChannel, params = {}) {
|
|
50
|
+
async negotiate(privateChannel, params = {}) {
|
|
51
51
|
const connectId = privateChannel ? 'private' : 'public';
|
|
52
52
|
const urls = this.safeValue(this.options, 'urls', {});
|
|
53
53
|
const spawaned = this.safeValue(urls, connectId);
|
|
54
54
|
if (spawaned !== undefined) {
|
|
55
|
-
return spawaned;
|
|
55
|
+
return await spawaned;
|
|
56
56
|
}
|
|
57
57
|
// we store an awaitable to the url
|
|
58
58
|
// so that multiple calls don't asynchronously
|
|
59
59
|
// fetch different urls and overwrite each other
|
|
60
60
|
urls[connectId] = this.spawn(this.negotiateHelper, privateChannel, params);
|
|
61
61
|
this.options['urls'] = urls;
|
|
62
|
-
|
|
62
|
+
const future = urls[connectId];
|
|
63
|
+
return await future;
|
|
63
64
|
}
|
|
64
65
|
async negotiateHelper(privateChannel, params = {}) {
|
|
65
66
|
let response = undefined;
|
|
@@ -545,7 +546,7 @@ class kucoin extends kucoin$1 {
|
|
|
545
546
|
const limit = this.safeInteger(subscription, 'limit');
|
|
546
547
|
const snapshotDelay = this.handleOption('watchOrderBook', 'snapshotDelay', 5);
|
|
547
548
|
if (cacheLength === snapshotDelay) {
|
|
548
|
-
this.spawn(this.loadOrderBook, client, messageHash, symbol, limit);
|
|
549
|
+
this.spawn(this.loadOrderBook, client, messageHash, symbol, limit, {});
|
|
549
550
|
}
|
|
550
551
|
storedOrderBook.cache.push(data);
|
|
551
552
|
return;
|
|
@@ -987,7 +988,8 @@ class kucoin extends kucoin$1 {
|
|
|
987
988
|
//
|
|
988
989
|
const topic = this.safeString(message, 'topic');
|
|
989
990
|
if (topic === '/market/ticker:all') {
|
|
990
|
-
|
|
991
|
+
this.handleTicker(client, message);
|
|
992
|
+
return;
|
|
991
993
|
}
|
|
992
994
|
const subject = this.safeString(message, 'subject');
|
|
993
995
|
const methods = {
|
|
@@ -1002,11 +1004,8 @@ class kucoin extends kucoin$1 {
|
|
|
1002
1004
|
'stopOrder': this.handleOrder,
|
|
1003
1005
|
};
|
|
1004
1006
|
const method = this.safeValue(methods, subject);
|
|
1005
|
-
if (method
|
|
1006
|
-
|
|
1007
|
-
}
|
|
1008
|
-
else {
|
|
1009
|
-
return method.call(this, client, message);
|
|
1007
|
+
if (method !== undefined) {
|
|
1008
|
+
method.call(this, client, message);
|
|
1010
1009
|
}
|
|
1011
1010
|
}
|
|
1012
1011
|
ping(client) {
|
|
@@ -1054,7 +1053,7 @@ class kucoin extends kucoin$1 {
|
|
|
1054
1053
|
};
|
|
1055
1054
|
const method = this.safeValue(methods, type);
|
|
1056
1055
|
if (method !== undefined) {
|
|
1057
|
-
|
|
1056
|
+
method.call(this, client, message);
|
|
1058
1057
|
}
|
|
1059
1058
|
}
|
|
1060
1059
|
}
|
|
@@ -57,19 +57,20 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
57
57
|
},
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
negotiate(privateChannel, params = {}) {
|
|
60
|
+
async negotiate(privateChannel, params = {}) {
|
|
61
61
|
const connectId = privateChannel ? 'private' : 'public';
|
|
62
62
|
const urls = this.safeValue(this.options, 'urls', {});
|
|
63
63
|
const spawaned = this.safeValue(urls, connectId);
|
|
64
64
|
if (spawaned !== undefined) {
|
|
65
|
-
return spawaned;
|
|
65
|
+
return await spawaned;
|
|
66
66
|
}
|
|
67
67
|
// we store an awaitable to the url
|
|
68
68
|
// so that multiple calls don't asynchronously
|
|
69
69
|
// fetch different urls and overwrite each other
|
|
70
|
-
urls[connectId] = this.spawn(this.negotiateHelper, privateChannel, params);
|
|
70
|
+
urls[connectId] = this.spawn(this.negotiateHelper, privateChannel, params); // we have to wait here otherwsie in c# will not work
|
|
71
71
|
this.options['urls'] = urls;
|
|
72
|
-
|
|
72
|
+
const future = urls[connectId];
|
|
73
|
+
return await future;
|
|
73
74
|
}
|
|
74
75
|
async negotiateHelper(privateChannel, params = {}) {
|
|
75
76
|
let response = undefined;
|
|
@@ -582,6 +583,9 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
582
583
|
const messageHash = 'orderbook:' + symbol;
|
|
583
584
|
const storedOrderBook = this.safeValue(this.orderbooks, symbol);
|
|
584
585
|
const nonce = this.safeInteger(storedOrderBook, 'nonce');
|
|
586
|
+
if (storedOrderBook === undefined) {
|
|
587
|
+
return; // this shouldn't be needed, but for some reason sometimes this runs before handleOrderBookSubscription in c#
|
|
588
|
+
}
|
|
585
589
|
const deltaEnd = this.safeInteger(data, 'sequence');
|
|
586
590
|
if (nonce === undefined) {
|
|
587
591
|
const cacheLength = storedOrderBook.cache.length;
|
|
@@ -600,7 +604,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
600
604
|
const limit = this.safeInteger(subscription, 'limit');
|
|
601
605
|
const snapshotDelay = this.handleOption('watchOrderBook', 'snapshotDelay', 5);
|
|
602
606
|
if (cacheLength === snapshotDelay) {
|
|
603
|
-
this.spawn(this.loadOrderBook, client, messageHash, symbol, limit);
|
|
607
|
+
this.spawn(this.loadOrderBook, client, messageHash, symbol, limit, {});
|
|
604
608
|
}
|
|
605
609
|
storedOrderBook.cache.push(data);
|
|
606
610
|
return;
|
|
@@ -928,11 +932,8 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
928
932
|
'position.adjustRiskLimit': this.handlePosition,
|
|
929
933
|
};
|
|
930
934
|
const method = this.safeValue(methods, subject);
|
|
931
|
-
if (method
|
|
932
|
-
|
|
933
|
-
}
|
|
934
|
-
else {
|
|
935
|
-
return method.call(this, client, message);
|
|
935
|
+
if (method !== undefined) {
|
|
936
|
+
method.call(this, client, message);
|
|
936
937
|
}
|
|
937
938
|
}
|
|
938
939
|
ping(client) {
|
|
@@ -981,7 +982,7 @@ class kucoinfutures extends kucoinfutures$1 {
|
|
|
981
982
|
};
|
|
982
983
|
const method = this.safeValue(methods, type);
|
|
983
984
|
if (method !== undefined) {
|
|
984
|
-
|
|
985
|
+
method.call(this, client, message);
|
|
985
986
|
}
|
|
986
987
|
}
|
|
987
988
|
}
|
|
@@ -776,17 +776,17 @@ class lbank extends lbank$1 {
|
|
|
776
776
|
const orderBook = this.safeValue(message, 'depth', message);
|
|
777
777
|
const datetime = this.safeString(message, 'TS');
|
|
778
778
|
const timestamp = this.parse8601(datetime);
|
|
779
|
-
let
|
|
780
|
-
if (
|
|
781
|
-
|
|
782
|
-
this.orderbooks[symbol] =
|
|
779
|
+
let orderbook = this.safeValue(this.orderbooks, symbol);
|
|
780
|
+
if (orderbook === undefined) {
|
|
781
|
+
orderbook = this.orderBook({});
|
|
782
|
+
this.orderbooks[symbol] = orderbook;
|
|
783
783
|
}
|
|
784
784
|
const snapshot = this.parseOrderBook(orderBook, symbol, timestamp, 'bids', 'asks');
|
|
785
|
-
|
|
785
|
+
orderbook.reset(snapshot);
|
|
786
786
|
let messageHash = 'orderbook:' + symbol;
|
|
787
|
-
client.resolve(
|
|
787
|
+
client.resolve(orderbook, messageHash);
|
|
788
788
|
messageHash = 'fetchOrderbook:' + symbol;
|
|
789
|
-
client.resolve(
|
|
789
|
+
client.resolve(orderbook, messageHash);
|
|
790
790
|
}
|
|
791
791
|
handleErrorMessage(client, message) {
|
|
792
792
|
//
|
|
@@ -814,7 +814,8 @@ class lbank extends lbank$1 {
|
|
|
814
814
|
handleMessage(client, message) {
|
|
815
815
|
const status = this.safeString(message, 'status');
|
|
816
816
|
if (status === 'error') {
|
|
817
|
-
|
|
817
|
+
this.handleErrorMessage(client, message);
|
|
818
|
+
return;
|
|
818
819
|
}
|
|
819
820
|
const type = this.safeString2(message, 'type', 'action');
|
|
820
821
|
if (type === 'ping') {
|
|
@@ -830,9 +831,8 @@ class lbank extends lbank$1 {
|
|
|
830
831
|
};
|
|
831
832
|
const handler = this.safeValue(handlers, type);
|
|
832
833
|
if (handler !== undefined) {
|
|
833
|
-
|
|
834
|
+
handler.call(this, client, message);
|
|
834
835
|
}
|
|
835
|
-
return message;
|
|
836
836
|
}
|
|
837
837
|
async authenticate(params = {}) {
|
|
838
838
|
// when we implement more private streams, we need to refactor the authentication
|