> ## 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 PnL Exits

> Get notified each time a trader closes a position, with the realized result.

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

Fires once each time a tracked trader closes a position, emitting a single exit marker with the realized result. Each marker is designed to be overlaid on a PnL chart so you can see exactly where a trader entered and left a market.

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

## Exit reasons

Each marker carries a `reason` describing how the position closed:

| Reason | Meaning |
| - | - |
| `resolved_win` | Held to market resolution and won by verdict |
| `resolved_loss` | Held to market resolution and lost by verdict |
| `sold_win` | Closed before resolution with a positive realized PnL |
| `sold_loss` | Closed before resolution with a negative realized PnL |

## Subscribe

```json theme={null}
{
  "op": "subscribe",
  "event": "trader_pnl_exits",
  "traders": ["0x37BA57e2942A57F05B5E4BCFD4d027845cFC40ec"]
}
```

## Response

```json theme={null}
{
  "event": "trader_pnl_exits",
  "timestamp": 1775913505260,
  "data": {
    "trader": "0x37BA57e2942A57F05B5E4BCFD4d027845cFC40ec",
    "position_id": "21742633143463906290569050155826241533067272736897614950488156847949938836455",
    "condition_id": "0x4fec624c0ff2bfae89956cebd6fbc9c58f995f824382dc587dc5a32a4b15940b",
    "event_slug": "2026-us-midterm-elections",
    "market_slug": "will-candidate-x-win",
    "title": "Will Candidate X win?",
    "question": "Will Candidate X win the 2026 election?",
    "image_url": "https://polymarket-upload.s3.us-east-2.amazonaws.com/example.png",
    "outcome": "Yes",
    "outcome_index": 0,
    "pnl_usd": 1700.00,
    "pnl_pct": 56.67,
    "cost_basis_usd": 3000.00,
    "reason": "resolved_win",
    "block": 68554321,
    "ts": 1713052800
  }
}
```


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