ccxt 4.3.86__py2.py3-none-any.whl → 4.3.88__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.
- ccxt/__init__.py +2 -1
- ccxt/abstract/kucoin.py +1 -0
- ccxt/abstract/kucoinfutures.py +1 -0
- ccxt/async_support/__init__.py +2 -1
- ccxt/async_support/base/exchange.py +3 -3
- ccxt/async_support/bingx.py +5 -1
- ccxt/async_support/coinex.py +1 -1
- ccxt/async_support/hashkey.py +1 -2
- ccxt/async_support/kraken.py +32 -5
- ccxt/async_support/kucoin.py +2 -0
- ccxt/async_support/upbit.py +1 -1
- ccxt/base/errors.py +7 -1
- ccxt/base/exchange.py +3 -3
- ccxt/bingx.py +5 -1
- ccxt/coinex.py +1 -1
- ccxt/hashkey.py +1 -2
- ccxt/kraken.py +32 -5
- ccxt/kucoin.py +2 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitfinex.py +1 -0
- ccxt/pro/bitfinex2.py +1 -0
- ccxt/pro/bitget.py +143 -16
- ccxt/pro/bitopro.py +1 -0
- ccxt/pro/bitstamp.py +1 -0
- ccxt/pro/blockchaincom.py +1 -0
- ccxt/pro/cex.py +1 -0
- ccxt/pro/coincheck.py +1 -0
- ccxt/pro/coinone.py +1 -0
- ccxt/pro/hashkey.py +1 -0
- ccxt/pro/hitbtc.py +1 -0
- ccxt/pro/hollaex.py +1 -0
- ccxt/pro/htx.py +1 -0
- ccxt/pro/huobijp.py +1 -0
- ccxt/pro/hyperliquid.py +7 -0
- ccxt/pro/independentreserve.py +1 -0
- ccxt/pro/lbank.py +1 -0
- ccxt/pro/luno.py +1 -0
- ccxt/pro/ndax.py +5 -0
- ccxt/pro/okcoin.py +7 -0
- ccxt/pro/onetrading.py +1 -0
- ccxt/pro/p2b.py +30 -7
- ccxt/pro/paradex.py +1 -0
- ccxt/pro/poloniex.py +32 -3
- ccxt/pro/poloniexfutures.py +1 -0
- ccxt/pro/probit.py +2 -0
- ccxt/pro/upbit.py +44 -3
- ccxt/pro/vertex.py +1 -0
- ccxt/pro/wazirx.py +3 -0
- ccxt/pro/whitebit.py +9 -0
- ccxt/test/tests_async.py +18 -1
- ccxt/test/tests_sync.py +18 -1
- ccxt/upbit.py +1 -1
- {ccxt-4.3.86.dist-info → ccxt-4.3.88.dist-info}/METADATA +7 -6
- {ccxt-4.3.86.dist-info → ccxt-4.3.88.dist-info}/RECORD +57 -57
- {ccxt-4.3.86.dist-info → ccxt-4.3.88.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.86.dist-info → ccxt-4.3.88.dist-info}/WHEEL +0 -0
- {ccxt-4.3.86.dist-info → ccxt-4.3.88.dist-info}/top_level.txt +0 -0
ccxt/pro/bitget.py
CHANGED
@@ -16,6 +16,7 @@ from ccxt.base.errors import ArgumentsRequired
|
|
16
16
|
from ccxt.base.errors import BadRequest
|
17
17
|
from ccxt.base.errors import RateLimitExceeded
|
18
18
|
from ccxt.base.errors import ChecksumError
|
19
|
+
from ccxt.base.errors import UnsubscribeError
|
19
20
|
from ccxt.base.precise import Precise
|
20
21
|
|
21
22
|
|
@@ -133,6 +134,17 @@ class bitget(ccxt.async_support.bitget):
|
|
133
134
|
}
|
134
135
|
return await self.watch_public(messageHash, args, params)
|
135
136
|
|
137
|
+
async def un_watch_ticker(self, symbol: str, params={}) -> Any:
|
138
|
+
"""
|
139
|
+
unsubscribe from the ticker channel
|
140
|
+
:see: https://www.bitget.com/api-doc/spot/websocket/public/Tickers-Channel
|
141
|
+
:see: https://www.bitget.com/api-doc/contract/websocket/public/Tickers-Channel
|
142
|
+
:param str symbol: unified symbol of the market to unwatch the ticker for
|
143
|
+
:returns any: status of the unwatch request
|
144
|
+
"""
|
145
|
+
await self.load_markets()
|
146
|
+
return await self.un_watch_channel(symbol, 'ticker', 'ticker', params)
|
147
|
+
|
136
148
|
async def watch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
137
149
|
"""
|
138
150
|
watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
@@ -338,6 +350,20 @@ class bitget(ccxt.async_support.bitget):
|
|
338
350
|
limit = ohlcv.getLimit(symbol, limit)
|
339
351
|
return self.filter_by_since_limit(ohlcv, since, limit, 0, True)
|
340
352
|
|
353
|
+
async def un_watch_ohlcv(self, symbol: str, timeframe='1m', params={}) -> Any:
|
354
|
+
"""
|
355
|
+
unsubscribe from the ohlcv channel
|
356
|
+
:see: https://www.bitget.com/api-doc/spot/websocket/public/Candlesticks-Channel
|
357
|
+
:see: https://www.bitget.com/api-doc/contract/websocket/public/Candlesticks-Channel
|
358
|
+
:param str symbol: unified symbol of the market to unwatch the ohlcv for
|
359
|
+
:returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
|
360
|
+
"""
|
361
|
+
await self.load_markets()
|
362
|
+
timeframes = self.safe_dict(self.options, 'timeframes')
|
363
|
+
interval = self.safe_string(timeframes, timeframe)
|
364
|
+
channel = 'candle' + interval
|
365
|
+
return await self.un_watch_channel(symbol, channel, 'candles:' + timeframe, params)
|
366
|
+
|
341
367
|
def handle_ohlcv(self, client: Client, message):
|
342
368
|
#
|
343
369
|
# {
|
@@ -440,13 +466,17 @@ class bitget(ccxt.async_support.bitget):
|
|
440
466
|
:returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols
|
441
467
|
"""
|
442
468
|
await self.load_markets()
|
443
|
-
market = self.market(symbol)
|
444
|
-
messageHash = 'unsubscribe:orderbook:' + market['symbol']
|
445
469
|
channel = 'books'
|
446
470
|
limit = self.safe_integer(params, 'limit')
|
447
471
|
if (limit == 1) or (limit == 5) or (limit == 15):
|
448
472
|
params = self.omit(params, 'limit')
|
449
473
|
channel += str(limit)
|
474
|
+
return await self.un_watch_channel(symbol, channel, 'orderbook', params)
|
475
|
+
|
476
|
+
async def un_watch_channel(self, symbol: str, channel: str, messageHashTopic: str, params={}) -> Any:
|
477
|
+
await self.load_markets()
|
478
|
+
market = self.market(symbol)
|
479
|
+
messageHash = 'unsubscribe:' + messageHashTopic + ':' + market['symbol']
|
450
480
|
instType = None
|
451
481
|
instType, params = self.get_inst_type(market, params)
|
452
482
|
args: dict = {
|
@@ -648,6 +678,17 @@ class bitget(ccxt.async_support.bitget):
|
|
648
678
|
limit = trades.getLimit(tradeSymbol, limit)
|
649
679
|
return self.filter_by_since_limit(trades, since, limit, 'timestamp', True)
|
650
680
|
|
681
|
+
async def un_watch_trades(self, symbol: str, params={}) -> Any:
|
682
|
+
"""
|
683
|
+
unsubscribe from the trades channel
|
684
|
+
:see: https://www.bitget.com/api-doc/spot/websocket/public/Trades-Channel
|
685
|
+
:see: https://www.bitget.com/api-doc/contract/websocket/public/New-Trades-Channel
|
686
|
+
:param str symbol: unified symbol of the market to unwatch the trades for
|
687
|
+
:returns any: status of the unwatch request
|
688
|
+
"""
|
689
|
+
await self.load_markets()
|
690
|
+
return await self.un_watch_channel(symbol, 'trade', 'trade', params)
|
691
|
+
|
651
692
|
def handle_trades(self, client: Client, message):
|
652
693
|
#
|
653
694
|
# {
|
@@ -1750,6 +1791,99 @@ class bitget(ccxt.async_support.bitget):
|
|
1750
1791
|
#
|
1751
1792
|
return message
|
1752
1793
|
|
1794
|
+
def handle_order_book_un_subscription(self, client: Client, message):
|
1795
|
+
#
|
1796
|
+
# {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"books","instId":"BTCUSDT"}}
|
1797
|
+
#
|
1798
|
+
arg = self.safe_dict(message, 'arg', {})
|
1799
|
+
instType = self.safe_string_lower(arg, 'instType')
|
1800
|
+
type = 'spot' if (instType == 'spot') else 'contract'
|
1801
|
+
instId = self.safe_string(arg, 'instId')
|
1802
|
+
market = self.safe_market(instId, None, None, type)
|
1803
|
+
symbol = market['symbol']
|
1804
|
+
messageHash = 'unsubscribe:orderbook:' + market['symbol']
|
1805
|
+
subMessageHash = 'orderbook:' + symbol
|
1806
|
+
if symbol in self.orderbooks:
|
1807
|
+
del self.orderbooks[symbol]
|
1808
|
+
if subMessageHash in client.subscriptions:
|
1809
|
+
del client.subscriptions[subMessageHash]
|
1810
|
+
if messageHash in client.subscriptions:
|
1811
|
+
del client.subscriptions[messageHash]
|
1812
|
+
error = UnsubscribeError(self.id + 'orderbook ' + symbol)
|
1813
|
+
client.reject(error, subMessageHash)
|
1814
|
+
client.resolve(True, messageHash)
|
1815
|
+
|
1816
|
+
def handle_trades_un_subscription(self, client: Client, message):
|
1817
|
+
#
|
1818
|
+
# {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"trade","instId":"BTCUSDT"}}
|
1819
|
+
#
|
1820
|
+
arg = self.safe_dict(message, 'arg', {})
|
1821
|
+
instType = self.safe_string_lower(arg, 'instType')
|
1822
|
+
type = 'spot' if (instType == 'spot') else 'contract'
|
1823
|
+
instId = self.safe_string(arg, 'instId')
|
1824
|
+
market = self.safe_market(instId, None, None, type)
|
1825
|
+
symbol = market['symbol']
|
1826
|
+
messageHash = 'unsubscribe:trade:' + market['symbol']
|
1827
|
+
subMessageHash = 'trade:' + symbol
|
1828
|
+
if symbol in self.trades:
|
1829
|
+
del self.trades[symbol]
|
1830
|
+
if subMessageHash in client.subscriptions:
|
1831
|
+
del client.subscriptions[subMessageHash]
|
1832
|
+
if messageHash in client.subscriptions:
|
1833
|
+
del client.subscriptions[messageHash]
|
1834
|
+
error = UnsubscribeError(self.id + 'trades ' + symbol)
|
1835
|
+
client.reject(error, subMessageHash)
|
1836
|
+
client.resolve(True, messageHash)
|
1837
|
+
|
1838
|
+
def handle_ticker_un_subscription(self, client: Client, message):
|
1839
|
+
#
|
1840
|
+
# {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"trade","instId":"BTCUSDT"}}
|
1841
|
+
#
|
1842
|
+
arg = self.safe_dict(message, 'arg', {})
|
1843
|
+
instType = self.safe_string_lower(arg, 'instType')
|
1844
|
+
type = 'spot' if (instType == 'spot') else 'contract'
|
1845
|
+
instId = self.safe_string(arg, 'instId')
|
1846
|
+
market = self.safe_market(instId, None, None, type)
|
1847
|
+
symbol = market['symbol']
|
1848
|
+
messageHash = 'unsubscribe:ticker:' + market['symbol']
|
1849
|
+
subMessageHash = 'ticker:' + symbol
|
1850
|
+
if symbol in self.tickers:
|
1851
|
+
del self.tickers[symbol]
|
1852
|
+
if subMessageHash in client.subscriptions:
|
1853
|
+
del client.subscriptions[subMessageHash]
|
1854
|
+
if messageHash in client.subscriptions:
|
1855
|
+
del client.subscriptions[messageHash]
|
1856
|
+
error = UnsubscribeError(self.id + 'ticker ' + symbol)
|
1857
|
+
client.reject(error, subMessageHash)
|
1858
|
+
client.resolve(True, messageHash)
|
1859
|
+
|
1860
|
+
def handle_ohlcv_un_subscription(self, client: Client, message):
|
1861
|
+
#
|
1862
|
+
# {"event":"unsubscribe","arg":{"instType":"SPOT","channel":"candle1m","instId":"BTCUSDT"}}
|
1863
|
+
#
|
1864
|
+
arg = self.safe_dict(message, 'arg', {})
|
1865
|
+
instType = self.safe_string_lower(arg, 'instType')
|
1866
|
+
type = 'spot' if (instType == 'spot') else 'contract'
|
1867
|
+
instId = self.safe_string(arg, 'instId')
|
1868
|
+
channel = self.safe_string(arg, 'channel')
|
1869
|
+
interval = channel.replace('candle', '')
|
1870
|
+
timeframes = self.safe_value(self.options, 'timeframes')
|
1871
|
+
timeframe = self.find_timeframe(interval, timeframes)
|
1872
|
+
market = self.safe_market(instId, None, None, type)
|
1873
|
+
symbol = market['symbol']
|
1874
|
+
messageHash = 'unsubscribe:candles:' + timeframe + ':' + market['symbol']
|
1875
|
+
subMessageHash = 'candles:' + timeframe + ':' + symbol
|
1876
|
+
if symbol in self.ohlcvs:
|
1877
|
+
if timeframe in self.ohlcvs[symbol]:
|
1878
|
+
del self.ohlcvs[symbol][timeframe]
|
1879
|
+
if subMessageHash in client.subscriptions:
|
1880
|
+
del client.subscriptions[subMessageHash]
|
1881
|
+
if messageHash in client.subscriptions:
|
1882
|
+
del client.subscriptions[messageHash]
|
1883
|
+
error = UnsubscribeError(self.id + ' ohlcv ' + timeframe + ' ' + symbol)
|
1884
|
+
client.reject(error, subMessageHash)
|
1885
|
+
client.resolve(True, messageHash)
|
1886
|
+
|
1753
1887
|
def handle_un_subscription_status(self, client: Client, message):
|
1754
1888
|
#
|
1755
1889
|
# {
|
@@ -1778,18 +1912,11 @@ class bitget(ccxt.async_support.bitget):
|
|
1778
1912
|
channel = self.safe_string(arg, 'channel')
|
1779
1913
|
if channel == 'books':
|
1780
1914
|
# for now only unWatchOrderBook is supporteod
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
if symbol in self.orderbooks:
|
1789
|
-
del self.orderbooks[symbol]
|
1790
|
-
if subMessageHash in client.subscriptions:
|
1791
|
-
del client.subscriptions[subMessageHash]
|
1792
|
-
if messageHash in client.subscriptions:
|
1793
|
-
del client.subscriptions[messageHash]
|
1794
|
-
client.resolve(True, messageHash)
|
1915
|
+
self.handle_order_book_un_subscription(client, message)
|
1916
|
+
elif channel == 'trade':
|
1917
|
+
self.handle_trades_un_subscription(client, message)
|
1918
|
+
elif channel == 'ticker':
|
1919
|
+
self.handle_ticker_un_subscription(client, message)
|
1920
|
+
elif channel.startswith('candle'):
|
1921
|
+
self.handle_ohlcv_un_subscription(client, message)
|
1795
1922
|
return message
|
ccxt/pro/bitopro.py
CHANGED
ccxt/pro/bitstamp.py
CHANGED
ccxt/pro/blockchaincom.py
CHANGED
ccxt/pro/cex.py
CHANGED
ccxt/pro/coincheck.py
CHANGED
ccxt/pro/coinone.py
CHANGED
ccxt/pro/hashkey.py
CHANGED
ccxt/pro/hitbtc.py
CHANGED
ccxt/pro/hollaex.py
CHANGED
ccxt/pro/htx.py
CHANGED
ccxt/pro/huobijp.py
CHANGED
ccxt/pro/hyperliquid.py
CHANGED
@@ -28,6 +28,7 @@ class hyperliquid(ccxt.async_support.hyperliquid):
|
|
28
28
|
'watchTicker': False,
|
29
29
|
'watchTickers': True,
|
30
30
|
'watchTrades': True,
|
31
|
+
'watchTradesForSymbols': False,
|
31
32
|
'watchPosition': False,
|
32
33
|
},
|
33
34
|
'urls': {
|
@@ -137,6 +138,7 @@ class hyperliquid(ccxt.async_support.hyperliquid):
|
|
137
138
|
async def watch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
138
139
|
"""
|
139
140
|
watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
141
|
+
:see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
140
142
|
:param str symbol: unified symbol of the market to fetch the order book for
|
141
143
|
:param int [limit]: the maximum amount of order book entries to return
|
142
144
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -207,6 +209,7 @@ class hyperliquid(ccxt.async_support.hyperliquid):
|
|
207
209
|
async def watch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
208
210
|
"""
|
209
211
|
watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
212
|
+
:see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
210
213
|
:param str[] symbols: unified symbol of the market to fetch the ticker for
|
211
214
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
212
215
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -230,6 +233,7 @@ class hyperliquid(ccxt.async_support.hyperliquid):
|
|
230
233
|
async def watch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
231
234
|
"""
|
232
235
|
watches information on multiple trades made by the user
|
236
|
+
:see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
233
237
|
:param str symbol: unified market symbol of the market orders were made in
|
234
238
|
:param int [since]: the earliest time in ms to fetch orders for
|
235
239
|
:param int [limit]: the maximum number of order structures to retrieve
|
@@ -390,6 +394,7 @@ class hyperliquid(ccxt.async_support.hyperliquid):
|
|
390
394
|
async def watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
391
395
|
"""
|
392
396
|
watches information on multiple trades made in a market
|
397
|
+
:see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
393
398
|
:param str symbol: unified market symbol of the market trades were made in
|
394
399
|
:param int [since]: the earliest time in ms to fetch trades for
|
395
400
|
:param int [limit]: the maximum number of trade structures to retrieve
|
@@ -514,6 +519,7 @@ class hyperliquid(ccxt.async_support.hyperliquid):
|
|
514
519
|
async def watch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
515
520
|
"""
|
516
521
|
watches historical candlestick data containing the open, high, low, close price, and the volume of a market
|
522
|
+
:see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
517
523
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
518
524
|
:param str timeframe: the length of time each candle represents
|
519
525
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -594,6 +600,7 @@ class hyperliquid(ccxt.async_support.hyperliquid):
|
|
594
600
|
async def watch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
595
601
|
"""
|
596
602
|
watches information on multiple orders made by the user
|
603
|
+
:see: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/websocket/subscriptions
|
597
604
|
:param str symbol: unified market symbol of the market orders were made in
|
598
605
|
:param int [since]: the earliest time in ms to fetch orders for
|
599
606
|
:param int [limit]: the maximum number of order structures to retrieve
|
ccxt/pro/independentreserve.py
CHANGED
ccxt/pro/lbank.py
CHANGED
ccxt/pro/luno.py
CHANGED
ccxt/pro/ndax.py
CHANGED
@@ -19,6 +19,7 @@ class ndax(ccxt.async_support.ndax):
|
|
19
19
|
'ws': True,
|
20
20
|
'watchOrderBook': True,
|
21
21
|
'watchTrades': True,
|
22
|
+
'watchTradesForSymbols': False,
|
22
23
|
'watchTicker': True,
|
23
24
|
'watchOHLCV': True,
|
24
25
|
},
|
@@ -45,6 +46,7 @@ class ndax(ccxt.async_support.ndax):
|
|
45
46
|
async def watch_ticker(self, symbol: str, params={}) -> Ticker:
|
46
47
|
"""
|
47
48
|
watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
49
|
+
:see: https://apidoc.ndax.io/#subscribelevel1
|
48
50
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
49
51
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
50
52
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -108,6 +110,7 @@ class ndax(ccxt.async_support.ndax):
|
|
108
110
|
async def watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
109
111
|
"""
|
110
112
|
get the list of most recent trades for a particular symbol
|
113
|
+
:see: https://apidoc.ndax.io/#subscribetrades
|
111
114
|
:param str symbol: unified symbol of the market to fetch trades for
|
112
115
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
113
116
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -183,6 +186,7 @@ class ndax(ccxt.async_support.ndax):
|
|
183
186
|
async def watch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
184
187
|
"""
|
185
188
|
watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
189
|
+
:see: https://apidoc.ndax.io/#subscribeticker
|
186
190
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
187
191
|
:param str timeframe: the length of time each candle represents
|
188
192
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -303,6 +307,7 @@ class ndax(ccxt.async_support.ndax):
|
|
303
307
|
async def watch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
304
308
|
"""
|
305
309
|
watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
310
|
+
:see: https://apidoc.ndax.io/#subscribelevel2
|
306
311
|
:param str symbol: unified symbol of the market to fetch the order book for
|
307
312
|
:param int [limit]: the maximum amount of order book entries to return
|
308
313
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
ccxt/pro/okcoin.py
CHANGED
@@ -24,6 +24,7 @@ class okcoin(ccxt.async_support.okcoin):
|
|
24
24
|
'watchOrderBook': True,
|
25
25
|
'watchOrders': True,
|
26
26
|
'watchTrades': True,
|
27
|
+
'watchTradesForSymbols': False,
|
27
28
|
'watchBalance': True,
|
28
29
|
'watchOHLCV': True,
|
29
30
|
},
|
@@ -72,6 +73,7 @@ class okcoin(ccxt.async_support.okcoin):
|
|
72
73
|
async def watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
73
74
|
"""
|
74
75
|
get the list of most recent trades for a particular symbol
|
76
|
+
:see: https://www.okcoin.com/docs-v5/en/#websocket-api-public-channel-trades-channel
|
75
77
|
:param str symbol: unified symbol of the market to fetch trades for
|
76
78
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
77
79
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -88,6 +90,7 @@ class okcoin(ccxt.async_support.okcoin):
|
|
88
90
|
async def watch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
89
91
|
"""
|
90
92
|
watches information on multiple orders made by the user
|
93
|
+
:see: https://www.okcoin.com/docs-v5/en/#websocket-api-private-channel-order-channel
|
91
94
|
:param str symbol: unified market symbol of the market orders were made in
|
92
95
|
:param int [since]: the earliest time in ms to fetch orders for
|
93
96
|
:param int [limit]: the maximum number of order structures to retrieve
|
@@ -166,6 +169,7 @@ class okcoin(ccxt.async_support.okcoin):
|
|
166
169
|
async def watch_ticker(self, symbol: str, params={}) -> Ticker:
|
167
170
|
"""
|
168
171
|
watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
172
|
+
:see: https://www.okcoin.com/docs-v5/en/#websocket-api-public-channel-tickers-channel
|
169
173
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
170
174
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
171
175
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -241,6 +245,7 @@ class okcoin(ccxt.async_support.okcoin):
|
|
241
245
|
async def watch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
242
246
|
"""
|
243
247
|
watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
248
|
+
:see: https://www.okcoin.com/docs-v5/en/#websocket-api-public-channel-candlesticks-channel
|
244
249
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
245
250
|
:param str timeframe: the length of time each candle represents
|
246
251
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -303,6 +308,7 @@ class okcoin(ccxt.async_support.okcoin):
|
|
303
308
|
async def watch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
304
309
|
"""
|
305
310
|
watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
311
|
+
:see: https://www.okcoin.com/docs-v5/en/#websocket-api-public-channel-order-book-channel
|
306
312
|
:param str symbol: unified symbol of the market to fetch the order book for
|
307
313
|
:param int [limit]: the maximum amount of order book entries to return
|
308
314
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -457,6 +463,7 @@ class okcoin(ccxt.async_support.okcoin):
|
|
457
463
|
async def watch_balance(self, params={}) -> Balances:
|
458
464
|
"""
|
459
465
|
watch balance and get the amount of funds available for trading or funds locked in orders
|
466
|
+
:see: https://www.okcoin.com/docs-v5/en/#websocket-api-private-channel-account-channel
|
460
467
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
461
468
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
462
469
|
"""
|
ccxt/pro/onetrading.py
CHANGED
ccxt/pro/p2b.py
CHANGED
@@ -36,6 +36,7 @@ class p2b(ccxt.async_support.p2b):
|
|
36
36
|
'watchTicker': True,
|
37
37
|
'watchTickers': False, # in the docs but does not return anything when subscribed to
|
38
38
|
'watchTrades': True,
|
39
|
+
'watchTradesForSymbols': True,
|
39
40
|
},
|
40
41
|
'urls': {
|
41
42
|
'api': {
|
@@ -142,15 +143,37 @@ class p2b(ccxt.async_support.p2b):
|
|
142
143
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
143
144
|
:returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
|
144
145
|
"""
|
146
|
+
return await self.watch_trades_for_symbols([symbol], since, limit, params)
|
147
|
+
|
148
|
+
async def watch_trades_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
149
|
+
"""
|
150
|
+
get the list of most recent trades for a list of symbols
|
151
|
+
:see: https://github.com/P2B-team/P2B-WSS-Public/blob/main/wss_documentation.md#deals
|
152
|
+
:param str[] symbols: unified symbol of the market to fetch trades for
|
153
|
+
:param int [since]: timestamp in ms of the earliest trade to fetch
|
154
|
+
:param int [limit]: the maximum amount of trades to fetch
|
155
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
156
|
+
:returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
|
157
|
+
"""
|
145
158
|
await self.load_markets()
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
159
|
+
symbols = self.market_symbols(symbols, None, False, True, True)
|
160
|
+
messageHashes = []
|
161
|
+
if symbols is not None:
|
162
|
+
for i in range(0, len(symbols)):
|
163
|
+
messageHashes.append('deals::' + symbols[i])
|
164
|
+
marketIds = self.market_ids(symbols)
|
165
|
+
url = self.urls['api']['ws']
|
166
|
+
subscribe: dict = {
|
167
|
+
'method': 'deals.subscribe',
|
168
|
+
'params': marketIds,
|
169
|
+
'id': self.milliseconds(),
|
170
|
+
}
|
171
|
+
query = self.extend(subscribe, params)
|
172
|
+
trades = await self.watch_multiple(url, messageHashes, query, messageHashes)
|
152
173
|
if self.newUpdates:
|
153
|
-
|
174
|
+
first = self.safe_value(trades, 0)
|
175
|
+
tradeSymbol = self.safe_string(first, 'symbol')
|
176
|
+
limit = trades.getLimit(tradeSymbol, limit)
|
154
177
|
return self.filter_by_since_limit(trades, since, limit, 'timestamp', True)
|
155
178
|
|
156
179
|
async def watch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
ccxt/pro/paradex.py
CHANGED
ccxt/pro/poloniex.py
CHANGED
@@ -27,6 +27,7 @@ class poloniex(ccxt.async_support.poloniex):
|
|
27
27
|
'watchTicker': True,
|
28
28
|
'watchTickers': True,
|
29
29
|
'watchTrades': True,
|
30
|
+
'watchTradesForSymbols': True,
|
30
31
|
'watchBalance': True,
|
31
32
|
'watchStatus': False,
|
32
33
|
'watchOrders': True,
|
@@ -367,12 +368,40 @@ class poloniex(ccxt.async_support.poloniex):
|
|
367
368
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
368
369
|
:returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
|
369
370
|
"""
|
371
|
+
return await self.watch_trades_for_symbols([symbol], since, limit, params)
|
372
|
+
|
373
|
+
async def watch_trades_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
374
|
+
"""
|
375
|
+
get the list of most recent trades for a list of symbols
|
376
|
+
:see: https://api-docs.poloniex.com/spot/websocket/market-data#trades
|
377
|
+
:param str[] symbols: unified symbol of the market to fetch trades for
|
378
|
+
:param int [since]: timestamp in ms of the earliest trade to fetch
|
379
|
+
:param int [limit]: the maximum amount of trades to fetch
|
380
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
381
|
+
:returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=public-trades>`
|
382
|
+
"""
|
370
383
|
await self.load_markets()
|
371
|
-
|
384
|
+
symbols = self.market_symbols(symbols, None, False, True, True)
|
372
385
|
name = 'trades'
|
373
|
-
|
386
|
+
url = self.urls['api']['ws']['public']
|
387
|
+
marketIds = self.market_ids(symbols)
|
388
|
+
subscribe: dict = {
|
389
|
+
'event': 'subscribe',
|
390
|
+
'channel': [
|
391
|
+
name,
|
392
|
+
],
|
393
|
+
'symbols': marketIds,
|
394
|
+
}
|
395
|
+
request = self.extend(subscribe, params)
|
396
|
+
messageHashes = []
|
397
|
+
if symbols is not None:
|
398
|
+
for i in range(0, len(symbols)):
|
399
|
+
messageHashes.append(name + '::' + symbols[i])
|
400
|
+
trades = await self.watch_multiple(url, messageHashes, request, messageHashes)
|
374
401
|
if self.newUpdates:
|
375
|
-
|
402
|
+
first = self.safe_value(trades, 0)
|
403
|
+
tradeSymbol = self.safe_string(first, 'symbol')
|
404
|
+
limit = trades.getLimit(tradeSymbol, limit)
|
376
405
|
return self.filter_by_since_limit(trades, since, limit, 'timestamp', True)
|
377
406
|
|
378
407
|
async def watch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
ccxt/pro/poloniexfutures.py
CHANGED
ccxt/pro/probit.py
CHANGED
@@ -22,6 +22,7 @@ class probit(ccxt.async_support.probit):
|
|
22
22
|
'watchTicker': True,
|
23
23
|
'watchTickers': False,
|
24
24
|
'watchTrades': True,
|
25
|
+
'watchTradesForSymbols': False,
|
25
26
|
'watchMyTrades': True,
|
26
27
|
'watchOrders': True,
|
27
28
|
'watchOrderBook': True,
|
@@ -217,6 +218,7 @@ class probit(ccxt.async_support.probit):
|
|
217
218
|
async def watch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
218
219
|
"""
|
219
220
|
get the list of trades associated with the user
|
221
|
+
:see: https://docs-en.probit.com/reference/trade_history
|
220
222
|
:param str symbol: unified symbol of the market to fetch trades for
|
221
223
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
222
224
|
:param int [limit]: the maximum amount of trades to fetch
|