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

Method fetch_order

python/ccxt/hashkey.py:2974–3069  ·  view source on GitHub ↗

fetches information on an order made by the user https://hashkeyglobal-apidoc.readme.io/reference/query-order https://hashkeyglobal-apidoc.readme.io/reference/get-futures-order :param str id: the order id :param str symbol: unified symbol of the market the

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

Source from the content-addressed store, hash-verified

2972 return [order]
2973
2974 def fetch_order(self, id: str, symbol: Str = None, params={}) -> Order:
2975 """
2976 fetches information on an order made by the user
2977
2978 https://hashkeyglobal-apidoc.readme.io/reference/query-order
2979 https://hashkeyglobal-apidoc.readme.io/reference/get-futures-order
2980
2981 :param str id: the order id
2982 :param str symbol: unified symbol of the market the order was made in
2983 :param dict [params]: extra parameters specific to the exchange API endpoint
2984 :param str [params.type]: 'spot' or 'swap' - the type of the market to fetch entry for(default 'spot')
2985 :param str [params.clientOrderId]: a unique id for the order that can be used alternative for the id
2986 :param str [params.accountId]: *spot markets only* account id to fetch the order from
2987 :param bool [params.trigger]: *swap markets only* True for fetching a trigger order(default False)
2988 :param bool [params.stop]: *swap markets only* an alternative for trigger param
2989 :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
2990 """
2991 methodName = 'fetchOrder'
2992 self.check_type_param(methodName, params)
2993 self.load_markets()
2994 request = {}
2995 clientOrderId = None
2996 clientOrderId, params = self.handle_param_string(params, 'clientOrderId')
2997 if clientOrderId is None:
2998 request['orderId'] = id
2999 market = None
3000 if symbol is not None:
3001 market = self.market(symbol)
3002 marketType = 'spot'
3003 marketType, params = self.handle_market_type_and_params(methodName, market, params, marketType)
3004 response = None
3005 if marketType == 'spot':
3006 if clientOrderId is not None:
3007 request['origClientOrderId'] = clientOrderId
3008 response = self.privateGetApiV1SpotOrder(self.extend(request, params))
3009 #
3010 # {
3011 # "accountId": "1732885739589466112",
3012 # "exchangeId": "301",
3013 # "symbol": "ETHUSDT",
3014 # "symbolName": "ETHUSDT",
3015 # "clientOrderId": "1722004623170558",
3016 # "orderId": "1738695230608169984",
3017 # "price": "0",
3018 # "origQty": "0",
3019 # "executedQty": "0.0061",
3020 # "cummulativeQuoteQty": "19.736489",
3021 # "cumulativeQuoteQty": "19.736489",
3022 # "avgPrice": "3235.49",
3023 # "status": "FILLED",
3024 # "timeInForce": "IOC",
3025 # "type": "MARKET",
3026 # "side": "BUY",
3027 # "stopPrice": "0.0",
3028 # "icebergQty": "0.0",
3029 # "time": "1722004623186",
3030 # "updateTime": "1722004623406",
3031 # "isWorking": True,

Callers

nothing calls this directly

Calls 11

check_type_paramMethod · 0.95
parse_orderMethod · 0.95
NotSupportedClass · 0.90
handle_param_stringMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected