ccxt 4.2.30__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/abstract/coinbase.py +10 -0
- ccxt/abstract/okx.py +12 -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 +17 -16
- 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 +386 -40
- ccxt/async_support/bitflyer.py +5 -5
- ccxt/async_support/bitforex.py +4 -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 +16 -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 +5 -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 +11 -11
- 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 +45 -5
- ccxt/async_support/krakenfutures.py +8 -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 +5 -4
- 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 +26 -12
- 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 +4 -1
- ccxt/async_support/probit.py +5 -5
- ccxt/async_support/timex.py +2 -2
- 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 +6 -6
- 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 +77 -44
- ccxt/base/types.py +10 -0
- ccxt/bigone.py +25 -5
- ccxt/binance.py +17 -16
- 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 +386 -40
- ccxt/bitflyer.py +5 -5
- ccxt/bitforex.py +4 -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 +16 -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 +5 -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 +11 -11
- ccxt/huobijp.py +4 -4
- ccxt/idex.py +2 -2
- ccxt/independentreserve.py +2 -2
- ccxt/indodax.py +2 -2
- ccxt/kraken.py +45 -5
- ccxt/krakenfutures.py +8 -5
- ccxt/kucoin.py +8 -8
- ccxt/kucoinfutures.py +4 -4
- ccxt/kuna.py +2 -2
- ccxt/latoken.py +3 -3
- ccxt/lbank.py +5 -4
- 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 +26 -12
- 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 +4 -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 +2 -2
- ccxt/tokocrypto.py +4 -4
- ccxt/upbit.py +2 -2
- ccxt/wavesexchange.py +4 -3
- ccxt/wazirx.py +1 -1
- ccxt/whitebit.py +6 -6
- ccxt/woo.py +6 -6
- ccxt/yobit.py +41 -2
- ccxt/zaif.py +2 -2
- ccxt/zonda.py +4 -4
- {ccxt-4.2.30.dist-info → ccxt-4.2.34.dist-info}/METADATA +10 -10
- ccxt-4.2.34.dist-info/RECORD +438 -0
- ccxt-4.2.30.dist-info/RECORD +0 -438
- {ccxt-4.2.30.dist-info → ccxt-4.2.34.dist-info}/WHEEL +0 -0
- {ccxt-4.2.30.dist-info → ccxt-4.2.34.dist-info}/top_level.txt +0 -0
ccxt/pro/blockchaincom.py
CHANGED
@@ -107,7 +107,7 @@ class blockchaincom(ccxt.async_support.blockchaincom):
|
|
107
107
|
#
|
108
108
|
event = self.safe_string(message, 'event')
|
109
109
|
if event == 'subscribed':
|
110
|
-
return
|
110
|
+
return
|
111
111
|
result = {'info': message}
|
112
112
|
balances = self.safe_value(message, 'balances', [])
|
113
113
|
for i in range(0, len(balances)):
|
@@ -172,10 +172,9 @@ class blockchaincom(ccxt.async_support.blockchaincom):
|
|
172
172
|
# }
|
173
173
|
#
|
174
174
|
event = self.safe_string(message, 'event')
|
175
|
-
if event == '
|
176
|
-
|
177
|
-
|
178
|
-
raise ExchangeError(self.id + ' ' + self.json(message))
|
175
|
+
if event == 'rejected':
|
176
|
+
jsonMessage = self.json(message)
|
177
|
+
raise ExchangeError(self.id + ' ' + jsonMessage)
|
179
178
|
elif event == 'updated':
|
180
179
|
marketId = self.safe_string(message, 'symbol')
|
181
180
|
symbol = self.safe_symbol(marketId, None, '-')
|
@@ -192,7 +191,7 @@ class blockchaincom(ccxt.async_support.blockchaincom):
|
|
192
191
|
self.ohlcvs[symbol][timeframe] = stored
|
193
192
|
stored.append(ohlcv)
|
194
193
|
client.resolve(stored, messageHash)
|
195
|
-
|
194
|
+
elif event != 'subscribed':
|
196
195
|
raise NotSupported(self.id + ' ' + self.json(message))
|
197
196
|
|
198
197
|
async def watch_ticker(self, symbol: str, params={}) -> Ticker:
|
@@ -251,7 +250,7 @@ class blockchaincom(ccxt.async_support.blockchaincom):
|
|
251
250
|
symbol = market['symbol']
|
252
251
|
ticker = None
|
253
252
|
if event == 'subscribed':
|
254
|
-
return
|
253
|
+
return
|
255
254
|
elif event == 'snapshot':
|
256
255
|
ticker = self.parse_ticker(message, market)
|
257
256
|
elif event == 'updated':
|
@@ -345,7 +344,7 @@ class blockchaincom(ccxt.async_support.blockchaincom):
|
|
345
344
|
#
|
346
345
|
event = self.safe_string(message, 'event')
|
347
346
|
if event != 'updated':
|
348
|
-
return
|
347
|
+
return
|
349
348
|
marketId = self.safe_string(message, 'symbol')
|
350
349
|
symbol = self.safe_symbol(marketId)
|
351
350
|
market = self.safe_market(marketId)
|
@@ -500,7 +499,7 @@ class blockchaincom(ccxt.async_support.blockchaincom):
|
|
500
499
|
limit = self.safe_integer(self.options, 'ordersLimit', 1000)
|
501
500
|
self.orders = ArrayCacheBySymbolById(limit)
|
502
501
|
if event == 'subscribed':
|
503
|
-
return
|
502
|
+
return
|
504
503
|
elif event == 'rejected':
|
505
504
|
raise ExchangeError(self.id + ' ' + self.json(message))
|
506
505
|
elif event == 'snapshot':
|
@@ -662,25 +661,25 @@ class blockchaincom(ccxt.async_support.blockchaincom):
|
|
662
661
|
messageHash = 'orderbook:' + symbol + ':' + type
|
663
662
|
datetime = self.safe_string(message, 'timestamp')
|
664
663
|
timestamp = self.parse8601(datetime)
|
665
|
-
|
666
|
-
if
|
667
|
-
|
668
|
-
self.orderbooks[symbol] =
|
664
|
+
orderbook = self.safe_value(self.orderbooks, symbol)
|
665
|
+
if orderbook is None:
|
666
|
+
orderbook = self.counted_order_book({})
|
667
|
+
self.orderbooks[symbol] = orderbook
|
669
668
|
if event == 'subscribed':
|
670
|
-
return
|
669
|
+
return
|
671
670
|
elif event == 'snapshot':
|
672
671
|
snapshot = self.parse_order_book(message, symbol, timestamp, 'bids', 'asks', 'px', 'qty', 'num')
|
673
|
-
|
672
|
+
orderbook.reset(snapshot)
|
674
673
|
elif event == 'updated':
|
675
674
|
asks = self.safe_value(message, 'asks', [])
|
676
675
|
bids = self.safe_value(message, 'bids', [])
|
677
|
-
self.handle_deltas(
|
678
|
-
self.handle_deltas(
|
679
|
-
|
680
|
-
|
676
|
+
self.handle_deltas(orderbook['asks'], asks)
|
677
|
+
self.handle_deltas(orderbook['bids'], bids)
|
678
|
+
orderbook['timestamp'] = timestamp
|
679
|
+
orderbook['datetime'] = datetime
|
681
680
|
else:
|
682
681
|
raise NotSupported(self.id + ' watchOrderBook() does not support ' + event + ' yet')
|
683
|
-
client.resolve(
|
682
|
+
client.resolve(orderbook, messageHash)
|
684
683
|
|
685
684
|
def handle_delta(self, bookside, delta):
|
686
685
|
bookArray = self.parse_bid_ask(delta, 'px', 'qty', 'num')
|
@@ -717,7 +716,8 @@ class blockchaincom(ccxt.async_support.blockchaincom):
|
|
717
716
|
}
|
718
717
|
handler = self.safe_value(handlers, channel)
|
719
718
|
if handler is not None:
|
720
|
-
|
719
|
+
handler(client, message)
|
720
|
+
return
|
721
721
|
raise NotSupported(self.id + ' received an unsupported message: ' + self.json(message))
|
722
722
|
|
723
723
|
def handle_authentication_message(self, client: Client, message):
|
@@ -736,7 +736,7 @@ class blockchaincom(ccxt.async_support.blockchaincom):
|
|
736
736
|
if future is not None:
|
737
737
|
future.resolve(True)
|
738
738
|
|
739
|
-
def authenticate(self, params={}):
|
739
|
+
async def authenticate(self, params={}):
|
740
740
|
url = self.urls['api']['ws']
|
741
741
|
client = self.client(url)
|
742
742
|
messageHash = 'authenticated'
|
ccxt/pro/bybit.py
CHANGED
@@ -853,7 +853,7 @@ class bybit(ccxt.async_support.bybit):
|
|
853
853
|
"""
|
854
854
|
:see: https://bybit-exchange.github.io/docs/v5/websocket/private/position
|
855
855
|
watch all open positions
|
856
|
-
:param str[]
|
856
|
+
:param str[] [symbols]: list of unified market symbols
|
857
857
|
:param dict params: extra parameters specific to the exchange API endpoint
|
858
858
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/en/latest/manual.html#position-structure>`
|
859
859
|
"""
|
@@ -883,7 +883,7 @@ class bybit(ccxt.async_support.bybit):
|
|
883
883
|
|
884
884
|
def set_positions_cache(self, client: Client, symbols: Strings = None):
|
885
885
|
if self.positions is not None:
|
886
|
-
return
|
886
|
+
return
|
887
887
|
fetchPositionsSnapshot = self.handle_option('watchPositions', 'fetchPositionsSnapshot', True)
|
888
888
|
if fetchPositionsSnapshot:
|
889
889
|
messageHash = 'fetchPositionsSnapshot'
|
@@ -1002,7 +1002,7 @@ class bybit(ccxt.async_support.bybit):
|
|
1002
1002
|
limit = orders.getLimit(symbol, limit)
|
1003
1003
|
return self.filter_by_symbol_since_limit(orders, symbol, since, limit, True)
|
1004
1004
|
|
1005
|
-
def handle_order(self, client: Client, message
|
1005
|
+
def handle_order(self, client: Client, message):
|
1006
1006
|
#
|
1007
1007
|
# spot
|
1008
1008
|
# {
|
@@ -1532,7 +1532,7 @@ class bybit(ccxt.async_support.bybit):
|
|
1532
1532
|
authenticated = self.safe_value(client.subscriptions, messageHash)
|
1533
1533
|
if authenticated is None:
|
1534
1534
|
expiresInt = self.milliseconds() + 10000
|
1535
|
-
expires =
|
1535
|
+
expires = self.number_to_string(expiresInt)
|
1536
1536
|
path = 'GET/realtime'
|
1537
1537
|
auth = path + expires
|
1538
1538
|
signature = self.hmac(self.encode(auth), self.encode(self.secret), hashlib.sha256, 'hex')
|
@@ -1544,7 +1544,7 @@ class bybit(ccxt.async_support.bybit):
|
|
1544
1544
|
}
|
1545
1545
|
message = self.extend(request, params)
|
1546
1546
|
self.watch(url, messageHash, message, messageHash)
|
1547
|
-
return future
|
1547
|
+
return await future
|
1548
1548
|
|
1549
1549
|
def handle_error_message(self, client: Client, message):
|
1550
1550
|
#
|
ccxt/pro/cex.py
CHANGED
@@ -912,15 +912,15 @@ class cex(ccxt.async_support.cex):
|
|
912
912
|
messageHash = 'orderbook:' + symbol
|
913
913
|
timestamp = self.safe_integer_2(data, 'timestamp_ms', 'timestamp')
|
914
914
|
incrementalId = self.safe_number(data, 'id')
|
915
|
-
|
915
|
+
orderbook = self.order_book({})
|
916
916
|
snapshot = self.parse_order_book(data, symbol, timestamp, 'bids', 'asks')
|
917
917
|
snapshot['nonce'] = incrementalId
|
918
|
-
|
918
|
+
orderbook.reset(snapshot)
|
919
919
|
self.options['orderbook'][symbol] = {
|
920
920
|
'incrementalId': incrementalId,
|
921
921
|
}
|
922
|
-
self.orderbooks[symbol] =
|
923
|
-
client.resolve(
|
922
|
+
self.orderbooks[symbol] = orderbook
|
923
|
+
client.resolve(orderbook, messageHash)
|
924
924
|
|
925
925
|
def pair_to_symbol(self, pair):
|
926
926
|
parts = pair.split(':')
|
@@ -1355,7 +1355,8 @@ class cex(ccxt.async_support.cex):
|
|
1355
1355
|
def handle_message(self, client: Client, message):
|
1356
1356
|
ok = self.safe_string(message, 'ok')
|
1357
1357
|
if ok == 'error':
|
1358
|
-
|
1358
|
+
self.handle_error_message(client, message)
|
1359
|
+
return
|
1359
1360
|
event = self.safe_string(message, 'e')
|
1360
1361
|
handlers = {
|
1361
1362
|
'auth': self.handle_authentication_message,
|
@@ -1382,8 +1383,7 @@ class cex(ccxt.async_support.cex):
|
|
1382
1383
|
}
|
1383
1384
|
handler = self.safe_value(handlers, event)
|
1384
1385
|
if handler is not None:
|
1385
|
-
|
1386
|
-
return message
|
1386
|
+
handler(client, message)
|
1387
1387
|
|
1388
1388
|
def handle_authentication_message(self, client: Client, message):
|
1389
1389
|
#
|
ccxt/pro/coinbase.py
CHANGED
@@ -437,7 +437,8 @@ class coinbase(ccxt.async_support.coinbase):
|
|
437
437
|
side = self.safe_string(self.options['sides'], sideId)
|
438
438
|
price = self.safe_number(trade, 'price_level')
|
439
439
|
amount = self.safe_number(trade, 'new_quantity')
|
440
|
-
orderbook[side]
|
440
|
+
orderbookSide = orderbook[side]
|
441
|
+
orderbookSide.store(price, amount)
|
441
442
|
|
442
443
|
def handle_order_book(self, client, message):
|
443
444
|
#
|
@@ -525,4 +526,4 @@ class coinbase(ccxt.async_support.coinbase):
|
|
525
526
|
errorMessage = self.safe_string(message, 'message')
|
526
527
|
raise ExchangeError(errorMessage)
|
527
528
|
method = self.safe_value(methods, channel)
|
528
|
-
|
529
|
+
method(client, message)
|
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))
|