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

Method fetch_order

python/ccxt/async_support/htx.py:3622–3825  ·  view source on GitHub ↗

fetches information on an order made by the user https://huobiapi.github.io/docs/spot/v1/en/#get-the-order-detail-of-an-order-based-on-client-order-id https://huobiapi.github.io/docs/spot/v1/en/#get-the-order-detail-of-an-order https://www.htx.com/en-us/opend/newApi

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

Source from the content-addressed store, hash-verified

3620 return result
3621
3622 async def fetch_order(self, id: str, symbol: Str = None, params={}):
3623 """
3624 fetches information on an order made by the user
3625
3626 https://huobiapi.github.io/docs/spot/v1/en/#get-the-order-detail-of-an-order-based-on-client-order-id
3627 https://huobiapi.github.io/docs/spot/v1/en/#get-the-order-detail-of-an-order
3628 https://www.htx.com/en-us/opend/newApiPages/?id=8cb89359-77b5-11ed-9966-196a8401f83
3629 https://huobiapi.github.io/docs/dm/v1/en/#get-information-of-an-order
3630 https://huobiapi.github.io/docs/coin_margined_swap/v1/en/#get-information-of-an-order
3631
3632 :param str id: order id
3633 :param str [symbol]: unified symbol of the market the order was made in
3634 :param dict [params]: extra parameters specific to the exchange API endpoint
3635 :param bool [params.trigger]: *linear only* set to True if you want to fetch a trigger order
3636 :param bool [params.stopLossTakeProfit]: *linear only* set to True if you want to fetch a stop-loss take-profit order
3637 :param bool [params.stopLoss]: *linear only* set to True if you want to fetch a stop-loss order
3638 :param bool [params.takeProfit]: *linear only* set to True if you want to fetch a take-profit order
3639 :param bool [params.trailing]: *linear only* set to True if you want to fetch a trailing order
3640 :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
3641 """
3642 await self.load_markets()
3643 market = None
3644 if symbol is not None:
3645 market = self.market(symbol)
3646 marketType = None
3647 marketType, params = self.handle_market_type_and_params('fetchOrder', market, params)
3648 request = {
3649 # spot -----------------------------------------------------------
3650 # 'order-id': 'id',
3651 # 'symbol': market['id'],
3652 # 'client-order-id': clientOrderId,
3653 # 'clientOrderId': clientOrderId,
3654 # contracts ------------------------------------------------------
3655 # 'order_id': id,
3656 # 'client_order_id': clientOrderId,
3657 # 'contract_code': market['id'],
3658 # 'pair': 'BTC-USDT',
3659 # 'contract_type': 'this_week', # swap, self_week, next_week, quarter, next_ quarter
3660 }
3661 response = None
3662 if marketType == 'spot':
3663 clientOrderId = self.safe_string(params, 'clientOrderId')
3664 if clientOrderId is not None:
3665 # will be filled below in self.extend()
3666 # they expect clientOrderId instead of client-order-id
3667 # request['clientOrderId'] = clientOrderId
3668 response = await self.spotPrivateGetV1OrderOrdersGetClientOrder(self.extend(request, params))
3669 else:
3670 request['order-id'] = id
3671 response = await self.spotPrivateGetV1OrderOrdersOrderId(self.extend(request, params))
3672 else:
3673 trigger = self.safe_bool_2(params, 'stop', 'trigger')
3674 stopLossTakeProfit = self.safe_bool(params, 'stopLossTakeProfit')
3675 stopLoss = self.safe_bool(params, 'stopLoss')
3676 takeProfit = self.safe_bool(params, 'takeProfit')
3677 trailing = self.safe_bool(params, 'trailing')
3678 isAlgo = (trigger or stopLoss or takeProfit or stopLossTakeProfit or trailing)
3679 params = self.omit(params, ['stop', 'stopLossTakeProfit', 'trailing', 'trigger', 'stopLoss', 'takeProfit'])

Callers

nothing calls this directly

Calls 15

parse_orderMethod · 0.95
ArgumentsRequiredClass · 0.90
NotSupportedClass · 0.90
safe_stringMethod · 0.80
safe_bool_2Method · 0.80
safe_boolMethod · 0.80
safe_string_nMethod · 0.80
safe_valueMethod · 0.80

Tested by

no test coverage detected