ccxt 4.2.47__py2.py3-none-any.whl → 4.2.49__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/abstract/bitstamp.py +8 -0
- ccxt/abstract/indodax.py +9 -8
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +9 -4
- ccxt/async_support/bitmart.py +24 -2
- ccxt/async_support/bitstamp.py +8 -0
- ccxt/async_support/btcalpha.py +4 -0
- ccxt/async_support/btcmarkets.py +4 -0
- ccxt/async_support/btcturk.py +4 -0
- ccxt/async_support/bybit.py +132 -6
- ccxt/async_support/idex.py +48 -1
- ccxt/async_support/independentreserve.py +47 -1
- ccxt/async_support/indodax.py +115 -19
- ccxt/async_support/latoken.py +16 -0
- ccxt/async_support/luno.py +18 -0
- ccxt/async_support/lykke.py +19 -0
- ccxt/async_support/ndax.py +18 -0
- ccxt/async_support/okx.py +32 -5
- ccxt/async_support/upbit.py +92 -17
- ccxt/base/exchange.py +2 -2
- ccxt/binance.py +9 -4
- ccxt/bitmart.py +24 -2
- ccxt/bitstamp.py +8 -0
- ccxt/btcalpha.py +4 -0
- ccxt/btcmarkets.py +4 -0
- ccxt/btcturk.py +4 -0
- ccxt/bybit.py +132 -6
- ccxt/idex.py +48 -1
- ccxt/independentreserve.py +47 -1
- ccxt/indodax.py +115 -19
- ccxt/latoken.py +16 -0
- ccxt/luno.py +18 -0
- ccxt/lykke.py +19 -0
- ccxt/ndax.py +18 -0
- ccxt/okx.py +32 -5
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/ascendex.py +19 -7
- ccxt/pro/bitget.py +24 -7
- ccxt/pro/bitstamp.py +1 -1
- ccxt/pro/hitbtc.py +6 -11
- ccxt/pro/mexc.py +2 -1
- ccxt/test/test_async.py +10 -10
- ccxt/test/test_sync.py +10 -10
- ccxt/upbit.py +92 -17
- {ccxt-4.2.47.dist-info → ccxt-4.2.49.dist-info}/METADATA +4 -4
- {ccxt-4.2.47.dist-info → ccxt-4.2.49.dist-info}/RECORD +50 -50
- {ccxt-4.2.47.dist-info → ccxt-4.2.49.dist-info}/WHEEL +0 -0
- {ccxt-4.2.47.dist-info → ccxt-4.2.49.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/abstract/bitstamp.py
CHANGED
@@ -226,3 +226,11 @@ class ImplicitAPI:
|
|
226
226
|
private_post_eurcv_address = privatePostEurcvAddress = Entry('eurcv_address/', 'private', 'POST', {'cost': 1})
|
227
227
|
private_post_pyusd_withdrawal = privatePostPyusdWithdrawal = Entry('pyusd_withdrawal/', 'private', 'POST', {'cost': 1})
|
228
228
|
private_post_pyusd_address = privatePostPyusdAddress = Entry('pyusd_address/', 'private', 'POST', {'cost': 1})
|
229
|
+
private_post_lmwr_withdrawal = privatePostLmwrWithdrawal = Entry('lmwr_withdrawal/', 'private', 'POST', {'cost': 1})
|
230
|
+
private_post_lmwr_address = privatePostLmwrAddress = Entry('lmwr_address/', 'private', 'POST', {'cost': 1})
|
231
|
+
private_post_pepe_withdrawal = privatePostPepeWithdrawal = Entry('pepe_withdrawal/', 'private', 'POST', {'cost': 1})
|
232
|
+
private_post_pepe_address = privatePostPepeAddress = Entry('pepe_address/', 'private', 'POST', {'cost': 1})
|
233
|
+
private_post_blur_withdrawal = privatePostBlurWithdrawal = Entry('blur_withdrawal/', 'private', 'POST', {'cost': 1})
|
234
|
+
private_post_blur_address = privatePostBlurAddress = Entry('blur_address/', 'private', 'POST', {'cost': 1})
|
235
|
+
private_post_vext_withdrawal = privatePostVextWithdrawal = Entry('vext_withdrawal/', 'private', 'POST', {'cost': 1})
|
236
|
+
private_post_vext_address = privatePostVextAddress = Entry('vext_address/', 'private', 'POST', {'cost': 1})
|
ccxt/abstract/indodax.py
CHANGED
@@ -2,14 +2,15 @@ from ccxt.base.types import Entry
|
|
2
2
|
|
3
3
|
|
4
4
|
class ImplicitAPI:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
5
|
+
public_get_api_server_time = publicGetApiServerTime = Entry('api/server_time', 'public', 'GET', {'cost': 5})
|
6
|
+
public_get_api_pairs = publicGetApiPairs = Entry('api/pairs', 'public', 'GET', {'cost': 5})
|
7
|
+
public_get_api_price_increments = publicGetApiPriceIncrements = Entry('api/price_increments', 'public', 'GET', {'cost': 5})
|
8
|
+
public_get_api_summaries = publicGetApiSummaries = Entry('api/summaries', 'public', 'GET', {'cost': 5})
|
9
|
+
public_get_api_ticker_pair = publicGetApiTickerPair = Entry('api/ticker/{pair}', 'public', 'GET', {'cost': 5})
|
10
|
+
public_get_api_ticker_all = publicGetApiTickerAll = Entry('api/ticker_all', 'public', 'GET', {'cost': 5})
|
11
|
+
public_get_api_trades_pair = publicGetApiTradesPair = Entry('api/trades/{pair}', 'public', 'GET', {'cost': 5})
|
12
|
+
public_get_api_depth_pair = publicGetApiDepthPair = Entry('api/depth/{pair}', 'public', 'GET', {'cost': 5})
|
13
|
+
public_get_tradingview_history_v2 = publicGetTradingviewHistoryV2 = Entry('tradingview/history_v2', 'public', 'GET', {'cost': 5})
|
13
14
|
private_post_getinfo = privatePostGetInfo = Entry('getInfo', 'private', 'POST', {'cost': 4})
|
14
15
|
private_post_transhistory = privatePostTransHistory = Entry('transHistory', 'private', 'POST', {'cost': 4})
|
15
16
|
private_post_trade = privatePostTrade = Entry('trade', 'private', 'POST', {'cost': 1})
|
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/binance.py
CHANGED
@@ -2986,7 +2986,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2986
2986
|
fees = self.fees
|
2987
2987
|
linear = None
|
2988
2988
|
inverse = None
|
2989
|
-
strike = self.
|
2989
|
+
strike = self.safe_string(market, 'strikePrice')
|
2990
2990
|
symbol = base + '/' + quote
|
2991
2991
|
if contract:
|
2992
2992
|
if swap:
|
@@ -2994,7 +2994,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2994
2994
|
elif future:
|
2995
2995
|
symbol = symbol + ':' + settle + '-' + self.yymmdd(expiry)
|
2996
2996
|
elif option:
|
2997
|
-
symbol = symbol + ':' + settle + '-' + self.yymmdd(expiry) + '-' +
|
2997
|
+
symbol = symbol + ':' + settle + '-' + self.yymmdd(expiry) + '-' + strike + '-' + self.safe_string(optionParts, 3)
|
2998
2998
|
contractSize = self.safe_number_2(market, 'contractSize', 'unit', self.parse_number('1'))
|
2999
2999
|
linear = settle == quote
|
3000
3000
|
inverse = settle == base
|
@@ -3018,6 +3018,9 @@ class binance(Exchange, ImplicitAPI):
|
|
3018
3018
|
elif option:
|
3019
3019
|
unifiedType = 'option'
|
3020
3020
|
active = None
|
3021
|
+
parsedStrike = None
|
3022
|
+
if strike is not None:
|
3023
|
+
parsedStrike = self.parse_to_numeric(strike)
|
3021
3024
|
entry = {
|
3022
3025
|
'id': id,
|
3023
3026
|
'lowercaseId': lowercaseId,
|
@@ -3043,7 +3046,7 @@ class binance(Exchange, ImplicitAPI):
|
|
3043
3046
|
'contractSize': contractSize,
|
3044
3047
|
'expiry': expiry,
|
3045
3048
|
'expiryDatetime': self.iso8601(expiry),
|
3046
|
-
'strike':
|
3049
|
+
'strike': parsedStrike,
|
3047
3050
|
'optionType': self.safe_string_lower(market, 'side'),
|
3048
3051
|
'precision': {
|
3049
3052
|
'amount': self.safe_integer_2(market, 'quantityPrecision', 'quantityScale'),
|
@@ -5514,12 +5517,14 @@ class binance(Exchange, ImplicitAPI):
|
|
5514
5517
|
trailingDelta = self.safe_string(params, 'trailingDelta')
|
5515
5518
|
trailingTriggerPrice = self.safe_string_2(params, 'trailingTriggerPrice', 'activationPrice', self.number_to_string(price))
|
5516
5519
|
trailingPercent = self.safe_string_2(params, 'trailingPercent', 'callbackRate')
|
5520
|
+
priceMatch = self.safe_string(params, 'priceMatch')
|
5517
5521
|
isTrailingPercentOrder = trailingPercent is not None
|
5518
5522
|
isStopLoss = stopLossPrice is not None or trailingDelta is not None
|
5519
5523
|
isTakeProfit = takeProfitPrice is not None
|
5520
5524
|
isTriggerOrder = triggerPrice is not None
|
5521
5525
|
isConditional = isTriggerOrder or isTrailingPercentOrder or isStopLoss or isTakeProfit
|
5522
5526
|
isPortfolioMarginConditional = (isPortfolioMargin and isConditional)
|
5527
|
+
isPriceMatch = priceMatch is not None
|
5523
5528
|
uppercaseType = type.upper()
|
5524
5529
|
stopPrice = None
|
5525
5530
|
if isTrailingPercentOrder:
|
@@ -5656,7 +5661,7 @@ class binance(Exchange, ImplicitAPI):
|
|
5656
5661
|
request['quantity'] = self.parse_to_numeric(amount)
|
5657
5662
|
else:
|
5658
5663
|
request['quantity'] = self.amount_to_precision(symbol, amount)
|
5659
|
-
if priceIsRequired:
|
5664
|
+
if priceIsRequired and not isPriceMatch:
|
5660
5665
|
if price is None:
|
5661
5666
|
raise InvalidOrder(self.id + ' createOrder() requires a price argument for a ' + type + ' order')
|
5662
5667
|
request['price'] = self.price_to_precision(symbol, price)
|
ccxt/async_support/bitmart.py
CHANGED
@@ -1121,7 +1121,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1121
1121
|
|
1122
1122
|
def parse_ticker(self, ticker, market: Market = None) -> Ticker:
|
1123
1123
|
#
|
1124
|
-
# spot
|
1124
|
+
# spot(REST)
|
1125
1125
|
#
|
1126
1126
|
# {
|
1127
1127
|
# "symbol": "SOLAR_USDT",
|
@@ -1141,6 +1141,17 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1141
1141
|
# "timestamp": 1667403439367
|
1142
1142
|
# }
|
1143
1143
|
#
|
1144
|
+
# spot(WS)
|
1145
|
+
# {
|
1146
|
+
# "symbol":"BTC_USDT",
|
1147
|
+
# "last_price":"146.24",
|
1148
|
+
# "open_24h":"147.17",
|
1149
|
+
# "high_24h":"147.48",
|
1150
|
+
# "low_24h":"143.88",
|
1151
|
+
# "base_volume_24h":"117387.58", # NOT base, but quote currencynot !!
|
1152
|
+
# "s_t": 1610936002
|
1153
|
+
# }
|
1154
|
+
#
|
1144
1155
|
# swap
|
1145
1156
|
#
|
1146
1157
|
# {
|
@@ -1157,6 +1168,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1157
1168
|
# }
|
1158
1169
|
#
|
1159
1170
|
timestamp = self.safe_integer(ticker, 'timestamp')
|
1171
|
+
if timestamp is None:
|
1172
|
+
# ticker from WS has a different field(in seconds)
|
1173
|
+
timestamp = self.safe_integer_product(ticker, 's_t', 1000)
|
1160
1174
|
marketId = self.safe_string_2(ticker, 'symbol', 'contract_symbol')
|
1161
1175
|
market = self.safe_market(marketId, market)
|
1162
1176
|
symbol = market['symbol']
|
@@ -1171,7 +1185,15 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1171
1185
|
percentage = '0'
|
1172
1186
|
baseVolume = self.safe_string(ticker, 'base_volume_24h')
|
1173
1187
|
quoteVolume = self.safe_string(ticker, 'quote_volume_24h')
|
1174
|
-
quoteVolume
|
1188
|
+
if quoteVolume is None:
|
1189
|
+
if baseVolume is None:
|
1190
|
+
# self is swap
|
1191
|
+
quoteVolume = self.safe_string(ticker, 'volume_24h', quoteVolume)
|
1192
|
+
else:
|
1193
|
+
# self is a ticker from websockets
|
1194
|
+
# contrary to name and documentation, base_volume_24h is actually the quote volume
|
1195
|
+
quoteVolume = baseVolume
|
1196
|
+
baseVolume = None
|
1175
1197
|
average = self.safe_string_2(ticker, 'avg_price', 'index_price')
|
1176
1198
|
high = self.safe_string_2(ticker, 'high_24h', 'high_price')
|
1177
1199
|
low = self.safe_string_2(ticker, 'low_24h', 'low_price')
|
ccxt/async_support/bitstamp.py
CHANGED
@@ -361,6 +361,14 @@ class bitstamp(Exchange, ImplicitAPI):
|
|
361
361
|
'eurcv_address/': 1,
|
362
362
|
'pyusd_withdrawal/': 1,
|
363
363
|
'pyusd_address/': 1,
|
364
|
+
'lmwr_withdrawal/': 1,
|
365
|
+
'lmwr_address/': 1,
|
366
|
+
'pepe_withdrawal/': 1,
|
367
|
+
'pepe_address/': 1,
|
368
|
+
'blur_withdrawal/': 1,
|
369
|
+
'blur_address/': 1,
|
370
|
+
'vext_withdrawal/': 1,
|
371
|
+
'vext_address/': 1,
|
364
372
|
},
|
365
373
|
},
|
366
374
|
},
|
ccxt/async_support/btcalpha.py
CHANGED
@@ -36,6 +36,7 @@ class btcalpha(Exchange, ImplicitAPI):
|
|
36
36
|
'cancelOrder': True,
|
37
37
|
'closeAllPositions': False,
|
38
38
|
'closePosition': False,
|
39
|
+
'createDepositAddress': False,
|
39
40
|
'createOrder': True,
|
40
41
|
'createReduceOnlyOrder': False,
|
41
42
|
'createStopLimitOrder': False,
|
@@ -48,6 +49,9 @@ class btcalpha(Exchange, ImplicitAPI):
|
|
48
49
|
'fetchCrossBorrowRate': False,
|
49
50
|
'fetchCrossBorrowRates': False,
|
50
51
|
'fetchDeposit': False,
|
52
|
+
'fetchDepositAddress': False,
|
53
|
+
'fetchDepositAddresses': False,
|
54
|
+
'fetchDepositAddressesByNetwork': False,
|
51
55
|
'fetchDeposits': True,
|
52
56
|
'fetchFundingHistory': False,
|
53
57
|
'fetchFundingRate': False,
|
ccxt/async_support/btcmarkets.py
CHANGED
@@ -40,6 +40,7 @@ class btcmarkets(Exchange, ImplicitAPI):
|
|
40
40
|
'cancelOrders': True,
|
41
41
|
'closeAllPositions': False,
|
42
42
|
'closePosition': False,
|
43
|
+
'createDepositAddress': False,
|
43
44
|
'createOrder': True,
|
44
45
|
'createReduceOnlyOrder': False,
|
45
46
|
'fetchBalance': True,
|
@@ -48,6 +49,9 @@ class btcmarkets(Exchange, ImplicitAPI):
|
|
48
49
|
'fetchClosedOrders': 'emulated',
|
49
50
|
'fetchCrossBorrowRate': False,
|
50
51
|
'fetchCrossBorrowRates': False,
|
52
|
+
'fetchDepositAddress': False,
|
53
|
+
'fetchDepositAddresses': False,
|
54
|
+
'fetchDepositAddressesByNetwork': False,
|
51
55
|
'fetchDeposits': True,
|
52
56
|
'fetchDepositsWithdrawals': True,
|
53
57
|
'fetchFundingHistory': False,
|
ccxt/async_support/btcturk.py
CHANGED
@@ -37,6 +37,7 @@ class btcturk(Exchange, ImplicitAPI):
|
|
37
37
|
'cancelOrder': True,
|
38
38
|
'closeAllPositions': False,
|
39
39
|
'closePosition': False,
|
40
|
+
'createDepositAddress': False,
|
40
41
|
'createOrder': True,
|
41
42
|
'createReduceOnlyOrder': False,
|
42
43
|
'fetchBalance': True,
|
@@ -44,6 +45,9 @@ class btcturk(Exchange, ImplicitAPI):
|
|
44
45
|
'fetchBorrowRateHistory': False,
|
45
46
|
'fetchCrossBorrowRate': False,
|
46
47
|
'fetchCrossBorrowRates': False,
|
48
|
+
'fetchDepositAddress': False,
|
49
|
+
'fetchDepositAddresses': False,
|
50
|
+
'fetchDepositAddressesByNetwork': False,
|
47
51
|
'fetchFundingHistory': False,
|
48
52
|
'fetchFundingRate': False,
|
49
53
|
'fetchFundingRateHistory': False,
|
ccxt/async_support/bybit.py
CHANGED
@@ -96,6 +96,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
96
96
|
'fetchMarketLeverageTiers': True,
|
97
97
|
'fetchMarkets': True,
|
98
98
|
'fetchMarkOHLCV': True,
|
99
|
+
'fetchMyLiquidations': True,
|
99
100
|
'fetchMySettlementHistory': True,
|
100
101
|
'fetchMyTrades': True,
|
101
102
|
'fetchOHLCV': True,
|
@@ -4263,7 +4264,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4263
4264
|
paginate = False
|
4264
4265
|
paginate, params = self.handle_option_and_params(params, 'fetchOrders', 'paginate')
|
4265
4266
|
if paginate:
|
4266
|
-
return await self.fetch_paginated_call_cursor('fetchOrders', symbol, since, limit, params, 'nextPageCursor', '
|
4267
|
+
return await self.fetch_paginated_call_cursor('fetchOrders', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
|
4267
4268
|
enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
|
4268
4269
|
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
4269
4270
|
request = {}
|
@@ -4423,7 +4424,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4423
4424
|
paginate = False
|
4424
4425
|
paginate, params = self.handle_option_and_params(params, 'fetchCanceledAndClosedOrders', 'paginate')
|
4425
4426
|
if paginate:
|
4426
|
-
return await self.fetch_paginated_call_cursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, 'nextPageCursor', '
|
4427
|
+
return await self.fetch_paginated_call_cursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
|
4427
4428
|
enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
|
4428
4429
|
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
4429
4430
|
request = {}
|
@@ -4767,7 +4768,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4767
4768
|
paginate = False
|
4768
4769
|
paginate, params = self.handle_option_and_params(params, 'fetchMyTrades', 'paginate')
|
4769
4770
|
if paginate:
|
4770
|
-
return await self.fetch_paginated_call_cursor('fetchMyTrades', symbol, since, limit, params, 'nextPageCursor', '
|
4771
|
+
return await self.fetch_paginated_call_cursor('fetchMyTrades', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 100)
|
4771
4772
|
enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
|
4772
4773
|
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
4773
4774
|
request = {}
|
@@ -4957,7 +4958,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4957
4958
|
paginate = False
|
4958
4959
|
paginate, params = self.handle_option_and_params(params, 'fetchDeposits', 'paginate')
|
4959
4960
|
if paginate:
|
4960
|
-
return await self.fetch_paginated_call_cursor('fetchDeposits', code, since, limit, params, 'nextPageCursor', '
|
4961
|
+
return await self.fetch_paginated_call_cursor('fetchDeposits', code, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
|
4961
4962
|
request = {
|
4962
4963
|
# 'coin': currency['id'],
|
4963
4964
|
# 'limit': 20, # max 50
|
@@ -5019,7 +5020,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5019
5020
|
paginate = False
|
5020
5021
|
paginate, params = self.handle_option_and_params(params, 'fetchWithdrawals', 'paginate')
|
5021
5022
|
if paginate:
|
5022
|
-
return await self.fetch_paginated_call_cursor('fetchWithdrawals', code, since, limit, params, 'nextPageCursor', '
|
5023
|
+
return await self.fetch_paginated_call_cursor('fetchWithdrawals', code, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
|
5023
5024
|
request = {
|
5024
5025
|
# 'coin': currency['id'],
|
5025
5026
|
# 'limit': 20, # max 50
|
@@ -6420,7 +6421,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6420
6421
|
paginate = False
|
6421
6422
|
paginate, params = self.handle_option_and_params(params, 'fetchTransfers', 'paginate')
|
6422
6423
|
if paginate:
|
6423
|
-
return await self.fetch_paginated_call_cursor('fetchTransfers', code, since, limit, params, 'nextPageCursor', '
|
6424
|
+
return await self.fetch_paginated_call_cursor('fetchTransfers', code, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
|
6424
6425
|
currency = None
|
6425
6426
|
request = {}
|
6426
6427
|
if code is not None:
|
@@ -7213,6 +7214,131 @@ class bybit(Exchange, ImplicitAPI):
|
|
7213
7214
|
'info': greeks,
|
7214
7215
|
}
|
7215
7216
|
|
7217
|
+
async def fetch_my_liquidations(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
7218
|
+
"""
|
7219
|
+
retrieves the users liquidated positions
|
7220
|
+
:see: https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution
|
7221
|
+
:param str [symbol]: unified CCXT market symbol
|
7222
|
+
:param int [since]: the earliest time in ms to fetch liquidations for
|
7223
|
+
:param int [limit]: the maximum number of liquidation structures to retrieve
|
7224
|
+
:param dict [params]: exchange specific parameters for the exchange API endpoint
|
7225
|
+
:param str [params.type]: market type, ['swap', 'option', 'spot']
|
7226
|
+
:param str [params.subType]: market subType, ['linear', 'inverse']
|
7227
|
+
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
7228
|
+
:returns dict: an array of `liquidation structures <https://docs.ccxt.com/#/?id=liquidation-structure>`
|
7229
|
+
"""
|
7230
|
+
await self.load_markets()
|
7231
|
+
paginate = False
|
7232
|
+
paginate, params = self.handle_option_and_params(params, 'fetchMyLiquidations', 'paginate')
|
7233
|
+
if paginate:
|
7234
|
+
return await self.fetch_paginated_call_cursor('fetchMyLiquidations', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 100)
|
7235
|
+
request = {
|
7236
|
+
'execType': 'BustTrade',
|
7237
|
+
}
|
7238
|
+
market = None
|
7239
|
+
if symbol is not None:
|
7240
|
+
market = self.market(symbol)
|
7241
|
+
request['symbol'] = market['id']
|
7242
|
+
type = None
|
7243
|
+
type, params = self.get_bybit_type('fetchMyLiquidations', market, params)
|
7244
|
+
request['category'] = type
|
7245
|
+
if limit is not None:
|
7246
|
+
request['limit'] = limit
|
7247
|
+
if since is not None:
|
7248
|
+
request['startTime'] = since
|
7249
|
+
request, params = self.handle_until_option('endTime', request, params)
|
7250
|
+
response = await self.privateGetV5ExecutionList(self.extend(request, params))
|
7251
|
+
#
|
7252
|
+
# {
|
7253
|
+
# "retCode": 0,
|
7254
|
+
# "retMsg": "OK",
|
7255
|
+
# "result": {
|
7256
|
+
# "nextPageCursor": "132766%3A2%2C132766%3A2",
|
7257
|
+
# "category": "linear",
|
7258
|
+
# "list": [
|
7259
|
+
# {
|
7260
|
+
# "symbol": "ETHPERP",
|
7261
|
+
# "orderType": "Market",
|
7262
|
+
# "underlyingPrice": "",
|
7263
|
+
# "orderLinkId": "",
|
7264
|
+
# "side": "Buy",
|
7265
|
+
# "indexPrice": "",
|
7266
|
+
# "orderId": "8c065341-7b52-4ca9-ac2c-37e31ac55c94",
|
7267
|
+
# "stopOrderType": "UNKNOWN",
|
7268
|
+
# "leavesQty": "0",
|
7269
|
+
# "execTime": "1672282722429",
|
7270
|
+
# "isMaker": False,
|
7271
|
+
# "execFee": "0.071409",
|
7272
|
+
# "feeRate": "0.0006",
|
7273
|
+
# "execId": "e0cbe81d-0f18-5866-9415-cf319b5dab3b",
|
7274
|
+
# "tradeIv": "",
|
7275
|
+
# "blockTradeId": "",
|
7276
|
+
# "markPrice": "1183.54",
|
7277
|
+
# "execPrice": "1190.15",
|
7278
|
+
# "markIv": "",
|
7279
|
+
# "orderQty": "0.1",
|
7280
|
+
# "orderPrice": "1236.9",
|
7281
|
+
# "execValue": "119.015",
|
7282
|
+
# "execType": "Trade",
|
7283
|
+
# "execQty": "0.1"
|
7284
|
+
# }
|
7285
|
+
# ]
|
7286
|
+
# },
|
7287
|
+
# "retExtInfo": {},
|
7288
|
+
# "time": 1672283754510
|
7289
|
+
# }
|
7290
|
+
#
|
7291
|
+
liquidations = self.add_pagination_cursor_to_result(response)
|
7292
|
+
return self.parse_liquidations(liquidations, market, since, limit)
|
7293
|
+
|
7294
|
+
def parse_liquidation(self, liquidation, market: Market = None):
|
7295
|
+
#
|
7296
|
+
# {
|
7297
|
+
# "symbol": "ETHPERP",
|
7298
|
+
# "orderType": "Market",
|
7299
|
+
# "underlyingPrice": "",
|
7300
|
+
# "orderLinkId": "",
|
7301
|
+
# "side": "Buy",
|
7302
|
+
# "indexPrice": "",
|
7303
|
+
# "orderId": "8c065341-7b52-4ca9-ac2c-37e31ac55c94",
|
7304
|
+
# "stopOrderType": "UNKNOWN",
|
7305
|
+
# "leavesQty": "0",
|
7306
|
+
# "execTime": "1672282722429",
|
7307
|
+
# "isMaker": False,
|
7308
|
+
# "execFee": "0.071409",
|
7309
|
+
# "feeRate": "0.0006",
|
7310
|
+
# "execId": "e0cbe81d-0f18-5866-9415-cf319b5dab3b",
|
7311
|
+
# "tradeIv": "",
|
7312
|
+
# "blockTradeId": "",
|
7313
|
+
# "markPrice": "1183.54",
|
7314
|
+
# "execPrice": "1190.15",
|
7315
|
+
# "markIv": "",
|
7316
|
+
# "orderQty": "0.1",
|
7317
|
+
# "orderPrice": "1236.9",
|
7318
|
+
# "execValue": "119.015",
|
7319
|
+
# "execType": "Trade",
|
7320
|
+
# "execQty": "0.1"
|
7321
|
+
# }
|
7322
|
+
#
|
7323
|
+
marketId = self.safe_string(liquidation, 'symbol')
|
7324
|
+
timestamp = self.safe_integer(liquidation, 'execTime')
|
7325
|
+
contractsString = self.safe_string(liquidation, 'execQty')
|
7326
|
+
contractSizeString = self.safe_string(market, 'contractSize')
|
7327
|
+
priceString = self.safe_string(liquidation, 'execPrice')
|
7328
|
+
baseValueString = Precise.string_mul(contractsString, contractSizeString)
|
7329
|
+
quoteValueString = Precise.string_mul(baseValueString, priceString)
|
7330
|
+
return self.safe_liquidation({
|
7331
|
+
'info': liquidation,
|
7332
|
+
'symbol': self.safe_symbol(marketId, market),
|
7333
|
+
'contracts': self.parse_number(contractsString),
|
7334
|
+
'contractSize': self.parse_number(contractSizeString),
|
7335
|
+
'price': self.parse_number(priceString),
|
7336
|
+
'baseValue': self.parse_number(baseValueString),
|
7337
|
+
'quoteValue': self.parse_number(quoteValueString),
|
7338
|
+
'timestamp': timestamp,
|
7339
|
+
'datetime': self.iso8601(timestamp),
|
7340
|
+
})
|
7341
|
+
|
7216
7342
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
7217
7343
|
url = self.implode_hostname(self.urls['api'][api]) + '/' + path
|
7218
7344
|
if api == 'public':
|