ccxt 4.3.98__py2.py3-none-any.whl → 4.4.2__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 +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +71 -8
- ccxt/async_support/bitget.py +3 -2
- ccxt/async_support/cryptocom.py +1 -1
- ccxt/async_support/currencycom.py +1 -2
- ccxt/async_support/gate.py +1 -0
- ccxt/async_support/htx.py +1 -1
- ccxt/async_support/mexc.py +61 -1
- ccxt/async_support/xt.py +1 -1
- ccxt/base/exchange.py +53 -1
- ccxt/base/types.py +2 -2
- ccxt/binance.py +71 -8
- ccxt/bitget.py +3 -2
- ccxt/cryptocom.py +1 -1
- ccxt/currencycom.py +1 -2
- ccxt/gate.py +1 -0
- ccxt/htx.py +1 -1
- ccxt/mexc.py +61 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +3 -47
- ccxt/pro/bitget.py +1 -7
- ccxt/pro/bitmex.py +11 -1
- ccxt/pro/bybit.py +2 -41
- ccxt/pro/cryptocom.py +2 -31
- ccxt/pro/gate.py +1 -8
- ccxt/pro/hyperliquid.py +217 -11
- ccxt/pro/kucoin.py +2 -43
- ccxt/pro/kucoinfutures.py +122 -0
- ccxt/pro/okx.py +8 -31
- ccxt/xt.py +1 -1
- {ccxt-4.3.98.dist-info → ccxt-4.4.2.dist-info}/METADATA +5 -5
- {ccxt-4.3.98.dist-info → ccxt-4.4.2.dist-info}/RECORD +37 -37
- {ccxt-4.3.98.dist-info → ccxt-4.4.2.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.98.dist-info → ccxt-4.4.2.dist-info}/WHEEL +0 -0
- {ccxt-4.3.98.dist-info → ccxt-4.4.2.dist-info}/top_level.txt +0 -0
ccxt/cryptocom.py
CHANGED
@@ -156,7 +156,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
156
156
|
'www': 'https://crypto.com/',
|
157
157
|
'referral': {
|
158
158
|
'url': 'https://crypto.com/exch/kdacthrnxt',
|
159
|
-
'discount': 0.
|
159
|
+
'discount': 0.75,
|
160
160
|
},
|
161
161
|
'doc': [
|
162
162
|
'https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html',
|
ccxt/currencycom.py
CHANGED
@@ -1902,7 +1902,7 @@ class currencycom(Exchange, ImplicitAPI):
|
|
1902
1902
|
'collateral': None,
|
1903
1903
|
'side': side,
|
1904
1904
|
# 'realizedProfit': self.safe_number(position, 'rpl'),
|
1905
|
-
'
|
1905
|
+
'unrealizedPnl': unrealizedProfit,
|
1906
1906
|
'leverage': leverage,
|
1907
1907
|
'percentage': None,
|
1908
1908
|
'marginMode': None,
|
@@ -1916,7 +1916,6 @@ class currencycom(Exchange, ImplicitAPI):
|
|
1916
1916
|
'maintenanceMarginPercentage': None,
|
1917
1917
|
'marginRatio': None,
|
1918
1918
|
'id': None,
|
1919
|
-
'unrealizedPnl': None,
|
1920
1919
|
'hedged': None,
|
1921
1920
|
'stopLossPrice': None,
|
1922
1921
|
'takeProfitPrice': None,
|
ccxt/gate.py
CHANGED
@@ -625,6 +625,7 @@ class gate(Exchange, ImplicitAPI):
|
|
625
625
|
'MPH': 'MORPHER', # conflict with 88MPH
|
626
626
|
'POINT': 'GATEPOINT',
|
627
627
|
'RAI': 'RAIREFLEXINDEX', # conflict with RAI Finance
|
628
|
+
'RED': 'RedLang',
|
628
629
|
'SBTC': 'SUPERBITCOIN',
|
629
630
|
'TNC': 'TRINITYNETWORKCREDIT',
|
630
631
|
'VAI': 'VAIOT',
|
ccxt/htx.py
CHANGED
@@ -6978,7 +6978,7 @@ class htx(Exchange, ImplicitAPI):
|
|
6978
6978
|
'entryPrice': entryPrice,
|
6979
6979
|
'collateral': self.parse_number(collateral),
|
6980
6980
|
'side': side,
|
6981
|
-
'
|
6981
|
+
'unrealizedPnl': unrealizedProfit,
|
6982
6982
|
'leverage': self.parse_number(leverage),
|
6983
6983
|
'percentage': self.parse_number(percentage),
|
6984
6984
|
'marginMode': marginMode,
|
ccxt/mexc.py
CHANGED
@@ -1012,6 +1012,13 @@ class mexc(Exchange, ImplicitAPI):
|
|
1012
1012
|
return self.array_concat(spotMarket, swapMarket)
|
1013
1013
|
|
1014
1014
|
def fetch_spot_markets(self, params={}):
|
1015
|
+
"""
|
1016
|
+
* @ignore
|
1017
|
+
retrieves data on all spot markets for mexc
|
1018
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#exchange-information
|
1019
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1020
|
+
:returns dict[]: an array of objects representing market data
|
1021
|
+
"""
|
1015
1022
|
response = self.spotPublicGetExchangeInfo(params)
|
1016
1023
|
#
|
1017
1024
|
# {
|
@@ -1127,6 +1134,13 @@ class mexc(Exchange, ImplicitAPI):
|
|
1127
1134
|
return result
|
1128
1135
|
|
1129
1136
|
def fetch_swap_markets(self, params={}):
|
1137
|
+
"""
|
1138
|
+
* @ignore
|
1139
|
+
retrieves data on all swap markets for mexc
|
1140
|
+
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-contract-information
|
1141
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1142
|
+
:returns dict[]: an array of objects representing market data
|
1143
|
+
"""
|
1130
1144
|
response = self.contractPublicGetDetail(params)
|
1131
1145
|
#
|
1132
1146
|
# {
|
@@ -1666,6 +1680,8 @@ class mexc(Exchange, ImplicitAPI):
|
|
1666
1680
|
def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
1667
1681
|
"""
|
1668
1682
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
1683
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#24hr-ticker-price-change-statistics
|
1684
|
+
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-trend-data
|
1669
1685
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
1670
1686
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1671
1687
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -1747,6 +1763,8 @@ class mexc(Exchange, ImplicitAPI):
|
|
1747
1763
|
def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
1748
1764
|
"""
|
1749
1765
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
1766
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#24hr-ticker-price-change-statistics
|
1767
|
+
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-contract-trend-data
|
1750
1768
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
1751
1769
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1752
1770
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -1929,6 +1947,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
1929
1947
|
def fetch_bids_asks(self, symbols: Strings = None, params={}):
|
1930
1948
|
"""
|
1931
1949
|
fetches the bid and ask price and volume for multiple markets
|
1950
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#symbol-order-book-ticker
|
1932
1951
|
:param str[]|None symbols: unified symbols of the markets to fetch the bids and asks for, all markets are returned if not assigned
|
1933
1952
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1934
1953
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -2052,6 +2071,21 @@ class mexc(Exchange, ImplicitAPI):
|
|
2052
2071
|
return self.extend(request, params)
|
2053
2072
|
|
2054
2073
|
def create_spot_order(self, market, type, side, amount, price=None, marginMode=None, params={}):
|
2074
|
+
"""
|
2075
|
+
* @ignore
|
2076
|
+
create a trade order
|
2077
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
|
2078
|
+
:param str symbol: unified symbol of the market to create an order in
|
2079
|
+
:param str type: 'market' or 'limit'
|
2080
|
+
:param str side: 'buy' or 'sell'
|
2081
|
+
:param float amount: how much of currency you want to trade in units of base currency
|
2082
|
+
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
2083
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2084
|
+
:param str [params.marginMode]: only 'isolated' is supported for spot-margin trading
|
2085
|
+
:param float [params.triggerPrice]: The price at which a trigger order is triggered at
|
2086
|
+
:param bool [params.postOnly]: if True, the order will only be posted if it will be a maker order
|
2087
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2088
|
+
"""
|
2055
2089
|
self.load_markets()
|
2056
2090
|
request = self.create_spot_order_request(market, type, side, amount, price, marginMode, params)
|
2057
2091
|
response = self.spotPrivatePostOrder(self.extend(request, params))
|
@@ -2082,6 +2116,30 @@ class mexc(Exchange, ImplicitAPI):
|
|
2082
2116
|
return order
|
2083
2117
|
|
2084
2118
|
def create_swap_order(self, market, type, side, amount, price=None, marginMode=None, params={}):
|
2119
|
+
"""
|
2120
|
+
* @ignore
|
2121
|
+
create a trade order
|
2122
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#new-order
|
2123
|
+
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#order-under-maintenance
|
2124
|
+
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#trigger-order-under-maintenance
|
2125
|
+
:param str symbol: unified symbol of the market to create an order in
|
2126
|
+
:param str type: 'market' or 'limit'
|
2127
|
+
:param str side: 'buy' or 'sell'
|
2128
|
+
:param float amount: how much of currency you want to trade in units of base currency
|
2129
|
+
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
2130
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2131
|
+
:param str [params.marginMode]: only 'isolated' is supported for spot-margin trading
|
2132
|
+
:param float [params.triggerPrice]: The price at which a trigger order is triggered at
|
2133
|
+
:param bool [params.postOnly]: if True, the order will only be posted if it will be a maker order
|
2134
|
+
:param bool [params.reduceOnly]: indicates if self order is to reduce the size of a position
|
2135
|
+
*
|
2136
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
2137
|
+
:param int [params.leverage]: leverage is necessary on isolated margin
|
2138
|
+
:param long [params.positionId]: it is recommended to hasattr(self, fill) parameter when closing a position
|
2139
|
+
:param str [params.externalOid]: external order ID
|
2140
|
+
:param int [params.positionMode]: 1:hedge, 2:one-way, default: the user's current config
|
2141
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2142
|
+
"""
|
2085
2143
|
self.load_markets()
|
2086
2144
|
symbol = market['symbol']
|
2087
2145
|
unavailableContracts = self.safe_value(self.options, 'unavailableContracts', {})
|
@@ -2230,6 +2288,8 @@ class mexc(Exchange, ImplicitAPI):
|
|
2230
2288
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
2231
2289
|
"""
|
2232
2290
|
fetches information on an order made by the user
|
2291
|
+
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#query-order
|
2292
|
+
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#query-the-order-based-on-the-order-number
|
2233
2293
|
:param str symbol: unified symbol of the market the order was made in
|
2234
2294
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2235
2295
|
:param str [params.marginMode]: only 'isolated' is supported, for spot-margin trading
|
@@ -4506,7 +4566,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
4506
4566
|
'entryPrice': entryPrice,
|
4507
4567
|
'collateral': None,
|
4508
4568
|
'side': side,
|
4509
|
-
'
|
4569
|
+
'unrealizedPnl': None,
|
4510
4570
|
'leverage': self.parse_number(leverage),
|
4511
4571
|
'percentage': None,
|
4512
4572
|
'marginMode': marginType,
|
ccxt/pro/__init__.py
CHANGED
ccxt/pro/binance.py
CHANGED
@@ -14,7 +14,6 @@ from ccxt.base.errors import ArgumentsRequired
|
|
14
14
|
from ccxt.base.errors import BadRequest
|
15
15
|
from ccxt.base.errors import NotSupported
|
16
16
|
from ccxt.base.errors import ChecksumError
|
17
|
-
from ccxt.base.errors import UnsubscribeError
|
18
17
|
from ccxt.base.precise import Precise
|
19
18
|
|
20
19
|
|
@@ -952,52 +951,9 @@ class binance(ccxt.async_support.binance):
|
|
952
951
|
for j in range(0, len(messageHashes)):
|
953
952
|
unsubHash = messageHashes[j]
|
954
953
|
subHash = subMessageHashes[j]
|
955
|
-
|
956
|
-
del client.subscriptions[unsubHash]
|
957
|
-
if subHash in client.subscriptions:
|
958
|
-
del client.subscriptions[subHash]
|
959
|
-
error = UnsubscribeError(self.id + ' ' + subHash)
|
960
|
-
client.reject(error, subHash)
|
961
|
-
client.resolve(True, unsubHash)
|
954
|
+
self.clean_unsubscription(client, subHash, unsubHash)
|
962
955
|
self.clean_cache(subscription)
|
963
956
|
|
964
|
-
def clean_cache(self, subscription: dict):
|
965
|
-
topic = self.safe_string(subscription, 'topic')
|
966
|
-
symbols = self.safe_list(subscription, 'symbols', [])
|
967
|
-
symbolsLength = len(symbols)
|
968
|
-
if topic == 'ohlcv':
|
969
|
-
symbolsAndTimeFrames = self.safe_list(subscription, 'symbolsAndTimeframes', [])
|
970
|
-
for i in range(0, len(symbolsAndTimeFrames)):
|
971
|
-
symbolAndTimeFrame = symbolsAndTimeFrames[i]
|
972
|
-
symbol = self.safe_string(symbolAndTimeFrame, 0)
|
973
|
-
timeframe = self.safe_string(symbolAndTimeFrame, 1)
|
974
|
-
if timeframe in self.ohlcvs[symbol]:
|
975
|
-
del self.ohlcvs[symbol][timeframe]
|
976
|
-
elif symbolsLength > 0:
|
977
|
-
for i in range(0, len(symbols)):
|
978
|
-
symbol = symbols[i]
|
979
|
-
if topic == 'trade':
|
980
|
-
del self.trades[symbol]
|
981
|
-
elif topic == 'orderbook':
|
982
|
-
del self.orderbooks[symbol]
|
983
|
-
elif topic == 'ticker':
|
984
|
-
del self.tickers[symbol]
|
985
|
-
else:
|
986
|
-
if topic == 'myTrades':
|
987
|
-
# don't reset self.myTrades directly here
|
988
|
-
# because in c# we need to use a different object
|
989
|
-
keys = list(self.myTrades.keys())
|
990
|
-
for i in range(0, len(keys)):
|
991
|
-
del self.myTrades[keys[i]]
|
992
|
-
elif topic == 'orders':
|
993
|
-
orderSymbols = list(self.orders.keys())
|
994
|
-
for i in range(0, len(orderSymbols)):
|
995
|
-
del self.orders[orderSymbols[i]]
|
996
|
-
elif topic == 'ticker':
|
997
|
-
tickerSymbols = list(self.tickers.keys())
|
998
|
-
for i in range(0, len(tickerSymbols)):
|
999
|
-
del self.tickers[tickerSymbols[i]]
|
1000
|
-
|
1001
957
|
async def watch_trades_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
1002
958
|
"""
|
1003
959
|
get the list of most recent trades for a list of symbols
|
@@ -1106,7 +1062,7 @@ class binance(ccxt.async_support.binance):
|
|
1106
1062
|
'subMessageHashes': subMessageHashes,
|
1107
1063
|
'messageHashes': messageHashes,
|
1108
1064
|
'symbols': symbols,
|
1109
|
-
'topic': '
|
1065
|
+
'topic': 'trades',
|
1110
1066
|
}
|
1111
1067
|
return await self.watch_multiple(url, messageHashes, self.extend(request, query), messageHashes, subscription)
|
1112
1068
|
|
@@ -1810,7 +1766,7 @@ class binance(ccxt.async_support.binance):
|
|
1810
1766
|
result = await self.watch_multi_ticker_helper('watchBidsAsks', 'bookTicker', symbols, params)
|
1811
1767
|
if self.newUpdates:
|
1812
1768
|
return result
|
1813
|
-
return self.filter_by_array(self.
|
1769
|
+
return self.filter_by_array(self.bidsasks, 'symbol', symbols)
|
1814
1770
|
|
1815
1771
|
async def watch_multi_ticker_helper(self, methodName, channelName: str, symbols: Strings = None, params={}):
|
1816
1772
|
await self.load_markets()
|
ccxt/pro/bitget.py
CHANGED
@@ -1876,13 +1876,7 @@ class bitget(ccxt.async_support.bitget):
|
|
1876
1876
|
if symbol in self.ohlcvs:
|
1877
1877
|
if timeframe in self.ohlcvs[symbol]:
|
1878
1878
|
del self.ohlcvs[symbol][timeframe]
|
1879
|
-
|
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)
|
1879
|
+
self.clean_unsubscription(client, subMessageHash, messageHash)
|
1886
1880
|
|
1887
1881
|
def handle_un_subscription_status(self, client: Client, message):
|
1888
1882
|
#
|
ccxt/pro/bitmex.py
CHANGED
@@ -66,6 +66,7 @@ class bitmex(ccxt.async_support.bitmex):
|
|
66
66
|
async def watch_ticker(self, symbol: str, params={}) -> Ticker:
|
67
67
|
"""
|
68
68
|
watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
69
|
+
:see: https://www.bitmex.com/app/wsAPI#Subscriptions
|
69
70
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
70
71
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
71
72
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -78,6 +79,7 @@ class bitmex(ccxt.async_support.bitmex):
|
|
78
79
|
async def watch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
79
80
|
"""
|
80
81
|
watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
|
82
|
+
:see: https://www.bitmex.com/app/wsAPI#Subscriptions
|
81
83
|
:param str[] symbols: unified symbol of the market to fetch the ticker for
|
82
84
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
83
85
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -449,6 +451,7 @@ class bitmex(ccxt.async_support.bitmex):
|
|
449
451
|
async def watch_balance(self, params={}) -> Balances:
|
450
452
|
"""
|
451
453
|
watch balance and get the amount of funds available for trading or funds locked in orders
|
454
|
+
:see: https://www.bitmex.com/app/wsAPI#Subscriptions
|
452
455
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
453
456
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
454
457
|
"""
|
@@ -651,6 +654,7 @@ class bitmex(ccxt.async_support.bitmex):
|
|
651
654
|
async def watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
652
655
|
"""
|
653
656
|
get the list of most recent trades for a particular symbol
|
657
|
+
:see: https://www.bitmex.com/app/wsAPI#Subscriptions
|
654
658
|
:param str symbol: unified symbol of the market to fetch trades for
|
655
659
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
656
660
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -697,8 +701,8 @@ class bitmex(ccxt.async_support.bitmex):
|
|
697
701
|
|
698
702
|
async def watch_positions(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}) -> List[Position]:
|
699
703
|
"""
|
700
|
-
:see: https://www.bitmex.com/app/wsAPI
|
701
704
|
watch all open positions
|
705
|
+
:see: https://www.bitmex.com/app/wsAPI#Subscriptions
|
702
706
|
:param str[]|None symbols: list of unified market symbols
|
703
707
|
:param dict params: extra parameters specific to the exchange API endpoint
|
704
708
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/en/latest/manual.html#position-structure>`
|
@@ -894,6 +898,7 @@ class bitmex(ccxt.async_support.bitmex):
|
|
894
898
|
async def watch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
895
899
|
"""
|
896
900
|
watches information on multiple orders made by the user
|
901
|
+
:see: https://www.bitmex.com/app/wsAPI#Subscriptions
|
897
902
|
:param str symbol: unified market symbol of the market orders were made in
|
898
903
|
:param int [since]: the earliest time in ms to fetch orders for
|
899
904
|
:param int [limit]: the maximum number of order structures to retrieve
|
@@ -1100,6 +1105,7 @@ class bitmex(ccxt.async_support.bitmex):
|
|
1100
1105
|
async def watch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
1101
1106
|
"""
|
1102
1107
|
watches information on multiple trades made by the user
|
1108
|
+
:see: https://www.bitmex.com/app/wsAPI#Subscriptions
|
1103
1109
|
:param str symbol: unified market symbol of the market trades were made in
|
1104
1110
|
:param int [since]: the earliest time in ms to fetch trades for
|
1105
1111
|
:param int [limit]: the maximum number of trade structures to retrieve
|
@@ -1209,6 +1215,7 @@ class bitmex(ccxt.async_support.bitmex):
|
|
1209
1215
|
async def watch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
1210
1216
|
"""
|
1211
1217
|
watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
1218
|
+
:see: https://www.bitmex.com/app/wsAPI#OrderBookL2
|
1212
1219
|
:param str symbol: unified symbol of the market to fetch the order book for
|
1213
1220
|
:param int [limit]: the maximum amount of order book entries to return
|
1214
1221
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1219,6 +1226,7 @@ class bitmex(ccxt.async_support.bitmex):
|
|
1219
1226
|
async def watch_order_book_for_symbols(self, symbols: List[str], limit: Int = None, params={}) -> OrderBook:
|
1220
1227
|
"""
|
1221
1228
|
watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
1229
|
+
:see: https://www.bitmex.com/app/wsAPI#OrderBookL2
|
1222
1230
|
:param str[] symbols: unified array of symbols
|
1223
1231
|
:param int [limit]: the maximum amount of order book entries to return
|
1224
1232
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1255,6 +1263,7 @@ class bitmex(ccxt.async_support.bitmex):
|
|
1255
1263
|
async def watch_trades_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
1256
1264
|
"""
|
1257
1265
|
get the list of most recent trades for a list of symbols
|
1266
|
+
:see: https://www.bitmex.com/app/wsAPI#Subscriptions
|
1258
1267
|
:param str[] symbols: unified symbol of the market to fetch trades for
|
1259
1268
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
1260
1269
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -1288,6 +1297,7 @@ class bitmex(ccxt.async_support.bitmex):
|
|
1288
1297
|
async def watch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
1289
1298
|
"""
|
1290
1299
|
watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
1300
|
+
:see: https://www.bitmex.com/app/wsAPI#Subscriptions
|
1291
1301
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
1292
1302
|
:param str timeframe: the length of time each candle represents
|
1293
1303
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
ccxt/pro/bybit.py
CHANGED
@@ -15,7 +15,6 @@ from ccxt.base.errors import ExchangeError
|
|
15
15
|
from ccxt.base.errors import AuthenticationError
|
16
16
|
from ccxt.base.errors import ArgumentsRequired
|
17
17
|
from ccxt.base.errors import BadRequest
|
18
|
-
from ccxt.base.errors import UnsubscribeError
|
19
18
|
|
20
19
|
|
21
20
|
class bybit(ccxt.async_support.bybit):
|
@@ -953,7 +952,7 @@ class bybit(ccxt.async_support.bybit):
|
|
953
952
|
messageHash = 'unsubscribe:trade:' + symbol
|
954
953
|
messageHashes.append(messageHash)
|
955
954
|
subMessageHashes.append('trade:' + symbol)
|
956
|
-
return await self.un_watch_topics(url, '
|
955
|
+
return await self.un_watch_topics(url, 'trades', symbols, messageHashes, subMessageHashes, topics, params)
|
957
956
|
|
958
957
|
async def un_watch_trades(self, symbol: str, params={}) -> Any:
|
959
958
|
"""
|
@@ -2310,44 +2309,6 @@ class bybit(ccxt.async_support.bybit):
|
|
2310
2309
|
for j in range(0, len(messageHashes)):
|
2311
2310
|
unsubHash = messageHashes[j]
|
2312
2311
|
subHash = subMessageHashes[j]
|
2313
|
-
|
2314
|
-
del client.subscriptions[unsubHash]
|
2315
|
-
if subHash in client.subscriptions:
|
2316
|
-
del client.subscriptions[subHash]
|
2317
|
-
error = UnsubscribeError(self.id + ' ' + messageHash)
|
2318
|
-
client.reject(error, subHash)
|
2319
|
-
client.resolve(True, unsubHash)
|
2312
|
+
self.clean_unsubscription(client, subHash, unsubHash)
|
2320
2313
|
self.clean_cache(subscription)
|
2321
2314
|
return message
|
2322
|
-
|
2323
|
-
def clean_cache(self, subscription: dict):
|
2324
|
-
topic = self.safe_string(subscription, 'topic')
|
2325
|
-
symbols = self.safe_list(subscription, 'symbols', [])
|
2326
|
-
symbolsLength = len(symbols)
|
2327
|
-
if topic == 'ohlcv':
|
2328
|
-
symbolsAndTimeFrames = self.safe_list(subscription, 'symbolsAndTimeframes', [])
|
2329
|
-
for i in range(0, len(symbolsAndTimeFrames)):
|
2330
|
-
symbolAndTimeFrame = symbolsAndTimeFrames[i]
|
2331
|
-
symbol = self.safe_string(symbolAndTimeFrame, 0)
|
2332
|
-
timeframe = self.safe_string(symbolAndTimeFrame, 1)
|
2333
|
-
del self.ohlcvs[symbol][timeframe]
|
2334
|
-
elif symbolsLength > 0:
|
2335
|
-
for i in range(0, len(symbols)):
|
2336
|
-
symbol = symbols[i]
|
2337
|
-
if topic == 'trade':
|
2338
|
-
del self.trades[symbol]
|
2339
|
-
elif topic == 'orderbook':
|
2340
|
-
del self.orderbooks[symbol]
|
2341
|
-
elif topic == 'ticker':
|
2342
|
-
del self.tickers[symbol]
|
2343
|
-
else:
|
2344
|
-
if topic == 'myTrades':
|
2345
|
-
# don't reset self.myTrades directly here
|
2346
|
-
# because in c# we need to use a different object
|
2347
|
-
keys = list(self.myTrades.keys())
|
2348
|
-
for i in range(0, len(keys)):
|
2349
|
-
del self.myTrades[keys[i]]
|
2350
|
-
elif topic == 'orders':
|
2351
|
-
orderSymbols = list(self.orders.keys())
|
2352
|
-
for i in range(0, len(orderSymbols)):
|
2353
|
-
del self.orders[orderSymbols[i]]
|
ccxt/pro/cryptocom.py
CHANGED
@@ -14,7 +14,6 @@ from ccxt.base.errors import ExchangeError
|
|
14
14
|
from ccxt.base.errors import AuthenticationError
|
15
15
|
from ccxt.base.errors import NetworkError
|
16
16
|
from ccxt.base.errors import ChecksumError
|
17
|
-
from ccxt.base.errors import UnsubscribeError
|
18
17
|
|
19
18
|
|
20
19
|
class cryptocom(ccxt.async_support.cryptocom):
|
@@ -349,7 +348,7 @@ class cryptocom(ccxt.async_support.cryptocom):
|
|
349
348
|
currentTopic = 'trade' + '.' + market['id']
|
350
349
|
messageHashes.append('unsubscribe:trades:' + market['symbol'])
|
351
350
|
topics.append(currentTopic)
|
352
|
-
return await self.un_watch_public_multiple('
|
351
|
+
return await self.un_watch_public_multiple('trades', symbols, messageHashes, topics, topics, params)
|
353
352
|
|
354
353
|
def handle_trades(self, client: Client, message):
|
355
354
|
#
|
@@ -1118,33 +1117,5 @@ class cryptocom(ccxt.async_support.cryptocom):
|
|
1118
1117
|
for j in range(0, len(messageHashes)):
|
1119
1118
|
unsubHash = messageHashes[j]
|
1120
1119
|
subHash = subMessageHashes[j]
|
1121
|
-
|
1122
|
-
del client.subscriptions[unsubHash]
|
1123
|
-
if subHash in client.subscriptions:
|
1124
|
-
del client.subscriptions[subHash]
|
1125
|
-
error = UnsubscribeError(self.id + ' ' + subHash)
|
1126
|
-
client.reject(error, subHash)
|
1127
|
-
client.resolve(True, unsubHash)
|
1120
|
+
self.clean_unsubscription(client, subHash, unsubHash)
|
1128
1121
|
self.clean_cache(subscription)
|
1129
|
-
|
1130
|
-
def clean_cache(self, subscription: dict):
|
1131
|
-
topic = self.safe_string(subscription, 'topic')
|
1132
|
-
symbols = self.safe_list(subscription, 'symbols', [])
|
1133
|
-
symbolsLength = len(symbols)
|
1134
|
-
if topic == 'ohlcv':
|
1135
|
-
symbolsAndTimeFrames = self.safe_list(subscription, 'symbolsAndTimeframes', [])
|
1136
|
-
for i in range(0, len(symbolsAndTimeFrames)):
|
1137
|
-
symbolAndTimeFrame = symbolsAndTimeFrames[i]
|
1138
|
-
symbol = self.safe_string(symbolAndTimeFrame, 0)
|
1139
|
-
timeframe = self.safe_string(symbolAndTimeFrame, 1)
|
1140
|
-
if timeframe in self.ohlcvs[symbol]:
|
1141
|
-
del self.ohlcvs[symbol][timeframe]
|
1142
|
-
elif symbolsLength > 0:
|
1143
|
-
for i in range(0, len(symbols)):
|
1144
|
-
symbol = symbols[i]
|
1145
|
-
if topic == 'trade':
|
1146
|
-
del self.trades[symbol]
|
1147
|
-
elif topic == 'orderbook':
|
1148
|
-
del self.orderbooks[symbol]
|
1149
|
-
elif topic == 'ticker':
|
1150
|
-
del self.tickers[symbol]
|
ccxt/pro/gate.py
CHANGED
@@ -16,7 +16,6 @@ from ccxt.base.errors import ArgumentsRequired
|
|
16
16
|
from ccxt.base.errors import BadRequest
|
17
17
|
from ccxt.base.errors import NotSupported
|
18
18
|
from ccxt.base.errors import ChecksumError
|
19
|
-
from ccxt.base.errors import UnsubscribeError
|
20
19
|
from ccxt.base.precise import Precise
|
21
20
|
|
22
21
|
|
@@ -1539,13 +1538,7 @@ class gate(ccxt.async_support.gate):
|
|
1539
1538
|
for j in range(0, len(messageHashes)):
|
1540
1539
|
unsubHash = messageHashes[j]
|
1541
1540
|
subHash = subMessageHashes[j]
|
1542
|
-
|
1543
|
-
del client.subscriptions[unsubHash]
|
1544
|
-
if subHash in client.subscriptions:
|
1545
|
-
del client.subscriptions[subHash]
|
1546
|
-
error = UnsubscribeError(self.id + ' ' + messageHash)
|
1547
|
-
client.reject(error, subHash)
|
1548
|
-
client.resolve(True, unsubHash)
|
1541
|
+
self.clean_unsubscription(client, subHash, unsubHash)
|
1549
1542
|
self.clean_cache(subscription)
|
1550
1543
|
|
1551
1544
|
def clean_cache(self, subscription: dict):
|