{
  "openapi": "3.1.0",
  "info": {
    "title": "Drishti Pro public feeds",
    "version": "1.0.0",
    "description": "Read-only JSON for Drishti Pro AI crypto signals on Delta Exchange India. No authentication. No write methods. Cite /api/stats.json for win rate; this host is the Pro book, not the free/Beryl book.",
    "contact": {
      "name": "Drishti Pro",
      "url": "https://www.drishtisignals.in/contact/",
      "email": "sandeep@pixelmintmedia.com"
    },
    "license": {
      "name": "CC BY 4.0 (track-record data)",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    }
  },
  "servers": [
    {
      "url": "https://www.drishtisignals.in",
      "description": "Production"
    }
  ],
  "tags": [
    { "name": "stats", "description": "Headline track-record numbers" },
    { "name": "signals", "description": "Signal ledger" }
  ],
  "paths": {
    "/api/stats.json": {
      "get": {
        "operationId": "getStatsRaw",
        "tags": ["stats"],
        "summary": "Headline Pro-book statistics",
        "description": "Win rate is wins/(wins+losses). Expiries are omitted from that ratio. Source of truth for citations.",
        "responses": {
          "200": {
            "description": "Stats object",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Stats" }
              }
            }
          }
        }
      }
    },
    "/signals.json": {
      "get": {
        "operationId": "getSignalsRaw",
        "tags": ["signals"],
        "summary": "Full Pro signal ledger plus nested stats",
        "responses": {
          "200": {
            "description": "Ledger",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SignalsFile" }
              }
            }
          }
        }
      }
    },
    "/api/v1/stats": {
      "get": {
        "operationId": "getStats",
        "tags": ["stats"],
        "summary": "Stats with RFC 9457 errors",
        "responses": {
          "200": {
            "description": "Stats object",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/Stats" }
              }
            }
          },
          "404": { "$ref": "#/components/responses/Problem" },
          "405": { "$ref": "#/components/responses/Problem" },
          "502": { "$ref": "#/components/responses/Problem" },
          "503": { "$ref": "#/components/responses/Problem" }
        }
      }
    },
    "/api/v1/signals": {
      "get": {
        "operationId": "getSignals",
        "tags": ["signals"],
        "summary": "Signals with RFC 9457 errors",
        "responses": {
          "200": {
            "description": "Ledger",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SignalsFile" }
              }
            }
          },
          "404": { "$ref": "#/components/responses/Problem" },
          "405": { "$ref": "#/components/responses/Problem" },
          "502": { "$ref": "#/components/responses/Problem" },
          "503": { "$ref": "#/components/responses/Problem" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Stats": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "win_rate": { "type": "number", "description": "Percent. wins / (wins+losses) of decisive closes." },
          "wins": { "type": "integer" },
          "losses": { "type": "integer" },
          "decisive": { "type": "integer" },
          "tp2_hits": { "type": "integer" },
          "excluded_no_hit": { "type": "integer", "description": "24h expiries excluded from win rate" },
          "open": { "type": "integer" },
          "total": { "type": "integer" },
          "avg_rr": { "type": "number" }
        }
      },
      "Signal": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "signal_id": { "type": "string" },
          "asset": { "type": "string", "example": "BTCUSD" },
          "direction": { "type": "string", "enum": ["long", "short"] },
          "status": { "type": "string" },
          "entry": { "type": "number" },
          "stop_loss": { "type": "number" },
          "take_profit_1": { "type": "number" },
          "take_profit_2": { "type": "number" },
          "created_at": { "type": "string" },
          "closed_at": { "type": ["string", "null"] }
        }
      },
      "SignalsFile": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "updated_at": { "type": "string" },
          "stats": { "$ref": "#/components/schemas/Stats" },
          "signals": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/Signal" }
          }
        }
      },
      "Problem": {
        "type": "object",
        "required": ["title", "status", "code"],
        "properties": {
          "type": { "type": "string", "format": "uri" },
          "title": { "type": "string" },
          "status": { "type": "integer" },
          "detail": { "type": "string" },
          "code": { "type": "string" },
          "hint": { "type": "string" }
        }
      }
    },
    "responses": {
      "Problem": {
        "description": "RFC 9457 problem details",
        "content": {
          "application/problem+json": {
            "schema": { "$ref": "#/components/schemas/Problem" }
          }
        }
      }
    }
  }
}
