ccxt 4.2.31__py2.py3-none-any.whl → 4.2.34__py2.py3-none-any.whl
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.
Potentially problematic release.
This version of ccxt might be problematic. Click here for more details.
- ccxt/__init__.py +1 -1
- ccxt/ace.py +4 -3
- ccxt/alpaca.py +1 -1
- ccxt/ascendex.py +6 -6
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ace.py +4 -3
- ccxt/async_support/alpaca.py +1 -1
- ccxt/async_support/ascendex.py +6 -6
- ccxt/async_support/base/exchange.py +62 -39
- ccxt/async_support/bigone.py +25 -5
- ccxt/async_support/binance.py +16 -15
- ccxt/async_support/bingx.py +10 -9
- ccxt/async_support/bit2c.py +13 -1
- ccxt/async_support/bitbank.py +2 -2
- ccxt/async_support/bitbns.py +1 -1
- ccxt/async_support/bitfinex.py +5 -5
- ccxt/async_support/bitfinex2.py +6 -6
- ccxt/async_support/bitflyer.py +5 -5
- ccxt/async_support/bitforex.py +1 -1
- ccxt/async_support/bitget.py +11 -11
- ccxt/async_support/bithumb.py +2 -2
- ccxt/async_support/bitmart.py +9 -9
- ccxt/async_support/bitmex.py +3 -3
- ccxt/async_support/bitopro.py +2 -2
- ccxt/async_support/bitrue.py +8 -8
- ccxt/async_support/bitso.py +4 -4
- ccxt/async_support/bitstamp.py +2 -2
- ccxt/async_support/bitteam.py +1 -1
- ccxt/async_support/bitvavo.py +3 -3
- ccxt/async_support/bl3p.py +1 -1
- ccxt/async_support/blockchaincom.py +3 -3
- ccxt/async_support/btcalpha.py +1 -1
- ccxt/async_support/btcbox.py +1 -1
- ccxt/async_support/btcmarkets.py +2 -2
- ccxt/async_support/btcturk.py +1 -1
- ccxt/async_support/bybit.py +9 -9
- ccxt/async_support/cex.py +1 -1
- ccxt/async_support/coinbase.py +6 -6
- ccxt/async_support/coinbasepro.py +2 -2
- ccxt/async_support/coincheck.py +1 -1
- ccxt/async_support/coinex.py +9 -9
- ccxt/async_support/coinlist.py +4 -4
- ccxt/async_support/coinmate.py +2 -2
- ccxt/async_support/coinmetro.py +2 -2
- ccxt/async_support/coinone.py +1 -1
- ccxt/async_support/coinsph.py +2 -2
- ccxt/async_support/coinspot.py +1 -1
- ccxt/async_support/cryptocom.py +14 -14
- ccxt/async_support/currencycom.py +1 -1
- ccxt/async_support/delta.py +2 -2
- ccxt/async_support/deribit.py +4 -4
- ccxt/async_support/digifinex.py +6 -6
- ccxt/async_support/exmo.py +2 -2
- ccxt/async_support/gate.py +41 -37
- ccxt/async_support/gemini.py +2 -2
- ccxt/async_support/hitbtc.py +5 -5
- ccxt/async_support/hollaex.py +2 -2
- ccxt/async_support/htx.py +10 -10
- ccxt/async_support/huobijp.py +4 -4
- ccxt/async_support/idex.py +2 -2
- ccxt/async_support/independentreserve.py +2 -2
- ccxt/async_support/indodax.py +2 -2
- ccxt/async_support/kraken.py +42 -4
- ccxt/async_support/krakenfutures.py +5 -5
- ccxt/async_support/kucoin.py +8 -8
- ccxt/async_support/kucoinfutures.py +4 -4
- ccxt/async_support/kuna.py +2 -2
- ccxt/async_support/latoken.py +3 -3
- ccxt/async_support/lbank.py +2 -2
- ccxt/async_support/luno.py +1 -1
- ccxt/async_support/lykke.py +2 -2
- ccxt/async_support/mercado.py +2 -2
- ccxt/async_support/mexc.py +7 -6
- ccxt/async_support/ndax.py +2 -2
- ccxt/async_support/novadax.py +4 -4
- ccxt/async_support/oceanex.py +1 -1
- ccxt/async_support/okcoin.py +5 -5
- ccxt/async_support/okx.py +11 -10
- ccxt/async_support/onetrading.py +2 -2
- ccxt/async_support/p2b.py +1 -1
- ccxt/async_support/paymium.py +3 -3
- ccxt/async_support/phemex.py +13 -13
- ccxt/async_support/poloniex.py +4 -4
- ccxt/async_support/poloniexfutures.py +1 -1
- ccxt/async_support/probit.py +5 -5
- ccxt/async_support/timex.py +1 -1
- ccxt/async_support/tokocrypto.py +4 -4
- ccxt/async_support/upbit.py +2 -2
- ccxt/async_support/wavesexchange.py +4 -3
- ccxt/async_support/wazirx.py +1 -1
- ccxt/async_support/whitebit.py +5 -5
- ccxt/async_support/woo.py +6 -6
- ccxt/async_support/yobit.py +41 -2
- ccxt/async_support/zaif.py +2 -2
- ccxt/async_support/zonda.py +4 -4
- ccxt/base/exchange.py +67 -40
- ccxt/base/types.py +10 -0
- ccxt/bigone.py +25 -5
- ccxt/binance.py +16 -15
- ccxt/bingx.py +10 -9
- ccxt/bit2c.py +13 -1
- ccxt/bitbank.py +2 -2
- ccxt/bitbns.py +1 -1
- ccxt/bitfinex.py +5 -5
- ccxt/bitfinex2.py +6 -6
- ccxt/bitflyer.py +5 -5
- ccxt/bitforex.py +1 -1
- ccxt/bitget.py +11 -11
- ccxt/bithumb.py +2 -2
- ccxt/bitmart.py +9 -9
- ccxt/bitmex.py +3 -3
- ccxt/bitopro.py +2 -2
- ccxt/bitrue.py +8 -8
- ccxt/bitso.py +4 -4
- ccxt/bitstamp.py +2 -2
- ccxt/bitteam.py +1 -1
- ccxt/bitvavo.py +3 -3
- ccxt/bl3p.py +1 -1
- ccxt/blockchaincom.py +3 -3
- ccxt/btcalpha.py +1 -1
- ccxt/btcbox.py +1 -1
- ccxt/btcmarkets.py +2 -2
- ccxt/btcturk.py +1 -1
- ccxt/bybit.py +9 -9
- ccxt/cex.py +1 -1
- ccxt/coinbase.py +6 -6
- ccxt/coinbasepro.py +2 -2
- ccxt/coincheck.py +1 -1
- ccxt/coinex.py +9 -9
- ccxt/coinlist.py +4 -4
- ccxt/coinmate.py +2 -2
- ccxt/coinmetro.py +2 -2
- ccxt/coinone.py +1 -1
- ccxt/coinsph.py +2 -2
- ccxt/coinspot.py +1 -1
- ccxt/cryptocom.py +14 -14
- ccxt/currencycom.py +1 -1
- ccxt/delta.py +2 -2
- ccxt/deribit.py +4 -4
- ccxt/digifinex.py +6 -6
- ccxt/exmo.py +2 -2
- ccxt/gate.py +41 -37
- ccxt/gemini.py +2 -2
- ccxt/hitbtc.py +5 -5
- ccxt/hollaex.py +2 -2
- ccxt/htx.py +10 -10
- ccxt/huobijp.py +4 -4
- ccxt/idex.py +2 -2
- ccxt/independentreserve.py +2 -2
- ccxt/indodax.py +2 -2
- ccxt/kraken.py +42 -4
- ccxt/krakenfutures.py +5 -5
- ccxt/kucoin.py +8 -8
- ccxt/kucoinfutures.py +4 -4
- ccxt/kuna.py +2 -2
- ccxt/latoken.py +3 -3
- ccxt/lbank.py +2 -2
- ccxt/luno.py +1 -1
- ccxt/lykke.py +2 -2
- ccxt/mercado.py +2 -2
- ccxt/mexc.py +7 -6
- ccxt/ndax.py +2 -2
- ccxt/novadax.py +4 -4
- ccxt/oceanex.py +1 -1
- ccxt/okcoin.py +5 -5
- ccxt/okx.py +11 -10
- ccxt/onetrading.py +2 -2
- ccxt/p2b.py +1 -1
- ccxt/paymium.py +3 -3
- ccxt/phemex.py +13 -13
- ccxt/poloniex.py +4 -4
- ccxt/poloniexfutures.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/alpaca.py +8 -4
- ccxt/pro/ascendex.py +1 -2
- ccxt/pro/binance.py +14 -10
- ccxt/pro/bingx.py +1 -1
- ccxt/pro/bitfinex.py +21 -22
- ccxt/pro/bitfinex2.py +13 -15
- ccxt/pro/bitget.py +3 -1
- ccxt/pro/bitmart.py +3 -7
- ccxt/pro/bitmex.py +4 -6
- ccxt/pro/bitopro.py +2 -4
- ccxt/pro/bitrue.py +1 -1
- ccxt/pro/bitstamp.py +2 -3
- ccxt/pro/bitvavo.py +10 -5
- ccxt/pro/blockchaincom.py +22 -22
- ccxt/pro/bybit.py +5 -5
- ccxt/pro/cex.py +7 -7
- ccxt/pro/coinbase.py +3 -2
- ccxt/pro/coinbasepro.py +1 -1
- ccxt/pro/coinex.py +15 -13
- ccxt/pro/currencycom.py +5 -6
- ccxt/pro/deribit.py +4 -4
- ccxt/pro/exmo.py +15 -13
- ccxt/pro/gate.py +1 -1
- ccxt/pro/gemini.py +4 -2
- ccxt/pro/hitbtc.py +10 -9
- ccxt/pro/hollaex.py +2 -2
- ccxt/pro/htx.py +6 -6
- ccxt/pro/huobijp.py +3 -4
- ccxt/pro/idex.py +1 -1
- ccxt/pro/independentreserve.py +14 -13
- ccxt/pro/kraken.py +10 -14
- ccxt/pro/krakenfutures.py +10 -6
- ccxt/pro/kucoin.py +10 -10
- ccxt/pro/kucoinfutures.py +11 -10
- ccxt/pro/lbank.py +10 -10
- ccxt/pro/luno.py +12 -14
- ccxt/pro/mexc.py +3 -2
- ccxt/pro/ndax.py +7 -11
- ccxt/pro/okcoin.py +7 -10
- ccxt/pro/okx.py +6 -9
- ccxt/pro/onetrading.py +16 -15
- ccxt/pro/p2b.py +5 -3
- ccxt/pro/phemex.py +16 -11
- ccxt/pro/poloniex.py +6 -4
- ccxt/pro/poloniexfutures.py +13 -9
- ccxt/pro/probit.py +15 -12
- ccxt/pro/upbit.py +8 -8
- ccxt/pro/wazirx.py +6 -3
- ccxt/pro/woo.py +9 -7
- ccxt/probit.py +5 -5
- ccxt/test/base/test_order_book.py +7 -7
- ccxt/test/base/test_shared_methods.py +1 -1
- ccxt/test/test_async.py +86 -36
- ccxt/test/test_sync.py +86 -36
- ccxt/timex.py +1 -1
- ccxt/tokocrypto.py +4 -4
- ccxt/upbit.py +2 -2
- ccxt/wavesexchange.py +4 -3
- ccxt/wazirx.py +1 -1
- ccxt/whitebit.py +5 -5
- ccxt/woo.py +6 -6
- ccxt/yobit.py +41 -2
- ccxt/zaif.py +2 -2
- ccxt/zonda.py +4 -4
- {ccxt-4.2.31.dist-info → ccxt-4.2.34.dist-info}/METADATA +9 -8
- ccxt-4.2.34.dist-info/RECORD +438 -0
- ccxt-4.2.31.dist-info/RECORD +0 -438
- {ccxt-4.2.31.dist-info → ccxt-4.2.34.dist-info}/WHEEL +0 -0
- {ccxt-4.2.31.dist-info → ccxt-4.2.34.dist-info}/top_level.txt +0 -0
ccxt/pro/coinbasepro.py
CHANGED
ccxt/pro/coinex.py
CHANGED
@@ -630,26 +630,26 @@ class coinex(ccxt.async_support.coinex):
|
|
630
630
|
#
|
631
631
|
params = self.safe_value(message, 'params', [])
|
632
632
|
fullOrderBook = self.safe_value(params, 0)
|
633
|
-
|
633
|
+
orderbook = self.safe_value(params, 1)
|
634
634
|
marketId = self.safe_string(params, 2)
|
635
635
|
defaultType = self.safe_string(self.options, 'defaultType')
|
636
636
|
market = self.safe_market(marketId, None, None, defaultType)
|
637
637
|
symbol = market['symbol']
|
638
638
|
name = 'orderbook'
|
639
639
|
messageHash = name + ':' + symbol
|
640
|
-
timestamp = self.safe_integer(
|
640
|
+
timestamp = self.safe_integer(orderbook, 'time')
|
641
641
|
currentOrderBook = self.safe_value(self.orderbooks, symbol)
|
642
642
|
if fullOrderBook:
|
643
|
-
snapshot = self.parse_order_book(
|
643
|
+
snapshot = self.parse_order_book(orderbook, symbol, timestamp)
|
644
644
|
if currentOrderBook is None:
|
645
|
-
|
646
|
-
self.orderbooks[symbol] =
|
645
|
+
orderbook = self.order_book(snapshot)
|
646
|
+
self.orderbooks[symbol] = orderbook
|
647
647
|
else:
|
648
|
-
|
649
|
-
|
648
|
+
orderbook = self.orderbooks[symbol]
|
649
|
+
orderbook.reset(snapshot)
|
650
650
|
else:
|
651
|
-
asks = self.safe_value(
|
652
|
-
bids = self.safe_value(
|
651
|
+
asks = self.safe_value(orderbook, 'asks', [])
|
652
|
+
bids = self.safe_value(orderbook, 'bids', [])
|
653
653
|
self.handle_deltas(currentOrderBook['asks'], asks)
|
654
654
|
self.handle_deltas(currentOrderBook['bids'], bids)
|
655
655
|
currentOrderBook['nonce'] = timestamp
|
@@ -962,8 +962,9 @@ class coinex(ccxt.async_support.coinex):
|
|
962
962
|
}
|
963
963
|
handler = self.safe_value(handlers, method)
|
964
964
|
if handler is not None:
|
965
|
-
|
966
|
-
|
965
|
+
handler(client, message)
|
966
|
+
return
|
967
|
+
self.handle_subscription_status(client, message)
|
967
968
|
|
968
969
|
def handle_authentication_message(self, client: Client, message):
|
969
970
|
#
|
@@ -987,13 +988,14 @@ class coinex(ccxt.async_support.coinex):
|
|
987
988
|
if subscription is not None:
|
988
989
|
futureIndex = self.safe_string(subscription, 'future')
|
989
990
|
if futureIndex == 'ohlcv':
|
990
|
-
|
991
|
+
self.handle_ohlcv(client, message)
|
992
|
+
return
|
991
993
|
future = self.safe_value(client.futures, futureIndex)
|
992
994
|
if future is not None:
|
993
995
|
future.resolve(True)
|
994
996
|
del client.subscriptions[id]
|
995
997
|
|
996
|
-
def authenticate(self, params={}):
|
998
|
+
async def authenticate(self, params={}):
|
997
999
|
type = None
|
998
1000
|
type, params = self.handle_market_type_and_params('authenticate', None, params)
|
999
1001
|
url = self.urls['api']['ws'][type]
|
ccxt/pro/currencycom.py
CHANGED
@@ -517,9 +517,10 @@ class currencycom(ccxt.async_support.currencycom):
|
|
517
517
|
}
|
518
518
|
method = self.safe_value(methods, subscriptionDestination)
|
519
519
|
if method is None:
|
520
|
-
return
|
520
|
+
return
|
521
521
|
else:
|
522
|
-
|
522
|
+
method(client, message, subscription)
|
523
|
+
return
|
523
524
|
destination = self.safe_string(message, 'destination')
|
524
525
|
if destination is not None:
|
525
526
|
methods = {
|
@@ -529,7 +530,5 @@ class currencycom(ccxt.async_support.currencycom):
|
|
529
530
|
'ping': self.handle_pong,
|
530
531
|
}
|
531
532
|
method = self.safe_value(methods, destination)
|
532
|
-
if method is None:
|
533
|
-
|
534
|
-
else:
|
535
|
-
return method(client, message)
|
533
|
+
if method is not None:
|
534
|
+
method(client, message)
|
ccxt/pro/deribit.py
CHANGED
@@ -728,13 +728,13 @@ class deribit(ccxt.async_support.deribit):
|
|
728
728
|
}
|
729
729
|
handler = self.safe_value(handlers, channelId)
|
730
730
|
if handler is not None:
|
731
|
-
|
731
|
+
handler(client, message)
|
732
|
+
return
|
732
733
|
raise NotSupported(self.id + ' no handler found for self message ' + self.json(message))
|
733
734
|
result = self.safe_value(message, 'result', {})
|
734
735
|
accessToken = self.safe_string(result, 'access_token')
|
735
736
|
if accessToken is not None:
|
736
|
-
|
737
|
-
return message
|
737
|
+
self.handle_authentication_message(client, message)
|
738
738
|
|
739
739
|
def handle_authentication_message(self, client: Client, message):
|
740
740
|
#
|
@@ -758,7 +758,7 @@ class deribit(ccxt.async_support.deribit):
|
|
758
758
|
client.resolve(message, messageHash)
|
759
759
|
return message
|
760
760
|
|
761
|
-
def authenticate(self, params={}):
|
761
|
+
async def authenticate(self, params={}):
|
762
762
|
url = self.urls['api']['ws']
|
763
763
|
client = self.client(url)
|
764
764
|
time = self.milliseconds()
|
ccxt/pro/exmo.py
CHANGED
@@ -495,22 +495,22 @@ class exmo(ccxt.async_support.exmo):
|
|
495
495
|
orderBook = self.safe_value(message, 'data', {})
|
496
496
|
messageHash = 'orderbook:' + symbol
|
497
497
|
timestamp = self.safe_integer(message, 'ts')
|
498
|
-
|
499
|
-
if
|
500
|
-
|
501
|
-
self.orderbooks[symbol] =
|
498
|
+
orderbook = self.safe_value(self.orderbooks, symbol)
|
499
|
+
if orderbook is None:
|
500
|
+
orderbook = self.order_book({})
|
501
|
+
self.orderbooks[symbol] = orderbook
|
502
502
|
event = self.safe_string(message, 'event')
|
503
503
|
if event == 'snapshot':
|
504
504
|
snapshot = self.parse_order_book(orderBook, symbol, timestamp, 'bid', 'ask')
|
505
|
-
|
505
|
+
orderbook.reset(snapshot)
|
506
506
|
else:
|
507
507
|
asks = self.safe_value(orderBook, 'ask', [])
|
508
508
|
bids = self.safe_value(orderBook, 'bid', [])
|
509
|
-
self.handle_deltas(
|
510
|
-
self.handle_deltas(
|
511
|
-
|
512
|
-
|
513
|
-
client.resolve(
|
509
|
+
self.handle_deltas(orderbook['asks'], asks)
|
510
|
+
self.handle_deltas(orderbook['bids'], bids)
|
511
|
+
orderbook['timestamp'] = timestamp
|
512
|
+
orderbook['datetime'] = self.iso8601(timestamp)
|
513
|
+
client.resolve(orderbook, messageHash)
|
514
514
|
|
515
515
|
def handle_delta(self, bookside, delta):
|
516
516
|
bidAsk = self.parse_bid_ask(delta, 0, 1)
|
@@ -544,7 +544,8 @@ class exmo(ccxt.async_support.exmo):
|
|
544
544
|
}
|
545
545
|
eventHandler = self.safe_value(events, event)
|
546
546
|
if eventHandler is not None:
|
547
|
-
|
547
|
+
eventHandler(client, message)
|
548
|
+
return
|
548
549
|
if (event == 'update') or (event == 'snapshot'):
|
549
550
|
topic = self.safe_string(message, 'topic')
|
550
551
|
if topic is not None:
|
@@ -565,7 +566,8 @@ class exmo(ccxt.async_support.exmo):
|
|
565
566
|
}
|
566
567
|
handler = self.safe_value(handlers, channel)
|
567
568
|
if handler is not None:
|
568
|
-
|
569
|
+
handler(client, message)
|
570
|
+
return
|
569
571
|
raise NotSupported(self.id + ' received an unsupported message: ' + self.json(message))
|
570
572
|
|
571
573
|
def handle_subscribed(self, client: Client, message):
|
@@ -603,7 +605,7 @@ class exmo(ccxt.async_support.exmo):
|
|
603
605
|
messageHash = 'authenticated'
|
604
606
|
client.resolve(message, messageHash)
|
605
607
|
|
606
|
-
def authenticate(self, params={}):
|
608
|
+
async def authenticate(self, params={}):
|
607
609
|
messageHash = 'authenticated'
|
608
610
|
type, query = self.handle_market_type_and_params('authenticate', None, params)
|
609
611
|
url = self.urls['api']['ws'][type]
|
ccxt/pro/gate.py
CHANGED
@@ -211,7 +211,7 @@ class gate(ccxt.async_support.gate):
|
|
211
211
|
# max limit is 100
|
212
212
|
subscription = client.subscriptions[messageHash]
|
213
213
|
limit = self.safe_integer(subscription, 'limit')
|
214
|
-
self.spawn(self.load_order_book, client, messageHash, symbol, limit)
|
214
|
+
self.spawn(self.load_order_book, client, messageHash, symbol, limit, {}) # needed for c#, number of args needs to match
|
215
215
|
storedOrderBook.cache.append(delta)
|
216
216
|
return
|
217
217
|
elif nonce >= deltaEnd:
|
ccxt/pro/gemini.py
CHANGED
@@ -568,7 +568,8 @@ class gemini(ccxt.async_support.gemini):
|
|
568
568
|
#
|
569
569
|
isArray = isinstance(message, list)
|
570
570
|
if isArray:
|
571
|
-
|
571
|
+
self.handle_order(client, message)
|
572
|
+
return
|
572
573
|
reason = self.safe_string(message, 'reason')
|
573
574
|
if reason == 'error':
|
574
575
|
self.handle_error(client, message)
|
@@ -580,7 +581,8 @@ class gemini(ccxt.async_support.gemini):
|
|
580
581
|
}
|
581
582
|
type = self.safe_string(message, 'type', '')
|
582
583
|
if type.find('candles') >= 0:
|
583
|
-
|
584
|
+
self.handle_ohlcv(client, message)
|
585
|
+
return
|
584
586
|
method = self.safe_value(methods, type)
|
585
587
|
if method is not None:
|
586
588
|
method(client, message)
|
ccxt/pro/hitbtc.py
CHANGED
@@ -121,7 +121,7 @@ class hitbtc(ccxt.async_support.hitbtc):
|
|
121
121
|
#
|
122
122
|
return future
|
123
123
|
|
124
|
-
async def subscribe_public(self, name: str, symbols: Strings = None, params={}):
|
124
|
+
async def subscribe_public(self, name: str, messageHashPrefix: str, symbols: Strings = None, params={}):
|
125
125
|
"""
|
126
126
|
* @ignore
|
127
127
|
:param str name: websocket endpoint name
|
@@ -130,7 +130,7 @@ class hitbtc(ccxt.async_support.hitbtc):
|
|
130
130
|
"""
|
131
131
|
await self.load_markets()
|
132
132
|
url = self.urls['api']['ws']['public']
|
133
|
-
messageHash =
|
133
|
+
messageHash = messageHashPrefix
|
134
134
|
if symbols is not None:
|
135
135
|
messageHash = messageHash + '::' + ','.join(symbols)
|
136
136
|
subscribe = {
|
@@ -215,7 +215,7 @@ class hitbtc(ccxt.async_support.hitbtc):
|
|
215
215
|
'symbols': [market['id']],
|
216
216
|
},
|
217
217
|
}
|
218
|
-
orderbook = await self.subscribe_public(name, [symbol], self.deep_extend(request, params))
|
218
|
+
orderbook = await self.subscribe_public(name, name, [symbol], self.deep_extend(request, params))
|
219
219
|
return orderbook.limit()
|
220
220
|
|
221
221
|
def handle_order_book(self, client: Client, message):
|
@@ -303,7 +303,7 @@ class hitbtc(ccxt.async_support.hitbtc):
|
|
303
303
|
'symbols': [market['id']],
|
304
304
|
},
|
305
305
|
}
|
306
|
-
result = await self.subscribe_public(name, [symbol], self.deep_extend(request, params))
|
306
|
+
result = await self.subscribe_public(name, 'ticker', [symbol], self.deep_extend(request, params))
|
307
307
|
return self.safe_value(result, symbol)
|
308
308
|
|
309
309
|
async def watch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
@@ -334,7 +334,7 @@ class hitbtc(ccxt.async_support.hitbtc):
|
|
334
334
|
'symbols': marketIds,
|
335
335
|
},
|
336
336
|
}
|
337
|
-
tickers = await self.subscribe_public(name, symbols, self.deep_extend(request, params))
|
337
|
+
tickers = await self.subscribe_public(name, 'tickers', symbols, self.deep_extend(request, params))
|
338
338
|
if self.newUpdates:
|
339
339
|
return tickers
|
340
340
|
return self.filter_by_array(self.tickers, 'symbol', symbols)
|
@@ -391,7 +391,7 @@ class hitbtc(ccxt.async_support.hitbtc):
|
|
391
391
|
newTickers[symbol] = ticker
|
392
392
|
messageHash = channel + '::' + symbol
|
393
393
|
client.resolve(newTickers, messageHash)
|
394
|
-
messageHashes = self.find_message_hashes(client,
|
394
|
+
messageHashes = self.find_message_hashes(client, 'tickers::')
|
395
395
|
for i in range(0, len(messageHashes)):
|
396
396
|
messageHash = messageHashes[i]
|
397
397
|
parts = messageHash.split('::')
|
@@ -479,7 +479,8 @@ class hitbtc(ccxt.async_support.hitbtc):
|
|
479
479
|
}
|
480
480
|
if limit is not None:
|
481
481
|
request['limit'] = limit
|
482
|
-
|
482
|
+
name = 'trades'
|
483
|
+
trades = await self.subscribe_public(name, name, [symbol], self.deep_extend(request, params))
|
483
484
|
if self.newUpdates:
|
484
485
|
limit = trades.getLimit(symbol, limit)
|
485
486
|
return self.filter_by_since_limit(trades, since, limit, 'timestamp')
|
@@ -600,7 +601,7 @@ class hitbtc(ccxt.async_support.hitbtc):
|
|
600
601
|
}
|
601
602
|
if limit is not None:
|
602
603
|
request['params']['limit'] = limit
|
603
|
-
ohlcv = await self.subscribe_public(name, [symbol], self.deep_extend(request, params))
|
604
|
+
ohlcv = await self.subscribe_public(name, name, [symbol], self.deep_extend(request, params))
|
604
605
|
if self.newUpdates:
|
605
606
|
limit = ohlcv.getLimit(symbol, limit)
|
606
607
|
return self.filter_by_since_limit(ohlcv, since, limit, 0)
|
@@ -940,7 +941,7 @@ class hitbtc(ccxt.async_support.hitbtc):
|
|
940
941
|
}
|
941
942
|
return await self.subscribe_private(name, None, self.extend(request, params))
|
942
943
|
|
943
|
-
async def create_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount, price=None, params={}) -> Order:
|
944
|
+
async def create_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: float = None, params={}) -> Order:
|
944
945
|
"""
|
945
946
|
create a trade order
|
946
947
|
:see: https://api.hitbtc.com/#create-new-spot-order
|
ccxt/pro/hollaex.py
CHANGED
@@ -213,7 +213,7 @@ class hollaex(ccxt.async_support.hollaex):
|
|
213
213
|
# when the user does not have any trades yet
|
214
214
|
dataLength = len(rawTrades)
|
215
215
|
if dataLength == 0:
|
216
|
-
return
|
216
|
+
return
|
217
217
|
if self.myTrades is None:
|
218
218
|
limit = self.safe_integer(self.options, 'tradesLimit', 1000)
|
219
219
|
self.myTrades = ArrayCache(limit)
|
@@ -319,7 +319,7 @@ class hollaex(ccxt.async_support.hollaex):
|
|
319
319
|
# usually the first message is an empty array
|
320
320
|
dataLength = len(data)
|
321
321
|
if dataLength == 0:
|
322
|
-
return
|
322
|
+
return
|
323
323
|
if self.orders is None:
|
324
324
|
limit = self.safe_integer(self.options, 'ordersLimit', 1000)
|
325
325
|
self.orders = ArrayCacheBySymbolById(limit)
|
ccxt/pro/htx.py
CHANGED
@@ -452,6 +452,7 @@ class htx(ccxt.async_support.htx):
|
|
452
452
|
except Exception as e:
|
453
453
|
del client.subscriptions[messageHash]
|
454
454
|
client.reject(e, messageHash)
|
455
|
+
return None
|
455
456
|
|
456
457
|
def handle_delta(self, bookside, delta):
|
457
458
|
price = self.safe_float(delta, 0)
|
@@ -1581,11 +1582,11 @@ class htx(ccxt.async_support.htx):
|
|
1581
1582
|
if subscription is not None:
|
1582
1583
|
method = self.safe_value(subscription, 'method')
|
1583
1584
|
if method is not None:
|
1584
|
-
|
1585
|
+
method(client, message, subscription)
|
1586
|
+
return
|
1585
1587
|
# clean up
|
1586
1588
|
if id in client.subscriptions:
|
1587
1589
|
del client.subscriptions[id]
|
1588
|
-
return message
|
1589
1590
|
|
1590
1591
|
def handle_system_status(self, client: Client, message):
|
1591
1592
|
#
|
@@ -1694,10 +1695,9 @@ class htx(ccxt.async_support.htx):
|
|
1694
1695
|
'kline': self.handle_ohlcv,
|
1695
1696
|
}
|
1696
1697
|
method = self.safe_value(methods, methodName)
|
1697
|
-
if method is None:
|
1698
|
-
|
1699
|
-
|
1700
|
-
return method(client, message)
|
1698
|
+
if method is not None:
|
1699
|
+
method(client, message)
|
1700
|
+
return
|
1701
1701
|
# private spot subjects
|
1702
1702
|
privateParts = ch.split('#')
|
1703
1703
|
privateType = self.safe_string(privateParts, 0, '')
|
ccxt/pro/huobijp.py
CHANGED
@@ -350,6 +350,7 @@ class huobijp(ccxt.async_support.huobijp):
|
|
350
350
|
except Exception as e:
|
351
351
|
del client.subscriptions[messageHash]
|
352
352
|
client.reject(e, messageHash)
|
353
|
+
return None
|
353
354
|
|
354
355
|
def handle_delta(self, bookside, delta):
|
355
356
|
price = self.safe_float(delta, 0)
|
@@ -507,10 +508,8 @@ class huobijp(ccxt.async_support.huobijp):
|
|
507
508
|
# ...
|
508
509
|
}
|
509
510
|
method = self.safe_value(methods, methodName)
|
510
|
-
if method is None:
|
511
|
-
|
512
|
-
else:
|
513
|
-
return method(client, message)
|
511
|
+
if method is not None:
|
512
|
+
method(client, message)
|
514
513
|
|
515
514
|
async def pong(self, client, message):
|
516
515
|
#
|
ccxt/pro/idex.py
CHANGED
@@ -319,7 +319,7 @@ class idex(ccxt.async_support.idex):
|
|
319
319
|
symbol = self.safe_symbol(marketId)
|
320
320
|
if not (symbol in self.orderbooks):
|
321
321
|
orderbook = self.counted_order_book({})
|
322
|
-
orderbook.cache = []
|
322
|
+
# orderbook.cache = [] # cache is never used?
|
323
323
|
self.orderbooks[symbol] = orderbook
|
324
324
|
self.spawn(self.fetch_order_book_snapshot, client, symbol)
|
325
325
|
break
|
ccxt/pro/independentreserve.py
CHANGED
@@ -181,25 +181,25 @@ class independentreserve(ccxt.async_support.independentreserve):
|
|
181
181
|
subscription = self.safe_value(client.subscriptions, messageHash, {})
|
182
182
|
receivedSnapshot = self.safe_bool(subscription, 'receivedSnapshot', False)
|
183
183
|
timestamp = self.safe_integer(message, 'Time')
|
184
|
-
|
185
|
-
if
|
186
|
-
|
187
|
-
self.orderbooks[symbol] =
|
184
|
+
orderbook = self.safe_value(self.orderbooks, symbol)
|
185
|
+
if orderbook is None:
|
186
|
+
orderbook = self.order_book({})
|
187
|
+
self.orderbooks[symbol] = orderbook
|
188
188
|
if event == 'OrderBookSnapshot':
|
189
189
|
snapshot = self.parse_order_book(orderBook, symbol, timestamp, 'Bids', 'Offers', 'Price', 'Volume')
|
190
|
-
|
190
|
+
orderbook.reset(snapshot)
|
191
191
|
subscription['receivedSnapshot'] = True
|
192
192
|
else:
|
193
193
|
asks = self.safe_value(orderBook, 'Offers', [])
|
194
194
|
bids = self.safe_value(orderBook, 'Bids', [])
|
195
|
-
self.handle_deltas(
|
196
|
-
self.handle_deltas(
|
197
|
-
|
198
|
-
|
195
|
+
self.handle_deltas(orderbook['asks'], asks)
|
196
|
+
self.handle_deltas(orderbook['bids'], bids)
|
197
|
+
orderbook['timestamp'] = timestamp
|
198
|
+
orderbook['datetime'] = self.iso8601(timestamp)
|
199
199
|
checksum = self.safe_value(self.options, 'checksum', True)
|
200
200
|
if checksum and receivedSnapshot:
|
201
|
-
storedAsks =
|
202
|
-
storedBids =
|
201
|
+
storedAsks = orderbook['asks']
|
202
|
+
storedBids = orderbook['bids']
|
203
203
|
asksLength = len(storedAsks)
|
204
204
|
bidsLength = len(storedBids)
|
205
205
|
payload = ''
|
@@ -215,7 +215,7 @@ class independentreserve(ccxt.async_support.independentreserve):
|
|
215
215
|
error = InvalidNonce(self.id + ' invalid checksum')
|
216
216
|
client.reject(error, messageHash)
|
217
217
|
if receivedSnapshot:
|
218
|
-
client.resolve(
|
218
|
+
client.resolve(orderbook, messageHash)
|
219
219
|
|
220
220
|
def value_to_checksum(self, value):
|
221
221
|
result = format(value, '.8f')
|
@@ -263,5 +263,6 @@ class independentreserve(ccxt.async_support.independentreserve):
|
|
263
263
|
}
|
264
264
|
handler = self.safe_value(handlers, event)
|
265
265
|
if handler is not None:
|
266
|
-
|
266
|
+
handler(client, message)
|
267
|
+
return
|
267
268
|
raise NotSupported(self.id + ' received an unsupported message: ' + self.json(message))
|
ccxt/pro/kraken.py
CHANGED
@@ -641,7 +641,7 @@ class kraken(ccxt.async_support.kraken):
|
|
641
641
|
side = sides[key]
|
642
642
|
bookside = orderbook[side]
|
643
643
|
deltas = self.safe_value(message[1], key, [])
|
644
|
-
timestamp = self.
|
644
|
+
timestamp = self.custom_handle_deltas(bookside, deltas, timestamp)
|
645
645
|
orderbook['symbol'] = symbol
|
646
646
|
orderbook['timestamp'] = timestamp
|
647
647
|
orderbook['datetime'] = self.iso8601(timestamp)
|
@@ -667,10 +667,10 @@ class kraken(ccxt.async_support.kraken):
|
|
667
667
|
storedBids = orderbook['bids']
|
668
668
|
example = None
|
669
669
|
if a is not None:
|
670
|
-
timestamp = self.
|
670
|
+
timestamp = self.custom_handle_deltas(storedAsks, a, timestamp)
|
671
671
|
example = self.safe_value(a, 0)
|
672
672
|
if b is not None:
|
673
|
-
timestamp = self.
|
673
|
+
timestamp = self.custom_handle_deltas(storedBids, b, timestamp)
|
674
674
|
example = self.safe_value(b, 0)
|
675
675
|
# don't remove self line or I will poop on your face
|
676
676
|
orderbook.limit()
|
@@ -715,7 +715,7 @@ class kraken(ccxt.async_support.kraken):
|
|
715
715
|
else:
|
716
716
|
return joined
|
717
717
|
|
718
|
-
def
|
718
|
+
def custom_handle_deltas(self, bookside, deltas, timestamp=None):
|
719
719
|
for j in range(0, len(deltas)):
|
720
720
|
delta = deltas[j]
|
721
721
|
price = self.parse_number(delta[0])
|
@@ -1222,7 +1222,7 @@ class kraken(ccxt.async_support.kraken):
|
|
1222
1222
|
# "subscription": {name: "ticker"}
|
1223
1223
|
# }
|
1224
1224
|
#
|
1225
|
-
errorMessage = self.
|
1225
|
+
errorMessage = self.safe_string(message, 'errorMessage')
|
1226
1226
|
if errorMessage is not None:
|
1227
1227
|
requestId = self.safe_value(message, 'reqid')
|
1228
1228
|
if requestId is not None:
|
@@ -1230,7 +1230,7 @@ class kraken(ccxt.async_support.kraken):
|
|
1230
1230
|
broadKey = self.find_broadly_matched_key(broad, errorMessage)
|
1231
1231
|
exception = None
|
1232
1232
|
if broadKey is None:
|
1233
|
-
exception = ExchangeError(errorMessage)
|
1233
|
+
exception = ExchangeError(errorMessage) # c# requirement to convert the errorMessage to string
|
1234
1234
|
else:
|
1235
1235
|
exception = broad[broadKey](errorMessage)
|
1236
1236
|
client.reject(exception, requestId)
|
@@ -1256,10 +1256,8 @@ class kraken(ccxt.async_support.kraken):
|
|
1256
1256
|
'ownTrades': self.handle_my_trades,
|
1257
1257
|
}
|
1258
1258
|
method = self.safe_value_2(methods, name, channelName)
|
1259
|
-
if method is None:
|
1260
|
-
|
1261
|
-
else:
|
1262
|
-
return method(client, message, subscription)
|
1259
|
+
if method is not None:
|
1260
|
+
method(client, message, subscription)
|
1263
1261
|
else:
|
1264
1262
|
if self.handle_error_message(client, message):
|
1265
1263
|
event = self.safe_string(message, 'event')
|
@@ -1273,7 +1271,5 @@ class kraken(ccxt.async_support.kraken):
|
|
1273
1271
|
'cancelAllStatus': self.handle_cancel_all_orders,
|
1274
1272
|
}
|
1275
1273
|
method = self.safe_value(methods, event)
|
1276
|
-
if method is None:
|
1277
|
-
|
1278
|
-
else:
|
1279
|
-
return method(client, message)
|
1274
|
+
if method is not None:
|
1275
|
+
method(client, message)
|
ccxt/pro/krakenfutures.py
CHANGED
@@ -1008,12 +1008,14 @@ class krakenfutures(ccxt.async_support.krakenfutures):
|
|
1008
1008
|
bid = bids[i]
|
1009
1009
|
price = self.safe_number(bid, 'price')
|
1010
1010
|
qty = self.safe_number(bid, 'qty')
|
1011
|
-
orderbook['bids']
|
1011
|
+
bidsSide = orderbook['bids']
|
1012
|
+
bidsSide.store(price, qty)
|
1012
1013
|
for i in range(0, len(asks)):
|
1013
1014
|
ask = asks[i]
|
1014
1015
|
price = self.safe_number(ask, 'price')
|
1015
1016
|
qty = self.safe_number(ask, 'qty')
|
1016
|
-
orderbook['asks']
|
1017
|
+
asksSide = orderbook['asks']
|
1018
|
+
asksSide.store(price, qty)
|
1017
1019
|
orderbook['timestamp'] = timestamp
|
1018
1020
|
orderbook['datetime'] = self.iso8601(timestamp)
|
1019
1021
|
orderbook['symbol'] = symbol
|
@@ -1041,9 +1043,11 @@ class krakenfutures(ccxt.async_support.krakenfutures):
|
|
1041
1043
|
qty = self.safe_number(message, 'qty')
|
1042
1044
|
timestamp = self.safe_integer(message, 'timestamp')
|
1043
1045
|
if side == 'sell':
|
1044
|
-
orderbook['asks']
|
1046
|
+
asks = orderbook['asks']
|
1047
|
+
asks.store(price, qty)
|
1045
1048
|
else:
|
1046
|
-
orderbook['bids']
|
1049
|
+
bids = orderbook['bids']
|
1050
|
+
bids.store(price, qty)
|
1047
1051
|
orderbook['timestamp'] = timestamp
|
1048
1052
|
orderbook['datetime'] = self.iso8601(timestamp)
|
1049
1053
|
client.resolve(orderbook, messageHash)
|
@@ -1366,7 +1370,7 @@ class krakenfutures(ccxt.async_support.krakenfutures):
|
|
1366
1370
|
if event == 'challenge':
|
1367
1371
|
self.handle_authenticate(client, message)
|
1368
1372
|
elif event == 'alert':
|
1369
|
-
|
1373
|
+
self.handle_error_message(client, message)
|
1370
1374
|
elif event == 'pong':
|
1371
1375
|
client.lastPong = self.milliseconds()
|
1372
1376
|
elif event is None:
|
@@ -1391,7 +1395,7 @@ class krakenfutures(ccxt.async_support.krakenfutures):
|
|
1391
1395
|
}
|
1392
1396
|
method = self.safe_value(methods, feed)
|
1393
1397
|
if method is not None:
|
1394
|
-
|
1398
|
+
method(client, message)
|
1395
1399
|
|
1396
1400
|
def handle_authenticate(self, client: Client, message):
|
1397
1401
|
"""
|
ccxt/pro/kucoin.py
CHANGED
@@ -54,18 +54,19 @@ class kucoin(ccxt.async_support.kucoin):
|
|
54
54
|
},
|
55
55
|
})
|
56
56
|
|
57
|
-
def negotiate(self, privateChannel, params={}):
|
57
|
+
async def negotiate(self, privateChannel, params={}):
|
58
58
|
connectId = 'private' if privateChannel else 'public'
|
59
59
|
urls = self.safe_value(self.options, 'urls', {})
|
60
60
|
spawaned = self.safe_value(urls, connectId)
|
61
61
|
if spawaned is not None:
|
62
|
-
return spawaned
|
62
|
+
return await spawaned
|
63
63
|
# we store an awaitable to the url
|
64
64
|
# so that multiple calls don't asynchronously
|
65
65
|
# fetch different urls and overwrite each other
|
66
66
|
urls[connectId] = self.spawn(self.negotiate_helper, privateChannel, params)
|
67
67
|
self.options['urls'] = urls
|
68
|
-
|
68
|
+
future = urls[connectId]
|
69
|
+
return await future
|
69
70
|
|
70
71
|
async def negotiate_helper(self, privateChannel, params={}):
|
71
72
|
response = None
|
@@ -511,7 +512,7 @@ class kucoin(ccxt.async_support.kucoin):
|
|
511
512
|
limit = self.safe_integer(subscription, 'limit')
|
512
513
|
snapshotDelay = self.handle_option('watchOrderBook', 'snapshotDelay', 5)
|
513
514
|
if cacheLength == snapshotDelay:
|
514
|
-
self.spawn(self.load_order_book, client, messageHash, symbol, limit)
|
515
|
+
self.spawn(self.load_order_book, client, messageHash, symbol, limit, {})
|
515
516
|
storedOrderBook.cache.append(data)
|
516
517
|
return
|
517
518
|
elif nonce >= deltaEnd:
|
@@ -924,7 +925,8 @@ class kucoin(ccxt.async_support.kucoin):
|
|
924
925
|
#
|
925
926
|
topic = self.safe_string(message, 'topic')
|
926
927
|
if topic == '/market/ticker:all':
|
927
|
-
|
928
|
+
self.handle_ticker(client, message)
|
929
|
+
return
|
928
930
|
subject = self.safe_string(message, 'subject')
|
929
931
|
methods = {
|
930
932
|
'trade.l2update': self.handle_order_book,
|
@@ -938,10 +940,8 @@ class kucoin(ccxt.async_support.kucoin):
|
|
938
940
|
'stopOrder': self.handle_order,
|
939
941
|
}
|
940
942
|
method = self.safe_value(methods, subject)
|
941
|
-
if method is None:
|
942
|
-
|
943
|
-
else:
|
944
|
-
return method(client, message)
|
943
|
+
if method is not None:
|
944
|
+
method(client, message)
|
945
945
|
|
946
946
|
def ping(self, client):
|
947
947
|
# kucoin does not support built-in ws protocol-level ping-pong
|
@@ -986,4 +986,4 @@ class kucoin(ccxt.async_support.kucoin):
|
|
986
986
|
}
|
987
987
|
method = self.safe_value(methods, type)
|
988
988
|
if method is not None:
|
989
|
-
|
989
|
+
method(client, message)
|