> For the complete documentation index, see [llms.txt](https://docs.sfox.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sfox.com/rest-api/orders/get-all-done-orders.md).

# Get All Done Orders

<mark style="color:green;">**`GET`**</mark> `https://api.sfox.com/v1/orders/done`

Retrieve a list of completed orders.

{% hint style="info" %}
[**Rate Limit**](/rest-api/rate-limits.md)**: 5 requests per 10 seconds**

sFOX recommends using the [**Orders WebSocket feed**](/websocket-api/orders-and-account-data/orders.md) instead, which streams order updates in real-time and does not count towards your request limit.
{% endhint %}

### **Query Parameters**

<table><thead><tr><th width="211">Parameter</th><th width="133">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>limit</code></strong></td><td>int</td><td>Limit on the number of results to return. Default and maximum = <code>50</code>. Each response will include no more than 50 results.</td></tr><tr><td><strong><code>before</code></strong></td><td>int</td><td>Pagination parameter. Return results that occurred before (older) than the specified ID (<code>id</code> from response body).</td></tr><tr><td><strong><code>after</code></strong></td><td>int</td><td>Pagination parameter. Return results that occurred after (newer) than the specified ID (<code>id</code> from response body).</td></tr><tr><td><strong><code>action</code></strong></td><td>string</td><td>Filter response to only include orders with the specified action/side. Possible values: <code>buy</code> or <code>sell</code> (case sensitive).</td></tr><tr><td><strong><code>currency_pair</code></strong></td><td>string</td><td>Filter response to only include orders on the specified currency pair (<code>pair</code> from response body). Format: <code>&#x3C;basequote></code> e.g. <code>btcusd</code>.</td></tr><tr><td><strong><code>algorithm_id</code></strong></td><td>int</td><td>Filter response to only include orders with the specified <code>algorithm_id</code>/order type. Possible values: <a href="/rest-api/orders/algorithms-and-routing-types.md">Order Types</a>.</td></tr><tr><td><strong><code>status</code></strong></td><td>string</td><td>Filter response to only include orders with the specified order status (<code>status</code> from response body). Possible values: <a href="/rest-api/orders.md">Order Statuses</a>.</td></tr></tbody></table>

### Responses

<details>

<summary><mark style="color:green;">200</mark></summary>

```json
[
    {
        "id": 701968334,
        "side_id": 500,
        "action": "Buy",
        "algorithm_id": 200,
        "algorithm": "Smart",
        "type": "Smart",
        "pair": "btcusd",
        "quantity": 0.001,
        "price": 16900.6,
        "amount": 0,
        "net_market_amount": 0,
        "filled": 0.001,
        "vwap": 16900.6,
        "filled_amount": 16.9006,
        "fees": 0.0338012,
        "net_proceeds": -16.8667988,
        "status": "Done",
        "status_code": 300,
        "routing_option": "BestPrice",
        "routing_type": "NetPrice",
        "time_in_force": "GTC",
        "expires": null,
        "dateupdated": "2022-11-18T01:26:40.000Z",
        "date_added": "2022-11-17T20:52:40.000Z",
        "client_order_id": "94b0e7c4-0fa7-403d-a0d0-6c4ccec76630",
        "user_tx_id": "94b0e7c4-0fa7-403d-a0d0-6c4ccec76630",
        "o_action": "Buy",
        "algo_id": 200,
        "algorithm_options": null,
        "destination": ""
    },
    {
        "id": 701945645,
        "side_id": 500,
        "action": "Buy",
        "algorithm_id": 201,
        "algorithm": "Limit",
        "type": "Limit",
        "pair": "btcusd",
        "quantity": 0.01,
        "price": 16905,
        "amount": 0,
        "net_market_amount": 0,
        "filled": 0.01,
        "vwap": 16643,
        "filled_amount": 166.43,
        "fees": 0.16643,
        "net_proceeds": -166.26357,
        "status": "Done",
        "status_code": 300,
        "routing_option": "BestPrice",
        "routing_type": "NetPrice",
        "time_in_force": "GTC",
        "expires": null,
        "dateupdated": "2022-11-17T19:39:18.000Z",
        "date_added": "2022-11-17T18:52:40.000Z",
        "client_order_id": "",
        "user_tx_id": "",
        "o_action": "Buy",
        "algo_id": 201,
        "algorithm_options": null,
        "destination": ""
   }
]
```

</details>

### Example Requests

{% tabs %}
{% tab title="Shell" %}
{% code overflow="wrap" %}

```bash
curl -H 'Authorization: Bearer <API_TOKEN>' \
  'https://api.sfox.com/v1/orders/done?limit=20&after=711876817&currency_pair=btcusd'
```

{% endcode %}
{% endtab %}

{% tab title="NodeJS" %}
{% code overflow="wrap" %}

```javascript
const axios = require('axios');

axios({
  method: 'get',
  url: 'https://api.sfox.com/v1/orders/done?limit=20&after=711876817&currency_pair=btcusd',
  headers: {
    'Authorization': 'Bearer <API_KEY>'
  }
}).then(response => {
  console.log(response)
}).catch(err => {
  console.error(err)
});
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" %}

```python
import requests

data = requests.get(
  "https://api.sfox.com/v1/orders/done?limit=20&after=711876817&currency_pair=btcusd",
  headers={
    "Authorization": "Bearer <API_KEY>",
  }
)
print(data)
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sfox.com/rest-api/orders/get-all-done-orders.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
