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

Method fetch_order

python/ccxt/bitrue.py:2081–2166  ·  view source on GitHub ↗

fetches information on an order made by the user https://www.bitrue.com/api_docs_includes_file/spot/index.html#query-order-user_data https://www.bitrue.com/api_docs_includes_file/futures/index.html#query-order-user_data-hmac-sha256 :param str id: the order id

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

Source from the content-addressed store, hash-verified

2079 return self.parse_order(data, market)
2080
2081 def fetch_order(self, id: str, symbol: Str = None, params={}):
2082 """
2083 fetches information on an order made by the user
2084
2085 https://www.bitrue.com/api_docs_includes_file/spot/index.html#query-order-user_data
2086 https://www.bitrue.com/api_docs_includes_file/futures/index.html#query-order-user_data-hmac-sha256
2087
2088 :param str id: the order id
2089 :param str symbol: unified symbol of the market the order was made in
2090 :param dict [params]: extra parameters specific to the exchange API endpoint
2091 :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
2092 """
2093 if symbol is None:
2094 raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol argument')
2095 self.load_markets()
2096 market = self.market(symbol)
2097 origClientOrderId = self.safe_value_2(params, 'origClientOrderId', 'clientOrderId')
2098 params = self.omit(params, ['origClientOrderId', 'clientOrderId'])
2099 response = None
2100 data = {}
2101 request = {}
2102 if origClientOrderId is None:
2103 request['orderId'] = id
2104 else:
2105 if market['swap']:
2106 request['clientOrderId'] = origClientOrderId
2107 else:
2108 request['origClientOrderId'] = origClientOrderId
2109 if market['swap']:
2110 request['contractName'] = market['id']
2111 if market['linear']:
2112 response = self.fapiV2PrivateGetOrder(self.extend(request, params))
2113 elif market['inverse']:
2114 response = self.dapiV2PrivateGetOrder(self.extend(request, params))
2115 data = self.safe_dict(response, 'data', {})
2116 elif market['spot']:
2117 request['orderId'] = id # spot market id is mandatory
2118 request['symbol'] = market['id']
2119 response = self.spotV1PrivateGetOrder(self.extend(request, params))
2120 data = response
2121 else:
2122 raise NotSupported(self.id + ' fetchOrder only support spot & swap markets')
2123 #
2124 # spot
2125 #
2126 # {
2127 # "symbol": "LTCBTC",
2128 # "orderId": 1,
2129 # "clientOrderId": "myOrder1",
2130 # "price": "0.1",
2131 # "origQty": "1.0",
2132 # "executedQty": "0.0",
2133 # "cummulativeQuoteQty": "0.0",
2134 # "status": "NEW",
2135 # "timeInForce": "GTC",
2136 # "type": "LIMIT",
2137 # "side": "BUY",
2138 # "stopPrice": "0.0",

Callers

nothing calls this directly

Calls 12

parse_orderMethod · 0.95
ArgumentsRequiredClass · 0.90
NotSupportedClass · 0.90
safe_value_2Method · 0.80
safe_dictMethod · 0.80
fapiV2PrivateGetOrderMethod · 0.65
dapiV2PrivateGetOrderMethod · 0.65
spotV1PrivateGetOrderMethod · 0.65
load_marketsMethod · 0.45
marketMethod · 0.45
omitMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected