{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/stocktrends-com/json-schema/stocktrends-com-stock-trends-portfolio-strategy-response-schema.json",
  "title": "StockTrendsPortfolioStrategyResponse",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/stocktrends-com-openapi.json#/components/schemas/StockTrendsPortfolioStrategyResponse",
  "properties": {
    "request_id": {
      "type": "string",
      "title": "Request Id"
    },
    "port_id": {
      "type": "integer",
      "title": "Port Id"
    },
    "portfolio": {
      "$ref": "#/$defs/StockTrendsPortfolioStrategyPortfolio"
    },
    "strategy": {
      "$ref": "#/$defs/StockTrendsPortfolioStrategyData"
    },
    "verification": {
      "$ref": "#/$defs/StockTrendsPortfolioStrategyVerification"
    }
  },
  "type": "object",
  "required": [
    "request_id",
    "port_id",
    "portfolio",
    "strategy",
    "verification"
  ],
  "$defs": {
    "StockTrendsPortfolioStrategyData": {
      "properties": {
        "strategy_id": {
          "type": "integer",
          "title": "Strategy Id"
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Description"
        },
        "investment_amount": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Investment Amount"
        },
        "transaction_cost_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Transaction Cost Pct"
        },
        "round_trip_transaction_cost_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Round Trip Transaction Cost Pct"
        },
        "stop_loss_pct": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Stop Loss Pct"
        },
        "stop_loss_minimum": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "title": "Stop Loss Minimum"
        },
        "conditions": {
          "$ref": "#/$defs/StockTrendsStrategyConditions"
        }
      },
      "type": "object",
      "required": [
        "strategy_id",
        "description",
        "investment_amount",
        "transaction_cost_pct",
        "round_trip_transaction_cost_pct",
        "stop_loss_pct",
        "stop_loss_minimum",
        "conditions"
      ],
      "title": "StockTrendsPortfolioStrategyData"
    },
    "StockTrendsPortfolioStrategyPortfolio": {
      "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."
        },
        "strategy_id": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Strategy Id",
          "description": "Legacy strategy identifier configured for the portfolio."
        },
        "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": "StockTrendsPortfolioStrategyPortfolio"
    },
    "StockTrendsPortfolioStrategyVerification": {
      "properties": {
        "portfolio_metadata_endpoint": {
          "type": "string",
          "title": "Portfolio Metadata Endpoint"
        },
        "portfolio_returns_endpoint": {
          "type": "string",
          "title": "Portfolio Returns Endpoint"
        },
        "historical_positions_endpoint": {
          "type": "string",
          "title": "Historical Positions Endpoint"
        },
        "summary_endpoint": {
          "type": "string",
          "title": "Summary Endpoint"
        },
        "current_live_holdings_excluded": {
          "type": "boolean",
          "title": "Current Live Holdings Excluded"
        },
        "current_matching_candidates_excluded": {
          "type": "boolean",
          "title": "Current Matching Candidates Excluded"
        },
        "conditions_are_metadata_not_executable_api": {
          "type": "boolean",
          "title": "Conditions Are Metadata Not Executable Api"
        }
      },
      "type": "object",
      "required": [
        "portfolio_metadata_endpoint",
        "portfolio_returns_endpoint",
        "historical_positions_endpoint",
        "summary_endpoint",
        "current_live_holdings_excluded",
        "current_matching_candidates_excluded",
        "conditions_are_metadata_not_executable_api"
      ],
      "title": "StockTrendsPortfolioStrategyVerification"
    },
    "StockTrendsStrategyCondition": {
      "properties": {
        "sequence": {
          "type": "integer",
          "title": "Sequence",
          "description": "Deterministic alphabetical sequence within the buy or sell condition group. This does not imply strategy evaluation order."
        },
        "left_side": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Left Side",
          "description": "Legacy left-side condition expression."
        },
        "operator": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Operator",
          "description": "Legacy condition operator."
        },
        "right_side": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Right Side",
          "description": "Legacy right-side condition expression."
        },
        "sell_trigger": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Sell Trigger",
          "description": "Legacy sell-trigger code attached to sell rows."
        },
        "legacy_expression": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Legacy Expression",
          "description": "Null-safe legacy expression assembled as left_side, operator, and right_side metadata."
        }
      },
      "type": "object",
      "required": [
        "sequence"
      ],
      "title": "StockTrendsStrategyCondition"
    },
    "StockTrendsStrategyConditions": {
      "properties": {
        "buy": {
          "items": {
            "$ref": "#/$defs/StockTrendsStrategyCondition"
          },
          "type": "array",
          "title": "Buy"
        },
        "sell": {
          "items": {
            "$ref": "#/$defs/StockTrendsStrategyCondition"
          },
          "type": "array",
          "title": "Sell"
        }
      },
      "type": "object",
      "required": [
        "buy",
        "sell"
      ],
      "title": "StockTrendsStrategyConditions"
    }
  }
}