{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/stocktrends-com/json-schema/stocktrends-com-stock-trends-portfolio-returns-response-schema.json",
  "title": "StockTrendsPortfolioReturnsResponse",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/stocktrends-com-openapi.json#/components/schemas/StockTrendsPortfolioReturnsResponse",
  "properties": {
    "request_id": {
      "type": "string",
      "title": "Request Id"
    },
    "port_id": {
      "type": "integer",
      "title": "Port Id"
    },
    "portfolio": {
      "$ref": "#/$defs/StockTrendsPortfolioReturnsPortfolio"
    },
    "count": {
      "type": "integer",
      "title": "Count"
    },
    "returns": {
      "items": {
        "$ref": "#/$defs/StockTrendsPortfolioReturnPoint"
      },
      "type": "array",
      "title": "Returns"
    }
  },
  "type": "object",
  "required": [
    "request_id",
    "port_id",
    "portfolio",
    "count",
    "returns"
  ],
  "$defs": {
    "StockTrendsPortfolioReturnPoint": {
      "properties": {
        "weekdate": {
          "type": "string",
          "title": "Weekdate",
          "description": "Week-ending date for the portfolio return observation."
        },
        "buys": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Buys",
          "description": "Official portfolio buy activity recorded for the week."
        },
        "sells": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Sells",
          "description": "Official portfolio sell activity recorded for the week."
        },
        "held": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Held",
          "description": "Official portfolio held count recorded for the week."
        },
        "net_proceeds": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Net Proceeds",
          "description": "Official net proceeds recorded for the portfolio observation."
        },
        "realized_gain": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Realized Gain",
          "description": "Official realized gain for the portfolio observation."
        },
        "cumulative_realized_gain": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cumulative Realized Gain",
          "description": "Official cumulative realized gain through the observation week."
        },
        "total_valuation": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Total Valuation",
          "description": "Official total portfolio valuation for the observation week."
        },
        "unrealized_gain": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Unrealized Gain",
          "description": "Official unrealized gain for the portfolio observation."
        },
        "cumulative_total_gain": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Cumulative Total Gain",
          "description": "Official cumulative total gain through the observation week."
        },
        "tsx_index": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Tsx Index",
          "description": "TSX index reference value recorded with the portfolio observation."
        },
        "sp_index": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Sp Index",
          "description": "S&P index reference value recorded with the portfolio observation."
        }
      },
      "type": "object",
      "required": [
        "weekdate"
      ],
      "title": "StockTrendsPortfolioReturnPoint"
    },
    "StockTrendsPortfolioReturnsPortfolio": {
      "properties": {
        "port_id": {
          "type": "integer",
          "title": "Port Id",
          "description": "Official Stock Trends portfolio identifier."
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Name",
          "description": "Official Stock Trends portfolio name."
        },
        "selection_universe": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Selection Universe",
          "description": "Stock Trends strategy selection/filter universe configured for the portfolio."
        }
      },
      "type": "object",
      "required": [
        "port_id"
      ],
      "title": "StockTrendsPortfolioReturnsPortfolio"
    }
  }
}