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

Method fetch_order

python/ccxt/hyperliquid.py:2998–3059  ·  view source on GitHub ↗

fetches information on an order made by the user https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-order-status-by-oid-or-cloid :param str id: order id :param str symbol: unified symbol of the market the order was made in

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

Source from the content-addressed store, hash-verified

2996 return self.parse_orders(deduplicated, market, since, limit)
2997
2998 def fetch_order(self, id: str, symbol: Str = None, params={}):
2999 """
3000 fetches information on an order made by the user
3001
3002 https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-order-status-by-oid-or-cloid
3003
3004 :param str id: order id
3005 :param str symbol: unified symbol of the market the order was made in
3006 :param dict [params]: extra parameters specific to the exchange API endpoint
3007 :param str [params.clientOrderId]: client order id,(optional 128 bit hex string e.g. 0x1234567890abcdef1234567890abcdef)
3008 :param str [params.user]: user address, will default to self.walletAddress if not provided
3009 :param str [params.subAccountAddress]: sub account user address
3010 :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
3011 """
3012 userAddress = None
3013 userAddress, params = self.handle_public_address('fetchOrder', params)
3014 self.load_markets()
3015 market = None
3016 if symbol is not None:
3017 market = self.market(symbol)
3018 clientOrderId = self.safe_string(params, 'clientOrderId')
3019 request = {
3020 'type': 'orderStatus',
3021 # 'oid': id if isClientOrderId else self.parse_to_numeric(id),
3022 'user': userAddress,
3023 }
3024 if clientOrderId is not None:
3025 params = self.omit(params, 'clientOrderId')
3026 request['oid'] = clientOrderId
3027 else:
3028 isClientOrderId = len(id) >= 34
3029 request['oid'] = id if isClientOrderId else self.parse_to_numeric(id)
3030 response = self.publicPostInfo(self.extend(request, params))
3031 #
3032 # {
3033 # "order": {
3034 # "order": {
3035 # "children": [],
3036 # "cloid": null,
3037 # "coin": "ETH",
3038 # "isPositionTpsl": False,
3039 # "isTrigger": False,
3040 # "limitPx": "2000.0",
3041 # "oid": "3991946565",
3042 # "orderType": "Limit",
3043 # "origSz": "0.1",
3044 # "reduceOnly": False,
3045 # "side": "B",
3046 # "sz": "0.1",
3047 # "tif": "Gtc",
3048 # "timestamp": "1704346468838",
3049 # "triggerCondition": "N/A",
3050 # "triggerPx": "0.0"
3051 # },
3052 # "status": "open",
3053 # "statusTimestamp": "1704346468838"
3054 # },
3055 # "status": "order"

Callers

nothing calls this directly

Calls 10

handle_public_addressMethod · 0.95
marketMethod · 0.95
parse_orderMethod · 0.95
safe_stringMethod · 0.80
parse_to_numericMethod · 0.80
safe_dictMethod · 0.80
publicPostInfoMethod · 0.65
load_marketsMethod · 0.45
omitMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected