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

Method fetch_orders_by_status

python/ccxt/cex.py:973–1049  ·  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

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