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

# Trader Market PnL

> Get notified when a trader's per-market PnL crosses a configured threshold.

<Note>
  **Event:** `trader_market_pnl` \
  **Endpoint:** `wss://api.struct.to/ws/alerts` \
  **Cost:** 0.1 credits per event
</Note>

Fires when a trader's profit and loss in a specific market crosses the configured thresholds. Unlike `trader_global_pnl`, this event is scoped to individual markets, allowing you to track performance on a per-market basis.

## Filters

| Filter                      | Type       | Required | Description                                                |
| --------------------------- | ---------- | -------- | ---------------------------------------------------------- |
| `traders`                   | `string[]` | No       | Specific trader wallet addresses (max 500)                 |
| `condition_ids`             | `string[]` | No       | Restrict to specific markets (max 500)                     |
| `event_slugs`               | `string[]` | No       | Restrict to specific events (max 500)                      |
| `min_realized_pnl_usd`      | `number`   | No       | Minimum realized PnL in USD                                |
| `max_realized_pnl_usd`      | `number`   | No       | Maximum realized PnL in USD                                |
| `min_buy_usd`               | `number`   | No       | Minimum buy volume in USD                                  |
| `min_volume_usd`            | `number`   | No       | Minimum total volume in USD                                |
| `max_volume_usd`            | `number`   | No       | Maximum total volume in USD                                |
| `min_sell_volume_usd`       | `number`   | No       | Minimum sell volume in USD                                 |
| `timeframes`                | `string[]` | No       | Timeframes to track (valid: `1d`, `7d`, `30d`, `lifetime`) |
| `exclude_shortterm_markets` | `boolean`  | No       | Exclude short-term "updown" markets                        |

## Subscribe

```json theme={null}
{
  "op": "subscribe",
  "event": "trader_market_pnl",
  "traders": ["0x37BA57e2942A57F05B5E4BCFD4d027845cFC40ec"],
  "min_realized_pnl_usd": 1000,
  "exclude_shortterm_markets": true
}
```

## Response

```json theme={null}
{
  "event": "trader_market_pnl",
  "timestamp": 1775913505260,
  "data": {
    "trader": "0x37BA57e2942A57F05B5E4BCFD4d027845cFC40ec",
    "condition_id": "0x4fec624c0ff2bfae89956cebd6fbc9c58f995f824382dc587dc5a32a4b15940b",
    "event_slug": "2026-us-midterm-elections",
    "timeframe": "7d",
    "outcomes_traded": 2,
    "total_buys": 12,
    "total_sells": 8,
    "total_redemptions": 3,
    "total_merges": 1,
    "buy_usd": 10000.00,
    "sell_usd": 3500.00,
    "redemption_usd": 1200.00,
    "merge_usd": 300.00,
    "realized_pnl_usd": 3200.50,
    "winning_outcomes": 2,
    "total_fees": 30.00,
    "first_trade_at": 1712966400,
    "last_trade_at": 1713052800
  }
}
```
