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

# ghost.closed Event

> Fired when a Ghost Trader position is fully closed on any supported asset.

## Overview

The `ghost.closed` event fires when a Ghost Trader position is fully closed on any
supported asset. It includes the final P\&L (net of any TP1 partial sell), the exit
price, and a canonical `close_reason` label.

**Assets covered:** BTC, ETH, SOL, TAO, GOLD

**Latency:** Up to 30 seconds (poll-based dispatcher).

## Subscribe

Register via `POST /v1/webhooks` with `"ghost.closed"` in the `events` array.

```json theme={null}
{
  "url": "https://your-server.com/aioka-hook",
  "events": ["ghost.closed"]
}
```

## Payload

```json theme={null}
{
  "event": "ghost.closed",
  "timestamp": "2026-05-08T16:45:00.123456Z",
  "data": {
    "trade_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "asset": "BTC",
    "entry_price": "96450.00",
    "exit_price": "97820.50",
    "pnl": "412.30",
    "close_reason": "TSL",
    "closed_at": "2026-05-08 16:44:55+00:00"
  }
}
```

## Data Fields

<ResponseField name="trade_id" type="string">
  UUID of the closed trade.
</ResponseField>

<ResponseField name="asset" type="string">
  Asset symbol. One of: `BTC`, `ETH`, `SOL`, `TAO`, `GOLD`.
</ResponseField>

<ResponseField name="entry_price" type="decimal">
  Entry price in USD.
</ResponseField>

<ResponseField name="exit_price" type="decimal">
  Final exit price in USD.
</ResponseField>

<ResponseField name="pnl" type="decimal">
  Net P\&L in USD, including TP1 partial sell profit if TP1 fired before close.
</ResponseField>

<ResponseField name="close_reason" type="string">
  Canonical close reason. One of:

  | Value             | Description                                               |
  | :---------------- | :-------------------------------------------------------- |
  | `STOP_LOSS`       | Hard stop loss hit                                        |
  | `TP1`             | Closed at TP1 level (rare -- usually TSL fires after TP1) |
  | `TP2`             | Take Profit 2 hit                                         |
  | `TSL`             | Trailing stop loss triggered                              |
  | `BE_SHIELD`       | Break-Even Shield triggered                               |
  | `MANUAL`          | Manually closed via Telegram command                      |
  | `EXIT_SIGNAL`     | Score-based exit signal                                   |
  | `REGIME_EXIT`     | Market regime change forced exit                          |
  | `CONVICTION_EXIT` | AI Council low-conviction exit                            |
  | `FLASH_CRASH`     | Emergency flash-crash exit                                |
</ResponseField>

<ResponseField name="closed_at" type="string">
  ISO 8601 timestamp when the trade closed.
</ResponseField>

## Delivery

Delivered as a signed `POST` to your registered URL with:

* `X-AIOKA-Event: ghost.closed`
* `X-AIOKA-Signature: sha256=<hex>`
* `X-AIOKA-Timestamp: <unix>`

See [Register Webhook](/api-reference/webhooks/register) for signature verification.
