{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/alphabazaar-ai/json-schema/alphabazaar-ai-pnl-summary-response-schema.json",
  "title": "PnlSummaryResponse",
  "description": "GET /api/performance/pnl-summary",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/alphabazaar-ai-openapi.yml#/components/schemas/PnlSummaryResponse",
  "properties": {
    "status": {
      "type": "string",
      "title": "Status"
    },
    "total_signals": {
      "type": "integer",
      "title": "Total Signals"
    },
    "open_signals": {
      "type": "integer",
      "title": "Open Signals"
    },
    "closed_signals": {
      "type": "integer",
      "title": "Closed Signals"
    },
    "total_realized_pnl_percent": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Total Realized Pnl Percent"
    },
    "total_unrealized_pnl_percent": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Total Unrealized Pnl Percent"
    },
    "avg_return_percent": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Avg Return Percent"
    },
    "win_rate": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "title": "Win Rate"
    },
    "wins": {
      "type": "integer",
      "title": "Wins",
      "default": 0
    },
    "losses": {
      "type": "integer",
      "title": "Losses",
      "default": 0
    },
    "best_trade": {
      "anyOf": [
        {
          "$ref": "#/$defs/PnlSignalSummary"
        },
        {
          "type": "null"
        }
      ]
    },
    "worst_trade": {
      "anyOf": [
        {
          "$ref": "#/$defs/PnlSignalSummary"
        },
        {
          "type": "null"
        }
      ]
    },
    "open_positions": {
      "items": {
        "$ref": "#/$defs/PnlSignalSummary"
      },
      "type": "array",
      "title": "Open Positions",
      "default": []
    },
    "closed_positions": {
      "items": {
        "$ref": "#/$defs/PnlSignalSummary"
      },
      "type": "array",
      "title": "Closed Positions",
      "default": []
    }
  },
  "type": "object",
  "required": [
    "status",
    "total_signals",
    "open_signals",
    "closed_signals"
  ],
  "$defs": {
    "PnlSignalSummary": {
      "properties": {
        "signal_id": {
          "type": "string",
          "title": "Signal Id"
        },
        "ticker": {
          "type": "string",
          "title": "Ticker"
        },
        "action": {
          "type": "string",
          "title": "Action"
        },
        "entry_price": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Entry Price"
        },
        "exit_price": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Exit Price"
        },
        "current_price": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Current Price"
        },
        "pnl_percent": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Pnl Percent"
        },
        "pnl_dollars": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Pnl Dollars"
        },
        "position_size_percent": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Position Size Percent"
        },
        "status": {
          "type": "string",
          "title": "Status"
        },
        "close_reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Close Reason"
        },
        "opened_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Opened At"
        },
        "closed_at": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Closed At"
        }
      },
      "type": "object",
      "required": [
        "signal_id",
        "ticker",
        "action",
        "status"
      ],
      "title": "PnlSignalSummary"
    }
  }
}