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

Method fetch_closed_order

python/ccxt/bybit.py:5113–5141  ·  view source on GitHub ↗

fetches information on a closed order made by the user https://bybit-exchange.github.io/docs/v5/order/order-list :param str id: order id :param str [symbol]: unified symbol of the market the order was made in :param dict [params]: extra parameters specific

(self, id: str, symbol: Str = None, params={})

Source from the content-addressed store, hash-verified

5111 return self.parse_orders(data, market, since, limit)
5112
5113 def fetch_closed_order(self, id: str, symbol: Str = None, params={}) -> Order:
5114 """
5115 fetches information on a closed order made by the user
5116
5117 https://bybit-exchange.github.io/docs/v5/order/order-list
5118
5119 :param str id: order id
5120 :param str [symbol]: unified symbol of the market the order was made in
5121 :param dict [params]: extra parameters specific to the exchange API endpoint
5122 :param boolean [params.trigger]: set to True for fetching a closed trigger order
5123 :param boolean [params.stop]: alias for trigger
5124 :param str [params.type]: market type, ['swap', 'option', 'spot']
5125 :param str [params.subType]: market subType, ['linear', 'inverse']
5126 :param str [params.orderFilter]: 'Order' or 'StopOrder' or 'tpslOrder'
5127 :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
5128 """
5129 self.load_markets()
5130 request = {
5131 'orderId': id,
5132 }
5133 result = self.fetch_closed_orders(symbol, None, None, self.extend(request, params))
5134 length = len(result)
5135 if length == 0:
5136 isTrigger = self.safe_bool_n(params, ['trigger', 'stop'], False)
5137 extra = '' if isTrigger else ' If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = True'
5138 raise OrderNotFound('Order ' + str(id) + ' was not found.' + extra)
5139 if length > 1:
5140 raise InvalidOrder(self.id + ' returned more than one order')
5141 return self.safe_value(result, 0)
5142
5143 def fetch_open_order(self, id: str, symbol: Str = None, params={}) -> Order:
5144 """

Callers

nothing calls this directly

Calls 7

fetch_closed_ordersMethod · 0.95
OrderNotFoundClass · 0.90
InvalidOrderClass · 0.90
safe_bool_nMethod · 0.80
safe_valueMethod · 0.80
load_marketsMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected