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

Method fetch_orders

python/ccxt/coinbase.py:3419–3501  ·  view source on GitHub ↗

fetches information on multiple orders made by the user https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/orders/list-orders :param str symbol: unified market symbol that the orders were made in :param int [since]: the earliest time in ms to f

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

Source from the content-addressed store, hash-verified

3417 return self.parse_order(order, market)
3418
3419 def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = 100, params={}) -> List[Order]:
3420 """
3421 fetches information on multiple orders made by the user
3422
3423 https://docs.cdp.coinbase.com/api-reference/advanced-trade-api/rest-api/orders/list-orders
3424
3425 :param str symbol: unified market symbol that the orders were made in
3426 :param int [since]: the earliest time in ms to fetch orders
3427 :param int [limit]: the maximum number of order structures to retrieve
3428 :param dict [params]: extra parameters specific to the exchange API endpoint
3429 :param int [params.until]: the latest time in ms to fetch trades for
3430 :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
3431 :returns Order[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
3432 """
3433 self.load_markets()
3434 paginate = False
3435 paginate, params = self.handle_option_and_params(params, 'fetchOrders', 'paginate')
3436 if paginate:
3437 return self.fetch_paginated_call_cursor('fetchOrders', symbol, since, limit, params, 'cursor', 'cursor', None, 1000)
3438 market = None
3439 if symbol is not None:
3440 market = self.market(symbol)
3441 request = {}
3442 if market is not None:
3443 request['product_id'] = market['id']
3444 if limit is not None:
3445 request['limit'] = limit
3446 if since is not None:
3447 request['start_date'] = self.iso8601(since)
3448 until = self.safe_integer_n(params, ['until'])
3449 if until is not None:
3450 params = self.omit(params, ['until'])
3451 request['end_date'] = self.iso8601(until)
3452 response = self.v3PrivateGetBrokerageOrdersHistoricalBatch(self.extend(request, params))
3453 #
3454 # {
3455 # "orders": [
3456 # {
3457 # "order_id": "813a53c5-3e39-47bb-863d-2faf685d22d8",
3458 # "product_id": "BTC-USDT",
3459 # "user_id": "1111111-1111-1111-1111-111111111111",
3460 # "order_configuration": {
3461 # "market_market_ioc": {
3462 # "quote_size": "6.36"
3463 # }
3464 # },
3465 # "side": "BUY",
3466 # "client_order_id": "18eb9947-db49-4874-8e7b-39b8fe5f4317",
3467 # "status": "FILLED",
3468 # "time_in_force": "IMMEDIATE_OR_CANCEL",
3469 # "created_time": "2023-01-18T01:37:37.975552Z",
3470 # "completion_percentage": "100",
3471 # "filled_size": "0.000297920684505",
3472 # "average_filled_price": "21220.6399999973697697",
3473 # "fee": "",
3474 # "number_of_fills": "2",
3475 # "filled_value": "6.3220675944333996",
3476 # "pending_cancel": False,

Callers

nothing calls this directly

Calls 13

safe_integer_nMethod · 0.80
safe_listMethod · 0.80
safe_dictMethod · 0.80
safe_stringMethod · 0.80
parse_ordersMethod · 0.80
load_marketsMethod · 0.45
marketMethod · 0.45
iso8601Method · 0.45
omitMethod · 0.45

Tested by

no test coverage detected