> 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-trades.md).

# Get All Trades

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

Retrieve a list of completed trades (fills).

{% hint style="info" %}
[Stream trades real-time using the Trades WebSocket feed.](/websocket-api/orders-and-account-data/trades.md)
{% endhint %}

### **Path Parameters**

<table><thead><tr><th width="240">Parameter</th><th width="92">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong><code>page_size</code></strong></td><td>number</td><td><p>The maximum number of trades to include in the response. </p><p></p><p>e.g. <code>page_size=20</code> will return a maximum of 20 trades in the response</p><p></p><p>Default <code>page_size</code> = <code>100</code></p></td></tr><tr><td><strong><code>last_seen_id</code></strong></td><td>number</td><td><p>The <code>cursor</code> of trade to paginate from. The response will contain trades completed after the <code>cursor</code>.</p><p></p><p>e.g. <code>last_seen_id=NjM1MjQ20c=</code> will return trades completed after the trade associated with this <code>cursor</code></p></td></tr></tbody></table>

### Responses

<details>

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

```json
{
    "data": [
        {
            "cursor": "NjM1MzUwNzY=",
            "trade_id": 829106821,
            "order_id": 758399024,
            "date_updated": "2024-02-22T01:08:18.000Z",
            "action": "Sell",
            "currency_pair": "btcusd",
            "quantity": "0.01000000",
            "amount": "515.83628237",
            "price": "51583.62823740",
            "fees": "0.00000000",
            "net_amount": "515.83628237"
        },
        {
            "cursor": "NjM1MzUwNzQ=",
            "trade_id": 829106818,
            "order_id": 758319036,
            "date_updated": "2024-02-22T01:08:18.000Z",
            "action": "Buy",
            "currency_pair": "btcusd",
            "quantity": "0.01000000",
            "amount": "515.24440000",
            "price": "51524.44000000",
            "fees": "0.00000000",
            "net_amount": "515.24440000"
        },
        {
            "cursor": "NjM1MzUwNzI=",
            "trade_id": 829106817,
            "order_id": 758399024,
            "date_updated": "2024-02-22T01:08:18.000Z",
            "action": "Sell",
            "currency_pair": "btcusd",
            "quantity": "0.01000000",
            "amount": "515.79383311",
            "price": "51579.38331110",
            "fees": "0.00000000",
            "net_amount": "515.79383311"
        },
        {
            "cursor": "NjM1MzUwNjc=",
            "trade_id": 829105211,
            "order_id": 758399602,
            "date_updated": "2024-02-22T01:05:44.000Z",
            "action": "Sell",
            "currency_pair": "ltcusd",
            "quantity": "7.91515120",
            "amount": "542.39983445",
            "price": "68.52678120",
            "fees": "0.00000000",
            "net_amount": "542.39983445"
        },
        {
            "cursor": "NjM1MzUwNjU=",
            "trade_id": 829105212,
            "order_id": 758399603,
            "date_updated": "2024-02-22T01:05:44.000Z",
            "action": "Buy",
            "currency_pair": "ltcusd",
            "quantity": "7.91515120",
            "amount": "542.41023812",
            "price": "68.52809560",
            "fees": "0.00000000",
            "net_amount": "542.41023812"
        }
    ]
}
```

</details>

### Example Requests

{% tabs %}
{% tab title="Shell" %}

```bash
curl -H 'Authorization: Bearer <API_TOKEN>' \
  'https://api.sfox.com/v1/account/trades?page_size=<PAGE SIZE>&last_seen_id=
<CURSOR>'
```

{% endtab %}

{% tab title="NodeJS" %}

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

axios({
  method: 'get',
  url: 'https://api.sfox.com/v1/account/trades?page_size=<PAGE_SIZE>&last_seen_id=
<CURSOR>',
  headers: {
    'Authorization': 'Bearer <API_KEY>'
  }
}).then(response => {
  console.log(response)
}).catch(err => {
  console.error(err)
});
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

data = requests.get(
  "https://api.sfox.com/v1/account/trades?page_size=<PAGE SIZE>&last_seen_id=
<CURSOR>",
  headers={
    "Authorization": "Bearer <API_KEY>",
  }
)
print(data)
```

{% 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
