> ## 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 Trader Track Record

> Full validated trade history with per-trade detail, aggregates, and equity curve

## Overview

Returns the complete Ghost Trader track record since the Sprint 164 clean-slate restart
(2026-04-12 17:55 UTC). Powers the [aioka.io/track-record](https://aioka.io/track-record)
page. Every field is JSON-encoded in **camelCase** to match the website TypeScript
interface one-for-one.

Only trades with `is_valid = true` and `status = 'CLOSED'` are included. Backfilled,
synthetic, and open trades are excluded. `/v1/ghost/stats` remains the lightweight
5-field homepage widget endpoint — this endpoint is the full-history counterpart.

**Tier:** Public ✅ — No API key required
**Cache:** 300s (Redis)
**Rate limit:** None

## Response Fields — Aggregates

| Field                | Type    | Description                                                            |
| -------------------- | ------- | ---------------------------------------------------------------------- |
| `validatedTrades`    | integer | Number of closed validated trades in the history                       |
| `tradingMode`        | string  | `"LIVE"` once any trade has a real Kraken fill, otherwise `"PAPER"`    |
| `winRate`            | float   | Percentage of validated closed trades that were profitable (0.0–100.0) |
| `totalPnlUsd`        | float   | Sum of P\&L (USD) across all validated closed trades                   |
| `avgHoldTimeMinutes` | float   | Mean hold duration across all validated trades                         |
| `bestTradeUsd`       | float   | Best single-trade P\&L                                                 |
| `worstTradeUsd`      | float   | Worst single-trade P\&L                                                |
| `avgPnlPerTrade`     | float   | Mean P\&L per trade                                                    |
| `since`              | string  | Track record restart date (`"2026-04-12"`)                             |
| `trades`             | array   | Per-trade detail (see below)                                           |
| `equityCurve`        | array   | Cumulative P\&L points for charting                                    |

## Response Fields — Each Trade

| Field             | Type              | Description                                                                                    |
| ----------------- | ----------------- | ---------------------------------------------------------------------------------------------- |
| `id`              | string            | Trade UUID                                                                                     |
| `entryTime`       | string (ISO 8601) | UTC entry timestamp                                                                            |
| `exitTime`        | string (ISO 8601) | UTC exit timestamp                                                                             |
| `entryPrice`      | float             | BTC price at entry (USD)                                                                       |
| `exitPrice`       | float             | BTC price at exit (USD)                                                                        |
| `holdTimeMinutes` | integer           | Trade duration in minutes                                                                      |
| `pnlUsd`          | float             | Total trade P\&L including TP1 partial                                                         |
| `pnlPercent`      | float             | Percentage move from entry to exit                                                             |
| `result`          | string            | `"WIN"` or `"LOSS"`                                                                            |
| `mode`            | string            | Entry mode — `"A"`, `"B"`, or `"C"`                                                            |
| `tp1Hit`          | boolean           | Whether TP1 fired during the trade                                                             |
| `exitReason`      | string            | Human-readable exit cause (`"TP2 (Final Exit — Remaining 50%)"`, `"TSL"`, `"Stop Loss"`, etc.) |
| `entryConditions` | object \| null    | Entry snapshot — `councilVerdict`, `rsi`, `emaDistance`, `confidence`                          |

## Response Fields — Equity Curve Point

| Field           | Type           | Description                                       |
| --------------- | -------------- | ------------------------------------------------- |
| `date`          | string         | Exit timestamp for this point                     |
| `cumulativePnl` | float          | Running total P\&L up to and including this trade |
| `tradeId`       | string \| null | Trade UUID for cross-reference                    |
| `result`        | string \| null | `"WIN"` or `"LOSS"`                               |

<Note>
  P\&L accounting includes both the TP1 partial close and the final exit. A trade where
  TP1 locked +$670 and the remaining 50% exited at −$268 reports `pnlUsd = 401.35`.
</Note>

<RequestExample>
  ```bash curl theme={null}
  curl https://api.aioka.io/v1/ghost/track-record
  ```

  ```python Python theme={null}
  import httpx

  resp = httpx.get("https://api.aioka.io/v1/ghost/track-record")
  data = resp.json()
  print(f"{data['validatedTrades']} validated trades — mode: {data['tradingMode']}")
  print(f"Win rate: {data['winRate']}%  |  Total P&L: ${data['totalPnlUsd']:.2f}")
  for t in data["trades"]:
      print(f"  {t['id']}  {t['result']}  ${t['pnlUsd']:+.2f}  ({t['holdTimeMinutes']}m)")
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "validatedTrades": 1,
    "tradingMode": "LIVE",
    "winRate": 100.0,
    "totalPnlUsd": 795.28,
    "avgHoldTimeMinutes": 1470.0,
    "bestTradeUsd": 795.28,
    "worstTradeUsd": 0.0,
    "avgPnlPerTrade": 795.28,
    "since": "2026-04-12",
    "trades": [
      {
        "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "entryTime": "2026-04-12T20:00:00+00:00",
        "exitTime": "2026-04-13T20:30:00+00:00",
        "entryPrice": 71070.60,
        "exitPrice": 73329.50,
        "holdTimeMinutes": 1470,
        "pnlUsd": 795.28,
        "pnlPercent": 3.18,
        "result": "WIN",
        "mode": "A",
        "tp1Hit": true,
        "exitReason": "TP2 (Final Exit — Remaining 50%)",
        "entryConditions": {
          "councilVerdict": "BUY",
          "rsi": 35.44,
          "emaDistance": 0.6577,
          "confidence": 0.82
        }
      }
    ],
    "equityCurve": [
      {
        "date": "2026-04-13T20:30:00+00:00",
        "cumulativePnl": 795.28,
        "tradeId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "result": "WIN"
      }
    ]
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /v1/ghost/track-record
openapi: 3.1.0
info:
  title: AIOKA Intelligence API
  description: |

    ## AI-powered crypto market intelligence

    AIOKA Intelligence API provides real-time access to our AI Council verdicts,
    market signals, regime detection, and Ghost Trader entry signals.

    ### Tiers
    - **Free**: 100 calls/day — Verdict + Regime
    - **Basic** ($49/mo): 1,000 calls/day — + Signals
    - **Pro** ($199/mo): 10,000 calls/day — + Council + Ghost

    ### Authentication
    Pass your API key in the `X-API-Key` header:

    ```
    X-API-Key: aik_free_xxxxxxxxxxxx
    ```

    ### Get your API key
    `POST /v1/keys/generate` (free tier, no credit card)
  contact:
    name: AIOKA Support
    url: https://docs.aioka.io/
    email: api@aioka.io
  license:
    name: Commercial
    url: https://aioka.io/terms
  version: 1.0.0
servers:
  - url: https://api.aioka.io
    description: Production — AIOKA Intelligence API
security: []
paths:
  /v1/ghost/track-record:
    get:
      tags:
        - Ghost Trader
      summary: Ghost Trader Full Track Record
      description: >-
        Returns the full validated Ghost Trader track record since the Sprint
        164 deployment

        (2026-04-12 17:55 UTC — see CLAUDE.md clean slate). Each entry includes
        entry/exit

        prices, hold time, PnL, exit reason, and the entry-time council ruling.
        Derived

        aggregates (total PnL, win rate, best/worst trade, avg hold, avg PnL per
        trade) and a

        cumulative equity curve are included so the client can render the full
        track record

        page from a single response.


        ⚠️ **This is paper-trading data.** AIOKA Ghost Trader is a simulation
        and never places

        real orders via this endpoint.


        **Tier:** Public ✅

        **Cache:** None

        **Use:** aioka.io/track-record page
      operationId: get_ghost_track_record_v1_ghost_track_record_get
      responses:
        '200':
          description: Full validated track record
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GhostTrackRecordResponse'
      security: []
components:
  schemas:
    GhostTrackRecordResponse:
      properties:
        validatedTrades:
          type: integer
          title: Validatedtrades
        tradingMode:
          type: string
          title: Tradingmode
        winRate:
          type: number
          title: Winrate
        totalPnlUsd:
          type: number
          title: Totalpnlusd
        avgHoldTimeMinutes:
          type: number
          title: Avgholdtimeminutes
        bestTradeUsd:
          type: number
          title: Besttradeusd
        worstTradeUsd:
          type: number
          title: Worsttradeusd
        avgPnlPerTrade:
          type: number
          title: Avgpnlpertrade
        since:
          type: string
          title: Since
        trades:
          items:
            $ref: '#/components/schemas/GhostTrackRecordTrade'
          type: array
          title: Trades
        equityCurve:
          items:
            $ref: '#/components/schemas/GhostTrackRecordEquityPoint'
          type: array
          title: Equitycurve
      type: object
      required:
        - validatedTrades
        - tradingMode
        - winRate
        - totalPnlUsd
        - avgHoldTimeMinutes
        - bestTradeUsd
        - worstTradeUsd
        - avgPnlPerTrade
        - since
        - trades
        - equityCurve
      title: GhostTrackRecordResponse
    GhostTrackRecordTrade:
      properties:
        id:
          type: string
          title: Id
        entryTime:
          type: string
          title: Entrytime
        exitTime:
          type: string
          title: Exittime
        entryPrice:
          type: number
          title: Entryprice
        exitPrice:
          type: number
          title: Exitprice
        holdTimeMinutes:
          type: integer
          title: Holdtimeminutes
        pnlUsd:
          type: number
          title: Pnlusd
        pnlPercent:
          type: number
          title: Pnlpercent
        result:
          type: string
          title: Result
        mode:
          type: string
          title: Mode
        tp1Hit:
          type: boolean
          title: Tp1Hit
        exitReason:
          type: string
          title: Exitreason
        entryConditions:
          anyOf:
            - $ref: '#/components/schemas/GhostTrackRecordEntryConditions'
            - type: 'null'
      type: object
      required:
        - id
        - entryTime
        - exitTime
        - entryPrice
        - exitPrice
        - holdTimeMinutes
        - pnlUsd
        - pnlPercent
        - result
        - mode
        - tp1Hit
        - exitReason
      title: GhostTrackRecordTrade
    GhostTrackRecordEquityPoint:
      properties:
        date:
          type: string
          title: Date
        cumulativePnl:
          type: number
          title: Cumulativepnl
        tradeId:
          anyOf:
            - type: string
            - type: 'null'
          title: Tradeid
        result:
          anyOf:
            - type: string
            - type: 'null'
          title: Result
      type: object
      required:
        - date
        - cumulativePnl
      title: GhostTrackRecordEquityPoint
    GhostTrackRecordEntryConditions:
      properties:
        councilVerdict:
          type: string
          title: Councilverdict
        rsi:
          type: number
          title: Rsi
        emaDistance:
          type: number
          title: Emadistance
        confidence:
          type: number
          title: Confidence
      type: object
      required:
        - councilVerdict
        - rsi
        - emaDistance
        - confidence
      title: GhostTrackRecordEntryConditions

````