MCPcopy Create free account
hub / github.com/ccxt/ccxt / fetch_my_liquidations

Method fetch_my_liquidations

python/ccxt/bybit.py:8075–8152  ·  view source on GitHub ↗

retrieves the users liquidated positions https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution :param str [symbol]: unified CCXT market symbol :param int [since]: the earliest time in ms to fetch liquidations for :param int [limit]: the m

(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})

Source from the content-addressed store, hash-verified

8073 }
8074
8075 def fetch_my_liquidations(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Liquidation]:
8076 """
8077 retrieves the users liquidated positions
8078
8079 https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution
8080
8081 :param str [symbol]: unified CCXT market symbol
8082 :param int [since]: the earliest time in ms to fetch liquidations for
8083 :param int [limit]: the maximum number of liquidation structures to retrieve
8084 :param dict [params]: exchange specific parameters for the exchange API endpoint
8085 :param str [params.type]: market type, ['swap', 'option', 'spot']
8086 :param str [params.subType]: market subType, ['linear', 'inverse']
8087 :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)
8088 :returns dict: an array of `liquidation structures <https://docs.ccxt.com/?id=liquidation-structure>`
8089 """
8090 self.load_markets()
8091 paginate = False
8092 paginate, params = self.handle_option_and_params(params, 'fetchMyLiquidations', 'paginate')
8093 if paginate:
8094 return self.fetch_paginated_call_cursor('fetchMyLiquidations', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 100)
8095 request = {
8096 'execType': 'BustTrade',
8097 }
8098 market = None
8099 if symbol is not None:
8100 market = self.market(symbol)
8101 request['symbol'] = market['id']
8102 type = None
8103 type, params = self.get_bybit_type('fetchMyLiquidations', market, params)
8104 request['category'] = type
8105 if limit is not None:
8106 request['limit'] = limit
8107 if since is not None:
8108 request['startTime'] = since
8109 request, params = self.handle_until_option('endTime', request, params)
8110 response = self.privateGetV5ExecutionList(self.extend(request, params))
8111 #
8112 # {
8113 # "retCode": 0,
8114 # "retMsg": "OK",
8115 # "result": {
8116 # "nextPageCursor": "132766%3A2%2C132766%3A2",
8117 # "category": "linear",
8118 # "list": [
8119 # {
8120 # "symbol": "ETHPERP",
8121 # "orderType": "Market",
8122 # "underlyingPrice": "",
8123 # "orderLinkId": "",
8124 # "side": "Buy",
8125 # "indexPrice": "",
8126 # "orderId": "8c065341-7b52-4ca9-ac2c-37e31ac55c94",
8127 # "stopOrderType": "UNKNOWN",
8128 # "leavesQty": "0",
8129 # "execTime": "1672282722429",
8130 # "isMaker": False,
8131 # "execFee": "0.071409",
8132 # "feeRate": "0.0006",

Callers

nothing calls this directly

Calls 10

get_bybit_typeMethod · 0.95
handle_until_optionMethod · 0.80
parse_liquidationsMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected