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

Method fetch_order

python/ccxt/async_support/hyperliquid.py:2999–3060  ·  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

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