> ## Documentation Index
> Fetch the complete documentation index at: https://docs.orica.markets/llms.txt
> Use this file to discover all available pages before exploring further.

# Trades

> REST endpoints for querying trade history.

Trade history is available via the Activity WebSocket or through market-specific queries.

***

## Get Market Trades

Retrieve trade history for a specific market.

```
GET /trades/market/{market_address}
```

**market\_address** `string` *required*

The address of the market.

**outcome\_index** `integer`

Filter by outcome index.

**limit** `integer` (default: 50)

Number of trades to return.

**offset** `integer` (default: 0)

Offset for pagination.

```bash cURL theme={"dark"}
curl "https://api.orica.markets/trades/market/ABC123...?limit=50"
```

```typescript TypeScript theme={"dark"}
const response = await fetch(
  `https://api.orica.markets/trades/market/${marketAddress}?limit=50`
);
const trades = await response.json();
```

### Response

```json theme={"dark"}
[
  {
    "signature": "5K7x...",
    "market_address": "ABC123...",
    "user_address": "User456...",
    "trade_type": "buy",
    "outcome_index": 0,
    "amount_usdc": 100.50,
    "shares": 9850,
    "price": 0.0102,
    "market_cap_at_trade": 1250.75,
    "timestamp": 1704067200,
    "fees_paid_usdc": 1.71
  }
]
```

### Response Fields

**signature** `string`

Solana transaction signature.

**market\_address** `string`

Market where the trade occurred.

**user\_address** `string`

Wallet address of the trader.

**trade\_type** `string`

Type of trade: `buy`, `sell`, or `redeem`.

**outcome\_index** `number`

Index of the outcome traded.

**amount\_usdc** `number`

USDC amount (input for buy, output for sell/redeem).

**shares** `number`

Number of shares traded.

**price** `number`

Average price per share in USDC.

**market\_cap\_at\_trade** `number`

Total market cap at the time of trade.

**timestamp** `number`

Unix timestamp of the trade.

**fees\_paid\_usdc** `number`

Total fees paid in USDC.

***

## User Trades

User-specific trade history is available via the Activity WebSocket:

```typescript theme={"dark"}
const ws = new WebSocket("wss://api.orica.markets/ws/activity");

ws.onopen = () => {
  ws.send(JSON.stringify({ type: "user", address: userAddress }));
};

ws.onmessage = (event) => {
  const message = JSON.parse(event.data);
  if (message.type === "history") {
    console.log("User trades:", message.data);
  }
};
```

See [Activity WebSocket](https://docs.orica.markets/api-reference/websocket/activity-feed.md) for details.

***

## Volume Metrics

Aggregate volume data for a market:

```
GET /markets/{market_address}/volume
```

### Response

```json theme={"dark"}
{
  "market": "ABC123...",
  "total_volume_usdc": 150000.00,
  "volume_24h_usdc": 5420.50,
  "volume_7d_usdc": 32100.00,
  "volume_by_option": {
    "0": 85000.00,
    "1": 65000.00
  },
  "num_trades": 1247
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.