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

Method fetch_orders_by_status

python/ccxt/async_support/cex.py:974–1050  ·  view source on GitHub ↗

fetches information on multiple orders made by the user https://trade.cex.io/docs/#rest-private-api-calls-orders :param str status: order status to fetch for :param str symbol: unified market symbol of the market orders were made in :param int [since]: the

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

Source from the content-addressed store, hash-verified

972 return self.safe_balance(result)
973
974 async def fetch_orders_by_status(self, status: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
975 """
976 fetches information on multiple orders made by the user
977
978 https://trade.cex.io/docs/#rest-private-api-calls-orders
979
980 :param str status: order status to fetch for
981 :param str symbol: unified market symbol of the market orders were made in
982 :param int [since]: the earliest time in ms to fetch orders for
983 :param int [limit]: the maximum number of order structures to retrieve
984 :param dict [params]: extra parameters specific to the exchange API endpoint
985 :param int [params.until]: timestamp in ms of the latest entry
986 :returns Order[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
987 """
988 await self.load_markets()
989 request = {}
990 isClosedOrders = (status == 'closed')
991 if isClosedOrders:
992 request['archived'] = True
993 market = None
994 if symbol is not None:
995 market = self.market(symbol)
996 request['pair'] = market['id']
997 if limit is not None:
998 request['pageSize'] = limit
999 if since is not None:
1000 request['serverCreateTimestampFrom'] = since
1001 elif isClosedOrders:
1002 # exchange requires a `since` parameter for closed orders, so set default to allowed 365
1003 request['serverCreateTimestampFrom'] = self.milliseconds() - 364 * 24 * 60 * 60 * 1000
1004 until = None
1005 until, params = self.handle_param_integer_2(params, 'until', 'till')
1006 if until is not None:
1007 request['serverCreateTimestampTo'] = until
1008 response = await self.privatePostGetMyOrders(self.extend(request, params))
1009 #
1010 # if called without `pair`
1011 #
1012 # {
1013 # "ok": "ok",
1014 # "data": [
1015 # {
1016 # "orderId": "1313003",
1017 # "clientOrderId": "037F0AFEB93A",
1018 # "clientId": "up421412345",
1019 # "accountId": null,
1020 # "status": "FILLED",
1021 # "statusIsFinal": True,
1022 # "currency1": "AI",
1023 # "currency2": "USDT",
1024 # "side": "BUY",
1025 # "orderType": "Market",
1026 # "timeInForce": "IOC",
1027 # "comment": null,
1028 # "rejectCode": null,
1029 # "rejectReason": null,
1030 # "initialOnHoldAmountCcy1": null,
1031 # "initialOnHoldAmountCcy2": "10.23456700",

Callers 2

fetch_closed_ordersMethod · 0.95
fetch_open_ordersMethod · 0.95

Calls 8

safe_listMethod · 0.80
parse_ordersMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45
millisecondsMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected