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

Method fetch_order

python/ccxt/ascendex.py:1883–1986  ·  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

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