# Deals List

**Get List of All Deals for a User**

<mark style="color:green;">**`GET`**</mark> **`https://api.aitrade.com/api/deals`**

To obtain deals associated with a specific bot, provide the `bot_id`

**Query Params**

<table><thead><tr><th width="143">Name</th><th width="129">Type</th><th width="128" data-type="checkbox">Required</th><th>Description</th></tr></thead><tbody><tr><td>bot_id</td><td>integer</td><td>true</td><td>Filters deals related to the specified bot id. </td></tr><tr><td>status</td><td>string</td><td>false</td><td>Filter the list by status, options are <code>open</code> or <code>close</code></td></tr><tr><td>page_size</td><td>integer</td><td>false</td><td>maximum number of items returned per request</td></tr><tr><td>page</td><td>integer</td><td>false</td><td>Current page number for pagination</td></tr></tbody></table>

**Responses:**

* **Success (200)**: Returns the list of deals created by the bots and other specific settings of the deal.
* **Failure (401)**: Unauthenticated, indicating you're not logged in or lack permission to carry out the request.

{% tabs %}
{% tab title="200  successfully returned" %}

```javascript

{
    "code": 200,
    "message": "Success",
    "deals": {
        "current_page": 1,
        "data": [
            {
                "id": 37515,
                "deleted_at": null,
                "bot_id": 7443,
                "status": "working",
                "status_key": "in_progress",
                "strategy": "Long",
                "exchange_pair_id": 2,
                "profit": 1.48,
                "stop_loss": 10,
                "updated_at": "2024-01-31 14:54:09",
                "created_at": "2024-01-31 14:54:05",
                "exit_price": 0,
                "user_id": 1,
                "exchange_id": 0,
                "pair_id": 1,
                "note": null,
                "apy_rate": null,
                "meta": null,
                "pair": {
                    "id": 1,
                    "from": "AAPL",
                    "to": "USD",
                    "name": "AAPL-USD",
                    "kline_exchange_id": 16,
                    "quote_image": "https://yourdomain/path_to_image_file",
                    "base_image": "https://yourdomain/path_to_image_file"
                },
                "bot_name": "Test Extra params Rent",
                "bot_rent_id": 49,
                "bot_type": "",
                "pair_name": "AAPL/USD",
                "base_name": "USD",
                "quote_name": "AAPL",
                "exchange_image": "https://yourdomain/path_to_image_file",
                "tp_price": 0,
                "stop_loss_price": 166.61,
                "current_price": "172.84",
                "average_cost": 185.12,
                "base_order_price": 185.25,
                "lo_price": "172.84",
                "executed_vol": 370.24,
                "quantity": 2,
                "net_profit": -24.560000000000002,
                "profit_value": -6.633535004321521,
                "profit_value_abs": 0,
                "closed_orders": [
                    {
                        "name": "EO",
                        "quantity": 1,
                        "side": "BUY",
                        "description": "Buy 1 AAPL @ 184.99 USD",
                        "date": "2024-01-31 15:36",
                        "average": 184.99,
                        "exchange_pair": {
                            "id": 2,
                            "exchange_id": 0,
                            "pair_id": 1,
                            "name": "AAPL/USD",
                            "price_precision": 2,
                            "amount_precision": 0,
                            "pair": {
                                "id": 1,
                                "from": "AAPL",
                                "to": "USD",
                                "name": "AAPL-USD",
                                "kline_exchange_id": 16,
                                "quote_image": "https://yourdomain/path_to_image_file",
                                "base_image": "https://yourdomain/path_to_image_file"
                            }
                        }
                    }
                ],
                "open_orders": [],
                "position": null,
                "status_name": "Deal In Progress"
            }
        ],
        "first_page_url": "https://api.stockhero.ai/api/deals?page=1",
        "from": 1,
        "last_page": 1,
        "last_page_url": "https://api.stockhero.ai/api/deals?page=1",
        "links": [
            {
                "url": null,
                "label": "&laquo; Previous",
                "active": false
            },
            {
                "url": "https://api.stockhero.ai/api/deals?page=1",
                "label": "1",
                "active": true
            },
            {
                "url": null,
                "label": "Next &raquo;",
                "active": false
            }
        ],
        "next_page_url": null,
        "path": "https://api.stockhero.ai/api/deals",
        "per_page": 10,
        "prev_page_url": null,
        "to": 2,
        "total": 2
    }
}
```

{% endtab %}

{% tab title="401 Unauthenticated" %}

```
{
  "code": 401,
  "success": false,
  "message": "Unauthenticated."
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://apidocs-ga092.stockhero.ai/bot-execution/deals-list.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
