> For the complete documentation index, see [llms.txt](https://docs.ojolabs.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ojolabs.xyz/markets/api/trades.md).

# Trades

Retrieve trade history for markets and users.

## Get Trade History

Returns recent trades for a market.

```
GET /api/v1/trades/{marketId}
```

### Path Parameters

| Parameter  | Type    | Description       |
| ---------- | ------- | ----------------- |
| `marketId` | bytes32 | Market identifier |

### Response

{% code title="response.json" %}

```json
{
  "marketId": "0x1234...abcd",
  "trades": [
    {
      "price": 550000,
      "size": 10000000,
      "buyer": "0xBuyerAddress...",
      "seller": "0xSellerAddress...",
      "outcome": 0,
      "timestamp": 1735689000,
      "txHash": "0xTransactionHash..."
    }
  ],
  "count": 5
}
```

{% endcode %}

| Field       | Type    | Description                                     |
| ----------- | ------- | ----------------------------------------------- |
| `price`     | uint64  | Trade price (6 decimals). `550000` = $0.55      |
| `size`      | uint64  | Trade size (6 decimals). `10000000` = 10 shares |
| `buyer`     | address | Buyer's wallet address                          |
| `seller`    | address | Seller's wallet address                         |
| `outcome`   | uint8   | `0` = YES, `1` = NO                             |
| `timestamp` | int64   | Unix timestamp of the trade                     |
| `txHash`    | string  | On-chain settlement transaction hash            |

Returns up to 100 most recent trades, sorted by timestamp descending.

### Example

{% code title="curl" %}

```bash
curl "https://api.turbinefi.com/api/v1/trades/0x1234...abcd"
```

{% endcode %}

***

## Get User Activity

Returns trade history and settlement activity for a user on a specific chain.

```
GET /api/v1/users/{address}/activity
```

### Path Parameters

| Parameter | Type    | Description           |
| --------- | ------- | --------------------- |
| `address` | address | User's wallet address |

### Query Parameters

| Parameter  | Type    | Required | Description                               |
| ---------- | ------- | -------- | ----------------------------------------- |
| `chain_id` | integer | Yes      | Chain ID (e.g., `137`)                    |
| `limit`    | integer | No       | Number of results (default: 50, max: 100) |

### Response

{% code title="response.json" %}

```json
{
  "activity": [
    {
      "marketId": "0x...",
      "marketQuestion": "Will ETH reach $5000?",
      "price": 550000,
      "size": 10000000,
      "userRole": "buyer",
      "timestamp": 1735689000,
      "txHash": "0x..."
    }
  ],
  "settlements": [
    {
      "marketId": "0x...",
      "marketQuestion": "Will BTC hit $100k?",
      "payout": 50000000,
      "winningOutcome": 0,
      "timestamp": 1735700000
    }
  ]
}
```

{% endcode %}

| Field         | Type  | Description                       |
| ------------- | ----- | --------------------------------- |
| `activity`    | array | User's trades with market context |
| `settlements` | array | User's market settlement payouts  |

### Example

{% code title="curl" %}

```bash
curl "https://api.turbinefi.com/api/v1/users/0xYourAddress/activity?chain_id=137&limit=20"
```

{% endcode %}


---

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

```
GET https://docs.ojolabs.xyz/markets/api/trades.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.
