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

Method fetch_order

python/ccxt/bitget.py:6037–6204  ·  view source on GitHub ↗

fetches information on an order made by the user https://www.bitget.com/api-doc/spot/trade/Get-Order-Info https://www.bitget.com/api-doc/contract/trade/Get-Order-Details https://www.bitget.com/api-doc/uta/trade/Get-Order-Details :param str id: the order id

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

Source from the content-addressed store, hash-verified

6035 return self.parse_orders(responseList)
6036
6037 def fetch_order(self, id: str, symbol: Str = None, params={}):
6038 """
6039 fetches information on an order made by the user
6040
6041 https://www.bitget.com/api-doc/spot/trade/Get-Order-Info
6042 https://www.bitget.com/api-doc/contract/trade/Get-Order-Details
6043 https://www.bitget.com/api-doc/uta/trade/Get-Order-Details
6044
6045 :param str id: the order id
6046 :param str symbol: unified symbol of the market the order was made in
6047 :param dict [params]: extra parameters specific to the exchange API endpoint
6048 :param boolean [params.uta]: set to True for the unified trading account(uta), defaults to False
6049 :param str [params.clientOrderId]: the clientOrderId of the order, id does not need to be provided if clientOrderId is provided
6050 :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
6051 """
6052 if symbol is None:
6053 raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol argument')
6054 self.load_markets()
6055 market = self.market(symbol)
6056 request = {
6057 # 'orderId': id,
6058 }
6059 clientOrderId = self.safe_string_2(params, 'clientOrderId', 'clientOid')
6060 if clientOrderId is not None:
6061 params = self.omit(params, ['clientOrderId'])
6062 request['clientOid'] = clientOrderId
6063 else:
6064 request['orderId'] = id
6065 response = None
6066 uta = None
6067 uta, params = self.handle_option_and_params(params, 'fetchOrder', 'uta', False)
6068 if uta:
6069 response = self.privateUtaGetV3TradeOrderInfo(self.extend(request, params))
6070 elif market['spot']:
6071 response = self.privateSpotGetV2SpotTradeOrderInfo(self.extend(request, params))
6072 elif market['swap'] or market['future']:
6073 request['symbol'] = market['id']
6074 productType = None
6075 productType, params = self.handle_product_type_and_params(market, params)
6076 request['productType'] = productType
6077 response = self.privateMixGetV2MixOrderDetail(self.extend(request, params))
6078 else:
6079 raise NotSupported(self.id + ' fetchOrder() does not support ' + market['type'] + ' orders')
6080 #
6081 # spot
6082 #
6083 # {
6084 # "code": "00000",
6085 # "msg": "success",
6086 # "requestTime": 1700719076263,
6087 # "data": [
6088 # {
6089 # "userId": "7264631750",
6090 # "symbol": "BTCUSDT",
6091 # "orderId": "1111461743123927040",
6092 # "clientOid": "63f95110-93b5-4309-8f77-46339f1bcf3c",
6093 # "price": "25000.0000000000000000",
6094 # "size": "0.0002000000000000",

Callers

nothing calls this directly

Calls 15

parse_orderMethod · 0.95
ArgumentsRequiredClass · 0.90
NotSupportedClass · 0.90
OrderNotFoundClass · 0.90
safe_string_2Method · 0.80
safe_dictMethod · 0.80
safe_listMethod · 0.80

Tested by

no test coverage detected