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

> Public validated trade count since production launch

## Overview

Returns the count of validated (real, non-synthetic) Ghost Trader trades since the
Sprint 164 deployment on 2026-04-12 (clean-slate track record restart). Used by the aioka.io website for public
track record display.

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

## Response Fields

| Field              | Type    | Description                                                                                                |
| ------------------ | ------- | ---------------------------------------------------------------------------------------------------------- |
| `validated_trades` | integer | Number of validated trades with `is_valid=true` since launch                                               |
| `since`            | string  | Track record restart date (`"2026-04-12"`)                                                                 |
| `total_pnl`        | float   | Sum of P\&L (USD) across all validated closed trades. Returns `0.0` if no closed trades.                   |
| `win_rate`         | float   | Percentage of validated closed trades that were profitable (0.0–100.0). Returns `0.0` if no closed trades. |

<Note>
  Only trades marked `is_valid=true` are included in all calculations. Backfilled, synthetic, or
  test trades are excluded. `total_pnl` and `win_rate` are computed from **closed** validated trades only —
  an open position is counted in `validated_trades` but not in P\&L or win rate until it closes.
</Note>

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

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

  resp = httpx.get("https://api.aioka.io/v1/ghost/stats")
  data = resp.json()
  print(f"{data['validated_trades']} validated trades")
  print(f"Win rate: {data['win_rate']}%  |  Total P&L: ${data['total_pnl']:.2f}")
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "validated_trades": 3,
    "since": "2026-04-12",
    "total_pnl": 155.77,
    "win_rate": 67.0,
    "sprint": 336,
    "tests_passing": 5320
  }
  ```
</ResponseExample>


## OpenAPI

````yaml GET /v1/ghost/stats
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/stats:
    get:
      tags:
        - Ghost Trader
      summary: Ghost Trader Validated Trade Count
      description: >-
        Returns the count of validated (real, non-synthetic) Ghost Trader trades
        since the

        Sprint 164 deployment on 2026-04-12 (track record restart — see
        CLAUDE.md).


        **Tier:** Public ✅

        **Cache:** None

        **Use:** Website stats widgets, public track record display
      operationId: get_ghost_stats_v1_ghost_stats_get
      responses:
        '200':
          description: Trade count since production launch
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GhostStatsResponse'
      security: []
components:
  schemas:
    GhostStatsResponse:
      properties:
        validated_trades:
          type: integer
          title: Validated Trades
        since:
          type: string
          title: Since
        total_pnl:
          type: number
          title: Total Pnl
        win_rate:
          type: number
          title: Win Rate
        sprint:
          type: integer
          title: Sprint
        tests_passing:
          type: integer
          title: Tests Passing
      type: object
      required:
        - validated_trades
        - since
        - total_pnl
        - win_rate
        - sprint
        - tests_passing
      title: GhostStatsResponse
      example:
        since: '2026-04-12'
        sprint: 229
        tests_passing: 2153
        total_pnl: 155.77
        validated_trades: 3
        win_rate: 67

````