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

Method fetch_order

python/ccxt/async_support/ascendex.py:1884–1987  ·  view source on GitHub ↗

fetches information on an order made by the user https://ascendex.github.io/ascendex-pro-api/#query-order https://ascendex.github.io/ascendex-futures-pro-api-v2/#query-order-by-id :param str id: the order id :param str symbol: unified symbol of the market t

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

Source from the content-addressed store, hash-verified

1882 return self.parse_orders(info, market)
1883
1884 async def fetch_order(self, id: str, symbol: Str = None, params={}):
1885 """
1886 fetches information on an order made by the user
1887
1888 https://ascendex.github.io/ascendex-pro-api/#query-order
1889 https://ascendex.github.io/ascendex-futures-pro-api-v2/#query-order-by-id
1890
1891 :param str id: the order id
1892 :param str symbol: unified symbol of the market the order was made in
1893 :param dict [params]: extra parameters specific to the exchange API endpoint
1894 :returns dict: An `order structure <https://docs.ccxt.com/?id=order-structure>`
1895 """
1896 await self.load_markets()
1897 await self.load_accounts()
1898 market = None
1899 if symbol is not None:
1900 market = self.market(symbol)
1901 type, query = self.handle_market_type_and_params('fetchOrder', market, params)
1902 accountsByType = self.safe_dict(self.options, 'accountsByType', {})
1903 accountCategory = self.safe_string(accountsByType, type, 'cash')
1904 account = self.safe_dict(self.accounts, 0, {})
1905 accountGroup = self.safe_string(account, 'id')
1906 request = {
1907 'account-group': accountGroup,
1908 'account-category': accountCategory,
1909 'orderId': id,
1910 }
1911 response = None
1912 if (type == 'spot') or (type == 'margin'):
1913 response = await self.v1PrivateAccountCategoryGetOrderStatus(self.extend(request, query))
1914 elif type == 'swap':
1915 request['account-category'] = accountCategory
1916 response = await self.v2PrivateAccountGroupGetFuturesOrderStatus(self.extend(request, query))
1917 else:
1918 raise NotSupported(self.id + ' fetchOrder() is not currently supported for ' + type + ' markets')
1919 #
1920 # AccountCategoryGetOrderStatus
1921 #
1922 # {
1923 # "code": 0,
1924 # "accountCategory": "CASH",
1925 # "accountId": "cshQtyfq8XLAA9kcf19h8bXHbAwwoqDo",
1926 # "data": [
1927 # {
1928 # "symbol": "BTC/USDT",
1929 # "price": "8131.22",
1930 # "orderQty": "0.00082",
1931 # "orderType": "Market",
1932 # "avgPx": "7392.02",
1933 # "cumFee": "0.005152238",
1934 # "cumFilledQty": "0.00082",
1935 # "errorCode": "",
1936 # "feeAsset": "USDT",
1937 # "lastExecTime": 1575953151764,
1938 # "orderId": "a16eee20b6750866943712zWEDdAjt3",
1939 # "seqNum": 2623469,
1940 # "side": "Buy",
1941 # "status": "Filled",

Callers

nothing calls this directly

Calls 11

parse_orderMethod · 0.95
NotSupportedClass · 0.90
safe_dictMethod · 0.80
safe_stringMethod · 0.80
load_marketsMethod · 0.45
load_accountsMethod · 0.45
marketMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected