Skip to main content

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.

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.
{
  "url": "https://your-server.com/aioka-hook",
  "events": ["ghost.closed"]
}

Payload

{
  "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

trade_id
string
UUID of the closed trade.
asset
string
Asset symbol. One of: BTC, ETH, SOL, TAO, GOLD.
entry_price
decimal
Entry price in USD.
exit_price
decimal
Final exit price in USD.
pnl
decimal
Net P&L in USD, including TP1 partial sell profit if TP1 fired before close.
close_reason
string
Canonical close reason. One of:
ValueDescription
STOP_LOSSHard stop loss hit
TP1Closed at TP1 level (rare — usually TSL fires after TP1)
TP2Take Profit 2 hit
TSLTrailing stop loss triggered
BE_SHIELDBreak-Even Shield triggered
MANUALManually closed via Telegram command
EXIT_SIGNALScore-based exit signal
REGIME_EXITMarket regime change forced exit
CONVICTION_EXITAI Council low-conviction exit
FLASH_CRASHEmergency flash-crash exit
closed_at
string
ISO 8601 timestamp when the trade closed.

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 for signature verification.