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

Method fetch_open_orders

python/ccxt/ascendex.py:1988–2099  ·  view source on GitHub ↗

fetch all unfilled currently open orders https://ascendex.github.io/ascendex-pro-api/#list-open-orders https://ascendex.github.io/ascendex-futures-pro-api-v2/#list-open-orders :param str symbol: unified market symbol :param int [since]: the earliest time in

(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})

Source from the content-addressed store, hash-verified

1986 return self.parse_order(data, market)
1987
1988 def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1989 """
1990 fetch all unfilled currently open orders
1991
1992 https://ascendex.github.io/ascendex-pro-api/#list-open-orders
1993 https://ascendex.github.io/ascendex-futures-pro-api-v2/#list-open-orders
1994
1995 :param str symbol: unified market symbol
1996 :param int [since]: the earliest time in ms to fetch open orders for
1997 :param int [limit]: the maximum number of open orders structures to retrieve
1998 :param dict [params]: extra parameters specific to the exchange API endpoint
1999 :returns Order[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
2000 """
2001 self.load_markets()
2002 self.load_accounts()
2003 market = None
2004 if symbol is not None:
2005 market = self.market(symbol)
2006 symbol = market['symbol']
2007 account = self.safe_dict(self.accounts, 0, {})
2008 accountGroup = self.safe_string(account, 'id')
2009 type, query = self.handle_market_type_and_params('fetchOpenOrders', market, params)
2010 accountsByType = self.safe_dict(self.options, 'accountsByType', {})
2011 accountCategory = self.safe_string(accountsByType, type, 'cash')
2012 request = {
2013 'account-group': accountGroup,
2014 'account-category': accountCategory,
2015 }
2016 response = None
2017 if (type == 'spot') or (type == 'margin'):
2018 response = self.v1PrivateAccountCategoryGetOrderOpen(self.extend(request, query))
2019 elif type == 'swap':
2020 request['account-category'] = accountCategory
2021 response = self.v2PrivateAccountGroupGetFuturesOrderOpen(self.extend(request, query))
2022 else:
2023 raise NotSupported(self.id + ' fetchOpenOrders() is not currently supported for ' + type + ' markets')
2024 #
2025 # AccountCategoryGetOrderOpen
2026 #
2027 # {
2028 # "ac": "CASH",
2029 # "accountId": "cshQtyfq8XLAA9kcf19h8bXHbAwwoqDo",
2030 # "code": 0,
2031 # "data": [
2032 # {
2033 # "avgPx": "0", # Average filled price of the order
2034 # "cumFee": "0", # cumulative fee paid for self order
2035 # "cumFilledQty": "0", # cumulative filled quantity
2036 # "errorCode": "", # error code; could be empty
2037 # "feeAsset": "USDT", # fee asset
2038 # "lastExecTime": 1576019723550, # The last execution time of the order
2039 # "orderId": "s16ef21882ea0866943712034f36d83", # server provided orderId
2040 # "orderQty": "0.0083", # order quantity
2041 # "orderType": "Limit", # order type
2042 # "price": "7105", # order price
2043 # "seqNum": 8193258, # sequence number
2044 # "side": "Buy", # order side
2045 # "status": "New", # order status on matching engine

Callers

nothing calls this directly

Calls 15

parse_orderMethod · 0.95
NotSupportedClass · 0.90
safe_dictMethod · 0.80
safe_stringMethod · 0.80
safe_listMethod · 0.80
parse_ordersMethod · 0.80
rangeFunction · 0.50
load_marketsMethod · 0.45
load_accountsMethod · 0.45

Tested by

no test coverage detected