> For the complete documentation index, see [llms.txt](https://pacifica.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pacifica.gitbook.io/docs/api-documentation/api/rest-api/account/get-trade-history.md).

# Get trade history

```
GET /api/v1/trades/history
```

#### Query Parameters

<table><thead><tr><th width="176">Field</th><th width="98">Type</th><th width="95">Need</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><code>"account"</code></td><td>string</td><td>required</td><td>User's wallet address</td><td><code>42trU9A5...</code></td></tr><tr><td><code>"symbol"</code></td><td>string</td><td>optional</td><td>Market symbol to filter by</td><td><code>BTC</code></td></tr><tr><td><code>"start_time"</code></td><td>integer</td><td>optional</td><td>Start time in milliseconds</td><td><code>1625097600000</code></td></tr><tr><td><code>"end_time"</code></td><td>integer</td><td>optional</td><td>End time in milliseconds</td><td><code>1759215599188</code></td></tr><tr><td><code>"limit"</code></td><td>integer</td><td>optional</td><td>Maximum number of records to return, defaults to 100</td><td><code>100</code></td></tr><tr><td><code>"cursor"</code></td><td>integer</td><td>optional</td><td>Cursor pagination to access records. Default to none</td><td><code>1115hVka</code></td></tr></tbody></table>

```
/api/v1/positions/history?account=42trU9A5...&start_time=1625097600000&end_time=1759215599188
```

#### Response

* Status 200: Successfully retrieved portfolio position history

```json
  {
  "success": true,
  "data": [
    {
      "history_id": 19329801,
      "order_id": 315293920,
      "client_order_id": "acf...",
      "symbol": "LDO",
      "amount": "0.1",
      "price": "1.1904",
      "entry_price": "1.176247",
      "fee": "0",
      "pnl": "-0.001415",
      "event_type": "fulfill_maker",
      "side": "close_short",
      "created_at": 1759215599188,
      "cause": "normal"
    },
    ...
  ],
  "next_cursor": "11111Z5RK",
  "has_more": true
}
```

<table><thead><tr><th width="208">Field</th><th width="186">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>"history_id"</code></td><td>integer</td><td>History id of trade</td></tr><tr><td><code>"order_id"</code></td><td>integer</td><td>Order id of order that resulted in the trade</td></tr><tr><td><code>"client_order_id"</code></td><td>UUID</td><td>CLOID of order that resulted in the trade</td></tr><tr><td><code>"symbol"</code></td><td>string</td><td>Trading pair symbol</td></tr><tr><td><code>"amount"</code></td><td>decimal string</td><td>Amount (in token denomination) of the trade event</td></tr><tr><td><code>"price"</code></td><td>decimal string</td><td>Current price of the specified symbol</td></tr><tr><td><code>"entry_price"</code></td><td>decimal string</td><td>Price at which the trade event was executed</td></tr><tr><td><code>"fee"</code></td><td>decimal string</td><td>Fee paid by the trade event</td></tr><tr><td><code>"pnl"</code></td><td>decimal string</td><td>PnL generated by the trade event</td></tr><tr><td><code>"event_type"</code></td><td>string</td><td><code>"fulfill_taker"</code> if taker<br><code>"fulfill_maker"</code> if maker</td></tr><tr><td><code>"side"</code></td><td>string</td><td><code>"open_long"</code><br><code>"open_short"</code><br><code>"close_long"</code><br><code>"close_short"</code></td></tr><tr><td><code>"created_at"</code></td><td>integer</td><td>Timestamp in milliseconds when the trade event occurred</td></tr><tr><td><code>"cause"</code></td><td>string</td><td><code>"normal"</code><br>regular user-initiated trading<br><code>"market_liquidation"</code> position was liquidated due to insufficient margin<br><code>"backstop_liquidation"</code> position was liquidated by backstop mechanism<br><code>"settlement"</code><br>position was closed due to Auto-Deleveraging (ADL) or other settlement</td></tr><tr><td><code>'next_cursor'</code></td><td>string</td><td>Next cursor for pagination</td></tr><tr><td><code>'has_more'</code></td><td>boolean</td><td>True if there exists a <code>'next_cursor'</code></td></tr></tbody></table>

| Field          | Type   | Description                                                                                                                                                                                                                                                                                                                                          |
| -------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `'event_type'` | string | <p><code>"fulfill\_taker"</code> if maker<br><code>"fulfill\_maker"</code> if taker</p>                                                                                                                                                                                                                                                              |
| `'side'`       | string | <p><code>"open\_long"</code><br><code>"open\_short"</code><br><code>"close\_long"</code><br><code>"close\_short"</code></p>                                                                                                                                                                                                                          |
| `'cause'`      | string | <p><code>"normal"</code><br>regular user-initiated trading<br><code>"market\_liquidation"</code> position was liquidated due to insufficient margin<br><code>"backstop\_liquidation"</code> position was liquidated by backstop mechanism<br><code>"settlement"</code><br>position was closed due to Auto-Deleveraging (ADL) or other settlement</p> |

* Status 400: Invalid request parameters
* Status 401: Unauthorized access
* Status 500: Internal server error

#### Code Example (Python)

```python
import requests

response = requests.get(
    "/api/v1/trades/history?account=42trU9A5...&symbol=BTC&limit=20&cursor=11115hVka",
    headers={"Accept": "*/*"},
)

data = response.json()
```
