{
  "components": {
    "schemas": {
      "AboveAverage": {
        "properties": {
          "count": {
            "description": "Stocks closing above it.",
            "title": "Count",
            "type": "integer"
          },
          "days": {
            "description": "The average's length in sessions.",
            "title": "Days",
            "type": "integer"
          },
          "eligible": {
            "description": "Stocks with enough bars to have the average.",
            "title": "Eligible",
            "type": "integer"
          },
          "pct": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "count / eligible; null when none is eligible.",
            "title": "Pct"
          }
        },
        "required": [
          "days",
          "count",
          "eligible",
          "pct"
        ],
        "title": "AboveAverage",
        "type": "object"
      },
      "AccountProfileBody": {
        "additionalProperties": false,
        "properties": {
          "account_type": {
            "default": "cash",
            "enum": [
              "cash",
              "margin"
            ],
            "title": "Account Type",
            "type": "string"
          },
          "acknowledge_margin_risks": {
            "default": false,
            "title": "Acknowledge Margin Risks",
            "type": "boolean"
          },
          "allow_short": {
            "default": false,
            "title": "Allow Short",
            "type": "boolean"
          },
          "base_currency": {
            "default": "USD",
            "maxLength": 3,
            "minLength": 3,
            "title": "Base Currency",
            "type": "string"
          },
          "client_class": {
            "default": "retail",
            "enum": [
              "retail",
              "professional"
            ],
            "title": "Client Class",
            "type": "string"
          },
          "fx_policy": {
            "default": "refuse",
            "enum": [
              "refuse",
              "convert"
            ],
            "title": "Fx Policy",
            "type": "string"
          },
          "jurisdiction": {
            "enum": [
              "us",
              "eu",
              "uk"
            ],
            "title": "Jurisdiction",
            "type": "string"
          },
          "wash_sale_mode": {
            "default": "warn",
            "enum": [
              "warn",
              "block"
            ],
            "title": "Wash Sale Mode",
            "type": "string"
          }
        },
        "required": [
          "jurisdiction"
        ],
        "title": "AccountProfileBody",
        "type": "object"
      },
      "AccountProfileView": {
        "additionalProperties": false,
        "properties": {
          "account_type": {
            "default": "cash",
            "enum": [
              "cash",
              "margin"
            ],
            "title": "Account Type",
            "type": "string"
          },
          "allow_short": {
            "default": false,
            "title": "Allow Short",
            "type": "boolean"
          },
          "base_currency": {
            "default": "USD",
            "maxLength": 3,
            "minLength": 3,
            "title": "Base Currency",
            "type": "string"
          },
          "client_class": {
            "default": "retail",
            "enum": [
              "retail",
              "professional"
            ],
            "title": "Client Class",
            "type": "string"
          },
          "fx_policy": {
            "default": "refuse",
            "enum": [
              "refuse",
              "convert"
            ],
            "title": "Fx Policy",
            "type": "string"
          },
          "jurisdiction": {
            "enum": [
              "us",
              "eu",
              "uk"
            ],
            "title": "Jurisdiction",
            "type": "string"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "wash_sale_mode": {
            "default": "warn",
            "enum": [
              "warn",
              "block"
            ],
            "title": "Wash Sale Mode",
            "type": "string"
          }
        },
        "required": [
          "jurisdiction",
          "portfolio_id"
        ],
        "title": "AccountProfileView",
        "type": "object"
      },
      "AccountRuleView": {
        "properties": {
          "applies": {
            "title": "Applies",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name",
          "applies"
        ],
        "title": "AccountRuleView",
        "type": "object"
      },
      "AccountRulesSettings": {
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "default": false,
            "title": "Enabled",
            "type": "boolean"
          },
          "margin_accounts": {
            "default": false,
            "title": "Margin Accounts",
            "type": "boolean"
          },
          "margin_buffer": {
            "default": 0.1,
            "exclusiveMaximum": 1.0,
            "minimum": 0.0,
            "title": "Margin Buffer",
            "type": "number"
          },
          "pdt_equity_threshold": {
            "default": 25000.0,
            "minimum": 0.0,
            "title": "Pdt Equity Threshold",
            "type": "number"
          },
          "pdt_max_day_trades": {
            "default": 3,
            "minimum": 0.0,
            "title": "Pdt Max Day Trades",
            "type": "integer"
          },
          "pdt_window_days": {
            "default": 5,
            "minimum": 1.0,
            "title": "Pdt Window Days",
            "type": "integer"
          },
          "settlement_days": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "Settlement Days",
            "type": "object"
          },
          "short_disclosure_threshold": {
            "default": 0.001,
            "exclusiveMaximum": 1.0,
            "exclusiveMinimum": 0.0,
            "title": "Short Disclosure Threshold",
            "type": "number"
          },
          "wash_sale_window_days": {
            "default": 30,
            "minimum": 0.0,
            "title": "Wash Sale Window Days",
            "type": "integer"
          }
        },
        "title": "AccountRulesSettings",
        "type": "object"
      },
      "ActionDecision": {
        "additionalProperties": false,
        "properties": {
          "approve": {
            "description": "true runs the action, false drops it.",
            "title": "Approve",
            "type": "boolean"
          }
        },
        "required": [
          "approve"
        ],
        "title": "ActionDecision",
        "type": "object"
      },
      "AdjustmentView": {
        "properties": {
          "adjusted_quantity": {
            "title": "Adjusted Quantity",
            "type": "number"
          },
          "original_quantity": {
            "title": "Original Quantity",
            "type": "number"
          },
          "reason": {
            "title": "Reason",
            "type": "string"
          },
          "rule": {
            "title": "Rule",
            "type": "string"
          },
          "side": {
            "title": "Side",
            "type": "string"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "ticker",
          "side",
          "rule",
          "original_quantity",
          "adjusted_quantity",
          "reason"
        ],
        "title": "AdjustmentView",
        "type": "object"
      },
      "AgreementView": {
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The price day the strategies scored.",
            "title": "As Of"
          },
          "holdings": {
            "items": {
              "$ref": "#/components/schemas/HoldingAgreement"
            },
            "title": "Holdings",
            "type": "array"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "skipped": {
            "description": "Active strategies that could not be loaded.",
            "items": {
              "type": "string"
            },
            "title": "Skipped",
            "type": "array"
          },
          "strategies": {
            "description": "Active strategies asked, in registry order.",
            "items": {
              "type": "string"
            },
            "title": "Strategies",
            "type": "array"
          }
        },
        "required": [
          "portfolio_id",
          "as_of",
          "strategies",
          "skipped",
          "holdings"
        ],
        "title": "AgreementView",
        "type": "object"
      },
      "AlertView": {
        "properties": {
          "context": {
            "additionalProperties": true,
            "title": "Context",
            "type": "object"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "level": {
            "enum": [
              "info",
              "warning",
              "error"
            ],
            "title": "Level",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "title": {
            "title": "Title",
            "type": "string"
          }
        },
        "required": [
          "id",
          "level",
          "title",
          "message",
          "context",
          "created_at"
        ],
        "title": "AlertView",
        "type": "object"
      },
      "AlgoInfo": {
        "properties": {
          "cost_assumption": {
            "additionalProperties": {
              "type": "number"
            },
            "description": "spread_factor, impact_factor and timing_bps the backtest assumes.",
            "title": "Cost Assumption",
            "type": "object"
          },
          "defaults": {
            "additionalProperties": true,
            "title": "Defaults",
            "type": "object"
          },
          "description": {
            "title": "Description",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "params_schema": {
            "additionalProperties": true,
            "title": "Params Schema",
            "type": "object"
          },
          "sliceable": {
            "description": "Stonks can send it as child orders at other brokers.",
            "title": "Sliceable",
            "type": "boolean"
          },
          "title": {
            "title": "Title",
            "type": "string"
          }
        },
        "required": [
          "name",
          "title",
          "description",
          "sliceable",
          "params_schema",
          "defaults",
          "cost_assumption"
        ],
        "title": "AlgoInfo",
        "type": "object"
      },
      "AlgoList": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/AlgoInfo"
            },
            "title": "Items",
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "title": "AlgoList",
        "type": "object"
      },
      "AlgoSettingList": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/AlgoSettingView"
            },
            "title": "Items",
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "title": "AlgoSettingList",
        "type": "object"
      },
      "AlgoSettingUpdate": {
        "additionalProperties": false,
        "properties": {
          "algo": {
            "maxLength": 32,
            "minLength": 1,
            "title": "Algo",
            "type": "string"
          },
          "params": {
            "additionalProperties": true,
            "title": "Params",
            "type": "object"
          },
          "strategy_id": {
            "anyOf": [
              {
                "pattern": "^[A-Za-z0-9_.\\-]{1,64}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Id"
          }
        },
        "required": [
          "algo"
        ],
        "title": "AlgoSettingUpdate",
        "type": "object"
      },
      "AlgoSettingView": {
        "properties": {
          "algo": {
            "title": "Algo",
            "type": "string"
          },
          "params": {
            "additionalProperties": true,
            "title": "Params",
            "type": "object"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Empty: the portfolio's own setting.",
            "title": "Strategy Id"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "updated_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated By"
          }
        },
        "required": [
          "portfolio_id",
          "strategy_id",
          "algo",
          "params",
          "updated_by",
          "updated_at"
        ],
        "title": "AlgoSettingView",
        "type": "object"
      },
      "AllocationSlice": {
        "properties": {
          "holdings": {
            "description": "Holdings in the group (0 for cash).",
            "title": "Holdings",
            "type": "integer"
          },
          "key": {
            "description": "The group: an asset class, sector, currency or ticker.",
            "title": "Key",
            "type": "string"
          },
          "value": {
            "description": "Market value of the group (shorts count negative).",
            "title": "Value",
            "type": "number"
          },
          "weight": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "value / the book's total value; null when the total is zero or less.",
            "title": "Weight"
          }
        },
        "required": [
          "key",
          "value",
          "weight",
          "holdings"
        ],
        "title": "AllocationSlice",
        "type": "object"
      },
      "AllocationView": {
        "properties": {
          "asset_class": {
            "items": {
              "$ref": "#/components/schemas/AllocationSlice"
            },
            "title": "Asset Class",
            "type": "array"
          },
          "currency": {
            "items": {
              "$ref": "#/components/schemas/AllocationSlice"
            },
            "title": "Currency",
            "type": "array"
          },
          "sector": {
            "items": {
              "$ref": "#/components/schemas/AllocationSlice"
            },
            "title": "Sector",
            "type": "array"
          },
          "ticker": {
            "items": {
              "$ref": "#/components/schemas/AllocationSlice"
            },
            "title": "Ticker",
            "type": "array"
          }
        },
        "required": [
          "asset_class",
          "sector",
          "currency",
          "ticker"
        ],
        "title": "AllocationView",
        "type": "object"
      },
      "AlpacaStatus": {
        "properties": {
          "account": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/stonks__app__brokers__BrokerAccountView"
              },
              {
                "type": "null"
              }
            ]
          },
          "clock": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MarketClockView"
              },
              {
                "type": "null"
              }
            ]
          },
          "connected": {
            "title": "Connected",
            "type": "boolean"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "paper": {
            "title": "Paper",
            "type": "boolean"
          }
        },
        "required": [
          "paper",
          "connected"
        ],
        "title": "AlpacaStatus",
        "type": "object"
      },
      "AlphaBetaView": {
        "properties": {
          "alpha_annual": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Alpha Annual"
          },
          "alpha_t": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Alpha T"
          },
          "benchmark": {
            "default": "equal_weight",
            "title": "Benchmark",
            "type": "string"
          },
          "beta": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Beta"
          },
          "n_periods": {
            "default": 0,
            "title": "N Periods",
            "type": "integer"
          },
          "r_squared": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "R Squared"
          }
        },
        "title": "AlphaBetaView",
        "type": "object"
      },
      "AnnotationRequest": {
        "additionalProperties": false,
        "description": "A trade's review. Replaces what was there.",
        "properties": {
          "followed_plan": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Followed Plan"
          },
          "mistakes": {
            "items": {
              "type": "string"
            },
            "maxItems": 20,
            "title": "Mistakes",
            "type": "array"
          },
          "playbook_id": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Playbook Id"
          },
          "review": {
            "anyOf": [
              {
                "maxLength": 4000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "maxItems": 20,
            "title": "Tags",
            "type": "array"
          }
        },
        "title": "AnnotationRequest",
        "type": "object"
      },
      "AnnotationView": {
        "properties": {
          "followed_plan": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Followed Plan"
          },
          "mistakes": {
            "items": {
              "type": "string"
            },
            "title": "Mistakes",
            "type": "array"
          },
          "playbook_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Playbook Id"
          },
          "review": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "title": "Tags",
            "type": "array"
          },
          "trade_id": {
            "title": "Trade Id",
            "type": "integer"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          },
          "updated_by": {
            "title": "Updated By",
            "type": "string"
          }
        },
        "required": [
          "trade_id",
          "tags",
          "mistakes",
          "playbook_id",
          "followed_plan",
          "review",
          "updated_by",
          "updated_at"
        ],
        "title": "AnnotationView",
        "type": "object"
      },
      "ApiScope": {
        "description": "What a credential may do. A token never exceeds its user's role.",
        "enum": [
          "read",
          "trade",
          "lab",
          "admin",
          "lab_worker"
        ],
        "title": "ApiScope",
        "type": "string"
      },
      "ArtifactFile": {
        "properties": {
          "content_b64": {
            "title": "Content B64",
            "type": "string"
          },
          "path": {
            "maxLength": 1024,
            "minLength": 1,
            "title": "Path",
            "type": "string"
          }
        },
        "required": [
          "path",
          "content_b64"
        ],
        "title": "ArtifactFile",
        "type": "object"
      },
      "AssetClassCosts": {
        "description": "Fee and spread for one asset class.",
        "properties": {
          "commission": {
            "default": "none",
            "title": "Commission",
            "type": "string"
          },
          "fee_bps": {
            "default": 0.0,
            "minimum": 0.0,
            "title": "Fee Bps",
            "type": "number"
          },
          "fee_flat": {
            "default": 0.0,
            "minimum": 0.0,
            "title": "Fee Flat",
            "type": "number"
          },
          "half_spread_bps": {
            "default": 0.0,
            "minimum": 0.0,
            "title": "Half Spread Bps",
            "type": "number"
          },
          "us_sell_fees": {
            "default": false,
            "title": "Us Sell Fees",
            "type": "boolean"
          }
        },
        "title": "AssetClassCosts",
        "type": "object"
      },
      "AssistantEventView": {
        "description": "One server-sent event of a turn. ``kind`` is also the SSE event name.\n\n- ``text``: ``{delta}``, a piece of the answer\n- ``tool_call``: ``{id, name, arguments, needs_confirmation}``\n- ``tool_result``: ``{id, name, ok, result | error}``\n- ``confirm_required``: ``{action_id, tool, description, arguments, preview}``\n- ``grounding``: ``{status, ok, checked, ungrounded, ...}``: the numeric\n  grounding check (``rewriting``: the answer so far is replaced by a\n  rewrite, ``restored``: ``{answer}`` is shown again, ``ok`` or ``flagged``)\n- ``error``: ``{code, message}`` (``model_error``, ``timeout``, ``max_steps``, ...)\n- ``done``: ``{conversation_id, steps, pending_action_id}``, always last",
        "properties": {
          "data": {
            "additionalProperties": true,
            "title": "Data",
            "type": "object"
          },
          "kind": {
            "enum": [
              "text",
              "tool_call",
              "tool_result",
              "confirm_required",
              "grounding",
              "done",
              "error"
            ],
            "title": "Kind",
            "type": "string"
          }
        },
        "required": [
          "kind",
          "data"
        ],
        "title": "AssistantEventView",
        "type": "object"
      },
      "AssistantStatusView": {
        "properties": {
          "enabled": {
            "description": "True when a model endpoint is configured.",
            "title": "Enabled",
            "type": "boolean"
          },
          "frozen_until": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A burst of writes froze your assistant until then.",
            "title": "Frozen Until"
          },
          "max_steps": {
            "title": "Max Steps",
            "type": "integer"
          },
          "max_tokens": {
            "title": "Max Tokens",
            "type": "integer"
          },
          "model": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The model name, when enabled.",
            "title": "Model"
          },
          "order_tools": {
            "default": false,
            "description": "The assistant may draft orders for you to approve.",
            "title": "Order Tools",
            "type": "boolean"
          },
          "prompt_version": {
            "default": "2026-09-27.3",
            "title": "Prompt Version",
            "type": "string"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "research_only": {
            "default": true,
            "description": "No write tool at all for you right now.",
            "title": "Research Only",
            "type": "boolean"
          },
          "timeout_seconds": {
            "title": "Timeout Seconds",
            "type": "number"
          }
        },
        "required": [
          "enabled",
          "model",
          "max_steps",
          "max_tokens",
          "timeout_seconds"
        ],
        "title": "AssistantStatusView",
        "type": "object"
      },
      "AuthCheck": {
        "properties": {
          "authenticated": {
            "const": true,
            "default": true,
            "title": "Authenticated",
            "type": "boolean"
          }
        },
        "title": "AuthCheck",
        "type": "object"
      },
      "BacktestRequest": {
        "description": "Give ``universe`` (tickers) or ``universe_id``: a stored universe,\nevery member at some point in the window, delisted names included.",
        "properties": {
          "benchmark": {
            "anyOf": [
              {
                "description": "auto (SPY.US when priced, else EW), EW (equal-weight universe), a ticker such as QQQ.US, or none; default [lab] benchmark",
                "maxLength": 32,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Benchmark"
          },
          "cost_model": {
            "anyOf": [
              {
                "enum": [
                  "zero",
                  "realistic",
                  "ibkr_tiered",
                  "ibkr_fixed"
                ],
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/CostModelSettings"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cost Model"
          },
          "end": {
            "format": "date",
            "title": "End",
            "type": "string"
          },
          "fee_per_trade": {
            "default": 0.0,
            "minimum": 0.0,
            "title": "Fee Per Trade",
            "type": "number"
          },
          "initial_cash": {
            "default": 10000.0,
            "exclusiveMinimum": 0.0,
            "title": "Initial Cash",
            "type": "number"
          },
          "interval": {
            "default": "1d",
            "title": "Interval",
            "type": "string"
          },
          "rebalance_every_bars": {
            "default": 1,
            "minimum": 1.0,
            "title": "Rebalance Every Bars",
            "type": "integer"
          },
          "slippage_bps": {
            "default": 0.0,
            "minimum": 0.0,
            "title": "Slippage Bps",
            "type": "number"
          },
          "start": {
            "format": "date",
            "title": "Start",
            "type": "string"
          },
          "strategy": {
            "$ref": "#/components/schemas/StrategyRef"
          },
          "threshold": {
            "default": 0.0,
            "title": "Threshold",
            "type": "number"
          },
          "universe": {
            "items": {
              "type": "string"
            },
            "title": "Universe",
            "type": "array"
          },
          "universe_id": {
            "anyOf": [
              {
                "pattern": "^[a-z0-9][a-z0-9_.-]{0,63}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Universe Id"
          }
        },
        "required": [
          "strategy",
          "start",
          "end"
        ],
        "title": "BacktestRequest",
        "type": "object"
      },
      "BacktestResult": {
        "properties": {
          "benchmark": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BenchmarkStatsView"
              },
              {
                "type": "null"
              }
            ]
          },
          "benchmark_equity": {
            "items": {
              "$ref": "#/components/schemas/EquityPoint"
            },
            "title": "Benchmark Equity",
            "type": "array"
          },
          "cagr": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cagr"
          },
          "calmar": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Calmar"
          },
          "drawdown": {
            "items": {
              "$ref": "#/components/schemas/EquityPoint"
            },
            "title": "Drawdown",
            "type": "array"
          },
          "end": {
            "format": "date",
            "title": "End",
            "type": "string"
          },
          "equity": {
            "items": {
              "$ref": "#/components/schemas/EquityPoint"
            },
            "title": "Equity",
            "type": "array"
          },
          "es_95": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Es 95"
          },
          "final_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Final Return"
          },
          "fitness": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fitness"
          },
          "interval": {
            "title": "Interval",
            "type": "string"
          },
          "kurtosis": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Kurtosis"
          },
          "lots": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LotView"
              },
              {
                "type": "null"
              }
            ]
          },
          "max_dd_duration_bars": {
            "default": 0,
            "title": "Max Dd Duration Bars",
            "type": "integer"
          },
          "max_drawdown": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Drawdown"
          },
          "profit_factor": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Profit Factor"
          },
          "sharpe": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sharpe"
          },
          "skew": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Skew"
          },
          "sortino": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sortino"
          },
          "start": {
            "format": "date",
            "title": "Start",
            "type": "string"
          },
          "strategy_id": {
            "title": "Strategy Id",
            "type": "string"
          },
          "trade_count": {
            "default": 0,
            "title": "Trade Count",
            "type": "integer"
          },
          "trade_stats": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TradeStatsView"
              },
              {
                "type": "null"
              }
            ]
          },
          "trades": {
            "items": {
              "$ref": "#/components/schemas/TradeView"
            },
            "title": "Trades",
            "type": "array"
          },
          "ulcer_index": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ulcer Index"
          },
          "var_95": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Var 95"
          }
        },
        "required": [
          "strategy_id",
          "interval",
          "start",
          "end",
          "final_return",
          "sharpe",
          "max_drawdown",
          "cagr",
          "profit_factor",
          "equity"
        ],
        "title": "BacktestResult",
        "type": "object"
      },
      "BackupResultView": {
        "properties": {
          "backup_id": {
            "title": "Backup Id",
            "type": "string"
          },
          "pruned": {
            "items": {
              "type": "string"
            },
            "title": "Pruned",
            "type": "array"
          }
        },
        "required": [
          "backup_id",
          "pruned"
        ],
        "title": "BackupResultView",
        "type": "object"
      },
      "BackupView": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "size_bytes": {
            "title": "Size Bytes",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "created_at",
          "size_bytes"
        ],
        "title": "BackupView",
        "type": "object"
      },
      "BarSeries": {
        "properties": {
          "bars": {
            "items": {
              "$ref": "#/components/schemas/BarView"
            },
            "title": "Bars",
            "type": "array"
          },
          "interval": {
            "title": "Interval",
            "type": "string"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "truncated": {
            "title": "Truncated",
            "type": "boolean"
          }
        },
        "required": [
          "ticker",
          "interval",
          "bars",
          "truncated"
        ],
        "title": "BarSeries",
        "type": "object"
      },
      "BarView": {
        "properties": {
          "adj_close": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Adj Close"
          },
          "close": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Close"
          },
          "high": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "High"
          },
          "low": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Low"
          },
          "open": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Open"
          },
          "timestamp": {
            "format": "date-time",
            "title": "Timestamp",
            "type": "string"
          },
          "volume": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Volume"
          }
        },
        "required": [
          "timestamp",
          "open",
          "high",
          "low",
          "close",
          "adj_close",
          "volume"
        ],
        "title": "BarView",
        "type": "object"
      },
      "BehaviourBucketView": {
        "properties": {
          "label": {
            "title": "Label",
            "type": "string"
          },
          "pnl": {
            "title": "Pnl",
            "type": "number"
          },
          "trades": {
            "title": "Trades",
            "type": "integer"
          },
          "win_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Win Rate"
          }
        },
        "required": [
          "label",
          "trades",
          "pnl",
          "win_rate"
        ],
        "title": "BehaviourBucketView",
        "type": "object"
      },
      "BehaviourView": {
        "description": "How you trade by hand: your manual orders and the trades a broker\nsync brought in, paired into round trips (FIFO, fees in).",
        "properties": {
          "against_strategies_cost": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "P&L of the trades against the strategies (negative: what it cost).",
            "title": "Against Strategies Cost"
          },
          "avg_loss": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Loss"
          },
          "avg_win": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Win"
          },
          "by_holding": {
            "items": {
              "$ref": "#/components/schemas/BehaviourBucketView"
            },
            "title": "By Holding",
            "type": "array"
          },
          "by_weekday": {
            "description": "By the weekday of the entry.",
            "items": {
              "$ref": "#/components/schemas/BehaviourBucketView"
            },
            "title": "By Weekday",
            "type": "array"
          },
          "disposition": {
            "$ref": "#/components/schemas/DispositionView"
          },
          "open_positions": {
            "title": "Open Positions",
            "type": "integer"
          },
          "overtrading": {
            "$ref": "#/components/schemas/OvertradingView"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "revenge": {
            "$ref": "#/components/schemas/BehaviourBucketView",
            "description": "Entries within a day of a losing exit, and how they did."
          },
          "since": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Since"
          },
          "sources": {
            "additionalProperties": {
              "type": "integer"
            },
            "description": "Fills by source: manual or broker.",
            "title": "Sources",
            "type": "object"
          },
          "total_pnl": {
            "title": "Total Pnl",
            "type": "number"
          },
          "trades": {
            "description": "Closed round trips.",
            "title": "Trades",
            "type": "integer"
          },
          "versus_strategies": {
            "description": "Trades with, against or without a view of the active strategies' signals at the entry.",
            "items": {
              "$ref": "#/components/schemas/BehaviourBucketView"
            },
            "title": "Versus Strategies",
            "type": "array"
          },
          "win_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Win Rate"
          }
        },
        "required": [
          "portfolio_id",
          "since",
          "trades",
          "open_positions",
          "win_rate",
          "total_pnl",
          "avg_win",
          "avg_loss",
          "by_holding",
          "by_weekday",
          "disposition",
          "overtrading",
          "revenge",
          "versus_strategies",
          "against_strategies_cost",
          "sources"
        ],
        "title": "BehaviourView",
        "type": "object"
      },
      "BenchmarkStatsView": {
        "description": "A backtest against its benchmark (``backtest.benchmark.BenchmarkStats``).\nRatios are ``None`` when not finite.",
        "properties": {
          "alpha_annual": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Alpha Annual"
          },
          "alpha_tstat": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Alpha Tstat"
          },
          "benchmark_cagr": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Benchmark Cagr"
          },
          "benchmark_max_dd": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Benchmark Max Dd"
          },
          "benchmark_sharpe": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Benchmark Sharpe"
          },
          "beta": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Beta"
          },
          "correlation": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Correlation"
          },
          "down_capture": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Down Capture"
          },
          "excess_cagr": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Excess Cagr"
          },
          "excluded": {
            "items": {
              "type": "string"
            },
            "title": "Excluded",
            "type": "array"
          },
          "information_ratio": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Information Ratio"
          },
          "members": {
            "items": {
              "type": "string"
            },
            "title": "Members",
            "type": "array"
          },
          "n_obs": {
            "title": "N Obs",
            "type": "integer"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "r2": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "R2"
          },
          "residual_sharpe": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Residual Sharpe"
          },
          "spec": {
            "title": "Spec",
            "type": "string"
          },
          "tracking_error": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tracking Error"
          },
          "up_capture": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Up Capture"
          }
        },
        "required": [
          "name",
          "spec",
          "n_obs",
          "benchmark_cagr",
          "excess_cagr",
          "benchmark_sharpe",
          "benchmark_max_dd",
          "beta",
          "alpha_annual",
          "alpha_tstat",
          "r2",
          "residual_sharpe",
          "tracking_error",
          "information_ratio",
          "up_capture",
          "down_capture",
          "correlation"
        ],
        "title": "BenchmarkStatsView",
        "type": "object"
      },
      "BorrowCheckSettings": {
        "additionalProperties": false,
        "properties": {
          "borrow": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BorrowSettings"
              },
              {
                "type": "null"
              }
            ]
          },
          "enabled": {
            "default": false,
            "title": "Enabled",
            "type": "boolean"
          },
          "max_borrow_fee": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Borrow Fee"
          }
        },
        "title": "BorrowCheckSettings",
        "type": "object"
      },
      "BorrowSettings": {
        "additionalProperties": false,
        "description": "``FlatBorrow`` knobs: the general-collateral fee per asset class and\nthe tickers that are hard to borrow or not borrowable at all.",
        "properties": {
          "fee_rate_annual": {
            "additionalProperties": {
              "type": "number"
            },
            "propertyNames": {
              "enum": [
                "equity",
                "crypto",
                "commodity",
                "bond"
              ]
            },
            "title": "Fee Rate Annual",
            "type": "object"
          },
          "hard": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Hard",
            "type": "array"
          },
          "hard_fee_rate_annual": {
            "default": 0.05,
            "minimum": 0.0,
            "title": "Hard Fee Rate Annual",
            "type": "number"
          },
          "none": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "None",
            "type": "array"
          }
        },
        "title": "BorrowSettings",
        "type": "object"
      },
      "Breadth": {
        "properties": {
          "above_200": {
            "$ref": "#/components/schemas/AboveAverage"
          },
          "above_50": {
            "$ref": "#/components/schemas/AboveAverage"
          },
          "advance_decline_ratio": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "advancers / decliners; null without decliners.",
            "title": "Advance Decline Ratio"
          },
          "advancers": {
            "title": "Advancers",
            "type": "integer"
          },
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The last day with bars; null for an empty lake.",
            "title": "As Of"
          },
          "decliners": {
            "title": "Decliners",
            "type": "integer"
          },
          "distribution_dates": {
            "items": {
              "format": "date",
              "type": "string"
            },
            "title": "Distribution Dates",
            "type": "array"
          },
          "distribution_days": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null without index bars.",
            "title": "Distribution Days"
          },
          "distribution_window": {
            "title": "Distribution Window",
            "type": "integer"
          },
          "high_low_window": {
            "description": "Sessions in the high and low window.",
            "title": "High Low Window",
            "type": "integer"
          },
          "index": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The index distribution days are counted on.",
            "title": "Index"
          },
          "lines": {
            "description": "What the numbers mean, in plain words.",
            "items": {
              "$ref": "#/components/schemas/BreadthLine"
            },
            "title": "Lines",
            "type": "array"
          },
          "members": {
            "description": "Stocks with a close on as_of and the day before.",
            "title": "Members",
            "type": "integer"
          },
          "new_highs": {
            "title": "New Highs",
            "type": "integer"
          },
          "new_lows": {
            "title": "New Lows",
            "type": "integer"
          },
          "unchanged": {
            "title": "Unchanged",
            "type": "integer"
          }
        },
        "required": [
          "as_of",
          "members",
          "advancers",
          "decliners",
          "unchanged",
          "advance_decline_ratio",
          "above_50",
          "above_200",
          "new_highs",
          "new_lows",
          "high_low_window",
          "index",
          "distribution_days",
          "distribution_dates",
          "distribution_window",
          "lines"
        ],
        "title": "Breadth",
        "type": "object"
      },
      "BreadthLine": {
        "properties": {
          "key": {
            "enum": [
              "advance_decline",
              "above_average",
              "highs_lows",
              "distribution",
              "empty"
            ],
            "title": "Key",
            "type": "string"
          },
          "text": {
            "description": "One plain sentence.",
            "title": "Text",
            "type": "string"
          },
          "tone": {
            "enum": [
              "good",
              "neutral",
              "bad"
            ],
            "title": "Tone",
            "type": "string"
          }
        },
        "required": [
          "key",
          "text",
          "tone"
        ],
        "title": "BreadthLine",
        "type": "object"
      },
      "BreadthView": {
        "properties": {
          "breadth": {
            "$ref": "#/components/schemas/Breadth"
          },
          "universe": {
            "description": "What was measured, in words.",
            "title": "Universe",
            "type": "string"
          }
        },
        "required": [
          "universe",
          "breadth"
        ],
        "title": "BreadthView",
        "type": "object"
      },
      "BreakdownView": {
        "properties": {
          "base_currency": {
            "title": "Base Currency",
            "type": "string"
          },
          "by": {
            "enum": [
              "all",
              "sleeve",
              "origin",
              "ticker",
              "side",
              "exit_trigger",
              "tag",
              "mistake",
              "playbook",
              "plan"
            ],
            "title": "By",
            "type": "string"
          },
          "fx_missing": {
            "items": {
              "type": "string"
            },
            "title": "Fx Missing",
            "type": "array"
          },
          "groups": {
            "items": {
              "$ref": "#/components/schemas/GroupStatsView"
            },
            "title": "Groups",
            "type": "array"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "since": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Since"
          },
          "unconverted": {
            "title": "Unconverted",
            "type": "integer"
          },
          "until": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Until"
          }
        },
        "required": [
          "portfolio_id",
          "by",
          "base_currency",
          "since",
          "until",
          "groups",
          "unconverted",
          "fx_missing"
        ],
        "title": "BreakdownView",
        "type": "object"
      },
      "BriefingPrefsUpdate": {
        "properties": {
          "post_close": {
            "title": "Post Close",
            "type": "boolean"
          },
          "pre_open": {
            "title": "Pre Open",
            "type": "boolean"
          }
        },
        "required": [
          "pre_open",
          "post_close"
        ],
        "title": "BriefingPrefsUpdate",
        "type": "object"
      },
      "BriefingPrefsView": {
        "properties": {
          "available": {
            "title": "Available",
            "type": "boolean"
          },
          "post_close": {
            "title": "Post Close",
            "type": "boolean"
          },
          "pre_open": {
            "title": "Pre Open",
            "type": "boolean"
          }
        },
        "required": [
          "available",
          "pre_open",
          "post_close"
        ],
        "title": "BriefingPrefsView",
        "type": "object"
      },
      "BriefingRunRequest": {
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          },
          "kind": {
            "enum": [
              "pre_open",
              "post_close"
            ],
            "title": "Kind",
            "type": "string"
          }
        },
        "required": [
          "kind"
        ],
        "title": "BriefingRunRequest",
        "type": "object"
      },
      "BriefingRunView": {
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "failed": {
            "default": 0,
            "title": "Failed",
            "type": "integer"
          },
          "kind": {
            "enum": [
              "pre_open",
              "post_close"
            ],
            "title": "Kind",
            "type": "string"
          },
          "people": {
            "default": 0,
            "title": "People",
            "type": "integer"
          },
          "sent": {
            "default": 0,
            "title": "Sent",
            "type": "integer"
          },
          "skipped": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Skipped"
          }
        },
        "required": [
          "kind",
          "as_of"
        ],
        "title": "BriefingRunView",
        "type": "object"
      },
      "BrokerInfo": {
        "properties": {
          "allow_live": {
            "title": "Allow Live",
            "type": "boolean"
          },
          "credentials_configured": {
            "title": "Credentials Configured",
            "type": "boolean"
          },
          "kind": {
            "enum": [
              "simulated",
              "alpaca",
              "ibkr"
            ],
            "title": "Kind",
            "type": "string"
          },
          "paper": {
            "title": "Paper",
            "type": "boolean"
          },
          "real_money_books": {
            "default": 0,
            "title": "Real Money Books",
            "type": "integer"
          }
        },
        "required": [
          "kind",
          "paper",
          "allow_live",
          "credentials_configured"
        ],
        "title": "BrokerInfo",
        "type": "object"
      },
      "CalendarBucketView": {
        "properties": {
          "end": {
            "format": "date",
            "title": "End",
            "type": "string"
          },
          "key": {
            "title": "Key",
            "type": "string"
          },
          "pnl": {
            "title": "Pnl",
            "type": "number"
          },
          "start": {
            "format": "date",
            "title": "Start",
            "type": "string"
          },
          "trades": {
            "title": "Trades",
            "type": "integer"
          },
          "wins": {
            "title": "Wins",
            "type": "integer"
          }
        },
        "required": [
          "key",
          "start",
          "end",
          "pnl",
          "trades",
          "wins"
        ],
        "title": "CalendarBucketView",
        "type": "object"
      },
      "CalendarRefreshRequest": {
        "properties": {
          "alert_days": {
            "anyOf": [
              {
                "additionalProperties": {
                  "type": "integer"
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Alert Days"
          },
          "alerts": {
            "default": true,
            "title": "Alerts",
            "type": "boolean"
          },
          "countries": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 100,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Countries"
          },
          "end": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "End"
          },
          "kinds": {
            "items": {
              "enum": [
                "earnings",
                "dividends",
                "economic"
              ],
              "type": "string"
            },
            "minItems": 1,
            "title": "Kinds",
            "type": "array"
          },
          "source": {
            "default": "eodhd",
            "enum": [
              "eodhd",
              "yahoo",
              "defillama"
            ],
            "title": "Source",
            "type": "string"
          },
          "start": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start"
          },
          "tickers": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 5000,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tickers"
          }
        },
        "title": "CalendarRefreshRequest",
        "type": "object"
      },
      "CalendarRefreshView": {
        "properties": {
          "alerts": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EventAlertSummary"
              },
              {
                "type": "null"
              }
            ]
          },
          "calendars_failed": {
            "title": "Calendars Failed",
            "type": "integer"
          },
          "calendars_ok": {
            "title": "Calendars Ok",
            "type": "integer"
          },
          "end": {
            "format": "date",
            "title": "End",
            "type": "string"
          },
          "failed": {
            "items": {
              "type": "string"
            },
            "title": "Failed",
            "type": "array"
          },
          "run_id": {
            "title": "Run Id",
            "type": "integer"
          },
          "start": {
            "format": "date",
            "title": "Start",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "run_id",
          "status",
          "start",
          "end",
          "calendars_ok",
          "calendars_failed",
          "failed"
        ],
        "title": "CalendarRefreshView",
        "type": "object"
      },
      "CalendarView": {
        "properties": {
          "dividends": {
            "items": {
              "$ref": "#/components/schemas/DividendEvent"
            },
            "title": "Dividends",
            "type": "array"
          },
          "earnings": {
            "items": {
              "$ref": "#/components/schemas/EarningsEvent"
            },
            "title": "Earnings",
            "type": "array"
          },
          "economic": {
            "items": {
              "$ref": "#/components/schemas/EconomicEvent"
            },
            "title": "Economic",
            "type": "array"
          },
          "end": {
            "format": "date",
            "title": "End",
            "type": "string"
          },
          "filings": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/FilingEvent"
            },
            "title": "Filings",
            "type": "array"
          },
          "scope": {
            "enum": [
              "all",
              "holdings",
              "watchlists",
              "tickers"
            ],
            "title": "Scope",
            "type": "string"
          },
          "start": {
            "format": "date",
            "title": "Start",
            "type": "string"
          },
          "tickers": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tickers"
          },
          "truncated": {
            "default": false,
            "title": "Truncated",
            "type": "boolean"
          }
        },
        "required": [
          "start",
          "end",
          "scope",
          "tickers",
          "earnings",
          "dividends",
          "economic"
        ],
        "title": "CalendarView",
        "type": "object"
      },
      "CalibrationView": {
        "description": "Live calibration of a classifier version's probability forecasts\n(roadmap 23.9): Brier score against always forecasting the base rate,\nthe reliability table and the expected calibration error. Empty for a\nmodel that forecasts no probabilities.",
        "properties": {
          "base_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Base Rate"
          },
          "bins": {
            "items": {
              "$ref": "#/components/schemas/ReliabilityBinView"
            },
            "title": "Bins",
            "type": "array"
          },
          "brier": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Brier"
          },
          "brier_base_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Brier Base Rate"
          },
          "ece": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ece"
          },
          "mean_forecast": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mean Forecast"
          },
          "n_forecasts": {
            "title": "N Forecasts",
            "type": "integer"
          },
          "n_resolved": {
            "title": "N Resolved",
            "type": "integer"
          },
          "skill": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Skill"
          },
          "strategy_id": {
            "title": "Strategy Id",
            "type": "string"
          },
          "version": {
            "title": "Version",
            "type": "integer"
          }
        },
        "required": [
          "strategy_id",
          "version",
          "n_forecasts",
          "n_resolved",
          "brier",
          "brier_base_rate",
          "skill",
          "base_rate",
          "mean_forecast",
          "ece",
          "bins"
        ],
        "title": "CalibrationView",
        "type": "object"
      },
      "CapitalRampSettings": {
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "default": false,
            "title": "Enabled",
            "type": "boolean"
          }
        },
        "title": "CapitalRampSettings",
        "type": "object"
      },
      "CashFlowCreate": {
        "additionalProperties": false,
        "properties": {
          "amount": {
            "exclusiveMinimum": 0.0,
            "maximum": 1000000000000.0,
            "title": "Amount",
            "type": "number"
          },
          "flow_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Default: today (UTC).",
            "title": "Flow Date"
          },
          "kind": {
            "enum": [
              "deposit",
              "withdrawal"
            ],
            "title": "Kind",
            "type": "string"
          },
          "note": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Note"
          }
        },
        "required": [
          "kind",
          "amount"
        ],
        "title": "CashFlowCreate",
        "type": "object"
      },
      "CashFlowView": {
        "properties": {
          "amount": {
            "title": "Amount",
            "type": "number"
          },
          "flow_date": {
            "format": "date",
            "title": "Flow Date",
            "type": "string"
          },
          "id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "The recorded row; null for a flow from a broker sync.",
            "title": "Id"
          },
          "kind": {
            "enum": [
              "deposit",
              "withdrawal"
            ],
            "title": "Kind",
            "type": "string"
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Note"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "source": {
            "enum": [
              "manual",
              "broker"
            ],
            "title": "Source",
            "type": "string"
          }
        },
        "required": [
          "id",
          "portfolio_id",
          "flow_date",
          "kind",
          "amount",
          "source"
        ],
        "title": "CashFlowView",
        "type": "object"
      },
      "ChannelDefaultView": {
        "properties": {
          "channel": {
            "title": "Channel",
            "type": "string"
          },
          "default_enabled": {
            "title": "Default Enabled",
            "type": "boolean"
          },
          "fallback": {
            "title": "Fallback",
            "type": "boolean"
          }
        },
        "required": [
          "channel",
          "default_enabled",
          "fallback"
        ],
        "title": "ChannelDefaultView",
        "type": "object"
      },
      "ChartFillView": {
        "properties": {
          "filled_at": {
            "format": "date-time",
            "title": "Filled At",
            "type": "string"
          },
          "order_client_id": {
            "title": "Order Client Id",
            "type": "string"
          },
          "price": {
            "title": "Price",
            "type": "number"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "side": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Side"
          },
          "strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Id"
          },
          "strategy_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The strategy's plain title (a starter's), or null: the console names it from the id.",
            "title": "Strategy Name"
          }
        },
        "required": [
          "filled_at",
          "side",
          "quantity",
          "price",
          "order_client_id",
          "strategy_id"
        ],
        "title": "ChartFillView",
        "type": "object"
      },
      "ChartSignalView": {
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "strategy_id": {
            "title": "Strategy Id",
            "type": "string"
          },
          "strategy_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The strategy's plain title (a starter's), or null: the console names it from the id.",
            "title": "Strategy Name"
          },
          "strength": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strength"
          }
        },
        "required": [
          "as_of",
          "strategy_id",
          "kind",
          "strength",
          "reason"
        ],
        "title": "ChartSignalView",
        "type": "object"
      },
      "ChartView": {
        "properties": {
          "bars": {
            "items": {
              "$ref": "#/components/schemas/BarView"
            },
            "title": "Bars",
            "type": "array"
          },
          "fills": {
            "items": {
              "$ref": "#/components/schemas/ChartFillView"
            },
            "title": "Fills",
            "type": "array"
          },
          "interval": {
            "title": "Interval",
            "type": "string"
          },
          "portfolio_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Id"
          },
          "signals": {
            "items": {
              "$ref": "#/components/schemas/ChartSignalView"
            },
            "title": "Signals",
            "type": "array"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "truncated": {
            "title": "Truncated",
            "type": "boolean"
          }
        },
        "required": [
          "ticker",
          "interval",
          "bars",
          "truncated",
          "portfolio_id",
          "fills",
          "signals"
        ],
        "title": "ChartView",
        "type": "object"
      },
      "ChoiceOption": {
        "properties": {
          "label": {
            "title": "Label",
            "type": "string"
          },
          "value": {
            "title": "Value",
            "type": "string"
          }
        },
        "required": [
          "value",
          "label"
        ],
        "title": "ChoiceOption",
        "type": "object"
      },
      "CircuitBreakerSettings": {
        "additionalProperties": false,
        "properties": {
          "cooldown": {
            "default": "rest_of_month",
            "enum": [
              "rest_of_month",
              "none"
            ],
            "title": "Cooldown",
            "type": "string"
          },
          "max_drawdown_halt": {
            "anyOf": [
              {
                "exclusiveMaximum": 1.0,
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Drawdown Halt"
          },
          "max_month_loss": {
            "anyOf": [
              {
                "exclusiveMaximum": 1.0,
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Month Loss"
          },
          "max_week_loss": {
            "anyOf": [
              {
                "exclusiveMaximum": 1.0,
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Week Loss"
          },
          "week_sessions": {
            "default": 5,
            "maximum": 60.0,
            "minimum": 1.0,
            "title": "Week Sessions",
            "type": "integer"
          }
        },
        "title": "CircuitBreakerSettings",
        "type": "object"
      },
      "ClaimResult": {
        "properties": {
          "job": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ClaimedJob"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "ClaimResult",
        "type": "object"
      },
      "ClaimedJob": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "owner_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owner Id"
          },
          "params": {
            "additionalProperties": true,
            "title": "Params",
            "type": "object"
          },
          "seed": {
            "$ref": "#/components/schemas/ResearchRows"
          },
          "snapshot": {
            "$ref": "#/components/schemas/SnapshotRef"
          }
        },
        "required": [
          "id",
          "kind",
          "params",
          "owner_id",
          "created_at",
          "snapshot",
          "seed"
        ],
        "title": "ClaimedJob",
        "type": "object"
      },
      "ClearHaltRequest": {
        "additionalProperties": false,
        "properties": {
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "title": "Reason",
            "type": "string"
          }
        },
        "required": [
          "reason"
        ],
        "title": "ClearHaltRequest",
        "type": "object"
      },
      "ColumnMapping": {
        "additionalProperties": false,
        "description": "Which CSV column holds which field. Only ``date`` is required, plus\neither a ``type`` column (with ``types`` mapping its values to kinds) or\none fixed ``kind`` for every row.",
        "properties": {
          "amount": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount"
          },
          "currency": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Currency"
          },
          "date": {
            "maxLength": 120,
            "minLength": 1,
            "title": "Date",
            "type": "string"
          },
          "date_format": {
            "anyOf": [
              {
                "maxLength": 40,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Date Format"
          },
          "default_currency": {
            "default": "USD",
            "maxLength": 3,
            "minLength": 3,
            "title": "Default Currency",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "exchange": {
            "anyOf": [
              {
                "maxLength": 20,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exchange"
          },
          "fee": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fee"
          },
          "kind": {
            "anyOf": [
              {
                "enum": [
                  "trade",
                  "dividend",
                  "interest",
                  "fee",
                  "deposit",
                  "withdrawal",
                  "split",
                  "other"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Kind"
          },
          "price": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Price"
          },
          "quantity": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Quantity"
          },
          "sell_values": {
            "items": {
              "type": "string"
            },
            "maxItems": 50,
            "title": "Sell Values",
            "type": "array"
          },
          "symbol": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Symbol"
          },
          "type": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Type"
          },
          "types": {
            "additionalProperties": {
              "enum": [
                "trade",
                "dividend",
                "interest",
                "fee",
                "deposit",
                "withdrawal",
                "split",
                "other"
              ],
              "type": "string"
            },
            "maxProperties": 100,
            "title": "Types",
            "type": "object"
          }
        },
        "required": [
          "date"
        ],
        "title": "ColumnMapping",
        "type": "object"
      },
      "CommissionSettings": {
        "additionalProperties": false,
        "description": "``[backtest.costs.commissions]``: the rates of every schedule. An\nasset class picks its schedule with ``commission``.",
        "properties": {
          "commission_multiplier": {
            "default": 1.0,
            "minimum": 0.0,
            "title": "Commission Multiplier",
            "type": "number"
          },
          "ibkr_fixed": {
            "$ref": "#/components/schemas/IbkrFixedFees",
            "default": {
              "max_fraction": 0.01,
              "minimum": 1.0,
              "per_share": 0.005
            }
          },
          "ibkr_tiered": {
            "$ref": "#/components/schemas/IbkrTieredFees",
            "default": {
              "clearing_per_share": 0.0002,
              "exchange_per_share": 0.003,
              "max_fraction": 0.01,
              "minimum": 0.35,
              "monthly_shares": 0.0,
              "tiers": [
                [
                  300000.0,
                  0.0035
                ],
                [
                  3000000.0,
                  0.002
                ],
                [
                  20000000.0,
                  0.0015
                ],
                [
                  100000000.0,
                  0.001
                ],
                [
                  null,
                  0.0005
                ]
              ]
            }
          },
          "us_regulatory": {
            "$ref": "#/components/schemas/UsRegulatoryFees",
            "default": {
              "cat_per_share": 3.5e-05,
              "sec_rate_per_million": 27.8,
              "taf_max": 8.3,
              "taf_per_share": 0.000166
            }
          }
        },
        "title": "CommissionSettings",
        "type": "object"
      },
      "ComparePoint": {
        "properties": {
          "time": {
            "format": "date",
            "title": "Time",
            "type": "string"
          },
          "value": {
            "title": "Value",
            "type": "number"
          }
        },
        "required": [
          "time",
          "value"
        ],
        "title": "ComparePoint",
        "type": "object"
      },
      "CompareSeriesView": {
        "properties": {
          "drawdown": {
            "items": {
              "$ref": "#/components/schemas/ComparePoint"
            },
            "title": "Drawdown",
            "type": "array"
          },
          "max_drawdown": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Drawdown"
          },
          "periods_per_year": {
            "title": "Periods Per Year",
            "type": "number"
          },
          "points": {
            "items": {
              "$ref": "#/components/schemas/ComparePoint"
            },
            "title": "Points",
            "type": "array"
          },
          "rolling_sharpe": {
            "items": {
              "$ref": "#/components/schemas/ComparePoint"
            },
            "title": "Rolling Sharpe",
            "type": "array"
          },
          "sharpe": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sharpe"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "total_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Return"
          }
        },
        "required": [
          "ticker",
          "points",
          "drawdown",
          "rolling_sharpe",
          "total_return",
          "max_drawdown",
          "sharpe",
          "periods_per_year"
        ],
        "title": "CompareSeriesView",
        "type": "object"
      },
      "CompareView": {
        "properties": {
          "end": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "End"
          },
          "missing": {
            "items": {
              "type": "string"
            },
            "title": "Missing",
            "type": "array"
          },
          "series": {
            "items": {
              "$ref": "#/components/schemas/CompareSeriesView"
            },
            "title": "Series",
            "type": "array"
          },
          "start": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start"
          },
          "window": {
            "title": "Window",
            "type": "integer"
          }
        },
        "required": [
          "start",
          "end",
          "window",
          "series",
          "missing"
        ],
        "title": "CompareView",
        "type": "object"
      },
      "Concentration": {
        "properties": {
          "effective_holdings": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "1 / hhi.",
            "title": "Effective Holdings"
          },
          "hhi": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Herfindahl index of the holding weights (0 to 1).",
            "title": "Hhi"
          },
          "holdings": {
            "description": "Priced holdings.",
            "title": "Holdings",
            "type": "integer"
          },
          "largest": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Largest"
          },
          "top5_weight": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Top5 Weight"
          },
          "top_weight": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Largest holding's share of gross holdings.",
            "title": "Top Weight"
          }
        },
        "required": [
          "holdings",
          "largest",
          "top_weight",
          "top5_weight",
          "hhi",
          "effective_holdings"
        ],
        "title": "Concentration",
        "type": "object"
      },
      "ConnectWithKeysRequest": {
        "additionalProperties": false,
        "description": "API-key connect. ``fields`` are the provider's ``credential_fields``\n(plus ``paper`` for brokers with a paper endpoint). They are write-only:\nnever logged, stored only sealed, never returned.",
        "properties": {
          "fields": {
            "additionalProperties": {
              "format": "password",
              "type": "string",
              "writeOnly": true
            },
            "maxProperties": 16,
            "title": "Fields",
            "type": "object"
          },
          "label": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          },
          "provider": {
            "maxLength": 64,
            "minLength": 1,
            "title": "Provider",
            "type": "string"
          }
        },
        "required": [
          "provider",
          "fields"
        ],
        "title": "ConnectWithKeysRequest",
        "type": "object"
      },
      "ConnectionView": {
        "properties": {
          "accounts_count": {
            "default": 0,
            "title": "Accounts Count",
            "type": "integer"
          },
          "consecutive_failures": {
            "title": "Consecutive Failures",
            "type": "integer"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          },
          "last_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Error"
          },
          "last_sync_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Sync At"
          },
          "last_sync_status": {
            "anyOf": [
              {
                "enum": [
                  "ok",
                  "partial",
                  "error"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Sync Status"
          },
          "next_sync_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Sync At"
          },
          "provider": {
            "title": "Provider",
            "type": "string"
          },
          "status": {
            "enum": [
              "pending",
              "active",
              "error"
            ],
            "title": "Status",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "provider",
          "label",
          "status",
          "last_sync_at",
          "last_sync_status",
          "last_error",
          "consecutive_failures",
          "next_sync_at",
          "created_at",
          "updated_at"
        ],
        "title": "ConnectionView",
        "type": "object"
      },
      "ConversationCreate": {
        "additionalProperties": false,
        "properties": {
          "research_only": {
            "default": false,
            "description": "Offer no write tool at all in this conversation.",
            "title": "Research Only",
            "type": "boolean"
          },
          "title": {
            "default": "",
            "maxLength": 80,
            "title": "Title",
            "type": "string"
          }
        },
        "title": "ConversationCreate",
        "type": "object"
      },
      "ConversationDetailView": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "messages": {
            "items": {
              "$ref": "#/components/schemas/MessageView"
            },
            "title": "Messages",
            "type": "array"
          },
          "pending_actions": {
            "description": "Write actions waiting for you to approve or reject.",
            "items": {
              "$ref": "#/components/schemas/PendingActionView"
            },
            "title": "Pending Actions",
            "type": "array"
          },
          "research_only": {
            "default": false,
            "title": "Research Only",
            "type": "boolean"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "created_at",
          "updated_at",
          "messages",
          "pending_actions"
        ],
        "title": "ConversationDetailView",
        "type": "object"
      },
      "ConversationView": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "research_only": {
            "default": false,
            "title": "Research Only",
            "type": "boolean"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "created_at",
          "updated_at"
        ],
        "title": "ConversationView",
        "type": "object"
      },
      "CostComparisonView": {
        "description": "Live shortfall of the strategy's real orders against the cost\nmodel's estimate (BL-32, P22), in bps.",
        "properties": {
          "live_is_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Live Is Bps"
          },
          "model_gap_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model Gap Bps"
          },
          "modelled_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Modelled Bps"
          },
          "orders": {
            "default": 0,
            "title": "Orders",
            "type": "integer"
          }
        },
        "title": "CostComparisonView",
        "type": "object"
      },
      "CostModelPreset": {
        "properties": {
          "description": {
            "title": "Description",
            "type": "string"
          },
          "name": {
            "enum": [
              "zero",
              "realistic",
              "ibkr_tiered",
              "ibkr_fixed"
            ],
            "title": "Name",
            "type": "string"
          },
          "settings": {
            "$ref": "#/components/schemas/CostModelSettings"
          }
        },
        "required": [
          "name",
          "description",
          "settings"
        ],
        "title": "CostModelPreset",
        "type": "object"
      },
      "CostModelSettings": {
        "description": "Settings for ``AssetClassCostModel``. Zero costs by default;\n``CostModelSettings.realistic()`` is a sensible starting point.",
        "properties": {
          "adv_window": {
            "default": 20,
            "minimum": 1.0,
            "title": "Adv Window",
            "type": "integer"
          },
          "asset_classes": {
            "additionalProperties": {
              "$ref": "#/components/schemas/AssetClassCosts"
            },
            "propertyNames": {
              "enum": [
                "equity",
                "crypto",
                "commodity",
                "bond"
              ]
            },
            "title": "Asset Classes",
            "type": "object"
          },
          "commissions": {
            "$ref": "#/components/schemas/CommissionSettings",
            "default": {
              "commission_multiplier": 1.0,
              "ibkr_fixed": {
                "max_fraction": 0.01,
                "minimum": 1.0,
                "per_share": 0.005
              },
              "ibkr_tiered": {
                "clearing_per_share": 0.0002,
                "exchange_per_share": 0.003,
                "max_fraction": 0.01,
                "minimum": 0.35,
                "monthly_shares": 0.0,
                "tiers": [
                  [
                    300000.0,
                    0.0035
                  ],
                  [
                    3000000.0,
                    0.002
                  ],
                  [
                    20000000.0,
                    0.0015
                  ],
                  [
                    100000000.0,
                    0.001
                  ],
                  [
                    null,
                    0.0005
                  ]
                ]
              },
              "us_regulatory": {
                "cat_per_share": 3.5e-05,
                "sec_rate_per_million": 27.8,
                "taf_max": 8.3,
                "taf_per_share": 0.000166
              }
            }
          },
          "default": {
            "$ref": "#/components/schemas/AssetClassCosts",
            "default": {
              "commission": "none",
              "fee_bps": 0.0,
              "fee_flat": 0.0,
              "half_spread_bps": 0.0,
              "us_sell_fees": false
            }
          },
          "exec_algo": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ExecAlgoAssumption"
              },
              {
                "type": "null"
              }
            ]
          },
          "half_spread_model": {
            "default": "class",
            "enum": [
              "class",
              "corwin_schultz",
              "abdi_ranaldo"
            ],
            "title": "Half Spread Model",
            "type": "string"
          },
          "impact_bps": {
            "default": 0.0,
            "minimum": 0.0,
            "title": "Impact Bps",
            "type": "number"
          },
          "impact_gamma": {
            "default": 1.0,
            "minimum": 0.0,
            "title": "Impact Gamma",
            "type": "number"
          },
          "impact_model": {
            "default": "sqrt",
            "enum": [
              "sqrt",
              "sqrt_vol",
              "istar"
            ],
            "title": "Impact Model",
            "type": "string"
          },
          "istar": {
            "$ref": "#/components/schemas/IStarSettings",
            "default": {
              "a1": 708.0,
              "a2": 0.55,
              "a3": 0.71,
              "a4": 0.5,
              "b1": 0.98,
              "periods_per_year": 252.0,
              "pov": 0.1
            }
          },
          "max_half_spread_bps": {
            "default": 200.0,
            "minimum": 0.0,
            "title": "Max Half Spread Bps",
            "type": "number"
          },
          "max_impact_bps": {
            "default": 500.0,
            "minimum": 0.0,
            "title": "Max Impact Bps",
            "type": "number"
          },
          "spread_window": {
            "default": 20,
            "minimum": 1.0,
            "title": "Spread Window",
            "type": "integer"
          },
          "vol_window": {
            "default": 20,
            "minimum": 2.0,
            "title": "Vol Window",
            "type": "integer"
          }
        },
        "title": "CostModelSettings",
        "type": "object"
      },
      "CoverageRow": {
        "properties": {
          "first_bar": {
            "format": "date-time",
            "title": "First Bar",
            "type": "string"
          },
          "interval": {
            "title": "Interval",
            "type": "string"
          },
          "last_bar": {
            "format": "date-time",
            "title": "Last Bar",
            "type": "string"
          },
          "rows": {
            "title": "Rows",
            "type": "integer"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "ticker",
          "interval",
          "first_bar",
          "last_bar",
          "rows"
        ],
        "title": "CoverageRow",
        "type": "object"
      },
      "DataCoverage": {
        "description": "Which kinds of data the lake holds at all. Calendars, news,\nfundamentals and option chains need a paid data plan, so an empty page\ncan say \"needs a data plan\" instead of looking broken (audit F49).",
        "properties": {
          "calendars": {
            "title": "Calendars",
            "type": "boolean"
          },
          "fundamentals": {
            "title": "Fundamentals",
            "type": "boolean"
          },
          "news": {
            "title": "News",
            "type": "boolean"
          },
          "options": {
            "title": "Options",
            "type": "boolean"
          }
        },
        "required": [
          "fundamentals",
          "calendars",
          "news",
          "options"
        ],
        "title": "DataCoverage",
        "type": "object"
      },
      "DataSourceInfo": {
        "properties": {
          "configured": {
            "title": "Configured",
            "type": "boolean"
          },
          "default": {
            "title": "Default",
            "type": "boolean"
          },
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Detail"
          },
          "id": {
            "enum": [
              "eodhd",
              "yahoo",
              "defillama"
            ],
            "title": "Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "default",
          "configured"
        ],
        "title": "DataSourceInfo",
        "type": "object"
      },
      "DayChangeView": {
        "description": "A book's headline value and change on its latest day. ``/api/pnl``\nand ``/api/insights`` both carry it from\n:func:`stonks.production.pnl.day_change`, so every page shows the same\nnumber: format ``change_pct`` with one formatter everywhere.",
        "properties": {
          "change": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Change"
          },
          "change_pct": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "change / the previous value (0.01 = +1%).",
            "title": "Change Pct"
          },
          "day": {
            "description": "The trading day of the latest snapshot.",
            "format": "date",
            "title": "Day",
            "type": "string"
          },
          "previous_day": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The day the change is measured from (null with one day of history or across a gap longer than a long weekend).",
            "title": "Previous Day"
          },
          "value": {
            "description": "The book's value at the latest snapshot.",
            "title": "Value",
            "type": "number"
          }
        },
        "required": [
          "day",
          "previous_day",
          "value",
          "change",
          "change_pct"
        ],
        "title": "DayChangeView",
        "type": "object"
      },
      "DemoPointView": {
        "properties": {
          "day": {
            "format": "date",
            "title": "Day",
            "type": "string"
          },
          "value": {
            "title": "Value",
            "type": "number"
          }
        },
        "required": [
          "day",
          "value"
        ],
        "title": "DemoPointView",
        "type": "object"
      },
      "DemoPortfolioView": {
        "description": "Your demo portfolio. ``exists`` is false until you open one: then\nthe other fields are empty.",
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          },
          "cash": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cash"
          },
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "currency": {
            "default": "USD",
            "title": "Currency",
            "type": "string"
          },
          "curve": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/DemoPointView"
            },
            "title": "Curve",
            "type": "array"
          },
          "day_change": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Day Change"
          },
          "exists": {
            "title": "Exists",
            "type": "boolean"
          },
          "label": {
            "default": "Sample data",
            "title": "Label",
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "positions": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/DemoPositionView"
            },
            "title": "Positions",
            "type": "array"
          },
          "start_value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start Value"
          },
          "total_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Return"
          },
          "total_value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Value"
          }
        },
        "required": [
          "exists"
        ],
        "title": "DemoPortfolioView",
        "type": "object"
      },
      "DemoPositionView": {
        "properties": {
          "cost": {
            "title": "Cost",
            "type": "number"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "pnl": {
            "title": "Pnl",
            "type": "number"
          },
          "pnl_pct": {
            "title": "Pnl Pct",
            "type": "number"
          },
          "price": {
            "title": "Price",
            "type": "number"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "sector": {
            "title": "Sector",
            "type": "string"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "value": {
            "title": "Value",
            "type": "number"
          },
          "weight": {
            "title": "Weight",
            "type": "number"
          }
        },
        "required": [
          "ticker",
          "name",
          "sector",
          "quantity",
          "cost",
          "price",
          "value",
          "weight",
          "pnl",
          "pnl_pct"
        ],
        "title": "DemoPositionView",
        "type": "object"
      },
      "DisconnectView": {
        "properties": {
          "archived_portfolios": {
            "items": {
              "type": "string"
            },
            "title": "Archived Portfolios",
            "type": "array"
          },
          "connection_id": {
            "title": "Connection Id",
            "type": "string"
          },
          "remote_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Remote Error"
          },
          "remote_removed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Remote Removed"
          }
        },
        "required": [
          "connection_id",
          "archived_portfolios",
          "remote_removed",
          "remote_error"
        ],
        "title": "DisconnectView",
        "type": "object"
      },
      "DispositionView": {
        "properties": {
          "avg_days_losers": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Days Losers"
          },
          "avg_days_winners": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Days Winners"
          },
          "present": {
            "description": "Losers are held clearly longer than winners.",
            "title": "Present",
            "type": "boolean"
          },
          "ratio": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Losers held this many times longer than winners.",
            "title": "Ratio"
          }
        },
        "required": [
          "avg_days_winners",
          "avg_days_losers",
          "ratio",
          "present"
        ],
        "title": "DispositionView",
        "type": "object"
      },
      "DividendEvent": {
        "properties": {
          "amount": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Currency"
          },
          "declaration_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Declaration Date"
          },
          "ex_date": {
            "format": "date",
            "title": "Ex Date",
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "pay_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pay Date"
          },
          "record_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Record Date"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "ticker",
          "ex_date"
        ],
        "title": "DividendEvent",
        "type": "object"
      },
      "Draft": {
        "properties": {
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "enum": [
              "rule",
              "code"
            ],
            "title": "Kind",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "owner_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owner Id"
          },
          "registered_strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Registered Strategy Id"
          },
          "source_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Code"
          },
          "spec": {
            "additionalProperties": true,
            "title": "Spec",
            "type": "object"
          },
          "status": {
            "enum": [
              "draft",
              "registered"
            ],
            "title": "Status",
            "type": "string"
          },
          "strategy_status": {
            "anyOf": [
              {
                "enum": [
                  "active",
                  "shadow",
                  "retired"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Status"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "kind",
          "spec",
          "source_code",
          "status",
          "registered_strategy_id",
          "strategy_status",
          "created_at",
          "updated_at"
        ],
        "title": "Draft",
        "type": "object"
      },
      "DraftBacktestRequest": {
        "description": "A :class:`~stonks.app.lab.BacktestRequest` without the strategy\n(the draft is the strategy).",
        "properties": {
          "benchmark": {
            "anyOf": [
              {
                "description": "auto (SPY.US when priced, else EW), EW (equal-weight universe), a ticker such as QQQ.US, or none; default [lab] benchmark",
                "maxLength": 32,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Benchmark"
          },
          "cost_model": {
            "anyOf": [
              {
                "enum": [
                  "zero",
                  "realistic",
                  "ibkr_tiered",
                  "ibkr_fixed"
                ],
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/CostModelSettings"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cost Model"
          },
          "end": {
            "format": "date",
            "title": "End",
            "type": "string"
          },
          "fee_per_trade": {
            "default": 0.0,
            "minimum": 0.0,
            "title": "Fee Per Trade",
            "type": "number"
          },
          "initial_cash": {
            "default": 10000.0,
            "exclusiveMinimum": 0.0,
            "title": "Initial Cash",
            "type": "number"
          },
          "interval": {
            "default": "1d",
            "title": "Interval",
            "type": "string"
          },
          "rebalance_every_bars": {
            "default": 1,
            "minimum": 1.0,
            "title": "Rebalance Every Bars",
            "type": "integer"
          },
          "slippage_bps": {
            "default": 0.0,
            "minimum": 0.0,
            "title": "Slippage Bps",
            "type": "number"
          },
          "start": {
            "format": "date",
            "title": "Start",
            "type": "string"
          },
          "threshold": {
            "default": 0.0,
            "title": "Threshold",
            "type": "number"
          },
          "universe": {
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "title": "Universe",
            "type": "array"
          }
        },
        "required": [
          "universe",
          "start",
          "end"
        ],
        "title": "DraftBacktestRequest",
        "type": "object"
      },
      "DraftCreate": {
        "properties": {
          "kind": {
            "default": "rule",
            "enum": [
              "rule",
              "code"
            ],
            "title": "Kind",
            "type": "string"
          },
          "name": {
            "maxLength": 100,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "source_code": {
            "anyOf": [
              {
                "maxLength": 200000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Code"
          },
          "spec": {
            "additionalProperties": true,
            "title": "Spec",
            "type": "object"
          }
        },
        "required": [
          "name"
        ],
        "title": "DraftCreate",
        "type": "object"
      },
      "DraftLabRunRequest": {
        "description": "A :class:`~stonks.app.lab.LabRunRequest` without the strategy. A\nrule draft's spec is fixed (it has no tunable parameters); a code\ndraft's class is tuned over its parameter space. Registering\n(``register_strategy`` always, ``register_if_passes`` only on a pass)\nlinks the new strategy to the draft.",
        "properties": {
          "benchmark": {
            "anyOf": [
              {
                "description": "auto (SPY.US when priced, else EW), EW (equal-weight universe), a ticker such as QQQ.US, or none; default [lab] benchmark",
                "maxLength": 32,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Benchmark"
          },
          "budget": {
            "default": 20,
            "maximum": 1000.0,
            "minimum": 1.0,
            "title": "Budget",
            "type": "integer"
          },
          "cost_model": {
            "anyOf": [
              {
                "enum": [
                  "zero",
                  "realistic",
                  "ibkr_tiered",
                  "ibkr_fixed"
                ],
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/CostModelSettings"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cost Model"
          },
          "embargo_bars": {
            "anyOf": [
              {
                "maximum": 10000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Embargo Bars"
          },
          "end": {
            "format": "date",
            "title": "End",
            "type": "string"
          },
          "grid_size": {
            "anyOf": [
              {
                "maximum": 50.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true,
            "description": "Deprecated: use tuner_options.grid_size",
            "title": "Grid Size"
          },
          "heatmap": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/HeatmapOptions"
              },
              {
                "type": "null"
              }
            ]
          },
          "hypothesis": {
            "anyOf": [
              {
                "maxLength": 4000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hypothesis"
          },
          "interval": {
            "default": "1d",
            "title": "Interval",
            "type": "string"
          },
          "mcpt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/McptOptions"
              },
              {
                "type": "null"
              }
            ]
          },
          "objective": {
            "default": "sharpe",
            "enum": [
              "sharpe",
              "cagr",
              "final_return",
              "sortino",
              "calmar",
              "sharpe_dd",
              "multi",
              "cv_sharpe",
              "cv_cagr",
              "cv_final_return"
            ],
            "title": "Objective",
            "type": "string"
          },
          "preflight": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preflight"
          },
          "premortem": {
            "anyOf": [
              {
                "maxLength": 4000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Premortem"
          },
          "preset": {
            "anyOf": [
              {
                "enum": [
                  "promotion",
                  "quick",
                  "standard"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preset"
          },
          "prune": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true,
            "description": "Deprecated: use tuner_options.prune",
            "title": "Prune"
          },
          "register_if_passes": {
            "default": false,
            "title": "Register If Passes",
            "type": "boolean"
          },
          "register_strategy": {
            "default": false,
            "title": "Register Strategy",
            "type": "boolean"
          },
          "sampler": {
            "anyOf": [
              {
                "maxLength": 32,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true,
            "description": "Deprecated: use tuner_options.sampler",
            "title": "Sampler"
          },
          "seed": {
            "default": 0,
            "title": "Seed",
            "type": "integer"
          },
          "start": {
            "format": "date",
            "title": "Start",
            "type": "string"
          },
          "strict_preflight": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strict Preflight"
          },
          "survival_tests": {
            "anyOf": [
              {
                "items": {
                  "enum": [
                    "benchmark_relative",
                    "cost_stress",
                    "cpcv",
                    "crisis",
                    "cross_instrument",
                    "data_snooping",
                    "deflated_sharpe",
                    "drift",
                    "event_study",
                    "forecast_skill",
                    "mc_trades",
                    "mcpt",
                    "oos",
                    "pbo",
                    "period_stability",
                    "permutation",
                    "perturbation",
                    "plateau",
                    "pool_correlation",
                    "runs_test",
                    "signal_ic",
                    "stress",
                    "vs_random",
                    "walk_forward",
                    "walk_forward_mcpt"
                  ],
                  "type": "string"
                },
                "minItems": 1,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Survival Tests"
          },
          "test_options": {
            "anyOf": [
              {
                "additionalProperties": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "propertyNames": {
                  "enum": [
                    "benchmark_relative",
                    "cost_stress",
                    "cpcv",
                    "crisis",
                    "cross_instrument",
                    "data_snooping",
                    "deflated_sharpe",
                    "drift",
                    "event_study",
                    "forecast_skill",
                    "mc_trades",
                    "mcpt",
                    "oos",
                    "pbo",
                    "period_stability",
                    "permutation",
                    "perturbation",
                    "plateau",
                    "pool_correlation",
                    "runs_test",
                    "signal_ic",
                    "stress",
                    "vs_random",
                    "walk_forward",
                    "walk_forward_mcpt"
                  ]
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Test Options"
          },
          "train_ratio": {
            "default": 0.7,
            "exclusiveMaximum": 1.0,
            "exclusiveMinimum": 0.0,
            "title": "Train Ratio",
            "type": "number"
          },
          "tuner": {
            "default": "random",
            "enum": [
              "grid",
              "optuna",
              "prescreen",
              "random"
            ],
            "title": "Tuner",
            "type": "string"
          },
          "tuner_options": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tuner Options"
          },
          "universe": {
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "title": "Universe",
            "type": "array"
          },
          "walk_forward": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WalkForwardConfig"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "universe",
          "start",
          "end"
        ],
        "title": "DraftLabRunRequest",
        "type": "object"
      },
      "DraftUpdate": {
        "properties": {
          "name": {
            "anyOf": [
              {
                "maxLength": 100,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "source_code": {
            "anyOf": [
              {
                "maxLength": 200000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Code"
          },
          "spec": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Spec"
          }
        },
        "title": "DraftUpdate",
        "type": "object"
      },
      "DraftValidation": {
        "properties": {
          "issues": {
            "items": {
              "$ref": "#/components/schemas/ValidationIssue"
            },
            "title": "Issues",
            "type": "array"
          },
          "smoke": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SmokeCheck"
              },
              {
                "type": "null"
              }
            ]
          },
          "valid": {
            "title": "Valid",
            "type": "boolean"
          }
        },
        "required": [
          "valid",
          "issues"
        ],
        "title": "DraftValidation",
        "type": "object"
      },
      "DrawdownScalingSettings": {
        "additionalProperties": false,
        "properties": {
          "schedule": {
            "anyOf": [
              {
                "items": {
                  "maxItems": 2,
                  "minItems": 2,
                  "prefixItems": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "number"
                    }
                  ],
                  "type": "array"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Schedule"
          }
        },
        "title": "DrawdownScalingSettings",
        "type": "object"
      },
      "DriftItemView": {
        "properties": {
          "broker": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Broker"
          },
          "detail": {
            "title": "Detail",
            "type": "string"
          },
          "explained": {
            "title": "Explained",
            "type": "boolean"
          },
          "key": {
            "title": "Key",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "material": {
            "title": "Material",
            "type": "boolean"
          },
          "ours": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ours"
          }
        },
        "required": [
          "kind",
          "key",
          "ours",
          "broker",
          "material",
          "explained",
          "detail"
        ],
        "title": "DriftItemView",
        "type": "object"
      },
      "DuplicateSource": {
        "description": "Where rows a preview calls duplicates were imported before.",
        "properties": {
          "import_id": {
            "title": "Import Id",
            "type": "string"
          },
          "imported_on": {
            "format": "date",
            "title": "Imported On",
            "type": "string"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "portfolio_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Name"
          }
        },
        "required": [
          "portfolio_id",
          "portfolio_name",
          "import_id",
          "imported_on"
        ],
        "title": "DuplicateSource",
        "type": "object"
      },
      "EarningsEvent": {
        "properties": {
          "before_after_market": {
            "anyOf": [
              {
                "enum": [
                  "before",
                  "during",
                  "after"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Before After Market"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Currency"
          },
          "eps_actual": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Eps Actual"
          },
          "eps_difference": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Eps Difference"
          },
          "eps_estimate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Eps Estimate"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "period_end": {
            "format": "date",
            "title": "Period End",
            "type": "string"
          },
          "report_date": {
            "format": "date",
            "title": "Report Date",
            "type": "string"
          },
          "surprise_percent": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Surprise Percent"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "ticker",
          "period_end",
          "report_date"
        ],
        "title": "EarningsEvent",
        "type": "object"
      },
      "EarningsWarning": {
        "properties": {
          "before_after_market": {
            "anyOf": [
              {
                "enum": [
                  "before",
                  "during",
                  "after"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Before After Market"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "next_open": {
            "format": "date-time",
            "title": "Next Open",
            "type": "string"
          },
          "report_date": {
            "format": "date",
            "title": "Report Date",
            "type": "string"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "ticker",
          "report_date",
          "next_open"
        ],
        "title": "EarningsWarning",
        "type": "object"
      },
      "EarningsWarningsView": {
        "properties": {
          "checked": {
            "items": {
              "type": "string"
            },
            "title": "Checked",
            "type": "array"
          },
          "warnings": {
            "items": {
              "$ref": "#/components/schemas/EarningsWarning"
            },
            "title": "Warnings",
            "type": "array"
          }
        },
        "required": [
          "checked",
          "warnings"
        ],
        "title": "EarningsWarningsView",
        "type": "object"
      },
      "EconomicAlertsUpdate": {
        "description": "Economic release alerts. Only what is given changes.",
        "properties": {
          "countries": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 30,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Countries"
          },
          "default_countries": {
            "default": false,
            "title": "Default Countries",
            "type": "boolean"
          },
          "min_importance": {
            "anyOf": [
              {
                "enum": [
                  "low",
                  "medium",
                  "high"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Min Importance"
          }
        },
        "title": "EconomicAlertsUpdate",
        "type": "object"
      },
      "EconomicAlertsView": {
        "description": "Which economic releases alert you. Turned on or off by the\n``economic`` switch in ``event_alerts``.",
        "properties": {
          "countries": {
            "items": {
              "type": "string"
            },
            "title": "Countries",
            "type": "array"
          },
          "country_options": {
            "items": {
              "$ref": "#/components/schemas/ChoiceOption"
            },
            "title": "Country Options",
            "type": "array"
          },
          "default_countries": {
            "title": "Default Countries",
            "type": "boolean"
          },
          "importance_options": {
            "items": {
              "$ref": "#/components/schemas/ChoiceOption"
            },
            "title": "Importance Options",
            "type": "array"
          },
          "min_importance": {
            "enum": [
              "low",
              "medium",
              "high"
            ],
            "title": "Min Importance",
            "type": "string"
          }
        },
        "required": [
          "countries",
          "default_countries",
          "min_importance"
        ],
        "title": "EconomicAlertsView",
        "type": "object"
      },
      "EconomicEvent": {
        "properties": {
          "actual": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actual"
          },
          "change": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Change"
          },
          "change_pct": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Change Pct"
          },
          "comparison": {
            "enum": [
              "mom",
              "qoq",
              "yoy",
              "none"
            ],
            "title": "Comparison",
            "type": "string"
          },
          "country": {
            "title": "Country",
            "type": "string"
          },
          "estimate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Estimate"
          },
          "event_time": {
            "format": "date-time",
            "title": "Event Time",
            "type": "string"
          },
          "event_type": {
            "title": "Event Type",
            "type": "string"
          },
          "importance": {
            "default": "low",
            "enum": [
              "low",
              "medium",
              "high"
            ],
            "title": "Importance",
            "type": "string"
          },
          "period": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Period"
          },
          "previous": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Previous"
          }
        },
        "required": [
          "country",
          "event_time",
          "event_type",
          "comparison"
        ],
        "title": "EconomicEvent",
        "type": "object"
      },
      "EngineView": {
        "properties": {
          "bar_closes": {
            "title": "Bar Closes",
            "type": "integer"
          },
          "bars": {
            "title": "Bars",
            "type": "integer"
          },
          "calendar": {
            "title": "Calendar",
            "type": "string"
          },
          "deadman": {
            "enum": [
              "ok",
              "silent",
              "closed",
              "stopped"
            ],
            "title": "Deadman",
            "type": "string"
          },
          "dispatch_lag": {
            "$ref": "#/components/schemas/LatencyView"
          },
          "engine_id": {
            "title": "Engine Id",
            "type": "string"
          },
          "event_to_order": {
            "$ref": "#/components/schemas/LatencyView"
          },
          "handler_errors": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "Handler Errors",
            "type": "object"
          },
          "last_dispatch_age_seconds": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Dispatch Age Seconds"
          },
          "last_dispatch_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Dispatch At"
          },
          "late_bars": {
            "title": "Late Bars",
            "type": "integer"
          },
          "live": {
            "title": "Live",
            "type": "boolean"
          },
          "market_open": {
            "title": "Market Open",
            "type": "boolean"
          },
          "pending_closes": {
            "title": "Pending Closes",
            "type": "integer"
          },
          "silent_seconds": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Silent Seconds"
          },
          "started_at": {
            "format": "date-time",
            "title": "Started At",
            "type": "string"
          },
          "state": {
            "title": "State",
            "type": "string"
          },
          "stopped_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stopped At"
          },
          "stream": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StreamHealthView"
              },
              {
                "type": "null"
              }
            ]
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "engine_id",
          "calendar",
          "state",
          "live",
          "started_at",
          "updated_at",
          "stopped_at",
          "last_dispatch_at",
          "last_dispatch_age_seconds",
          "market_open",
          "deadman",
          "silent_seconds",
          "bar_closes",
          "bars",
          "late_bars",
          "pending_closes",
          "handler_errors",
          "stream",
          "dispatch_lag",
          "event_to_order"
        ],
        "title": "EngineView",
        "type": "object"
      },
      "EnrolStartView": {
        "properties": {
          "otpauth_uri": {
            "title": "Otpauth Uri",
            "type": "string"
          },
          "secret": {
            "title": "Secret",
            "type": "string"
          }
        },
        "required": [
          "secret",
          "otpauth_uri"
        ],
        "title": "EnrolStartView",
        "type": "object"
      },
      "EnsureDataRequest": {
        "description": "Fetch the missing bars of the universe's members over a window\n(every name that was a member on any day of it, delisted ones too).",
        "properties": {
          "end": {
            "format": "date",
            "title": "End",
            "type": "string"
          },
          "interval": {
            "default": "1d",
            "title": "Interval",
            "type": "string"
          },
          "source": {
            "anyOf": [
              {
                "enum": [
                  "eodhd",
                  "yahoo",
                  "defillama"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source"
          },
          "start": {
            "format": "date",
            "title": "Start",
            "type": "string"
          }
        },
        "required": [
          "start",
          "end"
        ],
        "title": "EnsureDataRequest",
        "type": "object"
      },
      "EnsureReport": {
        "description": "What an ensure did. ``run_id`` is the ``ingest_runs`` row (``None``\nwhen nothing was missing).",
        "properties": {
          "bulk_days": {
            "default": 0,
            "title": "Bulk Days",
            "type": "integer"
          },
          "clipped_start": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Clipped Start"
          },
          "end": {
            "format": "date",
            "title": "End",
            "type": "string"
          },
          "failed": {
            "items": {
              "type": "string"
            },
            "title": "Failed",
            "type": "array"
          },
          "gaps": {
            "default": 0,
            "title": "Gaps",
            "type": "integer"
          },
          "interval": {
            "title": "Interval",
            "type": "string"
          },
          "readjusted": {
            "items": {
              "type": "string"
            },
            "title": "Readjusted",
            "type": "array"
          },
          "run_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Run Id"
          },
          "source": {
            "title": "Source",
            "type": "string"
          },
          "start": {
            "format": "date",
            "title": "Start",
            "type": "string"
          },
          "status": {
            "default": "ok",
            "title": "Status",
            "type": "string"
          },
          "tickers_failed": {
            "default": 0,
            "title": "Tickers Failed",
            "type": "integer"
          },
          "tickers_fetched": {
            "default": 0,
            "title": "Tickers Fetched",
            "type": "integer"
          },
          "tickers_requested": {
            "default": 0,
            "title": "Tickers Requested",
            "type": "integer"
          },
          "tickers_up_to_date": {
            "default": 0,
            "title": "Tickers Up To Date",
            "type": "integer"
          },
          "warnings": {
            "items": {
              "type": "string"
            },
            "title": "Warnings",
            "type": "array"
          }
        },
        "required": [
          "interval",
          "start",
          "end",
          "source"
        ],
        "title": "EnsureReport",
        "type": "object"
      },
      "EquityPoint": {
        "properties": {
          "timestamp": {
            "format": "date-time",
            "title": "Timestamp",
            "type": "string"
          },
          "value": {
            "title": "Value",
            "type": "number"
          }
        },
        "required": [
          "timestamp",
          "value"
        ],
        "title": "EquityPoint",
        "type": "object"
      },
      "EquityPointView": {
        "properties": {
          "date": {
            "format": "date",
            "title": "Date",
            "type": "string"
          },
          "value": {
            "title": "Value",
            "type": "number"
          }
        },
        "required": [
          "date",
          "value"
        ],
        "title": "EquityPointView",
        "type": "object"
      },
      "EventAlertKindView": {
        "properties": {
          "default_days_ahead": {
            "title": "Default Days Ahead",
            "type": "integer"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "topic": {
            "title": "Topic",
            "type": "string"
          }
        },
        "required": [
          "kind",
          "label",
          "default_days_ahead",
          "topic"
        ],
        "title": "EventAlertKindView",
        "type": "object"
      },
      "EventAlertSummary": {
        "properties": {
          "people": {
            "title": "People",
            "type": "integer"
          },
          "repeats": {
            "title": "Repeats",
            "type": "integer"
          },
          "sent": {
            "title": "Sent",
            "type": "integer"
          }
        },
        "required": [
          "people",
          "sent",
          "repeats"
        ],
        "title": "EventAlertSummary",
        "type": "object"
      },
      "EventAlertSwitchItem": {
        "properties": {
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "topic": {
            "maxLength": 32,
            "minLength": 1,
            "title": "Topic",
            "type": "string"
          }
        },
        "required": [
          "topic",
          "enabled"
        ],
        "title": "EventAlertSwitchItem",
        "type": "object"
      },
      "EventAlertSwitchView": {
        "properties": {
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "topic": {
            "title": "Topic",
            "type": "string"
          }
        },
        "required": [
          "topic",
          "label",
          "enabled"
        ],
        "title": "EventAlertSwitchView",
        "type": "object"
      },
      "ExchangeView": {
        "description": "An exchange our instruments name, for the exchange picker.",
        "properties": {
          "exchange": {
            "title": "Exchange",
            "type": "string"
          },
          "instruments": {
            "title": "Instruments",
            "type": "integer"
          },
          "listed": {
            "title": "Listed",
            "type": "integer"
          }
        },
        "required": [
          "exchange",
          "instruments",
          "listed"
        ],
        "title": "ExchangeView",
        "type": "object"
      },
      "ExecAlgoAssumption": {
        "additionalProperties": false,
        "description": "``[backtest.costs.exec_algo]``: the execution algo the fills assume.",
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "params": {
            "additionalProperties": true,
            "title": "Params",
            "type": "object"
          }
        },
        "required": [
          "name"
        ],
        "title": "ExecAlgoAssumption",
        "type": "object"
      },
      "Exposure": {
        "properties": {
          "benchmark": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Benchmark"
          },
          "beta": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Sum of each holding's weight times its beta to the benchmark, over the holdings with a beta. Null when none has one.",
            "title": "Beta"
          },
          "beta_coverage": {
            "description": "Share of the gross holdings (by value) that have a beta.",
            "title": "Beta Coverage",
            "type": "number"
          },
          "gross": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "(long - short) / total value; null without value.",
            "title": "Gross"
          },
          "long_value": {
            "title": "Long Value",
            "type": "number"
          },
          "net": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "(long + short) / total value; null without value.",
            "title": "Net"
          },
          "short_value": {
            "description": "Market value of short holdings (zero or negative).",
            "title": "Short Value",
            "type": "number"
          }
        },
        "required": [
          "long_value",
          "short_value",
          "gross",
          "net",
          "beta",
          "beta_coverage",
          "benchmark"
        ],
        "title": "Exposure",
        "type": "object"
      },
      "ExpressionCheckRequest": {
        "properties": {
          "expression": {
            "maxLength": 2000,
            "minLength": 1,
            "title": "Expression",
            "type": "string"
          }
        },
        "required": [
          "expression"
        ],
        "title": "ExpressionCheckRequest",
        "type": "object"
      },
      "ExpressionCheckView": {
        "properties": {
          "canonical": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Canonical"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "lookback_bars": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Lookback Bars"
          },
          "ok": {
            "title": "Ok",
            "type": "boolean"
          }
        },
        "required": [
          "ok"
        ],
        "title": "ExpressionCheckView",
        "type": "object"
      },
      "ExternalOrderView": {
        "properties": {
          "broker_order_id": {
            "title": "Broker Order Id",
            "type": "string"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "side": {
            "title": "Side",
            "type": "string"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "broker_order_id",
          "ticker",
          "side",
          "quantity"
        ],
        "title": "ExternalOrderView",
        "type": "object"
      },
      "ExternalView": {
        "description": "The owner's own holdings and hand-placed orders: never drift.",
        "properties": {
          "orders": {
            "items": {
              "$ref": "#/components/schemas/ExternalOrderView"
            },
            "title": "Orders",
            "type": "array"
          },
          "positions": {
            "additionalProperties": {
              "type": "number"
            },
            "title": "Positions",
            "type": "object"
          }
        },
        "required": [
          "positions",
          "orders"
        ],
        "title": "ExternalView",
        "type": "object"
      },
      "FactorCatalogView": {
        "properties": {
          "factors": {
            "items": {
              "$ref": "#/components/schemas/FactorView"
            },
            "title": "Factors",
            "type": "array"
          },
          "families": {
            "items": {
              "type": "string"
            },
            "title": "Families",
            "type": "array"
          },
          "sets": {
            "items": {
              "$ref": "#/components/schemas/FactorSetView"
            },
            "title": "Sets",
            "type": "array"
          }
        },
        "required": [
          "factors",
          "sets",
          "families"
        ],
        "title": "FactorCatalogView",
        "type": "object"
      },
      "FactorSetView": {
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name",
          "count"
        ],
        "title": "FactorSetView",
        "type": "object"
      },
      "FactorTearSheetRequest": {
        "properties": {
          "end": {
            "format": "date",
            "title": "End",
            "type": "string"
          },
          "every_bars": {
            "default": 5,
            "maximum": 504.0,
            "minimum": 1.0,
            "title": "Every Bars",
            "type": "integer"
          },
          "factor": {
            "maxLength": 2000,
            "minLength": 1,
            "title": "Factor",
            "type": "string"
          },
          "horizons": {
            "default": [
              1,
              5,
              21
            ],
            "items": {
              "type": "integer"
            },
            "maxItems": 20,
            "minItems": 1,
            "title": "Horizons",
            "type": "array"
          },
          "interval": {
            "default": "1d",
            "title": "Interval",
            "type": "string"
          },
          "min_names": {
            "default": 5,
            "maximum": 1000.0,
            "minimum": 2.0,
            "title": "Min Names",
            "type": "integer"
          },
          "n_quantiles": {
            "default": 5,
            "maximum": 20.0,
            "minimum": 2.0,
            "title": "N Quantiles",
            "type": "integer"
          },
          "start": {
            "format": "date",
            "title": "Start",
            "type": "string"
          },
          "universe": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 5000,
                "minItems": 1,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Universe"
          },
          "universe_id": {
            "anyOf": [
              {
                "maxLength": 128,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Universe Id"
          }
        },
        "required": [
          "factor",
          "start",
          "end"
        ],
        "title": "FactorTearSheetRequest",
        "type": "object"
      },
      "FactorTearSheetView": {
        "description": ":class:`stonks.factors.tearsheet.FactorTearSheet`; NaN is null.",
        "properties": {
          "alpha_beta": {
            "$ref": "#/components/schemas/AlphaBetaView"
          },
          "coverage": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Coverage"
          },
          "every_bars": {
            "title": "Every Bars",
            "type": "integer"
          },
          "factor": {
            "$ref": "#/components/schemas/FactorView"
          },
          "horizons": {
            "items": {
              "$ref": "#/components/schemas/HorizonSummaryView"
            },
            "title": "Horizons",
            "type": "array"
          },
          "ic_by_group": {
            "additionalProperties": {
              "items": {
                "$ref": "#/components/schemas/GroupICView"
              },
              "type": "array"
            },
            "title": "Ic By Group",
            "type": "object"
          },
          "ic_horizon": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ic Horizon"
          },
          "ic_series": {
            "items": {
              "maxItems": 2,
              "minItems": 2,
              "prefixItems": [
                {
                  "type": "string"
                },
                {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              ],
              "type": "array"
            },
            "title": "Ic Series",
            "type": "array"
          },
          "interval": {
            "title": "Interval",
            "type": "string"
          },
          "monthly_ic": {
            "items": {
              "$ref": "#/components/schemas/MonthlyICView"
            },
            "title": "Monthly Ic",
            "type": "array"
          },
          "n_dates": {
            "title": "N Dates",
            "type": "integer"
          },
          "n_quantiles": {
            "title": "N Quantiles",
            "type": "integer"
          },
          "n_tickers": {
            "title": "N Tickers",
            "type": "integer"
          },
          "note": {
            "default": "",
            "title": "Note",
            "type": "string"
          },
          "periods": {
            "items": {
              "$ref": "#/components/schemas/PeriodICView"
            },
            "title": "Periods",
            "type": "array"
          },
          "quantile_curves": {
            "$ref": "#/components/schemas/QuantileCurvesView"
          },
          "score_turnover": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Score Turnover"
          },
          "size_basis": {
            "default": "none",
            "title": "Size Basis",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "top_quantile_turnover": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Top Quantile Turnover"
          },
          "universe_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Universe Id"
          },
          "window": {
            "maxItems": 2,
            "minItems": 2,
            "prefixItems": [
              {
                "type": "string"
              },
              {
                "type": "string"
              }
            ],
            "title": "Window",
            "type": "array"
          }
        },
        "required": [
          "factor",
          "window",
          "interval",
          "n_tickers",
          "n_dates",
          "every_bars",
          "n_quantiles",
          "status"
        ],
        "title": "FactorTearSheetView",
        "type": "object"
      },
      "FactorValue": {
        "properties": {
          "rank": {
            "title": "Rank",
            "type": "integer"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "value": {
            "title": "Value",
            "type": "number"
          }
        },
        "required": [
          "ticker",
          "value",
          "rank"
        ],
        "title": "FactorValue",
        "type": "object"
      },
      "FactorValuesRequest": {
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "factor": {
            "maxLength": 2000,
            "minLength": 1,
            "title": "Factor",
            "type": "string"
          },
          "universe": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 5000,
                "minItems": 1,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Universe"
          },
          "universe_id": {
            "anyOf": [
              {
                "maxLength": 128,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Universe Id"
          }
        },
        "required": [
          "factor",
          "as_of"
        ],
        "title": "FactorValuesRequest",
        "type": "object"
      },
      "FactorValuesView": {
        "properties": {
          "as_of": {
            "title": "As Of",
            "type": "string"
          },
          "direction": {
            "title": "Direction",
            "type": "integer"
          },
          "factor_id": {
            "title": "Factor Id",
            "type": "string"
          },
          "missing": {
            "items": {
              "type": "string"
            },
            "title": "Missing",
            "type": "array"
          },
          "values": {
            "items": {
              "$ref": "#/components/schemas/FactorValue"
            },
            "title": "Values",
            "type": "array"
          }
        },
        "required": [
          "factor_id",
          "as_of",
          "direction",
          "values",
          "missing"
        ],
        "title": "FactorValuesView",
        "type": "object"
      },
      "FactorView": {
        "properties": {
          "asset_classes": {
            "items": {
              "type": "string"
            },
            "title": "Asset Classes",
            "type": "array"
          },
          "description": {
            "title": "Description",
            "type": "string"
          },
          "direction": {
            "title": "Direction",
            "type": "integer"
          },
          "expression": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expression"
          },
          "family": {
            "title": "Family",
            "type": "string"
          },
          "hypothesis": {
            "title": "Hypothesis",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "lookback_bars": {
            "title": "Lookback Bars",
            "type": "integer"
          },
          "provenance": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ProvenanceView"
              },
              {
                "type": "null"
              }
            ]
          },
          "set": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Set"
          }
        },
        "required": [
          "id",
          "kind",
          "family",
          "description",
          "direction",
          "hypothesis",
          "lookback_bars",
          "asset_classes"
        ],
        "title": "FactorView",
        "type": "object"
      },
      "FailingCheck": {
        "description": "One go-live check that failed (``GoLiveCheck`` without ``passed``).",
        "properties": {
          "detail": {
            "default": "",
            "title": "Detail",
            "type": "string"
          },
          "limit": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Value"
          }
        },
        "required": [
          "name"
        ],
        "title": "FailingCheck",
        "type": "object"
      },
      "FeedItemView": {
        "properties": {
          "category": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Category"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "deep_link": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Deep Link"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "level": {
            "title": "Level",
            "type": "string"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "read_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Read At"
          },
          "title": {
            "title": "Title",
            "type": "string"
          }
        },
        "required": [
          "id",
          "category",
          "level",
          "title",
          "message",
          "deep_link",
          "created_at",
          "read_at"
        ],
        "title": "FeedItemView",
        "type": "object"
      },
      "FeedView": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/FeedItemView"
            },
            "title": "Items",
            "type": "array"
          },
          "unread_count": {
            "title": "Unread Count",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "unread_count"
        ],
        "title": "FeedView",
        "type": "object"
      },
      "FilingEvent": {
        "description": "A current report (8-K) a company filed (roadmap 23.13).",
        "properties": {
          "accepted_at": {
            "format": "date-time",
            "title": "Accepted At",
            "type": "string"
          },
          "form": {
            "title": "Form",
            "type": "string"
          },
          "item_names": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Item Names",
            "type": "array"
          },
          "items": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Items",
            "type": "array"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Url"
          }
        },
        "required": [
          "ticker",
          "form",
          "accepted_at"
        ],
        "title": "FilingEvent",
        "type": "object"
      },
      "FillView": {
        "properties": {
          "fee": {
            "title": "Fee",
            "type": "number"
          },
          "filled_at": {
            "title": "Filled At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "order_client_id": {
            "title": "Order Client Id",
            "type": "string"
          },
          "price": {
            "title": "Price",
            "type": "number"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "side": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Side"
          },
          "tick_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tick Id"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "id",
          "order_client_id",
          "tick_id",
          "ticker",
          "quantity",
          "price",
          "fee",
          "filled_at"
        ],
        "title": "FillView",
        "type": "object"
      },
      "FundCoverage": {
        "properties": {
          "as_of": {
            "description": "The day the fund's holdings list describes.",
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "covered": {
            "description": "Share of the fund the listed holdings explain (0 to 1).",
            "title": "Covered",
            "type": "number"
          },
          "fund": {
            "title": "Fund",
            "type": "string"
          },
          "holdings": {
            "description": "Holdings listed for the fund.",
            "title": "Holdings",
            "type": "integer"
          },
          "source": {
            "title": "Source",
            "type": "string"
          },
          "value": {
            "description": "Market value of the fund in the book.",
            "title": "Value",
            "type": "number"
          }
        },
        "required": [
          "fund",
          "as_of",
          "source",
          "value",
          "holdings",
          "covered"
        ],
        "title": "FundCoverage",
        "type": "object"
      },
      "FxRateView": {
        "properties": {
          "base_currency": {
            "title": "Base Currency",
            "type": "string"
          },
          "day": {
            "format": "date",
            "title": "Day",
            "type": "string"
          },
          "quote_currency": {
            "title": "Quote Currency",
            "type": "string"
          },
          "rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rate"
          }
        },
        "required": [
          "base_currency",
          "quote_currency",
          "day",
          "rate"
        ],
        "title": "FxRateView",
        "type": "object"
      },
      "GateCheckView": {
        "properties": {
          "detail": {
            "title": "Detail",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "passed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Passed"
          },
          "required": {
            "title": "Required"
          },
          "value": {
            "title": "Value"
          }
        },
        "required": [
          "name",
          "passed",
          "detail"
        ],
        "title": "GateCheckView",
        "type": "object"
      },
      "GateDayView": {
        "properties": {
          "clean": {
            "title": "Clean",
            "type": "boolean"
          },
          "drift_items": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Drift Items"
          },
          "fills": {
            "title": "Fills",
            "type": "integer"
          },
          "fills_missing_commission": {
            "title": "Fills Missing Commission",
            "type": "integer"
          },
          "live_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Live Return"
          },
          "model_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model Return"
          },
          "orders_filled": {
            "title": "Orders Filled",
            "type": "integer"
          },
          "orders_refused": {
            "title": "Orders Refused",
            "type": "integer"
          },
          "orders_rejected": {
            "title": "Orders Rejected",
            "type": "integer"
          },
          "orders_sent": {
            "title": "Orders Sent",
            "type": "integer"
          },
          "reject_rate": {
            "title": "Reject Rate",
            "type": "number"
          },
          "session_date": {
            "format": "date",
            "title": "Session Date",
            "type": "string"
          },
          "stage": {
            "enum": [
              "sim_paper",
              "broker_paper",
              "live_small",
              "live_scale"
            ],
            "title": "Stage",
            "type": "string"
          },
          "stuck_orders": {
            "title": "Stuck Orders",
            "type": "integer"
          },
          "tca_gap_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tca Gap Bps"
          },
          "tca_orders": {
            "title": "Tca Orders",
            "type": "integer"
          }
        },
        "required": [
          "session_date",
          "stage",
          "orders_sent",
          "orders_filled",
          "orders_rejected",
          "orders_refused",
          "stuck_orders",
          "fills",
          "fills_missing_commission",
          "tca_orders",
          "tca_gap_bps",
          "live_return",
          "model_return",
          "drift_items",
          "reject_rate",
          "clean"
        ],
        "title": "GateDayView",
        "type": "object"
      },
      "GateReportView": {
        "properties": {
          "checks": {
            "items": {
              "$ref": "#/components/schemas/GateCheckView"
            },
            "title": "Checks",
            "type": "array"
          },
          "computed_at": {
            "format": "date-time",
            "title": "Computed At",
            "type": "string"
          },
          "from_stage": {
            "enum": [
              "sim_paper",
              "broker_paper",
              "live_small",
              "live_scale"
            ],
            "title": "From Stage",
            "type": "string"
          },
          "metrics": {
            "additionalProperties": true,
            "title": "Metrics",
            "type": "object"
          },
          "passed": {
            "title": "Passed",
            "type": "boolean"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "target": {
            "anyOf": [
              {
                "enum": [
                  "sim_paper",
                  "broker_paper",
                  "live_small",
                  "live_scale"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target"
          }
        },
        "required": [
          "portfolio_id",
          "from_stage",
          "target",
          "passed",
          "checks",
          "metrics",
          "computed_at"
        ],
        "title": "GateReportView",
        "type": "object"
      },
      "GatewayHealthView": {
        "properties": {
          "configured": {
            "title": "Configured",
            "type": "boolean"
          },
          "gateways": {
            "items": {
              "$ref": "#/components/schemas/GatewayView"
            },
            "title": "Gateways",
            "type": "array"
          }
        },
        "required": [
          "configured",
          "gateways"
        ],
        "title": "GatewayHealthView",
        "type": "object"
      },
      "GatewayView": {
        "properties": {
          "checked": {
            "title": "Checked",
            "type": "boolean"
          },
          "connected": {
            "title": "Connected",
            "type": "boolean"
          },
          "consecutive_failures": {
            "title": "Consecutive Failures",
            "type": "integer"
          },
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Detail"
          },
          "down_since": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Down Since"
          },
          "fault": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fault"
          },
          "gateway": {
            "title": "Gateway",
            "type": "string"
          },
          "last_check_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Check At"
          },
          "last_ok_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Ok At"
          },
          "latency_ms": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Latency Ms"
          },
          "mode": {
            "enum": [
              "paper",
              "live"
            ],
            "title": "Mode",
            "type": "string"
          },
          "paused_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Paused At"
          },
          "paused_books": {
            "items": {
              "$ref": "#/components/schemas/PausedBookView"
            },
            "title": "Paused Books",
            "type": "array"
          },
          "paused_elsewhere": {
            "title": "Paused Elsewhere",
            "type": "integer"
          },
          "your_portfolios": {
            "items": {
              "type": "string"
            },
            "title": "Your Portfolios",
            "type": "array"
          }
        },
        "required": [
          "gateway",
          "mode",
          "connected",
          "checked",
          "last_check_at",
          "last_ok_at",
          "down_since",
          "consecutive_failures",
          "fault",
          "detail",
          "latency_ms",
          "paused_at",
          "your_portfolios",
          "paused_books",
          "paused_elsewhere"
        ],
        "title": "GatewayView",
        "type": "object"
      },
      "GoLiveCheckView": {
        "properties": {
          "detail": {
            "title": "Detail",
            "type": "string"
          },
          "limit": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit"
          },
          "name": {
            "enum": [
              "status",
              "min_days",
              "max_drawdown",
              "max_drift",
              "min_trades",
              "survival",
              "within_mc_band",
              "quit_rule",
              "promotion_preset",
              "nonzero_costs",
              "hypothesis_recorded",
              "backtest_min_trades"
            ],
            "title": "Name",
            "type": "string"
          },
          "passed": {
            "title": "Passed",
            "type": "boolean"
          },
          "value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Value"
          }
        },
        "required": [
          "name",
          "passed",
          "value",
          "limit",
          "detail"
        ],
        "title": "GoLiveCheckView",
        "type": "object"
      },
      "GoLivePolicy": {
        "additionalProperties": false,
        "description": "Limits a paper-trading period must meet before ``stonks golive check``\npasses (``[golive]``). The gate only reports; promotion stays a human\naction. Every limit is strict about missing data: a period with no\nsnapshots, no fills or no backtest expectation fails.",
        "properties": {
          "incubation": {
            "default": true,
            "title": "Incubation",
            "type": "boolean"
          },
          "max_drawdown": {
            "default": 0.15,
            "exclusiveMinimum": 0.0,
            "maximum": 1.0,
            "title": "Max Drawdown",
            "type": "number"
          },
          "max_drift": {
            "default": 0.1,
            "minimum": 0.0,
            "title": "Max Drift",
            "type": "number"
          },
          "min_backtest_trades": {
            "default": 30,
            "minimum": 1.0,
            "title": "Min Backtest Trades",
            "type": "integer"
          },
          "min_days": {
            "default": 63,
            "minimum": 1.0,
            "title": "Min Days",
            "type": "integer"
          },
          "min_hypothesis_chars": {
            "default": 20,
            "minimum": 1.0,
            "title": "Min Hypothesis Chars",
            "type": "integer"
          },
          "min_trades": {
            "default": 20,
            "minimum": 1.0,
            "title": "Min Trades",
            "type": "integer"
          },
          "min_trl_alpha": {
            "default": 0.05,
            "exclusiveMaximum": 1.0,
            "exclusiveMinimum": 0.0,
            "title": "Min Trl Alpha",
            "type": "number"
          },
          "min_trl_cap_days": {
            "default": 252,
            "minimum": 1.0,
            "title": "Min Trl Cap Days",
            "type": "integer"
          },
          "periods_per_year": {
            "default": 252.0,
            "exclusiveMinimum": 0.0,
            "title": "Periods Per Year",
            "type": "number"
          },
          "promotion_preset": {
            "default": "promotion",
            "title": "Promotion Preset",
            "type": "string"
          },
          "quit_drawdown_multiple": {
            "default": 1.5,
            "minimum": 1.0,
            "title": "Quit Drawdown Multiple",
            "type": "number"
          },
          "require_all_survival_passed": {
            "default": true,
            "title": "Require All Survival Passed",
            "type": "boolean"
          },
          "use_min_trl": {
            "default": true,
            "title": "Use Min Trl",
            "type": "boolean"
          }
        },
        "title": "GoLivePolicy",
        "type": "object"
      },
      "GoLiveReport": {
        "properties": {
          "checklist": {
            "$ref": "#/components/schemas/PromotionChecklistView",
            "default": {}
          },
          "checks": {
            "items": {
              "$ref": "#/components/schemas/GoLiveCheckView"
            },
            "title": "Checks",
            "type": "array"
          },
          "costs": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/CostComparisonView"
              },
              {
                "type": "null"
              }
            ]
          },
          "passed": {
            "title": "Passed",
            "type": "boolean"
          },
          "policy": {
            "$ref": "#/components/schemas/GoLivePolicy"
          },
          "real_money_books": {
            "default": 0,
            "title": "Real Money Books",
            "type": "integer"
          },
          "source": {
            "enum": [
              "shadow",
              "portfolio",
              "none"
            ],
            "title": "Source",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "strategy_id": {
            "title": "Strategy Id",
            "type": "string"
          }
        },
        "required": [
          "strategy_id",
          "status",
          "source",
          "passed",
          "checks",
          "policy"
        ],
        "title": "GoLiveReport",
        "type": "object"
      },
      "GrossExposureSettings": {
        "additionalProperties": false,
        "properties": {
          "max_gross": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Gross"
          }
        },
        "title": "GrossExposureSettings",
        "type": "object"
      },
      "GroupICView": {
        "properties": {
          "group": {
            "title": "Group",
            "type": "string"
          },
          "mean_ic": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mean Ic"
          },
          "mean_names": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mean Names"
          },
          "n_dates": {
            "title": "N Dates",
            "type": "integer"
          },
          "t_stat_hac": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "T Stat Hac"
          }
        },
        "required": [
          "group",
          "n_dates",
          "mean_names",
          "mean_ic",
          "t_stat_hac"
        ],
        "title": "GroupICView",
        "type": "object"
      },
      "GroupStatsView": {
        "description": "Results of one group of closed legs, money in the base currency.",
        "properties": {
          "avg_exit_efficiency": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Exit Efficiency"
          },
          "avg_holding_days": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Holding Days"
          },
          "avg_loss": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Loss"
          },
          "avg_pnl": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Pnl"
          },
          "avg_r": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg R"
          },
          "avg_win": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Win"
          },
          "key": {
            "title": "Key",
            "type": "string"
          },
          "losses": {
            "title": "Losses",
            "type": "integer"
          },
          "open": {
            "title": "Open",
            "type": "integer"
          },
          "pnl": {
            "title": "Pnl",
            "type": "number"
          },
          "profit_factor": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Profit Factor"
          },
          "r_trades": {
            "title": "R Trades",
            "type": "integer"
          },
          "trades": {
            "title": "Trades",
            "type": "integer"
          },
          "win_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Win Rate"
          },
          "wins": {
            "title": "Wins",
            "type": "integer"
          }
        },
        "required": [
          "key",
          "trades",
          "wins",
          "losses",
          "open",
          "win_rate",
          "pnl",
          "avg_pnl",
          "avg_win",
          "avg_loss",
          "profit_factor",
          "avg_r",
          "r_trades",
          "avg_holding_days",
          "avg_exit_efficiency"
        ],
        "title": "GroupStatsView",
        "type": "object"
      },
      "HaltView": {
        "properties": {
          "active": {
            "title": "Active",
            "type": "boolean"
          },
          "clear_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Clear Reason"
          },
          "cleared_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cleared At"
          },
          "cleared_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cleared By"
          },
          "expires_on": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires On"
          },
          "halt": {
            "enum": [
              "buys",
              "all"
            ],
            "title": "Halt",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "kind": {
            "enum": [
              "month_loss",
              "week_loss",
              "drawdown",
              "operational",
              "kill",
              "runaway",
              "broker_drift",
              "intraday_loss"
            ],
            "title": "Kind",
            "type": "string"
          },
          "portfolio_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Id"
          },
          "reason": {
            "title": "Reason",
            "type": "string"
          },
          "scope": {
            "enum": [
              "global",
              "user",
              "portfolio"
            ],
            "title": "Scope",
            "type": "string"
          },
          "tripped_at": {
            "title": "Tripped At",
            "type": "string"
          },
          "tripped_by": {
            "title": "Tripped By",
            "type": "string"
          },
          "user_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Id"
          }
        },
        "required": [
          "id",
          "kind",
          "scope",
          "user_id",
          "portfolio_id",
          "halt",
          "reason",
          "tripped_by",
          "tripped_at",
          "expires_on",
          "cleared_at",
          "cleared_by",
          "clear_reason",
          "active"
        ],
        "title": "HaltView",
        "type": "object"
      },
      "Health": {
        "properties": {
          "status": {
            "title": "Status",
            "type": "string"
          },
          "version": {
            "title": "Version",
            "type": "string"
          }
        },
        "required": [
          "status",
          "version"
        ],
        "title": "Health",
        "type": "object"
      },
      "HealthCheckView": {
        "properties": {
          "detail": {
            "title": "Detail",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "ok": {
            "title": "Ok",
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "ok",
          "detail"
        ],
        "title": "HealthCheckView",
        "type": "object"
      },
      "HealthConfig": {
        "additionalProperties": false,
        "description": "Thresholds for ``stonks health`` (``[production.health]``).",
        "properties": {
          "ingest_failure_lookback_hours": {
            "default": 24,
            "minimum": 1.0,
            "title": "Ingest Failure Lookback Hours",
            "type": "integer"
          },
          "max_bar_age_days": {
            "default": 4,
            "minimum": 0.0,
            "title": "Max Bar Age Days",
            "type": "integer"
          },
          "stuck_ingest_minutes": {
            "default": 180,
            "minimum": 1.0,
            "title": "Stuck Ingest Minutes",
            "type": "integer"
          },
          "stuck_lab_queue_minutes": {
            "default": 30,
            "minimum": 1.0,
            "title": "Stuck Lab Queue Minutes",
            "type": "integer"
          },
          "stuck_tick_minutes": {
            "default": 60,
            "minimum": 1.0,
            "title": "Stuck Tick Minutes",
            "type": "integer"
          }
        },
        "title": "HealthConfig",
        "type": "object"
      },
      "HealthReportView": {
        "properties": {
          "checked_at": {
            "format": "date-time",
            "title": "Checked At",
            "type": "string"
          },
          "checks": {
            "items": {
              "$ref": "#/components/schemas/HealthCheckView"
            },
            "title": "Checks",
            "type": "array"
          },
          "healthy": {
            "title": "Healthy",
            "type": "boolean"
          },
          "thresholds": {
            "$ref": "#/components/schemas/HealthConfig"
          }
        },
        "required": [
          "healthy",
          "checked_at",
          "checks",
          "thresholds"
        ],
        "title": "HealthReportView",
        "type": "object"
      },
      "HealthRunRequest": {
        "properties": {
          "tickers": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tickers"
          }
        },
        "title": "HealthRunRequest",
        "type": "object"
      },
      "HeartbeatReply": {
        "properties": {
          "cancel_requested": {
            "title": "Cancel Requested",
            "type": "boolean"
          },
          "running": {
            "title": "Running",
            "type": "boolean"
          }
        },
        "required": [
          "running",
          "cancel_requested"
        ],
        "title": "HeartbeatReply",
        "type": "object"
      },
      "HeatmapOptions": {
        "additionalProperties": false,
        "description": "Which two parameters to sweep and how finely.",
        "properties": {
          "fast": {
            "default": true,
            "description": "Score cells on the vectorised fast path when the strategy has one.",
            "title": "Fast",
            "type": "boolean"
          },
          "grid_size": {
            "default": 7,
            "description": "Points per axis.",
            "maximum": 15.0,
            "minimum": 2.0,
            "title": "Grid Size",
            "type": "integer"
          },
          "x": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Parameter across the map. Default: the first numeric tunable one.",
            "title": "X"
          },
          "y": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Parameter down the map. Default: the next numeric tunable one.",
            "title": "Y"
          }
        },
        "title": "HeatmapOptions",
        "type": "object"
      },
      "HeatmapView": {
        "description": "Scores over ``y_values`` (rows) by ``x_values`` (columns), ``None``\nfor a cell that failed. ``metric`` is the run's objective, or\n``fast_sharpe`` when the cells were scored on the vectorised fast path.\nEvery cell is a trial in the ledger.",
        "properties": {
          "best": {
            "additionalProperties": true,
            "title": "Best",
            "type": "object"
          },
          "fast": {
            "title": "Fast",
            "type": "boolean"
          },
          "fixed": {
            "additionalProperties": true,
            "title": "Fixed",
            "type": "object"
          },
          "metric": {
            "title": "Metric",
            "type": "string"
          },
          "plateau": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PlateauOverlayView"
              },
              {
                "type": "null"
              }
            ]
          },
          "scores": {
            "items": {
              "items": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "type": "array"
            },
            "title": "Scores",
            "type": "array"
          },
          "x": {
            "title": "X",
            "type": "string"
          },
          "x_values": {
            "items": {},
            "title": "X Values",
            "type": "array"
          },
          "y": {
            "title": "Y",
            "type": "string"
          },
          "y_values": {
            "items": {},
            "title": "Y Values",
            "type": "array"
          }
        },
        "required": [
          "x",
          "y",
          "x_values",
          "y_values",
          "scores",
          "metric",
          "fast",
          "best",
          "fixed"
        ],
        "title": "HeatmapView",
        "type": "object"
      },
      "HoldingAgreement": {
        "properties": {
          "agree": {
            "title": "Agree",
            "type": "integer"
          },
          "disagree": {
            "title": "Disagree",
            "type": "integer"
          },
          "opinions": {
            "items": {
              "$ref": "#/components/schemas/Opinion"
            },
            "title": "Opinions",
            "type": "array"
          },
          "side": {
            "enum": [
              "long",
              "short"
            ],
            "title": "Side",
            "type": "string"
          },
          "symbol": {
            "title": "Symbol",
            "type": "string"
          },
          "ticker": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ticker"
          }
        },
        "required": [
          "symbol",
          "ticker",
          "side",
          "agree",
          "disagree",
          "opinions"
        ],
        "title": "HoldingAgreement",
        "type": "object"
      },
      "HorizonICView": {
        "properties": {
          "hac_lags": {
            "title": "Hac Lags",
            "type": "integer"
          },
          "hit_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hit Rate"
          },
          "horizon": {
            "title": "Horizon",
            "type": "integer"
          },
          "ic_std": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ic Std"
          },
          "icir": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Icir"
          },
          "mean_ic": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mean Ic"
          },
          "n_dates": {
            "title": "N Dates",
            "type": "integer"
          },
          "quantile_means": {
            "items": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            },
            "title": "Quantile Means",
            "type": "array"
          },
          "se_hac": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Se Hac"
          },
          "se_iid": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Se Iid"
          },
          "spread_mean": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Spread Mean"
          },
          "spread_t_hac": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Spread T Hac"
          },
          "t_stat_hac": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "T Stat Hac"
          }
        },
        "required": [
          "horizon",
          "n_dates",
          "mean_ic",
          "ic_std",
          "icir",
          "hit_rate",
          "se_iid",
          "se_hac",
          "hac_lags",
          "t_stat_hac",
          "quantile_means",
          "spread_mean",
          "spread_t_hac"
        ],
        "title": "HorizonICView",
        "type": "object"
      },
      "HorizonSummaryView": {
        "properties": {
          "hac_lags": {
            "title": "Hac Lags",
            "type": "integer"
          },
          "hit_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hit Rate"
          },
          "horizon": {
            "title": "Horizon",
            "type": "integer"
          },
          "ic_std": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ic Std"
          },
          "icir": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Icir"
          },
          "mean_ic": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mean Ic"
          },
          "n_dates": {
            "title": "N Dates",
            "type": "integer"
          },
          "quantile_means": {
            "items": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            },
            "title": "Quantile Means",
            "type": "array"
          },
          "spread_mean": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Spread Mean"
          },
          "spread_t_hac": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Spread T Hac"
          },
          "t_stat_hac": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "T Stat Hac"
          }
        },
        "required": [
          "horizon",
          "n_dates",
          "mean_ic",
          "ic_std",
          "icir",
          "hit_rate",
          "t_stat_hac",
          "hac_lags",
          "quantile_means",
          "spread_mean",
          "spread_t_hac"
        ],
        "title": "HorizonSummaryView",
        "type": "object"
      },
      "IStarSettings": {
        "description": "Kissell's I-Star parameters: ``I = a1 (Q/ADV)^a2 sigma^a3`` bps, with\na temporary part ``b1 I pov^a4`` and a permanent part ``(1 - b1) I``.\nThe defaults are Kissell's published US-equity estimates, **not\ncalibrated** for this system; treat them as a starting point.",
        "properties": {
          "a1": {
            "default": 708.0,
            "minimum": 0.0,
            "title": "A1",
            "type": "number"
          },
          "a2": {
            "default": 0.55,
            "exclusiveMinimum": 0.0,
            "title": "A2",
            "type": "number"
          },
          "a3": {
            "default": 0.71,
            "minimum": 0.0,
            "title": "A3",
            "type": "number"
          },
          "a4": {
            "default": 0.5,
            "minimum": 0.0,
            "title": "A4",
            "type": "number"
          },
          "b1": {
            "default": 0.98,
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "B1",
            "type": "number"
          },
          "periods_per_year": {
            "default": 252.0,
            "exclusiveMinimum": 0.0,
            "title": "Periods Per Year",
            "type": "number"
          },
          "pov": {
            "default": 0.1,
            "exclusiveMinimum": 0.0,
            "maximum": 1.0,
            "title": "Pov",
            "type": "number"
          }
        },
        "title": "IStarSettings",
        "type": "object"
      },
      "IbkrFixedFees": {
        "additionalProperties": false,
        "description": "IBKR Pro Fixed, US stocks and ETFs.\nSource: interactivebrokers.com/en/pricing/commissions-stocks.php\n(Fixed: USD 0.005 per share, minimum USD 1.00, maximum 1% of trade value).",
        "properties": {
          "max_fraction": {
            "default": 0.01,
            "exclusiveMinimum": 0.0,
            "title": "Max Fraction",
            "type": "number"
          },
          "minimum": {
            "default": 1.0,
            "minimum": 0.0,
            "title": "Minimum",
            "type": "number"
          },
          "per_share": {
            "default": 0.005,
            "minimum": 0.0,
            "title": "Per Share",
            "type": "number"
          }
        },
        "title": "IbkrFixedFees",
        "type": "object"
      },
      "IbkrTieredFees": {
        "additionalProperties": false,
        "description": "IBKR Pro Tiered, US stocks and ETFs. Source: the page above\n(minimum USD 0.35 per order, maximum 1% of trade value, plus exchange,\nclearing and pass-through fees).",
        "properties": {
          "clearing_per_share": {
            "default": 0.0002,
            "minimum": 0.0,
            "title": "Clearing Per Share",
            "type": "number"
          },
          "exchange_per_share": {
            "default": 0.003,
            "minimum": 0.0,
            "title": "Exchange Per Share",
            "type": "number"
          },
          "max_fraction": {
            "default": 0.01,
            "exclusiveMinimum": 0.0,
            "title": "Max Fraction",
            "type": "number"
          },
          "minimum": {
            "default": 0.35,
            "minimum": 0.0,
            "title": "Minimum",
            "type": "number"
          },
          "monthly_shares": {
            "default": 0.0,
            "minimum": 0.0,
            "title": "Monthly Shares",
            "type": "number"
          },
          "tiers": {
            "default": [
              [
                300000,
                0.0035
              ],
              [
                3000000,
                0.002
              ],
              [
                20000000,
                0.0015
              ],
              [
                100000000,
                0.001
              ],
              [
                null,
                0.0005
              ]
            ],
            "items": {
              "maxItems": 2,
              "minItems": 2,
              "prefixItems": [
                {
                  "type": "number"
                },
                {
                  "type": "number"
                }
              ],
              "type": "array"
            },
            "title": "Tiers",
            "type": "array"
          }
        },
        "title": "IbkrTieredFees",
        "type": "object"
      },
      "IndexHistoryImport": {
        "description": "An index constituent history as CSV (``date,ticker,action`` with\n``add``, ``remove`` or ``member``) or JSON (``as_of``,\n``constituents``, ``changes``).",
        "properties": {
          "content": {
            "maxLength": 20000000,
            "minLength": 1,
            "title": "Content",
            "type": "string"
          },
          "format": {
            "default": "csv",
            "enum": [
              "csv",
              "json"
            ],
            "title": "Format",
            "type": "string"
          },
          "index_id": {
            "pattern": "^[a-z0-9][a-z0-9_]{0,63}$",
            "title": "Index Id",
            "type": "string"
          }
        },
        "required": [
          "index_id",
          "content"
        ],
        "title": "IndexHistoryImport",
        "type": "object"
      },
      "IndexHistoryView": {
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          },
          "changes": {
            "title": "Changes",
            "type": "integer"
          },
          "constituents": {
            "title": "Constituents",
            "type": "integer"
          },
          "index_id": {
            "title": "Index Id",
            "type": "string"
          }
        },
        "required": [
          "index_id",
          "as_of",
          "constituents",
          "changes"
        ],
        "title": "IndexHistoryView",
        "type": "object"
      },
      "IngestRequest": {
        "properties": {
          "exchange": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exchange"
          },
          "interval": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Interval"
          },
          "kind": {
            "enum": [
              "prices",
              "intraday",
              "fundamentals",
              "metadata",
              "borrow"
            ],
            "title": "Kind",
            "type": "string"
          },
          "markets": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Markets",
            "type": "array"
          },
          "since": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Since"
          },
          "source": {
            "default": "eodhd",
            "enum": [
              "eodhd",
              "yahoo",
              "defillama"
            ],
            "title": "Source",
            "type": "string"
          },
          "tickers": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Tickers",
            "type": "array"
          },
          "until": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Until"
          }
        },
        "required": [
          "kind"
        ],
        "title": "IngestRequest",
        "type": "object"
      },
      "IngestResultView": {
        "properties": {
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "run_id": {
            "title": "Run Id",
            "type": "integer"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "tickers_failed": {
            "title": "Tickers Failed",
            "type": "integer"
          },
          "tickers_ok": {
            "title": "Tickers Ok",
            "type": "integer"
          }
        },
        "required": [
          "run_id",
          "kind",
          "status",
          "tickers_ok",
          "tickers_failed"
        ],
        "title": "IngestResultView",
        "type": "object"
      },
      "IngestRunView": {
        "properties": {
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "finished_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "source": {
            "title": "Source",
            "type": "string"
          },
          "started_at": {
            "format": "date-time",
            "title": "Started At",
            "type": "string"
          },
          "status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          },
          "tickers_failed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tickers Failed"
          },
          "tickers_ok": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tickers Ok"
          }
        },
        "required": [
          "id",
          "source",
          "kind",
          "started_at",
          "finished_at",
          "tickers_ok",
          "tickers_failed",
          "status",
          "error"
        ],
        "title": "IngestRunView",
        "type": "object"
      },
      "InsightsTotalsView": {
        "description": "Sums over every active portfolio's latest snapshot, for admins. No\ntickers, sectors or per-person numbers (decision 2026-09-26).",
        "properties": {
          "asset_class": {
            "items": {
              "$ref": "#/components/schemas/AllocationSlice"
            },
            "title": "Asset Class",
            "type": "array"
          },
          "cash": {
            "title": "Cash",
            "type": "number"
          },
          "exposure": {
            "$ref": "#/components/schemas/Exposure"
          },
          "owners": {
            "title": "Owners",
            "type": "integer"
          },
          "portfolios": {
            "title": "Portfolios",
            "type": "integer"
          },
          "suppressed": {
            "default": false,
            "title": "Suppressed",
            "type": "boolean"
          },
          "total_value": {
            "title": "Total Value",
            "type": "number"
          }
        },
        "required": [
          "portfolios",
          "owners",
          "cash",
          "total_value",
          "asset_class",
          "exposure"
        ],
        "title": "InsightsTotalsView",
        "type": "object"
      },
      "InsightsView": {
        "properties": {
          "allocation": {
            "$ref": "#/components/schemas/AllocationView"
          },
          "cash": {
            "title": "Cash",
            "type": "number"
          },
          "currency": {
            "description": "Reporting currency. Amounts are not FX-converted.",
            "title": "Currency",
            "type": "string"
          },
          "day_change": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DayChangeView"
              },
              {
                "type": "null"
              }
            ],
            "description": "The headline value and day change, the same one /api/pnl carries."
          },
          "exposure": {
            "$ref": "#/components/schemas/Exposure"
          },
          "fx_missing": {
            "description": "Held currencies with no FX rate to the base currency.",
            "items": {
              "type": "string"
            },
            "title": "Fx Missing",
            "type": "array"
          },
          "monthly_returns": {
            "description": "Time-weighted return of each month from the daily values, oldest first: deposits and withdrawals are left out. Empty when a flow has no FX rate.",
            "items": {
              "$ref": "#/components/schemas/MonthlyReturn"
            },
            "title": "Monthly Returns",
            "type": "array"
          },
          "mwr": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Money-weighted return since inception, annualized (XIRR of the start value, deposits, withdrawals and the latest value).",
            "title": "Mwr"
          },
          "net_flows": {
            "default": 0.0,
            "description": "Deposits less withdrawals since inception.",
            "title": "Net Flows",
            "type": "number"
          },
          "notes": {
            "items": {
              "type": "string"
            },
            "title": "Notes",
            "type": "array"
          },
          "pnl": {
            "items": {
              "$ref": "#/components/schemas/PeriodPnl"
            },
            "title": "Pnl",
            "type": "array"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "risk": {
            "$ref": "#/components/schemas/RiskView"
          },
          "source": {
            "anyOf": [
              {
                "enum": [
                  "tick",
                  "sync"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "tick (the Stonks ledger) or sync (a broker).",
            "title": "Source"
          },
          "taken_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "When the snapshot read was taken.",
            "title": "Taken At"
          },
          "total_value": {
            "title": "Total Value",
            "type": "number"
          },
          "total_value_base": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Cash (kept in the base currency) plus every priced holding converted to the base currency at the latest FX rate; null when a held currency has no rate.",
            "title": "Total Value Base"
          },
          "uncovered": {
            "description": "Broker symbols no ticker maps to.",
            "items": {
              "type": "string"
            },
            "title": "Uncovered",
            "type": "array"
          },
          "unpriced": {
            "description": "Holdings without a price, left out of the numbers.",
            "items": {
              "type": "string"
            },
            "title": "Unpriced",
            "type": "array"
          }
        },
        "required": [
          "portfolio_id",
          "taken_at",
          "source",
          "currency",
          "cash",
          "total_value",
          "allocation",
          "exposure",
          "pnl",
          "risk",
          "uncovered",
          "unpriced",
          "notes"
        ],
        "title": "InsightsView",
        "type": "object"
      },
      "InstrumentView": {
        "properties": {
          "asset_class": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Asset Class"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Currency"
          },
          "exchange": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exchange"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "industry": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Industry"
          },
          "is_delisted": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Delisted"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "sector": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sector"
          },
          "security_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Security Type"
          }
        },
        "required": [
          "id",
          "name",
          "asset_class",
          "exchange",
          "currency",
          "sector",
          "industry",
          "is_delisted"
        ],
        "title": "InstrumentView",
        "type": "object"
      },
      "IntervalInfo": {
        "properties": {
          "code": {
            "title": "Code",
            "type": "string"
          },
          "is_intraday": {
            "title": "Is Intraday",
            "type": "boolean"
          },
          "seconds": {
            "title": "Seconds",
            "type": "integer"
          }
        },
        "required": [
          "code",
          "seconds",
          "is_intraday"
        ],
        "title": "IntervalInfo",
        "type": "object"
      },
      "IntradayDrawdownSettings": {
        "additionalProperties": false,
        "description": "``(drawdown from the day's high, size)`` levels; ``None`` is off.",
        "properties": {
          "schedule": {
            "anyOf": [
              {
                "items": {
                  "maxItems": 2,
                  "minItems": 2,
                  "prefixItems": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "number"
                    }
                  ],
                  "type": "array"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Schedule"
          }
        },
        "title": "IntradayDrawdownSettings",
        "type": "object"
      },
      "IntradayLossLimitSettings": {
        "additionalProperties": false,
        "properties": {
          "flatten": {
            "default": false,
            "title": "Flatten",
            "type": "boolean"
          },
          "hard_loss": {
            "anyOf": [
              {
                "exclusiveMaximum": 1.0,
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hard Loss"
          },
          "max_loss": {
            "anyOf": [
              {
                "exclusiveMaximum": 1.0,
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Loss"
          },
          "window_minutes": {
            "default": 5,
            "minimum": 1.0,
            "title": "Window Minutes",
            "type": "integer"
          }
        },
        "title": "IntradayLossLimitSettings",
        "type": "object"
      },
      "IntradayOrderRateSettings": {
        "additionalProperties": false,
        "properties": {
          "max_orders_per_day": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Orders Per Day"
          },
          "max_orders_per_minute": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Orders Per Minute"
          }
        },
        "title": "IntradayOrderRateSettings",
        "type": "object"
      },
      "IntradayPnlView": {
        "properties": {
          "available": {
            "title": "Available",
            "type": "boolean"
          },
          "note": {
            "title": "Note",
            "type": "string"
          },
          "snapshot_minutes": {
            "title": "Snapshot Minutes",
            "type": "integer"
          }
        },
        "required": [
          "available",
          "snapshot_minutes",
          "note"
        ],
        "title": "IntradayPnlView",
        "type": "object"
      },
      "IntradaySnapshotView": {
        "description": "One book at one moment of a session. ``strategy_id`` is null for the\nwhole portfolio. Money is in the book's currency.",
        "properties": {
          "at": {
            "format": "date-time",
            "title": "At",
            "type": "string"
          },
          "day": {
            "format": "date",
            "title": "Day",
            "type": "string"
          },
          "day_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Day Return"
          },
          "drawdown": {
            "title": "Drawdown",
            "type": "number"
          },
          "exposures": {
            "additionalProperties": {
              "type": "number"
            },
            "title": "Exposures",
            "type": "object"
          },
          "fees": {
            "title": "Fees",
            "type": "number"
          },
          "fills": {
            "title": "Fills",
            "type": "integer"
          },
          "gross_exposure": {
            "title": "Gross Exposure",
            "type": "number"
          },
          "high_water_pnl": {
            "title": "High Water Pnl",
            "type": "number"
          },
          "max_mark_age_seconds": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Mark Age Seconds"
          },
          "net_exposure": {
            "title": "Net Exposure",
            "type": "number"
          },
          "pnl": {
            "title": "Pnl",
            "type": "number"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "realised": {
            "title": "Realised",
            "type": "number"
          },
          "stale_marks": {
            "title": "Stale Marks",
            "type": "integer"
          },
          "start_value": {
            "title": "Start Value",
            "type": "number"
          },
          "strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Id"
          },
          "unmarked": {
            "title": "Unmarked",
            "type": "integer"
          },
          "unrealised": {
            "title": "Unrealised",
            "type": "number"
          },
          "value": {
            "title": "Value",
            "type": "number"
          }
        },
        "required": [
          "portfolio_id",
          "strategy_id",
          "day",
          "at",
          "start_value",
          "value",
          "realised",
          "unrealised",
          "fees",
          "pnl",
          "day_return",
          "high_water_pnl",
          "drawdown",
          "gross_exposure",
          "net_exposure",
          "exposures",
          "fills",
          "unmarked",
          "stale_marks",
          "max_mark_age_seconds"
        ],
        "title": "IntradaySnapshotView",
        "type": "object"
      },
      "IntradayStaleDataSettings": {
        "additionalProperties": false,
        "properties": {
          "max_bar_age_seconds": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Bar Age Seconds"
          }
        },
        "title": "IntradayStaleDataSettings",
        "type": "object"
      },
      "Job": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "error_detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Detail"
          },
          "finished_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Message"
          },
          "owner_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Owner Id"
          },
          "params": {
            "additionalProperties": true,
            "title": "Params",
            "type": "object"
          },
          "progress": {
            "title": "Progress",
            "type": "number"
          },
          "result": {
            "title": "Result"
          },
          "started_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started At"
          },
          "status": {
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed",
              "cancelled"
            ],
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "id",
          "kind",
          "params",
          "status",
          "progress",
          "created_at"
        ],
        "title": "Job",
        "type": "object"
      },
      "JobEvent": {
        "description": "One ``data:`` payload of the job event stream.",
        "properties": {
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Error"
          },
          "job_id": {
            "title": "Job Id",
            "type": "string"
          },
          "message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Message"
          },
          "progress": {
            "title": "Progress",
            "type": "number"
          },
          "reason": {
            "anyOf": [
              {
                "enum": [
                  "timeout",
                  "untracked"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "title": "Reason"
          },
          "status": {
            "enum": [
              "queued",
              "running",
              "succeeded",
              "failed",
              "cancelled"
            ],
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "job_id",
          "status",
          "progress"
        ],
        "title": "JobEvent",
        "type": "object"
      },
      "JournalEntryView": {
        "description": "One order: why it was placed, the signal context, the outcome and the\nnotes people added.",
        "properties": {
          "client_id": {
            "title": "Client Id",
            "type": "string"
          },
          "context": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Context"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "decided_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Decided At"
          },
          "decision_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Decision Price"
          },
          "next_session_move_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Session Move Bps"
          },
          "notes": {
            "items": {
              "$ref": "#/components/schemas/JournalNoteView"
            },
            "title": "Notes",
            "type": "array"
          },
          "portfolio_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Id"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "shortfall": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ShortfallView"
              },
              {
                "type": "null"
              }
            ]
          },
          "side": {
            "title": "Side",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "status_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status Reason"
          },
          "strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Id"
          },
          "strategy_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The strategy's plain title (a starter's), or null: the console names it from the id.",
            "title": "Strategy Name"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "trigger": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trigger"
          }
        },
        "required": [
          "client_id",
          "portfolio_id",
          "strategy_id",
          "ticker",
          "side",
          "quantity",
          "status",
          "status_reason",
          "created_at",
          "decided_at",
          "decision_price",
          "trigger",
          "context",
          "shortfall",
          "next_session_move_bps",
          "notes"
        ],
        "title": "JournalEntryView",
        "type": "object"
      },
      "JournalLabelsView": {
        "description": "Tags and mistakes already used in the portfolio, for suggestions.",
        "properties": {
          "mistakes": {
            "items": {
              "type": "string"
            },
            "title": "Mistakes",
            "type": "array"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "title": "Tags",
            "type": "array"
          }
        },
        "required": [
          "tags",
          "mistakes"
        ],
        "title": "JournalLabelsView",
        "type": "object"
      },
      "JournalNoteView": {
        "properties": {
          "author": {
            "title": "Author",
            "type": "string"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "note": {
            "title": "Note",
            "type": "string"
          },
          "order_client_id": {
            "title": "Order Client Id",
            "type": "string"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "order_client_id",
          "author",
          "note",
          "created_at",
          "updated_at"
        ],
        "title": "JournalNoteView",
        "type": "object"
      },
      "JournalTradeDetailView": {
        "description": "A whole trade: every leg and its review.",
        "properties": {
          "followed_plan": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Followed Plan"
          },
          "legs": {
            "items": {
              "$ref": "#/components/schemas/JournalTradeView"
            },
            "title": "Legs",
            "type": "array"
          },
          "mistakes": {
            "items": {
              "type": "string"
            },
            "title": "Mistakes",
            "type": "array"
          },
          "origin": {
            "enum": [
              "strategy",
              "manual"
            ],
            "title": "Origin",
            "type": "string"
          },
          "playbook_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Playbook Id"
          },
          "playbook_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Playbook Name"
          },
          "pnl": {
            "title": "Pnl",
            "type": "number"
          },
          "pnl_base": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pnl Base"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "review": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review"
          },
          "side": {
            "enum": [
              "long",
              "short"
            ],
            "title": "Side",
            "type": "string"
          },
          "sleeve": {
            "title": "Sleeve",
            "type": "string"
          },
          "sleeve_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The sleeve strategy's plain title (a starter's), or null.",
            "title": "Sleeve Name"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "title": "Tags",
            "type": "array"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "trade_id": {
            "title": "Trade Id",
            "type": "integer"
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          },
          "updated_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated By"
          }
        },
        "required": [
          "trade_id",
          "portfolio_id",
          "ticker",
          "side",
          "sleeve",
          "origin",
          "legs",
          "pnl",
          "pnl_base",
          "tags",
          "mistakes",
          "playbook_id",
          "playbook_name",
          "followed_plan",
          "review",
          "updated_by",
          "updated_at"
        ],
        "title": "JournalTradeDetailView",
        "type": "object"
      },
      "JournalTradeView": {
        "description": "One leg of a trade. Money is in the instrument's currency, and\n``pnl_base`` in the portfolio's base currency (null with no FX rate).",
        "properties": {
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "dividends": {
            "title": "Dividends",
            "type": "number"
          },
          "entry_at": {
            "format": "date-time",
            "title": "Entry At",
            "type": "string"
          },
          "entry_client_id": {
            "title": "Entry Client Id",
            "type": "string"
          },
          "entry_price": {
            "title": "Entry Price",
            "type": "number"
          },
          "exit_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exit At"
          },
          "exit_client_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exit Client Id"
          },
          "exit_efficiency": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exit Efficiency"
          },
          "exit_price": {
            "title": "Exit Price",
            "type": "number"
          },
          "exit_trigger": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exit Trigger"
          },
          "fees": {
            "title": "Fees",
            "type": "number"
          },
          "followed_plan": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Followed Plan"
          },
          "holding_days": {
            "title": "Holding Days",
            "type": "number"
          },
          "is_open": {
            "title": "Is Open",
            "type": "boolean"
          },
          "leg_id": {
            "title": "Leg Id",
            "type": "string"
          },
          "mae_pct": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mae Pct"
          },
          "mae_r": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mae R"
          },
          "mfe_pct": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mfe Pct"
          },
          "mistakes": {
            "items": {
              "type": "string"
            },
            "title": "Mistakes",
            "type": "array"
          },
          "origin": {
            "enum": [
              "strategy",
              "manual"
            ],
            "title": "Origin",
            "type": "string"
          },
          "playbook_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Playbook Id"
          },
          "playbook_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Playbook Name"
          },
          "pnl": {
            "title": "Pnl",
            "type": "number"
          },
          "pnl_base": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pnl Base"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "r_multiple": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "R Multiple"
          },
          "return_pct": {
            "title": "Return Pct",
            "type": "number"
          },
          "review": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Review"
          },
          "risk_amount": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Risk Amount"
          },
          "side": {
            "enum": [
              "long",
              "short"
            ],
            "title": "Side",
            "type": "string"
          },
          "sleeve": {
            "title": "Sleeve",
            "type": "string"
          },
          "sleeve_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The sleeve strategy's plain title (a starter's), or null.",
            "title": "Sleeve Name"
          },
          "stop_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop Price"
          },
          "stop_source": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop Source"
          },
          "tags": {
            "items": {
              "type": "string"
            },
            "title": "Tags",
            "type": "array"
          },
          "target_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Price"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "trade_id": {
            "title": "Trade Id",
            "type": "integer"
          }
        },
        "required": [
          "leg_id",
          "trade_id",
          "ticker",
          "side",
          "sleeve",
          "origin",
          "entry_client_id",
          "exit_client_id",
          "entry_at",
          "exit_at",
          "quantity",
          "entry_price",
          "exit_price",
          "is_open",
          "holding_days",
          "pnl",
          "return_pct",
          "fees",
          "dividends",
          "currency",
          "pnl_base",
          "mae_pct",
          "mfe_pct",
          "exit_efficiency",
          "exit_trigger",
          "stop_price",
          "stop_source",
          "target_price",
          "risk_amount",
          "r_multiple",
          "mae_r",
          "tags",
          "mistakes",
          "playbook_id",
          "playbook_name",
          "followed_plan",
          "review"
        ],
        "title": "JournalTradeView",
        "type": "object"
      },
      "KillSwitchRequest": {
        "additionalProperties": false,
        "properties": {
          "buys_only": {
            "default": false,
            "description": "stop buys only: sells and exits still go through, no position is closed",
            "title": "Buys Only",
            "type": "boolean"
          },
          "flatten": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true,
            "description": "deprecated name of buys_only (it never closed a position)",
            "title": "Flatten"
          },
          "portfolio_id": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Id"
          },
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "title": "Reason",
            "type": "string"
          },
          "scope": {
            "enum": [
              "global",
              "user",
              "portfolio"
            ],
            "title": "Scope",
            "type": "string"
          }
        },
        "required": [
          "scope",
          "reason"
        ],
        "title": "KillSwitchRequest",
        "type": "object"
      },
      "LabRunRequest": {
        "description": "Tunes the class the ``strategy`` ref points at over its parameter\nspace. The ref's ``params`` stay fixed for the whole search, such as\nthe ``factor`` of the ``factor`` strategy.\n\nGive ``universe`` (tickers), ``universe_id`` (a stored universe: every\nmember on any day of the window, delisted names included), or both\n(the preflight then reports members missing from the list).",
        "properties": {
          "benchmark": {
            "anyOf": [
              {
                "description": "auto (SPY.US when priced, else EW), EW (equal-weight universe), a ticker such as QQQ.US, or none; default [lab] benchmark",
                "maxLength": 32,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Benchmark"
          },
          "budget": {
            "default": 20,
            "maximum": 1000.0,
            "minimum": 1.0,
            "title": "Budget",
            "type": "integer"
          },
          "cost_model": {
            "anyOf": [
              {
                "enum": [
                  "zero",
                  "realistic",
                  "ibkr_tiered",
                  "ibkr_fixed"
                ],
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/CostModelSettings"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cost Model"
          },
          "embargo_bars": {
            "anyOf": [
              {
                "maximum": 10000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Embargo Bars"
          },
          "end": {
            "format": "date",
            "title": "End",
            "type": "string"
          },
          "ensure_data": {
            "default": false,
            "title": "Ensure Data",
            "type": "boolean"
          },
          "grid_size": {
            "anyOf": [
              {
                "maximum": 50.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true,
            "description": "Deprecated: use tuner_options.grid_size",
            "title": "Grid Size"
          },
          "heatmap": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/HeatmapOptions"
              },
              {
                "type": "null"
              }
            ]
          },
          "hypothesis": {
            "anyOf": [
              {
                "maxLength": 4000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hypothesis"
          },
          "interval": {
            "default": "1d",
            "title": "Interval",
            "type": "string"
          },
          "mcpt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/McptOptions"
              },
              {
                "type": "null"
              }
            ]
          },
          "objective": {
            "default": "sharpe",
            "enum": [
              "sharpe",
              "cagr",
              "final_return",
              "sortino",
              "calmar",
              "sharpe_dd",
              "multi",
              "cv_sharpe",
              "cv_cagr",
              "cv_final_return"
            ],
            "title": "Objective",
            "type": "string"
          },
          "preflight": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preflight"
          },
          "premortem": {
            "anyOf": [
              {
                "maxLength": 4000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Premortem"
          },
          "preset": {
            "anyOf": [
              {
                "enum": [
                  "promotion",
                  "quick",
                  "standard"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preset"
          },
          "prune": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true,
            "description": "Deprecated: use tuner_options.prune",
            "title": "Prune"
          },
          "register_if_passes": {
            "default": false,
            "title": "Register If Passes",
            "type": "boolean"
          },
          "register_strategy": {
            "default": false,
            "title": "Register Strategy",
            "type": "boolean"
          },
          "sampler": {
            "anyOf": [
              {
                "maxLength": 32,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true,
            "description": "Deprecated: use tuner_options.sampler",
            "title": "Sampler"
          },
          "seed": {
            "default": 0,
            "title": "Seed",
            "type": "integer"
          },
          "start": {
            "format": "date",
            "title": "Start",
            "type": "string"
          },
          "strategy": {
            "$ref": "#/components/schemas/StrategyRef"
          },
          "strict_preflight": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strict Preflight"
          },
          "survival_tests": {
            "anyOf": [
              {
                "items": {
                  "enum": [
                    "benchmark_relative",
                    "cost_stress",
                    "cpcv",
                    "crisis",
                    "cross_instrument",
                    "data_snooping",
                    "deflated_sharpe",
                    "drift",
                    "event_study",
                    "forecast_skill",
                    "mc_trades",
                    "mcpt",
                    "oos",
                    "pbo",
                    "period_stability",
                    "permutation",
                    "perturbation",
                    "plateau",
                    "pool_correlation",
                    "runs_test",
                    "signal_ic",
                    "stress",
                    "vs_random",
                    "walk_forward",
                    "walk_forward_mcpt"
                  ],
                  "type": "string"
                },
                "minItems": 1,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Survival Tests"
          },
          "test_options": {
            "anyOf": [
              {
                "additionalProperties": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "propertyNames": {
                  "enum": [
                    "benchmark_relative",
                    "cost_stress",
                    "cpcv",
                    "crisis",
                    "cross_instrument",
                    "data_snooping",
                    "deflated_sharpe",
                    "drift",
                    "event_study",
                    "forecast_skill",
                    "mc_trades",
                    "mcpt",
                    "oos",
                    "pbo",
                    "period_stability",
                    "permutation",
                    "perturbation",
                    "plateau",
                    "pool_correlation",
                    "runs_test",
                    "signal_ic",
                    "stress",
                    "vs_random",
                    "walk_forward",
                    "walk_forward_mcpt"
                  ]
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Test Options"
          },
          "train_ratio": {
            "default": 0.7,
            "exclusiveMaximum": 1.0,
            "exclusiveMinimum": 0.0,
            "title": "Train Ratio",
            "type": "number"
          },
          "tuner": {
            "default": "random",
            "enum": [
              "grid",
              "optuna",
              "prescreen",
              "random"
            ],
            "title": "Tuner",
            "type": "string"
          },
          "tuner_options": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tuner Options"
          },
          "universe": {
            "items": {
              "type": "string"
            },
            "title": "Universe",
            "type": "array"
          },
          "universe_id": {
            "anyOf": [
              {
                "pattern": "^[a-z0-9][a-z0-9_.-]{0,63}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Universe Id"
          },
          "walk_forward": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WalkForwardConfig"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "strategy",
          "start",
          "end"
        ],
        "title": "LabRunRequest",
        "type": "object"
      },
      "LabRunView": {
        "properties": {
          "benchmark": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BenchmarkStatsView"
              },
              {
                "type": "null"
              }
            ]
          },
          "best_params": {
            "additionalProperties": true,
            "title": "Best Params",
            "type": "object"
          },
          "best_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Best Score"
          },
          "class_path": {
            "title": "Class Path",
            "type": "string"
          },
          "ensure_job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ensure Job Id"
          },
          "heatmap": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/HeatmapView"
              },
              {
                "type": "null"
              }
            ]
          },
          "n_trials_class": {
            "default": 0,
            "title": "N Trials Class",
            "type": "integer"
          },
          "n_trials_family": {
            "default": 0,
            "title": "N Trials Family",
            "type": "integer"
          },
          "n_trials_run": {
            "default": 0,
            "title": "N Trials Run",
            "type": "integer"
          },
          "preflight": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PreflightView"
              },
              {
                "type": "null"
              }
            ]
          },
          "registered_strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Registered Strategy Id"
          },
          "robustness": {
            "default": "did_not_survive",
            "enum": [
              "survived",
              "did_not_survive"
            ],
            "title": "Robustness",
            "type": "string"
          },
          "run_id": {
            "default": "",
            "title": "Run Id",
            "type": "string"
          },
          "survival_reports": {
            "items": {
              "$ref": "#/components/schemas/SurvivalReportView"
            },
            "title": "Survival Reports",
            "type": "array"
          },
          "verdict": {
            "enum": [
              "pass",
              "fail"
            ],
            "title": "Verdict",
            "type": "string"
          }
        },
        "required": [
          "class_path",
          "best_params",
          "best_score",
          "verdict",
          "survival_reports",
          "registered_strategy_id"
        ],
        "title": "LabRunView",
        "type": "object"
      },
      "LastRunTotalsView": {
        "description": "Counts of one trading run over every book, for admins only.",
        "properties": {
          "fills": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null when the totals are suppressed.",
            "title": "Fills"
          },
          "finished_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "orders_placed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Null when the totals are suppressed.",
            "title": "Orders Placed"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "tick_id": {
            "title": "Tick Id",
            "type": "string"
          }
        },
        "required": [
          "tick_id",
          "status",
          "finished_at",
          "orders_placed",
          "fills"
        ],
        "title": "LastRunTotalsView",
        "type": "object"
      },
      "LatencyView": {
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "max_seconds": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Seconds"
          },
          "mean_seconds": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mean Seconds"
          },
          "p50_seconds": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "P50 Seconds"
          },
          "p95_seconds": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "P95 Seconds"
          }
        },
        "required": [
          "count",
          "p50_seconds",
          "p95_seconds",
          "mean_seconds",
          "max_seconds"
        ],
        "title": "LatencyView",
        "type": "object"
      },
      "LeaderboardRow": {
        "properties": {
          "book_trades": {
            "title": "Book Trades",
            "type": "integer"
          },
          "class_path": {
            "title": "Class Path",
            "type": "string"
          },
          "golive_passed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Golive Passed"
          },
          "live_since": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Live Since"
          },
          "paper": {
            "$ref": "#/components/schemas/PaperFigures"
          },
          "rank": {
            "title": "Rank",
            "type": "integer"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "strategy_id": {
            "title": "Strategy Id",
            "type": "string"
          },
          "strategy_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The strategy's plain title (a starter's), or null: the console names it from the id.",
            "title": "Strategy Name"
          },
          "survival_passed": {
            "title": "Survival Passed",
            "type": "integer"
          },
          "survival_total": {
            "title": "Survival Total",
            "type": "integer"
          }
        },
        "required": [
          "rank",
          "strategy_id",
          "class_path",
          "status",
          "paper",
          "book_trades",
          "live_since",
          "survival_passed",
          "survival_total",
          "golive_passed"
        ],
        "title": "LeaderboardRow",
        "type": "object"
      },
      "LeaderboardView": {
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          },
          "rows": {
            "items": {
              "$ref": "#/components/schemas/LeaderboardRow"
            },
            "title": "Rows",
            "type": "array"
          },
          "sort": {
            "enum": [
              "sharpe",
              "return",
              "drawdown",
              "trades"
            ],
            "title": "Sort",
            "type": "string"
          }
        },
        "required": [
          "rows",
          "sort",
          "as_of"
        ],
        "title": "LeaderboardView",
        "type": "object"
      },
      "LedgerRunDetail": {
        "properties": {
          "best_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Best finite objective score, null if none.",
            "title": "Best Score"
          },
          "budget": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Budget"
          },
          "end": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "End"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why the run failed, in plain words. Null unless it failed.",
            "title": "Error"
          },
          "error_detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The raw error of a failed run, for admins only: null for everyone else.",
            "title": "Error Detail"
          },
          "finished_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "hypothesis": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hypothesis"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "interval": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Interval"
          },
          "n_failed": {
            "description": "Trials that failed (no finite score).",
            "title": "N Failed",
            "type": "integer"
          },
          "n_trials": {
            "description": "Trials this run evaluated.",
            "title": "N Trials",
            "type": "integer"
          },
          "n_trials_class": {
            "description": "Trials of this strategy class across every recorded run (what P2 counts).",
            "title": "N Trials Class",
            "type": "integer"
          },
          "objective": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Objective"
          },
          "premortem": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Premortem"
          },
          "robustness": {
            "description": "The run's status: did the strategy survive the robustness tests. Independent of the trial counts.",
            "enum": [
              "running",
              "survived",
              "did_not_survive",
              "error",
              "stopped"
            ],
            "title": "Robustness",
            "type": "string"
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Seed"
          },
          "start": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start"
          },
          "started_at": {
            "format": "date-time",
            "title": "Started At",
            "type": "string"
          },
          "strategy_class": {
            "title": "Strategy Class",
            "type": "string"
          },
          "tickers": {
            "default": 0,
            "description": "Tickers in the dataset.",
            "title": "Tickers",
            "type": "integer"
          },
          "trials": {
            "items": {
              "$ref": "#/components/schemas/LedgerTrialView"
            },
            "title": "Trials",
            "type": "array"
          },
          "trials_errored": {
            "description": "Trials that ended with no score (same as n_failed).",
            "title": "Trials Errored",
            "type": "integer"
          },
          "trials_ran": {
            "description": "Trials that ran to a score.",
            "title": "Trials Ran",
            "type": "integer"
          },
          "tuner": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tuner"
          },
          "universe_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Universe Id"
          },
          "verdict": {
            "anyOf": [
              {
                "enum": [
                  "pass",
                  "fail",
                  "error"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Verdict"
          }
        },
        "required": [
          "id",
          "strategy_class",
          "hypothesis",
          "premortem",
          "tuner",
          "objective",
          "budget",
          "seed",
          "started_at",
          "finished_at",
          "verdict",
          "n_trials",
          "n_failed",
          "robustness",
          "trials_ran",
          "trials_errored",
          "best_score",
          "trials",
          "n_trials_class"
        ],
        "title": "LedgerRunDetail",
        "type": "object"
      },
      "LedgerRunView": {
        "description": "One recorded lab run: what was tested, why, and how it came out.",
        "properties": {
          "best_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Best finite objective score, null if none.",
            "title": "Best Score"
          },
          "budget": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Budget"
          },
          "end": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "End"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why the run failed, in plain words. Null unless it failed.",
            "title": "Error"
          },
          "error_detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The raw error of a failed run, for admins only: null for everyone else.",
            "title": "Error Detail"
          },
          "finished_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "hypothesis": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hypothesis"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "interval": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Interval"
          },
          "n_failed": {
            "description": "Trials that failed (no finite score).",
            "title": "N Failed",
            "type": "integer"
          },
          "n_trials": {
            "description": "Trials this run evaluated.",
            "title": "N Trials",
            "type": "integer"
          },
          "objective": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Objective"
          },
          "premortem": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Premortem"
          },
          "robustness": {
            "description": "The run's status: did the strategy survive the robustness tests. Independent of the trial counts.",
            "enum": [
              "running",
              "survived",
              "did_not_survive",
              "error",
              "stopped"
            ],
            "title": "Robustness",
            "type": "string"
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Seed"
          },
          "start": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start"
          },
          "started_at": {
            "format": "date-time",
            "title": "Started At",
            "type": "string"
          },
          "strategy_class": {
            "title": "Strategy Class",
            "type": "string"
          },
          "tickers": {
            "default": 0,
            "description": "Tickers in the dataset.",
            "title": "Tickers",
            "type": "integer"
          },
          "trials_errored": {
            "description": "Trials that ended with no score (same as n_failed).",
            "title": "Trials Errored",
            "type": "integer"
          },
          "trials_ran": {
            "description": "Trials that ran to a score.",
            "title": "Trials Ran",
            "type": "integer"
          },
          "tuner": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tuner"
          },
          "universe_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Universe Id"
          },
          "verdict": {
            "anyOf": [
              {
                "enum": [
                  "pass",
                  "fail",
                  "error"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Verdict"
          }
        },
        "required": [
          "id",
          "strategy_class",
          "hypothesis",
          "premortem",
          "tuner",
          "objective",
          "budget",
          "seed",
          "started_at",
          "finished_at",
          "verdict",
          "n_trials",
          "n_failed",
          "robustness",
          "trials_ran",
          "trials_errored",
          "best_score"
        ],
        "title": "LedgerRunView",
        "type": "object"
      },
      "LedgerTrialView": {
        "properties": {
          "n_bars": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "N Bars"
          },
          "outcome": {
            "description": "How the trial ran (ran or error); not a robustness verdict.",
            "enum": [
              "ran",
              "error"
            ],
            "title": "Outcome",
            "type": "string"
          },
          "params": {
            "additionalProperties": true,
            "title": "Params",
            "type": "object"
          },
          "score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Objective score, null for a failed trial.",
            "title": "Score"
          },
          "status": {
            "enum": [
              "ok",
              "failed"
            ],
            "title": "Status",
            "type": "string"
          },
          "trial_index": {
            "title": "Trial Index",
            "type": "integer"
          }
        },
        "required": [
          "trial_index",
          "params",
          "score",
          "n_bars",
          "status",
          "outcome"
        ],
        "title": "LedgerTrialView",
        "type": "object"
      },
      "LinkAccountRequest": {
        "additionalProperties": false,
        "properties": {
          "external_account_id": {
            "maxLength": 200,
            "minLength": 1,
            "title": "External Account Id",
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "portfolio_id": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Id"
          }
        },
        "required": [
          "external_account_id"
        ],
        "title": "LinkAccountRequest",
        "type": "object"
      },
      "LinkResultView": {
        "properties": {
          "connection_id": {
            "title": "Connection Id",
            "type": "string"
          },
          "external_account_id": {
            "title": "External Account Id",
            "type": "string"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          }
        },
        "required": [
          "connection_id",
          "external_account_id",
          "portfolio_id"
        ],
        "title": "LinkResultView",
        "type": "object"
      },
      "LiquiditySettings": {
        "additionalProperties": false,
        "properties": {
          "max_amihud": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Amihud"
          },
          "max_pct_adv": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "maximum": 1.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Pct Adv"
          },
          "min_median_dollar_volume": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Min Median Dollar Volume"
          }
        },
        "title": "LiquiditySettings",
        "type": "object"
      },
      "LiveAllocationUpdate": {
        "additionalProperties": false,
        "properties": {
          "amount": {
            "minimum": 0.0,
            "title": "Amount",
            "type": "number"
          },
          "currency": {
            "maxLength": 3,
            "minLength": 3,
            "title": "Currency",
            "type": "string"
          },
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "title": "Reason",
            "type": "string"
          }
        },
        "required": [
          "amount",
          "currency",
          "reason"
        ],
        "title": "LiveAllocationUpdate",
        "type": "object"
      },
      "LiveAllocationView": {
        "properties": {
          "amount": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Currency"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          },
          "updated_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated By"
          }
        },
        "required": [
          "portfolio_id",
          "amount",
          "currency",
          "reason",
          "updated_at",
          "updated_by"
        ],
        "title": "LiveAllocationView",
        "type": "object"
      },
      "LiveNotionalCapsSettings": {
        "additionalProperties": false,
        "properties": {
          "max_day_notional": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Day Notional"
          },
          "max_global_day_notional": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Global Day Notional"
          },
          "max_order_notional": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Order Notional"
          },
          "max_user_day_notional": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max User Day Notional"
          }
        },
        "title": "LiveNotionalCapsSettings",
        "type": "object"
      },
      "LivePreviewView": {
        "properties": {
          "account": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PreviewAccountView"
              },
              {
                "type": "null"
              }
            ]
          },
          "adjustments": {
            "items": {
              "$ref": "#/components/schemas/AdjustmentView"
            },
            "title": "Adjustments",
            "type": "array"
          },
          "allocation": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Allocation"
          },
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "notes": {
            "items": {
              "type": "string"
            },
            "title": "Notes",
            "type": "array"
          },
          "orders": {
            "items": {
              "$ref": "#/components/schemas/PreviewOrderView"
            },
            "title": "Orders",
            "type": "array"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "stage": {
            "enum": [
              "sim_paper",
              "broker_paper",
              "live_small",
              "live_scale"
            ],
            "title": "Stage",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "transmitted": {
            "title": "Transmitted",
            "type": "boolean"
          },
          "what_if_available": {
            "title": "What If Available",
            "type": "boolean"
          }
        },
        "required": [
          "portfolio_id",
          "as_of",
          "stage",
          "status",
          "reason",
          "orders",
          "adjustments",
          "account",
          "allocation",
          "what_if_available",
          "transmitted",
          "notes"
        ],
        "title": "LivePreviewView",
        "type": "object"
      },
      "LiveRuleView": {
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "on": {
            "title": "On",
            "type": "boolean"
          },
          "settings": {
            "additionalProperties": true,
            "title": "Settings",
            "type": "object"
          }
        },
        "required": [
          "name",
          "on",
          "settings"
        ],
        "title": "LiveRuleView",
        "type": "object"
      },
      "LiveRulesView": {
        "properties": {
          "account_rules": {
            "items": {
              "$ref": "#/components/schemas/AccountRuleView"
            },
            "title": "Account Rules",
            "type": "array"
          },
          "account_rules_on": {
            "title": "Account Rules On",
            "type": "boolean"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "profile_set": {
            "title": "Profile Set",
            "type": "boolean"
          },
          "safeguards": {
            "items": {
              "$ref": "#/components/schemas/LiveRuleView"
            },
            "title": "Safeguards",
            "type": "array"
          }
        },
        "required": [
          "portfolio_id",
          "safeguards",
          "account_rules_on",
          "profile_set",
          "account_rules"
        ],
        "title": "LiveRulesView",
        "type": "object"
      },
      "LiveStageView": {
        "properties": {
          "days": {
            "items": {
              "$ref": "#/components/schemas/GateDayView"
            },
            "title": "Days",
            "type": "array"
          },
          "history": {
            "items": {
              "$ref": "#/components/schemas/StageChangeView"
            },
            "title": "History",
            "type": "array"
          },
          "next_stage": {
            "anyOf": [
              {
                "enum": [
                  "sim_paper",
                  "broker_paper",
                  "live_small",
                  "live_scale"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Stage"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "real_money": {
            "title": "Real Money",
            "type": "boolean"
          },
          "stage": {
            "enum": [
              "sim_paper",
              "broker_paper",
              "live_small",
              "live_scale"
            ],
            "title": "Stage",
            "type": "string"
          }
        },
        "required": [
          "portfolio_id",
          "stage",
          "next_stage",
          "real_money",
          "history",
          "days"
        ],
        "title": "LiveStageView",
        "type": "object"
      },
      "LoginRequest": {
        "properties": {
          "email": {
            "maxLength": 320,
            "minLength": 3,
            "title": "Email",
            "type": "string"
          },
          "password": {
            "maxLength": 1024,
            "minLength": 1,
            "title": "Password",
            "type": "string"
          }
        },
        "required": [
          "email",
          "password"
        ],
        "title": "LoginRequest",
        "type": "object"
      },
      "LoginView": {
        "properties": {
          "csrf_token": {
            "title": "Csrf Token",
            "type": "string"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "next_step": {
            "enum": [
              "enrol",
              "verify"
            ],
            "title": "Next Step",
            "type": "string"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "display_name",
          "next_step",
          "csrf_token"
        ],
        "title": "LoginView",
        "type": "object"
      },
      "LookThrough": {
        "properties": {
          "country": {
            "items": {
              "$ref": "#/components/schemas/LookThroughSlice"
            },
            "title": "Country",
            "type": "array"
          },
          "fund_value": {
            "description": "Value of every held fund with a holdings list.",
            "title": "Fund Value",
            "type": "number"
          },
          "funds": {
            "description": "Held funds with a holdings list.",
            "items": {
              "$ref": "#/components/schemas/FundCoverage"
            },
            "title": "Funds",
            "type": "array"
          },
          "listed_fund_value": {
            "description": "Part of fund_value the listed holdings explain. The rest shows as 'not listed'.",
            "title": "Listed Fund Value",
            "type": "number"
          },
          "names": {
            "description": "Largest single names, funds split.",
            "items": {
              "$ref": "#/components/schemas/LookThroughName"
            },
            "title": "Names",
            "type": "array"
          },
          "sector": {
            "items": {
              "$ref": "#/components/schemas/LookThroughSlice"
            },
            "title": "Sector",
            "type": "array"
          }
        },
        "required": [
          "sector",
          "country",
          "names",
          "funds",
          "fund_value",
          "listed_fund_value"
        ],
        "title": "LookThrough",
        "type": "object"
      },
      "LookThroughName": {
        "description": "One company with its direct and fund holdings added up (23.14).",
        "properties": {
          "direct_value": {
            "title": "Direct Value",
            "type": "number"
          },
          "fund_value": {
            "title": "Fund Value",
            "type": "number"
          },
          "funds": {
            "description": "Held funds that own this name.",
            "items": {
              "type": "string"
            },
            "title": "Funds",
            "type": "array"
          },
          "key": {
            "description": "The ticker, or the fund's own code for the holding.",
            "title": "Key",
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "value": {
            "description": "Direct value plus each fund's value times its weight.",
            "title": "Value",
            "type": "number"
          },
          "weight": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "value / the book's total value.",
            "title": "Weight"
          }
        },
        "required": [
          "key",
          "name",
          "value",
          "weight",
          "direct_value",
          "fund_value",
          "funds"
        ],
        "title": "LookThroughName",
        "type": "object"
      },
      "LookThroughSlice": {
        "description": "One sector or country with funds split into what they hold (23.14).",
        "properties": {
          "direct_value": {
            "description": "Part held directly, not through a fund.",
            "title": "Direct Value",
            "type": "number"
          },
          "fund_value": {
            "description": "Part held through funds.",
            "title": "Fund Value",
            "type": "number"
          },
          "key": {
            "description": "A sector, an ISO country code, cash, not listed or unknown.",
            "title": "Key",
            "type": "string"
          },
          "value": {
            "description": "Market value in the group, funds split by weight.",
            "title": "Value",
            "type": "number"
          },
          "weight": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "value / the book's total value.",
            "title": "Weight"
          }
        },
        "required": [
          "key",
          "value",
          "weight",
          "direct_value",
          "fund_value"
        ],
        "title": "LookThroughSlice",
        "type": "object"
      },
      "LookThroughView": {
        "description": "A portfolio's exposure with each held fund split into what it holds\n(roadmap 23.14).",
        "properties": {
          "as_of": {
            "description": "Fund holdings are the lists known on this day.",
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "currency": {
            "description": "Reporting currency. Amounts are not FX-converted.",
            "title": "Currency",
            "type": "string"
          },
          "funds_without_list": {
            "description": "Held funds (ETFs) with no holdings list, counted as one name each.",
            "items": {
              "type": "string"
            },
            "title": "Funds Without List",
            "type": "array"
          },
          "look_through": {
            "$ref": "#/components/schemas/LookThrough"
          },
          "notes": {
            "items": {
              "type": "string"
            },
            "title": "Notes",
            "type": "array"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "total_value": {
            "title": "Total Value",
            "type": "number"
          }
        },
        "required": [
          "portfolio_id",
          "as_of",
          "currency",
          "total_value",
          "look_through",
          "notes"
        ],
        "title": "LookThroughView",
        "type": "object"
      },
      "LosingLockSettings": {
        "additionalProperties": false,
        "properties": {
          "lock_days": {
            "default": 30,
            "minimum": 1.0,
            "title": "Lock Days",
            "type": "integer"
          },
          "loss_window_days": {
            "default": 90,
            "minimum": 1.0,
            "title": "Loss Window Days",
            "type": "integer"
          },
          "max_consecutive_losses": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Consecutive Losses"
          },
          "max_loss_pct": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "maximum": 1.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Loss Pct"
          }
        },
        "title": "LosingLockSettings",
        "type": "object"
      },
      "LotPick": {
        "additionalProperties": false,
        "properties": {
          "buy_fill_id": {
            "title": "Buy Fill Id",
            "type": "integer"
          },
          "quantity": {
            "exclusiveMinimum": 0.0,
            "title": "Quantity",
            "type": "number"
          }
        },
        "required": [
          "buy_fill_id",
          "quantity"
        ],
        "title": "LotPick",
        "type": "object"
      },
      "LotPickView": {
        "properties": {
          "buy_fill_id": {
            "title": "Buy Fill Id",
            "type": "integer"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "sell_fill_id": {
            "title": "Sell Fill Id",
            "type": "integer"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "sell_fill_id",
          "buy_fill_id",
          "ticker",
          "quantity"
        ],
        "title": "LotPickView",
        "type": "object"
      },
      "LotPicksUpdate": {
        "additionalProperties": false,
        "description": "The lots one sell fill closes. An empty list clears the picks.",
        "properties": {
          "picks": {
            "items": {
              "$ref": "#/components/schemas/LotPick"
            },
            "maxItems": 500,
            "title": "Picks",
            "type": "array"
          },
          "sell_fill_id": {
            "title": "Sell Fill Id",
            "type": "integer"
          }
        },
        "required": [
          "sell_fill_id"
        ],
        "title": "LotPicksUpdate",
        "type": "object"
      },
      "LotSaleView": {
        "properties": {
          "acquired": {
            "format": "date",
            "title": "Acquired",
            "type": "string"
          },
          "cost_basis": {
            "title": "Cost Basis",
            "type": "number"
          },
          "gain": {
            "title": "Gain",
            "type": "number"
          },
          "holding_period": {
            "enum": [
              "short",
              "long"
            ],
            "title": "Holding Period",
            "type": "string"
          },
          "proceeds": {
            "title": "Proceeds",
            "type": "number"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          }
        },
        "required": [
          "acquired",
          "quantity",
          "cost_basis",
          "proceeds",
          "gain",
          "holding_period"
        ],
        "title": "LotSaleView",
        "type": "object"
      },
      "LotView": {
        "description": "What lot rounding did in a backtest (roadmap 23.1).",
        "properties": {
          "max_drift": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Drift"
          },
          "mean_drift": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mean Drift"
          },
          "min_capital": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Min Capital"
          },
          "min_capital_profile": {
            "default": "whole_shares",
            "title": "Min Capital Profile",
            "type": "string"
          },
          "orders": {
            "default": 0,
            "title": "Orders",
            "type": "integer"
          },
          "profile": {
            "title": "Profile",
            "type": "string"
          },
          "rounded": {
            "default": 0,
            "title": "Rounded",
            "type": "integer"
          },
          "skipped": {
            "default": 0,
            "title": "Skipped",
            "type": "integer"
          },
          "skipped_notional": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Skipped Notional"
          },
          "skipped_share": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Skipped Share"
          }
        },
        "required": [
          "profile"
        ],
        "title": "LotView",
        "type": "object"
      },
      "ManualDisciplineSettings": {
        "additionalProperties": false,
        "properties": {
          "cooldown_minutes": {
            "anyOf": [
              {
                "maximum": 10080.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cooldown Minutes"
          },
          "enabled": {
            "default": false,
            "title": "Enabled",
            "type": "boolean"
          },
          "max_daily_loss": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Daily Loss"
          },
          "max_entries_per_day": {
            "anyOf": [
              {
                "maximum": 1000.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Entries Per Day"
          },
          "require_stop_live": {
            "default": true,
            "title": "Require Stop Live",
            "type": "boolean"
          }
        },
        "title": "ManualDisciplineSettings",
        "type": "object"
      },
      "ManualOrderChange": {
        "additionalProperties": false,
        "description": "A new quantity or limit for one of your working manual orders. It is\ncancelled at the broker and replaced by a new order.",
        "properties": {
          "allow_reduce": {
            "default": false,
            "title": "Allow Reduce",
            "type": "boolean"
          },
          "limit_price": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit Price"
          },
          "portfolio_id": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Id"
          },
          "quantity": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "maximum": 1000000000.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Quantity"
          },
          "reason": {
            "maxLength": 500,
            "minLength": 3,
            "title": "Reason",
            "type": "string"
          }
        },
        "required": [
          "reason"
        ],
        "title": "ManualOrderChange",
        "type": "object"
      },
      "ManualOrderRequest": {
        "additionalProperties": false,
        "description": "One order you place by hand. It goes through the kill switch, every\nhalt and every risk rule of the book, like a strategy's order.",
        "properties": {
          "allow_reduce": {
            "default": false,
            "description": "Place a smaller order when a risk rule shrinks it. Off: the order is refused and the answer says what the rules allow.",
            "title": "Allow Reduce",
            "type": "boolean"
          },
          "client_id": {
            "anyOf": [
              {
                "pattern": "^[A-Za-z0-9_.\\-]{1,64}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Your idempotency key. The same key places the order once.",
            "title": "Client Id"
          },
          "limit_price": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Needed for a limit order.",
            "title": "Limit Price"
          },
          "order_type": {
            "default": "market",
            "enum": [
              "market",
              "limit"
            ],
            "title": "Order Type",
            "type": "string"
          },
          "portfolio_id": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "One of your portfolios. Default: your own book.",
            "title": "Portfolio Id"
          },
          "quantity": {
            "exclusiveMinimum": 0.0,
            "maximum": 1000000000.0,
            "title": "Quantity",
            "type": "number"
          },
          "reason": {
            "description": "Why you trade (recorded).",
            "maxLength": 500,
            "minLength": 3,
            "title": "Reason",
            "type": "string"
          },
          "side": {
            "enum": [
              "buy",
              "sell"
            ],
            "title": "Side",
            "type": "string"
          },
          "stop_price": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "A protective stop for this entry: below a buy, above a short sale. A book at a broker gets a stop order once the entry fills.",
            "title": "Stop Price"
          },
          "target_price": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Where you plan to take the profit (recorded).",
            "title": "Target Price"
          },
          "ticker": {
            "description": "Instrument id, e.g. AAPL.US",
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._\\-^=]{0,31}$",
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "ticker",
          "side",
          "quantity",
          "reason"
        ],
        "title": "ManualOrderRequest",
        "type": "object"
      },
      "ManualOrderResult": {
        "properties": {
          "adjustments": {
            "items": {
              "$ref": "#/components/schemas/RiskAdjustmentView"
            },
            "title": "Adjustments",
            "type": "array"
          },
          "client_id": {
            "title": "Client Id",
            "type": "string"
          },
          "duplicate": {
            "default": false,
            "description": "The client id was placed before.",
            "title": "Duplicate",
            "type": "boolean"
          },
          "fill_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fill Price"
          },
          "halt": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A halt that limits the book.",
            "title": "Halt"
          },
          "limit_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit Price"
          },
          "live": {
            "description": "The book trades real money.",
            "title": "Live",
            "type": "boolean"
          },
          "order_type": {
            "enum": [
              "market",
              "limit"
            ],
            "title": "Order Type",
            "type": "string"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "protective_stop": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The client id of the stop order placed at the broker.",
            "title": "Protective Stop"
          },
          "quantity": {
            "description": "What was placed (smaller when allow_reduce applied).",
            "title": "Quantity",
            "type": "number"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why it ended in its status.",
            "title": "Reason"
          },
          "reference_price": {
            "description": "The latest close the order was checked at.",
            "title": "Reference Price",
            "type": "number"
          },
          "requested_quantity": {
            "title": "Requested Quantity",
            "type": "number"
          },
          "reward_risk": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "The gain at the target over the loss at the stop.",
            "title": "Reward Risk"
          },
          "side": {
            "enum": [
              "buy",
              "sell"
            ],
            "title": "Side",
            "type": "string"
          },
          "status": {
            "enum": [
              "preview",
              "pending",
              "filled",
              "partially_filled",
              "rejected",
              "cancelled"
            ],
            "title": "Status",
            "type": "string"
          },
          "stop_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "The protective stop planned.",
            "title": "Stop Price"
          },
          "target_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Price"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "client_id",
          "portfolio_id",
          "ticker",
          "side",
          "order_type",
          "limit_price",
          "status",
          "requested_quantity",
          "quantity",
          "reference_price",
          "live"
        ],
        "title": "ManualOrderResult",
        "type": "object"
      },
      "MarginAccountView": {
        "description": "The account as the broker reports it now.",
        "properties": {
          "account_type": {
            "enum": [
              "cash",
              "margin"
            ],
            "title": "Account Type",
            "type": "string"
          },
          "available_funds": {
            "title": "Available Funds",
            "type": "number"
          },
          "buying_power": {
            "title": "Buying Power",
            "type": "number"
          },
          "cash": {
            "title": "Cash",
            "type": "number"
          },
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "cushion": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cushion"
          },
          "day_trades_remaining": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Day Trades Remaining"
          },
          "equity": {
            "title": "Equity",
            "type": "number"
          },
          "excess_liquidity": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Excess Liquidity"
          },
          "initial_margin": {
            "title": "Initial Margin",
            "type": "number"
          },
          "level": {
            "anyOf": [
              {
                "enum": [
                  "ok",
                  "warn",
                  "reduce",
                  "call"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Level"
          },
          "maintenance_margin": {
            "title": "Maintenance Margin",
            "type": "number"
          },
          "margin_room": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Margin Room"
          },
          "margin_use": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Margin Use"
          },
          "reported_type": {
            "anyOf": [
              {
                "enum": [
                  "cash",
                  "margin"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reported Type"
          }
        },
        "required": [
          "currency",
          "equity",
          "cash",
          "available_funds",
          "buying_power",
          "excess_liquidity",
          "initial_margin",
          "maintenance_margin",
          "margin_use",
          "cushion",
          "level",
          "margin_room",
          "account_type",
          "reported_type",
          "day_trades_remaining"
        ],
        "title": "MarginAccountView",
        "type": "object"
      },
      "MarginCallSettings": {
        "additionalProperties": false,
        "properties": {
          "buffer": {
            "default": 0.0,
            "exclusiveMaximum": 1.0,
            "minimum": 0.0,
            "title": "Buffer",
            "type": "number"
          },
          "enabled": {
            "default": false,
            "title": "Enabled",
            "type": "boolean"
          },
          "margin": {
            "$ref": "#/components/schemas/MarginSettings",
            "default": {
              "debit_rate_annual": 0.0,
              "model": "reg_t",
              "overrides": {},
              "rates": {
                "initial_long": 0.5,
                "initial_short": 0.5,
                "maintenance_long": 0.25,
                "maintenance_short": 0.3
              }
            }
          },
          "reduce_cushion": {
            "default": 0.1,
            "exclusiveMaximum": 1.0,
            "exclusiveMinimum": 0.0,
            "title": "Reduce Cushion",
            "type": "number"
          },
          "restore_cushion": {
            "default": 0.2,
            "exclusiveMaximum": 1.0,
            "exclusiveMinimum": 0.0,
            "title": "Restore Cushion",
            "type": "number"
          },
          "warn_cushion": {
            "default": 0.15,
            "exclusiveMaximum": 1.0,
            "exclusiveMinimum": 0.0,
            "title": "Warn Cushion",
            "type": "number"
          }
        },
        "title": "MarginCallSettings",
        "type": "object"
      },
      "MarginCheckView": {
        "properties": {
          "checked_at": {
            "format": "date-time",
            "title": "Checked At",
            "type": "string"
          },
          "cushion": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cushion"
          },
          "equity": {
            "title": "Equity",
            "type": "number"
          },
          "level": {
            "enum": [
              "ok",
              "warn",
              "reduce",
              "call"
            ],
            "title": "Level",
            "type": "string"
          },
          "maintenance_margin": {
            "title": "Maintenance Margin",
            "type": "number"
          },
          "source": {
            "enum": [
              "tick",
              "monitor"
            ],
            "title": "Source",
            "type": "string"
          }
        },
        "required": [
          "checked_at",
          "source",
          "level",
          "cushion",
          "equity",
          "maintenance_margin"
        ],
        "title": "MarginCheckView",
        "type": "object"
      },
      "MarginRates": {
        "additionalProperties": false,
        "description": "Requirement rates, as fractions of a position's market value.",
        "properties": {
          "initial_long": {
            "default": 0.5,
            "exclusiveMinimum": 0.0,
            "title": "Initial Long",
            "type": "number"
          },
          "initial_short": {
            "default": 0.5,
            "exclusiveMinimum": 0.0,
            "title": "Initial Short",
            "type": "number"
          },
          "maintenance_long": {
            "default": 0.25,
            "minimum": 0.0,
            "title": "Maintenance Long",
            "type": "number"
          },
          "maintenance_short": {
            "default": 0.3,
            "minimum": 0.0,
            "title": "Maintenance Short",
            "type": "number"
          }
        },
        "title": "MarginRates",
        "type": "object"
      },
      "MarginSettings": {
        "additionalProperties": false,
        "description": "Which margin model a book uses, and its rates.",
        "properties": {
          "debit_rate_annual": {
            "default": 0.0,
            "minimum": 0.0,
            "title": "Debit Rate Annual",
            "type": "number"
          },
          "model": {
            "default": "cash",
            "enum": [
              "cash",
              "reg_t"
            ],
            "title": "Model",
            "type": "string"
          },
          "overrides": {
            "additionalProperties": {
              "$ref": "#/components/schemas/MarginRates"
            },
            "propertyNames": {
              "enum": [
                "equity",
                "crypto",
                "commodity",
                "bond"
              ]
            },
            "title": "Overrides",
            "type": "object"
          },
          "rates": {
            "$ref": "#/components/schemas/MarginRates",
            "default": {
              "initial_long": 0.5,
              "initial_short": 0.5,
              "maintenance_long": 0.25,
              "maintenance_short": 0.3
            }
          }
        },
        "title": "MarginSettings",
        "type": "object"
      },
      "MarginView": {
        "properties": {
          "account": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MarginAccountView"
              },
              {
                "type": "null"
              }
            ]
          },
          "buffer": {
            "title": "Buffer",
            "type": "number"
          },
          "latest_check": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MarginCheckView"
              },
              {
                "type": "null"
              }
            ]
          },
          "margin_accounts_on": {
            "title": "Margin Accounts On",
            "type": "boolean"
          },
          "pdt": {
            "$ref": "#/components/schemas/PdtView"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "profile_type": {
            "anyOf": [
              {
                "enum": [
                  "cash",
                  "margin"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Profile Type"
          },
          "read_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Read Error"
          },
          "reduce_cushion": {
            "title": "Reduce Cushion",
            "type": "number"
          },
          "restore_cushion": {
            "title": "Restore Cushion",
            "type": "number"
          },
          "warn_cushion": {
            "title": "Warn Cushion",
            "type": "number"
          }
        },
        "required": [
          "portfolio_id",
          "profile_type",
          "margin_accounts_on",
          "account",
          "read_error",
          "buffer",
          "warn_cushion",
          "reduce_cushion",
          "restore_cushion",
          "pdt",
          "latest_check"
        ],
        "title": "MarginView",
        "type": "object"
      },
      "MarkReadRequest": {
        "properties": {
          "ids": {
            "anyOf": [
              {
                "items": {
                  "type": "integer"
                },
                "maxItems": 200,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ids"
          }
        },
        "title": "MarkReadRequest",
        "type": "object"
      },
      "MarkReadView": {
        "properties": {
          "unread_count": {
            "title": "Unread Count",
            "type": "integer"
          },
          "updated": {
            "title": "Updated",
            "type": "integer"
          }
        },
        "required": [
          "updated",
          "unread_count"
        ],
        "title": "MarkReadView",
        "type": "object"
      },
      "MarketClockView": {
        "properties": {
          "is_open": {
            "title": "Is Open",
            "type": "boolean"
          },
          "next_close": {
            "format": "date-time",
            "title": "Next Close",
            "type": "string"
          },
          "next_open": {
            "format": "date-time",
            "title": "Next Open",
            "type": "string"
          },
          "timestamp": {
            "format": "date-time",
            "title": "Timestamp",
            "type": "string"
          }
        },
        "required": [
          "timestamp",
          "is_open",
          "next_open",
          "next_close"
        ],
        "title": "MarketClockView",
        "type": "object"
      },
      "MarketSessionsView": {
        "properties": {
          "calendar": {
            "title": "Calendar",
            "type": "string"
          },
          "is_open": {
            "title": "Is Open",
            "type": "boolean"
          },
          "next": {
            "$ref": "#/components/schemas/SessionTimesView"
          },
          "today": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/SessionTimesView"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "calendar",
          "is_open",
          "today",
          "next"
        ],
        "title": "MarketSessionsView",
        "type": "object"
      },
      "MaxHoldingSettings": {
        "additionalProperties": false,
        "properties": {
          "max_holding_bars": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Holding Bars"
          }
        },
        "title": "MaxHoldingSettings",
        "type": "object"
      },
      "MaxOrdersPerRunSettings": {
        "additionalProperties": false,
        "properties": {
          "max_closing_orders": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Closing Orders"
          },
          "max_opening_orders": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Opening Orders"
          }
        },
        "title": "MaxOrdersPerRunSettings",
        "type": "object"
      },
      "McptOptions": {
        "additionalProperties": false,
        "description": "Monte-Carlo permutation test settings (survival test ``permutation``).",
        "properties": {
          "max_p_value": {
            "default": 0.05,
            "exclusiveMinimum": 0.0,
            "maximum": 1.0,
            "title": "Max P Value",
            "type": "number"
          },
          "metric": {
            "default": "profit_factor",
            "enum": [
              "profit_factor",
              "bar_profit_factor",
              "sharpe",
              "final_return",
              "cagr"
            ],
            "title": "Metric",
            "type": "string"
          },
          "n_permutations": {
            "default": 200,
            "maximum": 1000.0,
            "minimum": 1.0,
            "title": "N Permutations",
            "type": "integer"
          },
          "retune": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "const": "auto",
                "type": "string"
              }
            ],
            "default": false,
            "title": "Retune"
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "default": 17,
            "title": "Seed"
          }
        },
        "title": "McptOptions",
        "type": "object"
      },
      "MeView": {
        "properties": {
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "mfa_enrolled": {
            "title": "Mfa Enrolled",
            "type": "boolean"
          },
          "mfa_fresh": {
            "title": "Mfa Fresh",
            "type": "boolean"
          },
          "role": {
            "$ref": "#/components/schemas/Role"
          },
          "scopes": {
            "items": {
              "$ref": "#/components/schemas/ApiScope"
            },
            "title": "Scopes",
            "type": "array"
          },
          "toolsets": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Toolsets"
          },
          "user_id": {
            "title": "User Id",
            "type": "string"
          },
          "via": {
            "enum": [
              "session",
              "token",
              "legacy",
              "cli",
              "scheduler",
              "assistant",
              "telegram"
            ],
            "title": "Via",
            "type": "string"
          }
        },
        "required": [
          "user_id",
          "email",
          "display_name",
          "role",
          "via",
          "scopes",
          "mfa_enrolled",
          "mfa_fresh"
        ],
        "title": "MeView",
        "type": "object"
      },
      "MembershipSpanView": {
        "description": "One stretch of membership: a member from ``start_date`` up to the\nday before ``end_date``.",
        "properties": {
          "end_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "End Date"
          },
          "start_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start Date"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "ticker"
        ],
        "title": "MembershipSpanView",
        "type": "object"
      },
      "MessageCreate": {
        "additionalProperties": false,
        "properties": {
          "content": {
            "maxLength": 8000,
            "minLength": 1,
            "title": "Content",
            "type": "string"
          }
        },
        "required": [
          "content"
        ],
        "title": "MessageCreate",
        "type": "object"
      },
      "MessageView": {
        "properties": {
          "content": {
            "title": "Content",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "role": {
            "enum": [
              "user",
              "assistant",
              "tool"
            ],
            "title": "Role",
            "type": "string"
          },
          "tool_call_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Call Id"
          },
          "tool_calls": {
            "items": {
              "$ref": "#/components/schemas/ToolCallView"
            },
            "title": "Tool Calls",
            "type": "array"
          },
          "tool_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tool Name"
          }
        },
        "required": [
          "id",
          "role",
          "content",
          "created_at"
        ],
        "title": "MessageView",
        "type": "object"
      },
      "MetricFilter": {
        "additionalProperties": false,
        "description": "Keep a ticker when ``min <= value <= max``. A ticker with no value\nfor the metric fails the filter.",
        "properties": {
          "max": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max"
          },
          "metric": {
            "maxLength": 64,
            "title": "Metric",
            "type": "string"
          },
          "min": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Min"
          }
        },
        "required": [
          "metric"
        ],
        "title": "MetricFilter",
        "type": "object"
      },
      "MetricView": {
        "properties": {
          "description": {
            "title": "Description",
            "type": "string"
          },
          "group": {
            "enum": [
              "price",
              "fundamental"
            ],
            "title": "Group",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "unit": {
            "enum": [
              "ratio",
              "percent",
              "money"
            ],
            "title": "Unit",
            "type": "string"
          }
        },
        "required": [
          "id",
          "label",
          "group",
          "unit",
          "description"
        ],
        "title": "MetricView",
        "type": "object"
      },
      "MfaCodeRequest": {
        "properties": {
          "code": {
            "anyOf": [
              {
                "maxLength": 16,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code"
          },
          "recovery_code": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recovery Code"
          }
        },
        "title": "MfaCodeRequest",
        "type": "object"
      },
      "MfaView": {
        "properties": {
          "csrf_token": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Csrf Token"
          },
          "method": {
            "enum": [
              "totp",
              "recovery_code"
            ],
            "title": "Method",
            "type": "string"
          },
          "recovery_codes": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recovery Codes"
          },
          "recovery_codes_left": {
            "title": "Recovery Codes Left",
            "type": "integer"
          }
        },
        "required": [
          "method",
          "recovery_codes_left"
        ],
        "title": "MfaView",
        "type": "object"
      },
      "ModelVersionView": {
        "properties": {
          "book_id": {
            "title": "Book Id",
            "type": "string"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "created_by": {
            "title": "Created By",
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "fit": {
            "additionalProperties": true,
            "title": "Fit",
            "type": "object"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "strategy_id": {
            "title": "Strategy Id",
            "type": "string"
          },
          "train_end": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Train End"
          },
          "train_start": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Train Start"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          },
          "version": {
            "title": "Version",
            "type": "integer"
          }
        },
        "required": [
          "strategy_id",
          "version",
          "status",
          "book_id",
          "train_start",
          "train_end",
          "fit",
          "error",
          "created_by",
          "created_at",
          "updated_at"
        ],
        "title": "ModelVersionView",
        "type": "object"
      },
      "MonthlyICView": {
        "properties": {
          "months": {
            "items": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            },
            "title": "Months",
            "type": "array"
          },
          "year": {
            "title": "Year",
            "type": "integer"
          }
        },
        "required": [
          "year",
          "months"
        ],
        "title": "MonthlyICView",
        "type": "object"
      },
      "MonthlyReturn": {
        "properties": {
          "month": {
            "description": "YYYY-MM",
            "title": "Month",
            "type": "string"
          },
          "value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Value"
          }
        },
        "required": [
          "month",
          "value"
        ],
        "title": "MonthlyReturn",
        "type": "object"
      },
      "NetExposureSettings": {
        "additionalProperties": false,
        "properties": {
          "max_net": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Net"
          },
          "min_net": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Min Net"
          }
        },
        "title": "NetExposureSettings",
        "type": "object"
      },
      "NewsItem": {
        "properties": {
          "published_at": {
            "format": "date-time",
            "title": "Published At",
            "type": "string"
          },
          "sentiment": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sentiment"
          },
          "source_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Name"
          },
          "tags": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Tags",
            "type": "array"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Url"
          }
        },
        "required": [
          "ticker",
          "published_at",
          "title"
        ],
        "title": "NewsItem",
        "type": "object"
      },
      "NewsView": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/NewsItem"
            },
            "title": "Items",
            "type": "array"
          },
          "sentiment": {
            "items": {
              "$ref": "#/components/schemas/SentimentDay"
            },
            "title": "Sentiment",
            "type": "array"
          },
          "tickers": {
            "items": {
              "type": "string"
            },
            "title": "Tickers",
            "type": "array"
          }
        },
        "required": [
          "tickers",
          "items",
          "sentiment"
        ],
        "title": "NewsView",
        "type": "object"
      },
      "NoteRequest": {
        "additionalProperties": false,
        "properties": {
          "note": {
            "maxLength": 4000,
            "minLength": 1,
            "title": "Note",
            "type": "string"
          }
        },
        "required": [
          "note"
        ],
        "title": "NoteRequest",
        "type": "object"
      },
      "ObjectiveInfo": {
        "description": "An objective a lab request can name in ``objective``.",
        "properties": {
          "description": {
            "title": "Description",
            "type": "string"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name",
          "label",
          "description"
        ],
        "title": "ObjectiveInfo",
        "type": "object"
      },
      "OnboardingStepView": {
        "properties": {
          "derived": {
            "title": "Derived",
            "type": "boolean"
          },
          "id": {
            "enum": [
              "account",
              "portfolio",
              "data",
              "follow",
              "alerts"
            ],
            "title": "Id",
            "type": "string"
          },
          "optional": {
            "title": "Optional",
            "type": "boolean"
          },
          "state": {
            "enum": [
              "done",
              "skipped",
              "todo"
            ],
            "title": "State",
            "type": "string"
          }
        },
        "required": [
          "id",
          "state",
          "derived",
          "optional"
        ],
        "title": "OnboardingStepView",
        "type": "object"
      },
      "OnboardingUpdate": {
        "additionalProperties": false,
        "properties": {
          "dismissed": {
            "title": "Dismissed",
            "type": "boolean"
          }
        },
        "required": [
          "dismissed"
        ],
        "title": "OnboardingUpdate",
        "type": "object"
      },
      "OnboardingView": {
        "properties": {
          "complete": {
            "title": "Complete",
            "type": "boolean"
          },
          "dismissed": {
            "title": "Dismissed",
            "type": "boolean"
          },
          "show": {
            "title": "Show",
            "type": "boolean"
          },
          "steps": {
            "items": {
              "$ref": "#/components/schemas/OnboardingStepView"
            },
            "title": "Steps",
            "type": "array"
          }
        },
        "required": [
          "steps",
          "complete",
          "dismissed",
          "show"
        ],
        "title": "OnboardingView",
        "type": "object"
      },
      "OperationalHaltSettings": {
        "additionalProperties": false,
        "properties": {
          "max_bar_age_days": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Bar Age Days"
          }
        },
        "title": "OperationalHaltSettings",
        "type": "object"
      },
      "Opinion": {
        "properties": {
          "expected_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expected Return"
          },
          "reason": {
            "title": "Reason",
            "type": "string"
          },
          "stance": {
            "enum": [
              "agree",
              "disagree",
              "no_view",
              "not_applicable",
              "error"
            ],
            "title": "Stance",
            "type": "string"
          },
          "strategy_id": {
            "title": "Strategy Id",
            "type": "string"
          }
        },
        "required": [
          "strategy_id",
          "stance",
          "expected_return",
          "reason"
        ],
        "title": "Opinion",
        "type": "object"
      },
      "OptionChainRow": {
        "properties": {
          "call": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OptionQuoteView"
              },
              {
                "type": "null"
              }
            ]
          },
          "put": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/OptionQuoteView"
              },
              {
                "type": "null"
              }
            ]
          },
          "strike": {
            "title": "Strike",
            "type": "number"
          }
        },
        "required": [
          "strike"
        ],
        "title": "OptionChainRow",
        "type": "object"
      },
      "OptionChainView": {
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "days_to_expiry": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Days To Expiry"
          },
          "expiries": {
            "items": {
              "format": "date",
              "type": "string"
            },
            "title": "Expiries",
            "type": "array"
          },
          "expiry": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expiry"
          },
          "models": {
            "items": {
              "type": "string"
            },
            "title": "Models",
            "type": "array"
          },
          "rows": {
            "items": {
              "$ref": "#/components/schemas/OptionChainRow"
            },
            "title": "Rows",
            "type": "array"
          },
          "spot": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Spot"
          },
          "synthetic": {
            "title": "Synthetic",
            "type": "boolean"
          },
          "underlying": {
            "title": "Underlying",
            "type": "string"
          }
        },
        "required": [
          "underlying",
          "as_of",
          "expiries",
          "rows",
          "models",
          "synthetic"
        ],
        "title": "OptionChainView",
        "type": "object"
      },
      "OptionGreekLimitsSettings": {
        "additionalProperties": false,
        "properties": {
          "max_dollar_delta": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Dollar Delta"
          },
          "max_dollar_gamma": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Dollar Gamma"
          },
          "max_position_dollar_delta": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Position Dollar Delta"
          },
          "max_position_vega": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Position Vega"
          },
          "max_theta": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Theta"
          },
          "max_vega": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Vega"
          }
        },
        "title": "OptionGreekLimitsSettings",
        "type": "object"
      },
      "OptionMarginSettings": {
        "additionalProperties": false,
        "properties": {
          "cash_buffer": {
            "default": 0.0,
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Cash Buffer",
            "type": "number"
          },
          "enabled": {
            "default": false,
            "title": "Enabled",
            "type": "boolean"
          },
          "method": {
            "default": "reg_t",
            "enum": [
              "reg_t",
              "risk_based"
            ],
            "title": "Method",
            "type": "string"
          }
        },
        "title": "OptionMarginSettings",
        "type": "object"
      },
      "OptionMaxLossSettings": {
        "additionalProperties": false,
        "properties": {
          "max_loss_per_group": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Loss Per Group"
          },
          "max_loss_total": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Loss Total"
          }
        },
        "title": "OptionMaxLossSettings",
        "type": "object"
      },
      "OptionPayoffRequest": {
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          },
          "delta": {
            "anyOf": [
              {
                "exclusiveMaximum": 1.0,
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Delta"
          },
          "dte": {
            "default": 35,
            "maximum": 400.0,
            "minimum": 1.0,
            "title": "Dte",
            "type": "integer"
          },
          "long_delta": {
            "anyOf": [
              {
                "exclusiveMaximum": 1.0,
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Long Delta"
          },
          "short_delta": {
            "anyOf": [
              {
                "exclusiveMaximum": 1.0,
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Short Delta"
          },
          "structure": {
            "maxLength": 64,
            "minLength": 1,
            "title": "Structure",
            "type": "string"
          },
          "underlying": {
            "maxLength": 32,
            "minLength": 1,
            "pattern": "^[A-Za-z0-9._\\-]+$",
            "title": "Underlying",
            "type": "string"
          },
          "wing_delta": {
            "anyOf": [
              {
                "exclusiveMaximum": 1.0,
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Wing Delta"
          }
        },
        "required": [
          "underlying",
          "structure"
        ],
        "title": "OptionPayoffRequest",
        "type": "object"
      },
      "OptionPayoffView": {
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "breakevens": {
            "items": {
              "type": "number"
            },
            "title": "Breakevens",
            "type": "array"
          },
          "cost": {
            "title": "Cost",
            "type": "number"
          },
          "legs": {
            "items": {
              "$ref": "#/components/schemas/PayoffLegView"
            },
            "title": "Legs",
            "type": "array"
          },
          "max_gain": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Gain"
          },
          "max_loss": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Loss"
          },
          "points": {
            "items": {
              "$ref": "#/components/schemas/PayoffPointView"
            },
            "title": "Points",
            "type": "array"
          },
          "spot": {
            "title": "Spot",
            "type": "number"
          },
          "structure": {
            "title": "Structure",
            "type": "string"
          },
          "synthetic": {
            "title": "Synthetic",
            "type": "boolean"
          },
          "underlying": {
            "title": "Underlying",
            "type": "string"
          }
        },
        "required": [
          "underlying",
          "as_of",
          "spot",
          "structure",
          "legs",
          "points",
          "cost",
          "breakevens",
          "synthetic"
        ],
        "title": "OptionPayoffView",
        "type": "object"
      },
      "OptionQuoteView": {
        "properties": {
          "ask": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ask"
          },
          "bid": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bid"
          },
          "contract_id": {
            "title": "Contract Id",
            "type": "string"
          },
          "delta": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Delta"
          },
          "gamma": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gamma"
          },
          "iv": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Iv"
          },
          "mark": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mark"
          },
          "open_interest": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Open Interest"
          },
          "theta": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Theta"
          },
          "vega": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Vega"
          },
          "volume": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Volume"
          }
        },
        "required": [
          "contract_id"
        ],
        "title": "OptionQuoteView",
        "type": "object"
      },
      "OptionStrategyView": {
        "properties": {
          "hypothesis": {
            "title": "Hypothesis",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "parameters": {
            "items": {
              "$ref": "#/components/schemas/ParameterInfo"
            },
            "title": "Parameters",
            "type": "array"
          },
          "structures": {
            "items": {
              "type": "string"
            },
            "title": "Structures",
            "type": "array"
          }
        },
        "required": [
          "id",
          "hypothesis",
          "structures",
          "parameters"
        ],
        "title": "OptionStrategyView",
        "type": "object"
      },
      "OptionStructureView": {
        "properties": {
          "holds_shares": {
            "title": "Holds Shares",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "params": {
            "items": {
              "type": "string"
            },
            "title": "Params",
            "type": "array"
          }
        },
        "required": [
          "name",
          "params",
          "holds_shares"
        ],
        "title": "OptionStructureView",
        "type": "object"
      },
      "OptionUnderlyingView": {
        "properties": {
          "contracts": {
            "title": "Contracts",
            "type": "integer"
          },
          "days": {
            "title": "Days",
            "type": "integer"
          },
          "first_day": {
            "format": "date",
            "title": "First Day",
            "type": "string"
          },
          "last_day": {
            "format": "date",
            "title": "Last Day",
            "type": "string"
          },
          "sources": {
            "items": {
              "type": "string"
            },
            "title": "Sources",
            "type": "array"
          },
          "synthetic": {
            "title": "Synthetic",
            "type": "boolean"
          },
          "underlying": {
            "title": "Underlying",
            "type": "string"
          }
        },
        "required": [
          "underlying",
          "first_day",
          "last_day",
          "days",
          "contracts",
          "sources",
          "synthetic"
        ],
        "title": "OptionUnderlyingView",
        "type": "object"
      },
      "OptionsApprovalUpdate": {
        "additionalProperties": false,
        "properties": {
          "level": {
            "enum": [
              "none",
              "covered",
              "spreads",
              "naked"
            ],
            "title": "Level",
            "type": "string"
          },
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "title": "Reason",
            "type": "string"
          }
        },
        "required": [
          "level",
          "reason"
        ],
        "title": "OptionsApprovalUpdate",
        "type": "object"
      },
      "OptionsBacktestRequest": {
        "properties": {
          "cash": {
            "default": 100000.0,
            "exclusiveMinimum": 0.0,
            "maximum": 10000000000.0,
            "title": "Cash",
            "type": "number"
          },
          "end": {
            "format": "date",
            "title": "End",
            "type": "string"
          },
          "params": {
            "additionalProperties": true,
            "title": "Params",
            "type": "object"
          },
          "start": {
            "format": "date",
            "title": "Start",
            "type": "string"
          },
          "strategy": {
            "maxLength": 64,
            "minLength": 1,
            "title": "Strategy",
            "type": "string"
          },
          "trials": {
            "default": 1,
            "maximum": 100000.0,
            "minimum": 1.0,
            "title": "Trials",
            "type": "integer"
          },
          "underlyings": {
            "items": {
              "type": "string"
            },
            "maxItems": 10,
            "minItems": 1,
            "title": "Underlyings",
            "type": "array"
          },
          "validation": {
            "default": true,
            "title": "Validation",
            "type": "boolean"
          }
        },
        "required": [
          "strategy",
          "underlyings",
          "start",
          "end"
        ],
        "title": "OptionsBacktestRequest",
        "type": "object"
      },
      "OptionsBacktestView": {
        "properties": {
          "cagr": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cagr"
          },
          "days": {
            "title": "Days",
            "type": "integer"
          },
          "end": {
            "format": "date",
            "title": "End",
            "type": "string"
          },
          "equity": {
            "items": {
              "$ref": "#/components/schemas/EquityPointView"
            },
            "title": "Equity",
            "type": "array"
          },
          "fills": {
            "title": "Fills",
            "type": "integer"
          },
          "final_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Final Return"
          },
          "max_drawdown": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Drawdown"
          },
          "rejected": {
            "title": "Rejected",
            "type": "integer"
          },
          "rejection_reasons": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "Rejection Reasons",
            "type": "object"
          },
          "sharpe": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sharpe"
          },
          "sources": {
            "items": {
              "type": "string"
            },
            "title": "Sources",
            "type": "array"
          },
          "start": {
            "format": "date",
            "title": "Start",
            "type": "string"
          },
          "strategy": {
            "title": "Strategy",
            "type": "string"
          },
          "synthetic": {
            "title": "Synthetic",
            "type": "boolean"
          },
          "underlyings": {
            "items": {
              "type": "string"
            },
            "title": "Underlyings",
            "type": "array"
          },
          "validation": {
            "items": {
              "$ref": "#/components/schemas/SurvivalReportView"
            },
            "title": "Validation",
            "type": "array"
          },
          "verdict": {
            "enum": [
              "passed",
              "failed",
              "not_run"
            ],
            "title": "Verdict",
            "type": "string"
          }
        },
        "required": [
          "strategy",
          "underlyings",
          "start",
          "end",
          "days",
          "fills",
          "rejected",
          "rejection_reasons",
          "equity",
          "sources",
          "synthetic",
          "validation",
          "verdict"
        ],
        "title": "OptionsBacktestView",
        "type": "object"
      },
      "OptionsLevelView": {
        "properties": {
          "allows": {
            "title": "Allows",
            "type": "string"
          },
          "level": {
            "enum": [
              "none",
              "covered",
              "spreads",
              "naked"
            ],
            "title": "Level",
            "type": "string"
          }
        },
        "required": [
          "level",
          "allows"
        ],
        "title": "OptionsLevelView",
        "type": "object"
      },
      "OptionsLiveView": {
        "description": "A portfolio's live options state. ``allowed`` is true only when the\nswitch is on, the stage is ``live_small`` or higher and the level is\nabove ``none``.",
        "properties": {
          "allowed": {
            "title": "Allowed",
            "type": "boolean"
          },
          "auto_approve_closes": {
            "title": "Auto Approve Closes",
            "type": "boolean"
          },
          "close_sessions": {
            "title": "Close Sessions",
            "type": "integer"
          },
          "enabled": {
            "description": "[production.options] live, set by the admin",
            "title": "Enabled",
            "type": "boolean"
          },
          "expiry_action": {
            "title": "Expiry Action",
            "type": "string"
          },
          "level": {
            "enum": [
              "none",
              "covered",
              "spreads",
              "naked"
            ],
            "title": "Level",
            "type": "string"
          },
          "levels": {
            "items": {
              "$ref": "#/components/schemas/OptionsLevelView"
            },
            "title": "Levels",
            "type": "array"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "why the level was set",
            "title": "Reason"
          },
          "reasons": {
            "items": {
              "type": "string"
            },
            "title": "Reasons",
            "type": "array"
          },
          "stage": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stage"
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          },
          "updated_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated By"
          }
        },
        "required": [
          "portfolio_id",
          "enabled",
          "stage",
          "level",
          "allowed",
          "reasons",
          "levels",
          "auto_approve_closes",
          "expiry_action",
          "close_sessions"
        ],
        "title": "OptionsLiveView",
        "type": "object"
      },
      "OrderCancelRequest": {
        "additionalProperties": false,
        "properties": {
          "portfolio_id": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Id"
          },
          "reason": {
            "maxLength": 500,
            "minLength": 3,
            "title": "Reason",
            "type": "string"
          }
        },
        "required": [
          "reason"
        ],
        "title": "OrderCancelRequest",
        "type": "object"
      },
      "OrderCancelResult": {
        "properties": {
          "cancelled": {
            "title": "Cancelled",
            "type": "boolean"
          },
          "client_id": {
            "title": "Client Id",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "client_id",
          "status",
          "cancelled"
        ],
        "title": "OrderCancelResult",
        "type": "object"
      },
      "OrderDraftApproval": {
        "properties": {
          "draft": {
            "$ref": "#/components/schemas/OrderDraftView"
          },
          "order": {
            "$ref": "#/components/schemas/ManualOrderResult"
          }
        },
        "required": [
          "draft",
          "order"
        ],
        "title": "OrderDraftApproval",
        "type": "object"
      },
      "OrderDraftCreate": {
        "additionalProperties": false,
        "description": "An order to propose. The server prices it and checks it; a person\napproves it in the web app before anything is placed.",
        "properties": {
          "limit_price": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit Price"
          },
          "order_type": {
            "default": "market",
            "enum": [
              "market",
              "limit"
            ],
            "title": "Order Type",
            "type": "string"
          },
          "portfolio_id": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Id"
          },
          "quantity": {
            "exclusiveMinimum": 0.0,
            "maximum": 1000000000.0,
            "title": "Quantity",
            "type": "number"
          },
          "reason": {
            "maxLength": 500,
            "minLength": 3,
            "title": "Reason",
            "type": "string"
          },
          "retry_key": {
            "description": "The same key returns the draft already made (a safe retry).",
            "pattern": "^[A-Za-z0-9_.:\\-]{1,120}$",
            "title": "Retry Key",
            "type": "string"
          },
          "side": {
            "enum": [
              "buy",
              "sell"
            ],
            "title": "Side",
            "type": "string"
          },
          "ticker": {
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._\\-^=]{0,31}$",
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "ticker",
          "side",
          "quantity",
          "reason",
          "retry_key"
        ],
        "title": "OrderDraftCreate",
        "type": "object"
      },
      "OrderDraftDecision": {
        "additionalProperties": false,
        "properties": {
          "note": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Note"
          }
        },
        "title": "OrderDraftDecision",
        "type": "object"
      },
      "OrderDraftView": {
        "properties": {
          "client_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The manual order it became, once placed.",
            "title": "Client Id"
          },
          "conversation_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Conversation Id"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "decided_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Decided At"
          },
          "decided_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Decided By"
          },
          "decision_note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Decision Note"
          },
          "expires_at": {
            "format": "date-time",
            "title": "Expires At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "limit_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit Price"
          },
          "notional": {
            "description": "quantity x reference_price, computed by the server.",
            "title": "Notional",
            "type": "number"
          },
          "order_type": {
            "enum": [
              "market",
              "limit"
            ],
            "title": "Order Type",
            "type": "string"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "reason": {
            "title": "Reason",
            "type": "string"
          },
          "reference_price": {
            "description": "The latest close, computed by the server.",
            "title": "Reference Price",
            "type": "number"
          },
          "side": {
            "enum": [
              "buy",
              "sell"
            ],
            "title": "Side",
            "type": "string"
          },
          "source": {
            "enum": [
              "assistant",
              "console",
              "mcp"
            ],
            "title": "Source",
            "type": "string"
          },
          "status": {
            "enum": [
              "pending",
              "placed",
              "rejected",
              "expired",
              "cancelled"
            ],
            "title": "Status",
            "type": "string"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "id",
          "portfolio_id",
          "source",
          "conversation_id",
          "ticker",
          "side",
          "quantity",
          "order_type",
          "limit_price",
          "reason",
          "reference_price",
          "notional",
          "status",
          "client_id",
          "created_at",
          "expires_at",
          "decided_at",
          "decided_by",
          "decision_note"
        ],
        "title": "OrderDraftView",
        "type": "object"
      },
      "OrderView": {
        "properties": {
          "broker_order_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Broker Order Id"
          },
          "client_id": {
            "title": "Client Id",
            "type": "string"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "limit_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit Price"
          },
          "manual_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Manual Reason"
          },
          "order_type": {
            "title": "Order Type",
            "type": "string"
          },
          "origin": {
            "default": "strategy",
            "enum": [
              "strategy",
              "manual"
            ],
            "title": "Origin",
            "type": "string"
          },
          "placed_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Placed By"
          },
          "protective": {
            "default": false,
            "title": "Protective",
            "type": "boolean"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "replaces_client_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Replaces Client Id"
          },
          "side": {
            "title": "Side",
            "type": "string"
          },
          "state": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "State"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "status_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status Reason"
          },
          "stop_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop Price"
          },
          "strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Id"
          },
          "strategy_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The strategy's plain title (a starter's), or null: the console names it from the id.",
            "title": "Strategy Name"
          },
          "tick_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tick Id"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "time_in_force": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Time In Force"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "client_id",
          "tick_id",
          "strategy_id",
          "ticker",
          "side",
          "quantity",
          "order_type",
          "limit_price",
          "status",
          "broker_order_id",
          "created_at",
          "updated_at"
        ],
        "title": "OrderView",
        "type": "object"
      },
      "OvertradingView": {
        "properties": {
          "active_days": {
            "title": "Active Days",
            "type": "integer"
          },
          "busy_day_pnl": {
            "title": "Busy Day Pnl",
            "type": "number"
          },
          "busy_days": {
            "description": "Days with many entries (5 or more).",
            "title": "Busy Days",
            "type": "integer"
          },
          "entries_per_active_day": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Entries Per Active Day"
          },
          "max_entries_in_a_day": {
            "title": "Max Entries In A Day",
            "type": "integer"
          },
          "other_day_pnl": {
            "title": "Other Day Pnl",
            "type": "number"
          }
        },
        "required": [
          "active_days",
          "entries_per_active_day",
          "max_entries_in_a_day",
          "busy_days",
          "busy_day_pnl",
          "other_day_pnl"
        ],
        "title": "OvertradingView",
        "type": "object"
      },
      "Page_AlertView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/AlertView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[AlertView]",
        "type": "object"
      },
      "Page_BackupView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/BackupView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[BackupView]",
        "type": "object"
      },
      "Page_BrokerAccountView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/stonks__app__connections__BrokerAccountView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[BrokerAccountView]",
        "type": "object"
      },
      "Page_CashFlowView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/CashFlowView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[CashFlowView]",
        "type": "object"
      },
      "Page_ConnectionView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/ConnectionView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[ConnectionView]",
        "type": "object"
      },
      "Page_ConversationView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/ConversationView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[ConversationView]",
        "type": "object"
      },
      "Page_CoverageRow_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/CoverageRow"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[CoverageRow]",
        "type": "object"
      },
      "Page_Draft_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/Draft"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[Draft]",
        "type": "object"
      },
      "Page_ExchangeView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/ExchangeView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[ExchangeView]",
        "type": "object"
      },
      "Page_FillView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/FillView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[FillView]",
        "type": "object"
      },
      "Page_HaltView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/HaltView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[HaltView]",
        "type": "object"
      },
      "Page_IngestRunView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/IngestRunView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[IngestRunView]",
        "type": "object"
      },
      "Page_InstrumentView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/InstrumentView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[InstrumentView]",
        "type": "object"
      },
      "Page_IntradaySnapshotView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/IntradaySnapshotView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[IntradaySnapshotView]",
        "type": "object"
      },
      "Page_Job_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/Job"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[Job]",
        "type": "object"
      },
      "Page_JournalEntryView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/JournalEntryView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[JournalEntryView]",
        "type": "object"
      },
      "Page_JournalTradeView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/JournalTradeView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[JournalTradeView]",
        "type": "object"
      },
      "Page_LedgerRunView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/LedgerRunView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[LedgerRunView]",
        "type": "object"
      },
      "Page_LotPickView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/LotPickView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[LotPickView]",
        "type": "object"
      },
      "Page_MembershipSpanView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/MembershipSpanView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[MembershipSpanView]",
        "type": "object"
      },
      "Page_ModelVersionView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/ModelVersionView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[ModelVersionView]",
        "type": "object"
      },
      "Page_OptionUnderlyingView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/OptionUnderlyingView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[OptionUnderlyingView]",
        "type": "object"
      },
      "Page_OrderDraftView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/OrderDraftView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[OrderDraftView]",
        "type": "object"
      },
      "Page_OrderView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/OrderView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[OrderView]",
        "type": "object"
      },
      "Page_PlaybookView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/PlaybookView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[PlaybookView]",
        "type": "object"
      },
      "Page_PortfolioSummaryView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/PortfolioSummaryView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[PortfolioSummaryView]",
        "type": "object"
      },
      "Page_PriceAlertEventView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/PriceAlertEventView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[PriceAlertEventView]",
        "type": "object"
      },
      "Page_PriceAlertView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/PriceAlertView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[PriceAlertView]",
        "type": "object"
      },
      "Page_PushDeviceView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/PushDeviceView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[PushDeviceView]",
        "type": "object"
      },
      "Page_ReconcileReportView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/ReconcileReportView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[ReconcileReportView]",
        "type": "object"
      },
      "Page_ResearchSessionView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/ResearchSessionView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[ResearchSessionView]",
        "type": "object"
      },
      "Page_RiskSnapshotView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/RiskSnapshotView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[RiskSnapshotView]",
        "type": "object"
      },
      "Page_SavedScreenView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/SavedScreenView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[SavedScreenView]",
        "type": "object"
      },
      "Page_ScreenAlertEventView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/ScreenAlertEventView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[ScreenAlertEventView]",
        "type": "object"
      },
      "Page_ScreenAlertView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/ScreenAlertView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[ScreenAlertView]",
        "type": "object"
      },
      "Page_ShadowDecisionView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/ShadowDecisionView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[ShadowDecisionView]",
        "type": "object"
      },
      "Page_ShadowPnlSummary_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/ShadowPnlSummary"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[ShadowPnlSummary]",
        "type": "object"
      },
      "Page_SnapshotView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/SnapshotView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[SnapshotView]",
        "type": "object"
      },
      "Page_StatementFlagView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/StatementFlagView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[StatementFlagView]",
        "type": "object"
      },
      "Page_StatementImportView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/StatementImportView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[StatementImportView]",
        "type": "object"
      },
      "Page_StatusChangeView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/StatusChangeView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[StatusChangeView]",
        "type": "object"
      },
      "Page_StrategySummary_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/StrategySummary"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[StrategySummary]",
        "type": "object"
      },
      "Page_SubscriptionView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/SubscriptionView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[SubscriptionView]",
        "type": "object"
      },
      "Page_TickRun_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/TickRun"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[TickRun]",
        "type": "object"
      },
      "Page_TicketView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/TicketView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[TicketView]",
        "type": "object"
      },
      "Page_TokenView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/TokenView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[TokenView]",
        "type": "object"
      },
      "Page_ToolsetView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/ToolsetView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[ToolsetView]",
        "type": "object"
      },
      "Page_TradeDecisionView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/TradeDecisionView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[TradeDecisionView]",
        "type": "object"
      },
      "Page_TradingModeView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/TradingModeView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[TradingModeView]",
        "type": "object"
      },
      "Page_TurnView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/TurnView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[TurnView]",
        "type": "object"
      },
      "Page_UniverseView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/UniverseView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[UniverseView]",
        "type": "object"
      },
      "Page_UserView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/UserView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[UserView]",
        "type": "object"
      },
      "Page_VersionEventView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/VersionEventView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[VersionEventView]",
        "type": "object"
      },
      "Page_WatchlistView_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/WatchlistView"
            },
            "title": "Items",
            "type": "array"
          },
          "limit": {
            "title": "Limit",
            "type": "integer"
          },
          "offset": {
            "title": "Offset",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "items",
          "total",
          "limit",
          "offset"
        ],
        "title": "Page[WatchlistView]",
        "type": "object"
      },
      "PaperFigures": {
        "description": "The model book's result. Every figure is null without two days.",
        "properties": {
          "cagr": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cagr"
          },
          "days": {
            "title": "Days",
            "type": "integer"
          },
          "first_day": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "First Day"
          },
          "latest_day": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Latest Day"
          },
          "latest_value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Latest Value"
          },
          "max_drawdown": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Drawdown"
          },
          "sharpe": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sharpe"
          },
          "sortino": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sortino"
          },
          "total_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Return"
          },
          "trades": {
            "title": "Trades",
            "type": "integer"
          },
          "volatility": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Volatility"
          }
        },
        "required": [
          "days",
          "first_day",
          "latest_day",
          "latest_value",
          "total_return",
          "cagr",
          "sharpe",
          "sortino",
          "max_drawdown",
          "volatility",
          "trades"
        ],
        "title": "PaperFigures",
        "type": "object"
      },
      "ParameterInfo": {
        "properties": {
          "bounds": {
            "anyOf": [
              {
                "items": {},
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bounds"
          },
          "default": {
            "title": "Default"
          },
          "description": {
            "title": "Description",
            "type": "string"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "tunable": {
            "title": "Tunable",
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "kind",
          "tunable",
          "description"
        ],
        "title": "ParameterInfo",
        "type": "object"
      },
      "ParentOrderList": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/ParentOrderView"
            },
            "title": "Items",
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "title": "ParentOrderList",
        "type": "object"
      },
      "ParentOrderView": {
        "description": "A parent order Stonks works as child slices.",
        "properties": {
          "algo": {
            "title": "Algo",
            "type": "string"
          },
          "client_id": {
            "title": "Client Id",
            "type": "string"
          },
          "filled": {
            "title": "Filled",
            "type": "number"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "side": {
            "enum": [
              "buy",
              "sell"
            ],
            "title": "Side",
            "type": "string"
          },
          "slices": {
            "items": {
              "$ref": "#/components/schemas/SliceView"
            },
            "title": "Slices",
            "type": "array"
          },
          "state": {
            "title": "State",
            "type": "string"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "window_end": {
            "format": "date-time",
            "title": "Window End",
            "type": "string"
          },
          "window_start": {
            "format": "date-time",
            "title": "Window Start",
            "type": "string"
          }
        },
        "required": [
          "client_id",
          "portfolio_id",
          "ticker",
          "side",
          "quantity",
          "filled",
          "algo",
          "state",
          "window_start",
          "window_end",
          "slices"
        ],
        "title": "ParentOrderView",
        "type": "object"
      },
      "PasswordChangeRequest": {
        "properties": {
          "current_password": {
            "maxLength": 1024,
            "minLength": 1,
            "title": "Current Password",
            "type": "string"
          },
          "new_password": {
            "maxLength": 1024,
            "minLength": 1,
            "title": "New Password",
            "type": "string"
          }
        },
        "required": [
          "current_password",
          "new_password"
        ],
        "title": "PasswordChangeRequest",
        "type": "object"
      },
      "PasswordResetRequest": {
        "properties": {
          "new_password": {
            "maxLength": 1024,
            "minLength": 1,
            "title": "New Password",
            "type": "string"
          }
        },
        "required": [
          "new_password"
        ],
        "title": "PasswordResetRequest",
        "type": "object"
      },
      "PausedBookView": {
        "properties": {
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "portfolio_name": {
            "title": "Portfolio Name",
            "type": "string"
          },
          "reason": {
            "title": "Reason",
            "type": "string"
          },
          "strategy_id": {
            "title": "Strategy Id",
            "type": "string"
          },
          "subscription_id": {
            "title": "Subscription Id",
            "type": "string"
          }
        },
        "required": [
          "subscription_id",
          "portfolio_id",
          "portfolio_name",
          "strategy_id",
          "reason"
        ],
        "title": "PausedBookView",
        "type": "object"
      },
      "PayoffLegView": {
        "properties": {
          "expiry": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expiry"
          },
          "instrument": {
            "title": "Instrument",
            "type": "string"
          },
          "kind": {
            "enum": [
              "option",
              "shares"
            ],
            "title": "Kind",
            "type": "string"
          },
          "price": {
            "title": "Price",
            "type": "number"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "right": {
            "anyOf": [
              {
                "enum": [
                  "call",
                  "put"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Right"
          },
          "strike": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strike"
          }
        },
        "required": [
          "instrument",
          "kind",
          "quantity",
          "price"
        ],
        "title": "PayoffLegView",
        "type": "object"
      },
      "PayoffPointView": {
        "properties": {
          "profit": {
            "title": "Profit",
            "type": "number"
          },
          "spot": {
            "title": "Spot",
            "type": "number"
          }
        },
        "required": [
          "spot",
          "profit"
        ],
        "title": "PayoffPointView",
        "type": "object"
      },
      "PdtView": {
        "properties": {
          "applies": {
            "title": "Applies",
            "type": "boolean"
          },
          "day_trades_remaining": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Day Trades Remaining"
          },
          "equity_threshold": {
            "title": "Equity Threshold",
            "type": "number"
          },
          "max_day_trades": {
            "title": "Max Day Trades",
            "type": "integer"
          },
          "window_days": {
            "title": "Window Days",
            "type": "integer"
          }
        },
        "required": [
          "applies",
          "equity_threshold",
          "max_day_trades",
          "window_days",
          "day_trades_remaining"
        ],
        "title": "PdtView",
        "type": "object"
      },
      "PendingActionView": {
        "properties": {
          "arguments": {
            "additionalProperties": true,
            "title": "Arguments",
            "type": "object"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "status": {
            "enum": [
              "pending",
              "approved",
              "rejected",
              "done",
              "failed"
            ],
            "title": "Status",
            "type": "string"
          },
          "tool_call_id": {
            "title": "Tool Call Id",
            "type": "string"
          },
          "tool_name": {
            "title": "Tool Name",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tool_call_id",
          "tool_name",
          "arguments",
          "status",
          "created_at"
        ],
        "title": "PendingActionView",
        "type": "object"
      },
      "PeriodICView": {
        "properties": {
          "end": {
            "title": "End",
            "type": "string"
          },
          "mean_ic": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mean Ic"
          },
          "n_dates": {
            "title": "N Dates",
            "type": "integer"
          },
          "period": {
            "title": "Period",
            "type": "string"
          },
          "spread_mean": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Spread Mean"
          },
          "start": {
            "title": "Start",
            "type": "string"
          },
          "t_stat_hac": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "T Stat Hac"
          }
        },
        "required": [
          "period",
          "start",
          "end",
          "n_dates"
        ],
        "title": "PeriodICView",
        "type": "object"
      },
      "PeriodPnl": {
        "properties": {
          "change": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Value change, deposits and withdrawals included.",
            "title": "Change"
          },
          "change_pct": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "change / start_value (0.05 = +5%).",
            "title": "Change Pct"
          },
          "end_day": {
            "format": "date",
            "title": "End Day",
            "type": "string"
          },
          "end_value": {
            "title": "End Value",
            "type": "number"
          },
          "net_flows": {
            "default": 0.0,
            "description": "Deposits less withdrawals inside the period (roadmap 20.5).",
            "title": "Net Flows",
            "type": "number"
          },
          "period": {
            "enum": [
              "1d",
              "1w",
              "1m",
              "3m",
              "ytd",
              "1y",
              "inception"
            ],
            "title": "Period",
            "type": "string"
          },
          "start_day": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Day of the start value; null without history.",
            "title": "Start Day"
          },
          "start_value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start Value"
          },
          "twr": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Time-weighted return over the period: deposits and withdrawals taken out, so a deposit is never profit. Null without a start value.",
            "title": "Twr"
          }
        },
        "required": [
          "period",
          "start_day",
          "end_day",
          "start_value",
          "end_value",
          "change",
          "change_pct"
        ],
        "title": "PeriodPnl",
        "type": "object"
      },
      "PlanConfirm": {
        "additionalProperties": false,
        "properties": {
          "key": {
            "anyOf": [
              {
                "pattern": "^[A-Za-z0-9_.\\-]{1,64}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Idempotency key. Default: one from the plan's trades.",
            "title": "Key"
          },
          "long_term_rate": {
            "anyOf": [
              {
                "maximum": 1.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Long Term Rate"
          },
          "min_trade_value": {
            "default": 0.0,
            "minimum": 0.0,
            "title": "Min Trade Value",
            "type": "number"
          },
          "portfolio_id": {
            "pattern": "^[A-Za-z0-9_.\\-]{1,64}$",
            "title": "Portfolio Id",
            "type": "string"
          },
          "reason": {
            "maxLength": 500,
            "minLength": 3,
            "title": "Reason",
            "type": "string"
          },
          "short_term_rate": {
            "anyOf": [
              {
                "maximum": 1.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Short Term Rate"
          },
          "source": {
            "description": "strategy: the weights of the strategy's test book; targets: your list.",
            "enum": [
              "strategy",
              "targets"
            ],
            "title": "Source",
            "type": "string"
          },
          "strategy_id": {
            "anyOf": [
              {
                "pattern": "^[A-Za-z0-9_.\\-]{1,64}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Id"
          },
          "targets": {
            "items": {
              "$ref": "#/components/schemas/PlanTarget"
            },
            "maxItems": 500,
            "title": "Targets",
            "type": "array"
          }
        },
        "required": [
          "portfolio_id",
          "source",
          "reason"
        ],
        "title": "PlanConfirm",
        "type": "object"
      },
      "PlanConfirmResult": {
        "properties": {
          "key": {
            "title": "Key",
            "type": "string"
          },
          "plan": {
            "$ref": "#/components/schemas/RebalancePlanView"
          },
          "ticket_ids": {
            "items": {
              "type": "string"
            },
            "title": "Ticket Ids",
            "type": "array"
          },
          "written": {
            "description": "New tickets. A repeat of the same key writes none.",
            "title": "Written",
            "type": "integer"
          }
        },
        "required": [
          "plan",
          "key",
          "ticket_ids",
          "written"
        ],
        "title": "PlanConfirmResult",
        "type": "object"
      },
      "PlanLineView": {
        "properties": {
          "cost": {
            "title": "Cost",
            "type": "number"
          },
          "cost_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cost Bps"
          },
          "current_quantity": {
            "title": "Current Quantity",
            "type": "number"
          },
          "current_weight": {
            "title": "Current Weight",
            "type": "number"
          },
          "price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Price"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "side": {
            "anyOf": [
              {
                "enum": [
                  "buy",
                  "sell"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Side"
          },
          "skipped": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Skipped"
          },
          "target_quantity": {
            "title": "Target Quantity",
            "type": "number"
          },
          "target_weight": {
            "title": "Target Weight",
            "type": "number"
          },
          "tax": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PlanTaxView"
              },
              {
                "type": "null"
              }
            ]
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "value": {
            "title": "Value",
            "type": "number"
          },
          "weight_after": {
            "title": "Weight After",
            "type": "number"
          }
        },
        "required": [
          "ticker",
          "price",
          "current_quantity",
          "current_weight",
          "target_weight",
          "target_quantity",
          "side",
          "quantity",
          "value",
          "cost_bps",
          "cost",
          "weight_after",
          "skipped",
          "tax"
        ],
        "title": "PlanLineView",
        "type": "object"
      },
      "PlanRequest": {
        "additionalProperties": false,
        "properties": {
          "long_term_rate": {
            "anyOf": [
              {
                "maximum": 1.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Long Term Rate"
          },
          "min_trade_value": {
            "default": 0.0,
            "minimum": 0.0,
            "title": "Min Trade Value",
            "type": "number"
          },
          "portfolio_id": {
            "pattern": "^[A-Za-z0-9_.\\-]{1,64}$",
            "title": "Portfolio Id",
            "type": "string"
          },
          "short_term_rate": {
            "anyOf": [
              {
                "maximum": 1.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Short Term Rate"
          },
          "source": {
            "description": "strategy: the weights of the strategy's test book; targets: your list.",
            "enum": [
              "strategy",
              "targets"
            ],
            "title": "Source",
            "type": "string"
          },
          "strategy_id": {
            "anyOf": [
              {
                "pattern": "^[A-Za-z0-9_.\\-]{1,64}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Id"
          },
          "targets": {
            "items": {
              "$ref": "#/components/schemas/PlanTarget"
            },
            "maxItems": 500,
            "title": "Targets",
            "type": "array"
          }
        },
        "required": [
          "portfolio_id",
          "source"
        ],
        "title": "PlanRequest",
        "type": "object"
      },
      "PlanTarget": {
        "additionalProperties": false,
        "properties": {
          "ticker": {
            "pattern": "^[A-Za-z0-9._\\-^=:]{1,40}$",
            "title": "Ticker",
            "type": "string"
          },
          "weight": {
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Weight",
            "type": "number"
          }
        },
        "required": [
          "ticker",
          "weight"
        ],
        "title": "PlanTarget",
        "type": "object"
      },
      "PlanTaxView": {
        "properties": {
          "estimated_tax": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Estimated Tax"
          },
          "gain": {
            "title": "Gain",
            "type": "number"
          },
          "long_term_gain": {
            "title": "Long Term Gain",
            "type": "number"
          },
          "lots": {
            "items": {
              "$ref": "#/components/schemas/LotSaleView"
            },
            "title": "Lots",
            "type": "array"
          },
          "short_term_gain": {
            "title": "Short Term Gain",
            "type": "number"
          }
        },
        "required": [
          "lots",
          "gain",
          "short_term_gain",
          "long_term_gain",
          "estimated_tax"
        ],
        "title": "PlanTaxView",
        "type": "object"
      },
      "PlateauOverlayView": {
        "description": "The plateau test's verdict on the tuned set, laid over the map.",
        "properties": {
          "metrics": {
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            },
            "default": {},
            "title": "Metrics",
            "type": "object"
          },
          "notes": {
            "title": "Notes",
            "type": "string"
          },
          "passed": {
            "title": "Passed",
            "type": "boolean"
          },
          "step": {
            "title": "Step",
            "type": "number"
          },
          "x_range": {
            "anyOf": [
              {
                "items": {
                  "type": "number"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "X Range"
          },
          "y_range": {
            "anyOf": [
              {
                "items": {
                  "type": "number"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Y Range"
          }
        },
        "required": [
          "passed",
          "notes",
          "step"
        ],
        "title": "PlateauOverlayView",
        "type": "object"
      },
      "PlaybookCreate": {
        "additionalProperties": false,
        "properties": {
          "description": {
            "anyOf": [
              {
                "maxLength": 2000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "name": {
            "maxLength": 60,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "PlaybookCreate",
        "type": "object"
      },
      "PlaybookUpdate": {
        "additionalProperties": false,
        "properties": {
          "archived": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Archived"
          },
          "description": {
            "anyOf": [
              {
                "maxLength": 2000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 60,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          }
        },
        "title": "PlaybookUpdate",
        "type": "object"
      },
      "PlaybookView": {
        "properties": {
          "archived": {
            "title": "Archived",
            "type": "boolean"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "archived",
          "created_at",
          "updated_at"
        ],
        "title": "PlaybookView",
        "type": "object"
      },
      "PnlCalendarView": {
        "description": "Realised P&L of closed legs by exit day, ISO week and month.",
        "properties": {
          "base_currency": {
            "title": "Base Currency",
            "type": "string"
          },
          "best_day": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Best Day"
          },
          "days": {
            "items": {
              "$ref": "#/components/schemas/CalendarBucketView"
            },
            "title": "Days",
            "type": "array"
          },
          "fx_missing": {
            "items": {
              "type": "string"
            },
            "title": "Fx Missing",
            "type": "array"
          },
          "months": {
            "items": {
              "$ref": "#/components/schemas/CalendarBucketView"
            },
            "title": "Months",
            "type": "array"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "since": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Since"
          },
          "total": {
            "title": "Total",
            "type": "number"
          },
          "trades": {
            "title": "Trades",
            "type": "integer"
          },
          "unconverted": {
            "title": "Unconverted",
            "type": "integer"
          },
          "until": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Until"
          },
          "weeks": {
            "items": {
              "$ref": "#/components/schemas/CalendarBucketView"
            },
            "title": "Weeks",
            "type": "array"
          },
          "worst_day": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Worst Day"
          }
        },
        "required": [
          "portfolio_id",
          "base_currency",
          "since",
          "until",
          "days",
          "weeks",
          "months",
          "total",
          "trades",
          "best_day",
          "worst_day",
          "unconverted",
          "fx_missing"
        ],
        "title": "PnlCalendarView",
        "type": "object"
      },
      "PnlRowView": {
        "properties": {
          "cumulative_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cumulative Return"
          },
          "daily_change": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Daily Change"
          },
          "daily_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Daily Return"
          },
          "day": {
            "format": "date",
            "title": "Day",
            "type": "string"
          },
          "days_elapsed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Days Elapsed"
          },
          "drawdown": {
            "title": "Drawdown",
            "type": "number"
          },
          "total_value": {
            "title": "Total Value",
            "type": "number"
          }
        },
        "required": [
          "day",
          "total_value",
          "daily_change",
          "daily_return",
          "cumulative_return",
          "drawdown"
        ],
        "title": "PnlRowView",
        "type": "object"
      },
      "PnlSeries": {
        "description": "One row per day. ``strategy_id`` is ``None`` for the real portfolio\nand a shadow strategy's id for its virtual portfolio.",
        "properties": {
          "base_currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Base Currency"
          },
          "base_rows": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/PnlRowView"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Base Rows"
          },
          "day_change": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DayChangeView"
              },
              {
                "type": "null"
              }
            ]
          },
          "fx_missing": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Fx Missing",
            "type": "array"
          },
          "mwr": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mwr"
          },
          "net_flows": {
            "default": 0.0,
            "title": "Net Flows",
            "type": "number"
          },
          "rows": {
            "items": {
              "$ref": "#/components/schemas/PnlRowView"
            },
            "title": "Rows",
            "type": "array"
          },
          "strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Id"
          },
          "twr": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Twr"
          }
        },
        "required": [
          "strategy_id",
          "rows"
        ],
        "title": "PnlSeries",
        "type": "object"
      },
      "PortalLinkView": {
        "properties": {
          "connection_id": {
            "title": "Connection Id",
            "type": "string"
          },
          "expires_at": {
            "format": "date-time",
            "title": "Expires At",
            "type": "string"
          },
          "url": {
            "title": "Url",
            "type": "string"
          }
        },
        "required": [
          "connection_id",
          "url",
          "expires_at"
        ],
        "title": "PortalLinkView",
        "type": "object"
      },
      "PortfolioCreate": {
        "additionalProperties": false,
        "description": "A new paper portfolio of yours (simulated fills on the Stonks ledger).\nBroker portfolios come from linking a broker connection.",
        "properties": {
          "base_currency": {
            "default": "USD",
            "pattern": "^[A-Z]{3}$",
            "title": "Base Currency",
            "type": "string"
          },
          "initial_cash": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "maximum": 1000000000000.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Starting cash. Default: the configured amount.",
            "title": "Initial Cash"
          },
          "name": {
            "maxLength": 80,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "PortfolioCreate",
        "type": "object"
      },
      "PortfolioRename": {
        "additionalProperties": false,
        "properties": {
          "name": {
            "maxLength": 80,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name"
        ],
        "title": "PortfolioRename",
        "type": "object"
      },
      "PortfolioSubmitView": {
        "properties": {
          "failed": {
            "title": "Failed",
            "type": "integer"
          },
          "held": {
            "title": "Held",
            "type": "integer"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "sent": {
            "title": "Sent",
            "type": "integer"
          },
          "status": {
            "enum": [
              "ok",
              "partial",
              "skipped",
              "error"
            ],
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "portfolio_id",
          "status",
          "sent",
          "failed",
          "held",
          "reason"
        ],
        "title": "PortfolioSubmitView",
        "type": "object"
      },
      "PortfolioSummaryView": {
        "properties": {
          "base_currency": {
            "title": "Base Currency",
            "type": "string"
          },
          "broker_connection_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Broker Connection Id"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "initial_cash": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Initial Cash"
          },
          "is_default": {
            "default": false,
            "title": "Is Default",
            "type": "boolean"
          },
          "kind": {
            "enum": [
              "simulated",
              "broker"
            ],
            "title": "Kind",
            "type": "string"
          },
          "live_stage": {
            "default": "sim_paper",
            "enum": [
              "sim_paper",
              "broker_paper",
              "live_small",
              "live_scale"
            ],
            "title": "Live Stage",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "status": {
            "enum": [
              "active",
              "paused",
              "archived"
            ],
            "title": "Status",
            "type": "string"
          },
          "trading": {
            "enum": [
              "paper",
              "live"
            ],
            "title": "Trading",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "kind",
          "status",
          "base_currency",
          "initial_cash",
          "broker_connection_id",
          "trading",
          "created_at"
        ],
        "title": "PortfolioSummaryView",
        "type": "object"
      },
      "PortfolioSyncView": {
        "properties": {
          "activities_new": {
            "title": "Activities New",
            "type": "integer"
          },
          "activities_seen": {
            "title": "Activities Seen",
            "type": "integer"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "external_account_id": {
            "title": "External Account Id",
            "type": "string"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "positions": {
            "title": "Positions",
            "type": "integer"
          },
          "snapshot_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Snapshot Id"
          },
          "unmapped": {
            "items": {
              "type": "string"
            },
            "title": "Unmapped",
            "type": "array"
          }
        },
        "required": [
          "portfolio_id",
          "external_account_id",
          "snapshot_id",
          "positions",
          "unmapped",
          "activities_new",
          "activities_seen",
          "error"
        ],
        "title": "PortfolioSyncView",
        "type": "object"
      },
      "PortfolioTotalsView": {
        "description": "Sums over every active portfolio's latest snapshot, for admins. No\ntickers and no per-person numbers (decision 2026-09-26).",
        "properties": {
          "cash": {
            "title": "Cash",
            "type": "number"
          },
          "last_run": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/LastRunTotalsView"
              },
              {
                "type": "null"
              }
            ],
            "description": "The latest finished trading run's order and fill counts across every book (null before the first run). Traders see only their own books' counts on the runs list; this is the one place with the whole run."
          },
          "owners": {
            "description": "People who own those portfolios.",
            "title": "Owners",
            "type": "integer"
          },
          "portfolios": {
            "description": "Active portfolios with at least one snapshot.",
            "title": "Portfolios",
            "type": "integer"
          },
          "suppressed": {
            "default": false,
            "description": "True when too few other people own books for the sums to hide anyone's numbers: cash and value then read 0.",
            "title": "Suppressed",
            "type": "boolean"
          },
          "total_value": {
            "description": "Sum of each book's value at its latest snapshot.",
            "title": "Total Value",
            "type": "number"
          }
        },
        "required": [
          "portfolios",
          "owners",
          "cash",
          "total_value"
        ],
        "title": "PortfolioTotalsView",
        "type": "object"
      },
      "PortfolioView": {
        "properties": {
          "base_currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The portfolio's base (reporting) currency.",
            "title": "Base Currency"
          },
          "cash": {
            "title": "Cash",
            "type": "number"
          },
          "cost_basis": {
            "default": 0.0,
            "description": "Sum of the positions' cost_basis (positions with a known cost).",
            "title": "Cost Basis",
            "type": "number"
          },
          "currency": {
            "default": "USD",
            "description": "Reporting currency: the currency every held instrument shares, else the portfolio's base currency (also for an empty book; an instrument with an unknown currency counts as the base currency). Amounts are not FX-converted.",
            "title": "Currency",
            "type": "string"
          },
          "fx_missing": {
            "description": "Held currencies with no stored FX rate to the base currency.",
            "items": {
              "type": "string"
            },
            "title": "Fx Missing",
            "type": "array"
          },
          "positions": {
            "items": {
              "$ref": "#/components/schemas/PositionView"
            },
            "title": "Positions",
            "type": "array"
          },
          "positions_value": {
            "title": "Positions Value",
            "type": "number"
          },
          "positions_value_base": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "positions_value in the base currency; null when a held currency has no FX rate (see fx_missing).",
            "title": "Positions Value Base"
          },
          "snapshot_total_value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Snapshot Total Value"
          },
          "taken_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Taken At"
          },
          "tick_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tick Id"
          },
          "total_value": {
            "title": "Total Value",
            "type": "number"
          },
          "total_value_base": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Cash (kept in the base currency) plus positions_value_base; null when a held currency has no FX rate.",
            "title": "Total Value Base"
          },
          "unrealized_pnl": {
            "default": 0.0,
            "description": "Sum of the positions' unrealized_pnl (priced, known cost).",
            "title": "Unrealized Pnl",
            "type": "number"
          }
        },
        "required": [
          "taken_at",
          "tick_id",
          "cash",
          "positions",
          "positions_value",
          "total_value",
          "snapshot_total_value"
        ],
        "title": "PortfolioView",
        "type": "object"
      },
      "PortfolioVolSettings": {
        "additionalProperties": false,
        "properties": {
          "shock_cap": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Shock Cap"
          },
          "vol_cap": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Vol Cap"
          }
        },
        "title": "PortfolioVolSettings",
        "type": "object"
      },
      "PositionView": {
        "properties": {
          "avg_cost": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Average cost per share from the fill history (weighted average, fees included); null when the ledger has no fills for the position.",
            "title": "Avg Cost"
          },
          "cost_basis": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "avg_cost * quantity * multiplier.",
            "title": "Cost Basis"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The instrument's trading currency; null when unknown.",
            "title": "Currency"
          },
          "market_value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Market Value"
          },
          "market_value_base": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "market_value in the portfolio's base currency, at the FX rate of the price date; null when unpriced or no FX rate is stored.",
            "title": "Market Value Base"
          },
          "multiplier": {
            "default": 1.0,
            "description": "Units per contract: 1 for a stock, 100 for a standard option. price and avg_cost are per unit; market_value, cost_basis and unrealized_pnl count it.",
            "title": "Multiplier",
            "type": "number"
          },
          "price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Price"
          },
          "price_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Price Date"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "unrealized_pnl": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "(price - avg_cost) * quantity * multiplier at the latest stored close (an option's latest quote mark).",
            "title": "Unrealized Pnl"
          },
          "unrealized_pnl_pct": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "unrealized_pnl / |cost_basis| (0.05 = +5%).",
            "title": "Unrealized Pnl Pct"
          },
          "weight": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Weight"
          }
        },
        "required": [
          "ticker",
          "quantity",
          "price",
          "price_date",
          "market_value",
          "weight"
        ],
        "title": "PositionView",
        "type": "object"
      },
      "PreferenceItem": {
        "properties": {
          "category": {
            "enum": [
              "signal",
              "order",
              "risk",
              "system",
              "price_alert",
              "event_alert",
              "screen_alert"
            ],
            "title": "Category",
            "type": "string"
          },
          "channel": {
            "maxLength": 64,
            "minLength": 1,
            "title": "Channel",
            "type": "string"
          },
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "strategy_id": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Id"
          }
        },
        "required": [
          "category",
          "channel",
          "enabled"
        ],
        "title": "PreferenceItem",
        "type": "object"
      },
      "PreferencesUpdate": {
        "description": "Only what is given changes.",
        "properties": {
          "economic_alerts": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EconomicAlertsUpdate"
              },
              {
                "type": "null"
              }
            ]
          },
          "event_alerts": {
            "items": {
              "$ref": "#/components/schemas/EventAlertSwitchItem"
            },
            "maxItems": 20,
            "title": "Event Alerts",
            "type": "array"
          },
          "preferences": {
            "items": {
              "$ref": "#/components/schemas/PreferenceItem"
            },
            "maxItems": 200,
            "title": "Preferences",
            "type": "array"
          }
        },
        "title": "PreferencesUpdate",
        "type": "object"
      },
      "PreferencesView": {
        "properties": {
          "channel_defaults": {
            "items": {
              "$ref": "#/components/schemas/ChannelDefaultView"
            },
            "title": "Channel Defaults",
            "type": "array"
          },
          "channels": {
            "items": {
              "type": "string"
            },
            "title": "Channels",
            "type": "array"
          },
          "economic_alerts": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/EconomicAlertsView"
              },
              {
                "type": "null"
              }
            ]
          },
          "event_alerts": {
            "items": {
              "$ref": "#/components/schemas/EventAlertSwitchView"
            },
            "title": "Event Alerts",
            "type": "array"
          },
          "preferences": {
            "items": {
              "$ref": "#/components/schemas/PreferenceItem"
            },
            "title": "Preferences",
            "type": "array"
          },
          "quiet_end": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Quiet End"
          },
          "quiet_start": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Quiet Start"
          },
          "timezone": {
            "title": "Timezone",
            "type": "string"
          },
          "webhook": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Webhook"
          }
        },
        "required": [
          "preferences",
          "quiet_start",
          "quiet_end",
          "timezone",
          "webhook",
          "channels"
        ],
        "title": "PreferencesView",
        "type": "object"
      },
      "PreflightIssueView": {
        "properties": {
          "code": {
            "title": "Code",
            "type": "string"
          },
          "details": {
            "additionalProperties": true,
            "default": {},
            "title": "Details",
            "type": "object"
          },
          "message": {
            "title": "Message",
            "type": "string"
          },
          "severity": {
            "enum": [
              "error",
              "warning"
            ],
            "title": "Severity",
            "type": "string"
          }
        },
        "required": [
          "code",
          "severity",
          "message"
        ],
        "title": "PreflightIssueView",
        "type": "object"
      },
      "PreflightView": {
        "description": "The BL-37 data preflight of a lab run. A run only starts with no\nerrors, so a result carries warnings (and ``ok`` true).",
        "properties": {
          "issues": {
            "items": {
              "$ref": "#/components/schemas/PreflightIssueView"
            },
            "title": "Issues",
            "type": "array"
          },
          "ok": {
            "title": "Ok",
            "type": "boolean"
          },
          "skipped": {
            "title": "Skipped",
            "type": "boolean"
          }
        },
        "required": [
          "ok",
          "skipped",
          "issues"
        ],
        "title": "PreflightView",
        "type": "object"
      },
      "PreviewAccountView": {
        "properties": {
          "account_type": {
            "title": "Account Type",
            "type": "string"
          },
          "available_funds": {
            "title": "Available Funds",
            "type": "number"
          },
          "buying_power": {
            "title": "Buying Power",
            "type": "number"
          },
          "cash": {
            "title": "Cash",
            "type": "number"
          },
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "equity": {
            "title": "Equity",
            "type": "number"
          },
          "settled_cash": {
            "title": "Settled Cash",
            "type": "number"
          }
        },
        "required": [
          "equity",
          "cash",
          "settled_cash",
          "available_funds",
          "buying_power",
          "currency",
          "account_type"
        ],
        "title": "PreviewAccountView",
        "type": "object"
      },
      "PreviewLotView": {
        "properties": {
          "acquired": {
            "format": "date",
            "title": "Acquired",
            "type": "string"
          },
          "cost_basis": {
            "title": "Cost Basis",
            "type": "number"
          },
          "gain": {
            "title": "Gain",
            "type": "number"
          },
          "holding_period": {
            "enum": [
              "short",
              "long"
            ],
            "title": "Holding Period",
            "type": "string"
          },
          "kind": {
            "enum": [
              "long",
              "short"
            ],
            "title": "Kind",
            "type": "string"
          },
          "open_fill_id": {
            "description": "The fill that opened the lot.",
            "title": "Open Fill Id",
            "type": "integer"
          },
          "proceeds": {
            "title": "Proceeds",
            "type": "number"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "wash_sale_disallowed": {
            "title": "Wash Sale Disallowed",
            "type": "number"
          }
        },
        "required": [
          "open_fill_id",
          "kind",
          "quantity",
          "acquired",
          "holding_period",
          "cost_basis",
          "proceeds",
          "gain",
          "wash_sale_disallowed"
        ],
        "title": "PreviewLotView",
        "type": "object"
      },
      "PreviewOrderView": {
        "properties": {
          "adjustments": {
            "items": {
              "$ref": "#/components/schemas/AdjustmentView"
            },
            "title": "Adjustments",
            "type": "array"
          },
          "client_id": {
            "title": "Client Id",
            "type": "string"
          },
          "limit_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit Price"
          },
          "notional": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notional"
          },
          "order_type": {
            "title": "Order Type",
            "type": "string"
          },
          "position_effect": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Position Effect"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "side": {
            "title": "Side",
            "type": "string"
          },
          "strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Id"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "time_in_force": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Time In Force"
          },
          "what_if": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WhatIfView"
              },
              {
                "type": "null"
              }
            ]
          },
          "what_if_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "What If Error"
          }
        },
        "required": [
          "client_id",
          "ticker",
          "side",
          "quantity",
          "order_type",
          "limit_price",
          "time_in_force",
          "position_effect",
          "strategy_id",
          "notional",
          "what_if",
          "what_if_error",
          "adjustments"
        ],
        "title": "PreviewOrderView",
        "type": "object"
      },
      "PriceAlertCreate": {
        "additionalProperties": false,
        "description": "A rule on one ticker (``ticker``) or on one of your watchlists\n(``watchlist_id``), not both.",
        "properties": {
          "condition": {
            "enum": [
              "crosses_above",
              "crosses_below",
              "moves_pct"
            ],
            "title": "Condition",
            "type": "string"
          },
          "enabled": {
            "default": true,
            "title": "Enabled",
            "type": "boolean"
          },
          "level": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "The price to watch (crossings).",
            "title": "Level"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 80,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "pct": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "maximum": 1000.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Percent move, either way (moves_pct).",
            "title": "Pct"
          },
          "ticker": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ticker"
          },
          "watchlist_id": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Watchlist Id"
          },
          "window_days": {
            "anyOf": [
              {
                "maximum": 365.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Calendar days the move is measured over.",
            "title": "Window Days"
          }
        },
        "required": [
          "condition"
        ],
        "title": "PriceAlertCreate",
        "type": "object"
      },
      "PriceAlertEventView": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "detail": {
            "title": "Detail",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "observed_at": {
            "title": "Observed At",
            "type": "string"
          },
          "price": {
            "title": "Price",
            "type": "number"
          },
          "rule_id": {
            "title": "Rule Id",
            "type": "string"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "id",
          "rule_id",
          "ticker",
          "observed_at",
          "price",
          "detail",
          "created_at"
        ],
        "title": "PriceAlertEventView",
        "type": "object"
      },
      "PriceAlertRunRequest": {
        "additionalProperties": false,
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          }
        },
        "title": "PriceAlertRunRequest",
        "type": "object"
      },
      "PriceAlertRunView": {
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "checked": {
            "title": "Checked",
            "type": "integer"
          },
          "fired": {
            "title": "Fired",
            "type": "integer"
          },
          "published": {
            "title": "Published",
            "type": "integer"
          },
          "rules": {
            "title": "Rules",
            "type": "integer"
          },
          "skipped_no_price": {
            "title": "Skipped No Price",
            "type": "integer"
          }
        },
        "required": [
          "as_of",
          "rules",
          "checked",
          "fired",
          "published",
          "skipped_no_price"
        ],
        "title": "PriceAlertRunView",
        "type": "object"
      },
      "PriceAlertUpdate": {
        "additionalProperties": false,
        "description": "Change the name, the thresholds or switch the rule on or off. The\ntarget and the condition stay (make a new rule for another one).",
        "properties": {
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled"
          },
          "level": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "The price to watch (crossings).",
            "title": "Level"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 80,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "pct": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "maximum": 1000.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Percent move, either way (moves_pct).",
            "title": "Pct"
          },
          "window_days": {
            "anyOf": [
              {
                "maximum": 365.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Calendar days the move is measured over.",
            "title": "Window Days"
          }
        },
        "title": "PriceAlertUpdate",
        "type": "object"
      },
      "PriceAlertView": {
        "properties": {
          "condition": {
            "enum": [
              "crosses_above",
              "crosses_below",
              "moves_pct"
            ],
            "title": "Condition",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "last_seen": {
            "additionalProperties": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Last Seen",
            "type": "object"
          },
          "level": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Level"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "pct": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pct"
          },
          "target_kind": {
            "enum": [
              "ticker",
              "watchlist"
            ],
            "title": "Target Kind",
            "type": "string"
          },
          "ticker": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ticker"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "watchlist_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Watchlist Id"
          },
          "window_days": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Window Days"
          }
        },
        "required": [
          "id",
          "name",
          "target_kind",
          "ticker",
          "watchlist_id",
          "condition",
          "level",
          "pct",
          "window_days",
          "enabled",
          "created_at",
          "updated_at"
        ],
        "title": "PriceAlertView",
        "type": "object"
      },
      "PriceBandSettings": {
        "additionalProperties": false,
        "properties": {
          "band_pct": {
            "anyOf": [
              {
                "exclusiveMaximum": 1.0,
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Band Pct"
          },
          "delayed_band_pct": {
            "default": 0.01,
            "exclusiveMaximum": 1.0,
            "exclusiveMinimum": 0.0,
            "title": "Delayed Band Pct",
            "type": "number"
          },
          "max_gap_pct": {
            "anyOf": [
              {
                "exclusiveMaximum": 1.0,
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Gap Pct"
          },
          "nbbo_band_pct": {
            "default": 0.01,
            "exclusiveMaximum": 1.0,
            "exclusiveMinimum": 0.0,
            "title": "Nbbo Band Pct",
            "type": "number"
          }
        },
        "title": "PriceBandSettings",
        "type": "object"
      },
      "PriceCheckItemView": {
        "properties": {
          "adjustment_gap": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Adjustment Gap"
          },
          "close_gap": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Close Gap"
          },
          "detail": {
            "title": "Detail",
            "type": "string"
          },
          "second_close": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Second Close"
          },
          "source": {
            "default": "",
            "title": "Source",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "vendor_close": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Vendor Close"
          },
          "vendor_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Vendor Date"
          }
        },
        "required": [
          "ticker",
          "status",
          "detail"
        ],
        "title": "PriceCheckItemView",
        "type": "object"
      },
      "PriceCheckRunBody": {
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          }
        },
        "title": "PriceCheckRunBody",
        "type": "object"
      },
      "PriceCheckRunView": {
        "properties": {
          "check": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/PriceCheckView"
              },
              {
                "type": "null"
              }
            ]
          },
          "ran": {
            "title": "Ran",
            "type": "boolean"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          }
        },
        "required": [
          "ran"
        ],
        "title": "PriceCheckRunView",
        "type": "object"
      },
      "PriceCheckView": {
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "checked_at": {
            "format": "date-time",
            "title": "Checked At",
            "type": "string"
          },
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Detail"
          },
          "halt_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Halt Id"
          },
          "held": {
            "items": {
              "type": "string"
            },
            "title": "Held",
            "type": "array"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/PriceCheckItemView"
            },
            "title": "Items",
            "type": "array"
          },
          "source": {
            "title": "Source",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "tickers_checked": {
            "title": "Tickers Checked",
            "type": "integer"
          },
          "tickers_compared": {
            "title": "Tickers Compared",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "as_of",
          "checked_at",
          "source",
          "status",
          "tickers_checked",
          "tickers_compared",
          "held",
          "items"
        ],
        "title": "PriceCheckView",
        "type": "object"
      },
      "ProbeView": {
        "properties": {
          "checks": {
            "additionalProperties": {
              "type": "string"
            },
            "title": "Checks",
            "type": "object"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "status"
        ],
        "title": "ProbeView",
        "type": "object"
      },
      "ProblemDetails": {
        "properties": {
          "blockers": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Blockers"
          },
          "code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code"
          },
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Detail"
          },
          "errors": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Errors"
          },
          "failing_checks": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/FailingCheck"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Failing Checks"
          },
          "instance": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Instance"
          },
          "next_step": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Step"
          },
          "risk_adjustments": {
            "anyOf": [
              {
                "items": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Risk Adjustments"
          },
          "status": {
            "title": "Status",
            "type": "integer"
          },
          "title": {
            "title": "Title",
            "type": "string"
          },
          "type": {
            "default": "about:blank",
            "title": "Type",
            "type": "string"
          }
        },
        "required": [
          "title",
          "status"
        ],
        "title": "ProblemDetails",
        "type": "object"
      },
      "PromotionChecklistView": {
        "description": "What a reviewer reads before promoting; it doesn't change the\nverdict. ``None`` for anything not recorded.",
        "properties": {
          "dsr": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Dsr"
          },
          "excess_cagr": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Excess Cagr"
          },
          "hypothesis": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hypothesis"
          },
          "lot_skipped_share": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Lot Skipped Share"
          },
          "min_capital": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Min Capital"
          },
          "n_trials_class": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "N Trials Class"
          },
          "pbo": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pbo"
          },
          "premortem": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Premortem"
          }
        },
        "title": "PromotionChecklistView",
        "type": "object"
      },
      "ProtectiveStopSettings": {
        "additionalProperties": false,
        "properties": {
          "atr_multiple": {
            "default": 3.0,
            "exclusiveMinimum": 0.0,
            "maximum": 50.0,
            "title": "Atr Multiple",
            "type": "number"
          },
          "atr_window": {
            "default": 14,
            "maximum": 250.0,
            "minimum": 2.0,
            "title": "Atr Window",
            "type": "integer"
          },
          "enabled": {
            "default": false,
            "title": "Enabled",
            "type": "boolean"
          },
          "fallback_pct": {
            "default": 0.1,
            "exclusiveMaximum": 1.0,
            "exclusiveMinimum": 0.0,
            "title": "Fallback Pct",
            "type": "number"
          }
        },
        "title": "ProtectiveStopSettings",
        "type": "object"
      },
      "ProvenanceView": {
        "description": "The paper a published factor comes from (roadmap 23.13).",
        "properties": {
          "paper": {
            "title": "Paper",
            "type": "string"
          },
          "published": {
            "title": "Published",
            "type": "integer"
          },
          "reported": {
            "title": "Reported",
            "type": "string"
          },
          "sample_end": {
            "title": "Sample End",
            "type": "integer"
          },
          "sample_start": {
            "title": "Sample Start",
            "type": "integer"
          },
          "t_stat": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "T Stat"
          }
        },
        "required": [
          "paper",
          "published",
          "sample_start",
          "sample_end",
          "reported"
        ],
        "title": "ProvenanceView",
        "type": "object"
      },
      "ProviderView": {
        "properties": {
          "auth_flow": {
            "title": "Auth Flow",
            "type": "string"
          },
          "can_trade": {
            "title": "Can Trade",
            "type": "boolean"
          },
          "capabilities": {
            "items": {
              "type": "string"
            },
            "title": "Capabilities",
            "type": "array"
          },
          "credential_fields": {
            "items": {
              "type": "string"
            },
            "title": "Credential Fields",
            "type": "array"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "gateways": {
            "items": {
              "type": "string"
            },
            "title": "Gateways",
            "type": "array"
          },
          "has_paper": {
            "title": "Has Paper",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "needs_gateway": {
            "title": "Needs Gateway",
            "type": "boolean"
          }
        },
        "required": [
          "name",
          "display_name",
          "auth_flow",
          "capabilities",
          "credential_fields",
          "can_trade",
          "enabled",
          "has_paper",
          "needs_gateway"
        ],
        "title": "ProviderView",
        "type": "object"
      },
      "PushDeviceView": {
        "description": "A registered browser or installed app: no endpoint, no keys.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "endpoint_host": {
            "title": "Endpoint Host",
            "type": "string"
          },
          "failure_count": {
            "title": "Failure Count",
            "type": "integer"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "last_success_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Success At"
          },
          "user_agent": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Agent"
          }
        },
        "required": [
          "id",
          "endpoint_host",
          "user_agent",
          "created_at",
          "last_success_at",
          "failure_count"
        ],
        "title": "PushDeviceView",
        "type": "object"
      },
      "PushKeys": {
        "properties": {
          "auth": {
            "maxLength": 64,
            "minLength": 1,
            "title": "Auth",
            "type": "string"
          },
          "p256dh": {
            "maxLength": 256,
            "minLength": 1,
            "title": "P256Dh",
            "type": "string"
          }
        },
        "required": [
          "p256dh",
          "auth"
        ],
        "title": "PushKeys",
        "type": "object"
      },
      "PushSubscriptionRequest": {
        "description": "The browser's ``PushSubscription.toJSON()`` plus its user agent.",
        "properties": {
          "endpoint": {
            "maxLength": 2048,
            "minLength": 1,
            "title": "Endpoint",
            "type": "string"
          },
          "expirationTime": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expirationtime"
          },
          "keys": {
            "$ref": "#/components/schemas/PushKeys"
          },
          "user_agent": {
            "anyOf": [
              {
                "maxLength": 256,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "User Agent"
          }
        },
        "required": [
          "endpoint",
          "keys"
        ],
        "title": "PushSubscriptionRequest",
        "type": "object"
      },
      "PushUnsubscribeRequest": {
        "properties": {
          "endpoint": {
            "maxLength": 2048,
            "minLength": 1,
            "title": "Endpoint",
            "type": "string"
          }
        },
        "required": [
          "endpoint"
        ],
        "title": "PushUnsubscribeRequest",
        "type": "object"
      },
      "QuantileCurvesView": {
        "properties": {
          "dates": {
            "items": {
              "type": "string"
            },
            "title": "Dates",
            "type": "array"
          },
          "series": {
            "items": {
              "items": {
                "anyOf": [
                  {
                    "type": "number"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "type": "array"
            },
            "title": "Series",
            "type": "array"
          },
          "spread": {
            "items": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            },
            "title": "Spread",
            "type": "array"
          }
        },
        "title": "QuantileCurvesView",
        "type": "object"
      },
      "QuietHoursUpdate": {
        "properties": {
          "end": {
            "anyOf": [
              {
                "maxLength": 5,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "End"
          },
          "start": {
            "anyOf": [
              {
                "maxLength": 5,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start"
          }
        },
        "title": "QuietHoursUpdate",
        "type": "object"
      },
      "RebalancePlanView": {
        "properties": {
          "algo": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "The execution algo the trades would use.",
            "title": "Algo"
          },
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "buys": {
            "title": "Buys",
            "type": "number"
          },
          "cash_after": {
            "title": "Cash After",
            "type": "number"
          },
          "cash_before": {
            "title": "Cash Before",
            "type": "number"
          },
          "cash_weight_after": {
            "title": "Cash Weight After",
            "type": "number"
          },
          "equity": {
            "title": "Equity",
            "type": "number"
          },
          "lines": {
            "items": {
              "$ref": "#/components/schemas/PlanLineView"
            },
            "title": "Lines",
            "type": "array"
          },
          "max_drift_after": {
            "title": "Max Drift After",
            "type": "number"
          },
          "notes": {
            "items": {
              "type": "string"
            },
            "title": "Notes",
            "type": "array"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "sells": {
            "title": "Sells",
            "type": "number"
          },
          "source": {
            "enum": [
              "strategy",
              "targets"
            ],
            "title": "Source",
            "type": "string"
          },
          "strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Id"
          },
          "tax_total": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tax Total"
          },
          "total_cost": {
            "title": "Total Cost",
            "type": "number"
          },
          "turnover": {
            "description": "Traded value over the book's value.",
            "title": "Turnover",
            "type": "number"
          }
        },
        "required": [
          "portfolio_id",
          "source",
          "strategy_id",
          "as_of",
          "equity",
          "cash_before",
          "cash_after",
          "turnover",
          "total_cost",
          "buys",
          "sells",
          "cash_weight_after",
          "max_drift_after",
          "tax_total",
          "algo",
          "lines",
          "notes"
        ],
        "title": "RebalancePlanView",
        "type": "object"
      },
      "ReconcileReportView": {
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Detail"
          },
          "explained": {
            "items": {
              "$ref": "#/components/schemas/DriftItemView"
            },
            "title": "Explained",
            "type": "array"
          },
          "external": {
            "$ref": "#/components/schemas/ExternalView"
          },
          "halt_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Halt Id"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "items": {
            "items": {
              "$ref": "#/components/schemas/DriftItemView"
            },
            "title": "Items",
            "type": "array"
          },
          "kind": {
            "enum": [
              "sod",
              "submit",
              "eod",
              "adhoc"
            ],
            "title": "Kind",
            "type": "string"
          },
          "paused": {
            "items": {
              "type": "string"
            },
            "title": "Paused",
            "type": "array"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "status": {
            "enum": [
              "clean",
              "warn",
              "drift",
              "outage",
              "fault"
            ],
            "title": "Status",
            "type": "string"
          },
          "summary": {
            "additionalProperties": true,
            "title": "Summary",
            "type": "object"
          },
          "taken_at": {
            "title": "Taken At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "portfolio_id",
          "kind",
          "as_of",
          "taken_at",
          "status",
          "items",
          "explained",
          "external",
          "summary",
          "detail",
          "halt_id",
          "paused"
        ],
        "title": "ReconcileReportView",
        "type": "object"
      },
      "RecoveryCodesView": {
        "properties": {
          "recovery_codes": {
            "items": {
              "type": "string"
            },
            "title": "Recovery Codes",
            "type": "array"
          }
        },
        "required": [
          "recovery_codes"
        ],
        "title": "RecoveryCodesView",
        "type": "object"
      },
      "ReliabilityBinView": {
        "properties": {
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "lower": {
            "title": "Lower",
            "type": "number"
          },
          "mean_forecast": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mean Forecast"
          },
          "observed_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Observed Rate"
          },
          "upper": {
            "title": "Upper",
            "type": "number"
          }
        },
        "required": [
          "lower",
          "upper",
          "count",
          "mean_forecast",
          "observed_rate"
        ],
        "title": "ReliabilityBinView",
        "type": "object"
      },
      "ResearchProposalView": {
        "properties": {
          "arguments": {
            "additionalProperties": true,
            "description": "What the model proposed.",
            "title": "Arguments",
            "type": "object"
          },
          "best_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Best Score"
          },
          "budget": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Budget"
          },
          "class_path": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Class Path"
          },
          "cpu_seconds": {
            "title": "Cpu Seconds",
            "type": "number"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "finished_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "hypothesis": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hypothesis"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "lab_run_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The run in the trial ledger.",
            "title": "Lab Run Id"
          },
          "outcome": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Outcome"
          },
          "premortem": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Premortem"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why it was rejected, stopped or failed.",
            "title": "Reason"
          },
          "seq": {
            "title": "Seq",
            "type": "integer"
          },
          "status": {
            "enum": [
              "rejected",
              "running",
              "done",
              "failed",
              "stopped"
            ],
            "title": "Status",
            "type": "string"
          },
          "trials": {
            "title": "Trials",
            "type": "integer"
          },
          "validation_start": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Validation Start"
          },
          "verdict": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Verdict"
          }
        },
        "required": [
          "id",
          "seq",
          "hypothesis",
          "premortem",
          "class_path",
          "arguments",
          "status",
          "reason",
          "validation_start",
          "budget",
          "lab_run_id",
          "verdict",
          "best_score",
          "trials",
          "cpu_seconds",
          "outcome",
          "created_at",
          "finished_at"
        ],
        "title": "ResearchProposalView",
        "type": "object"
      },
      "ResearchRows": {
        "description": "Rows of the research tables plus the artifact files that go with them.",
        "properties": {
          "files": {
            "items": {
              "$ref": "#/components/schemas/ArtifactFile"
            },
            "title": "Files",
            "type": "array"
          },
          "lab_runs": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Lab Runs",
            "type": "array"
          },
          "lab_trials": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Lab Trials",
            "type": "array"
          },
          "strategies": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Strategies",
            "type": "array"
          },
          "survival_reports": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Survival Reports",
            "type": "array"
          }
        },
        "title": "ResearchRows",
        "type": "object"
      },
      "ResearchSessionDetailView": {
        "properties": {
          "cpu_seconds_used": {
            "title": "Cpu Seconds Used",
            "type": "number"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "finished_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "goal": {
            "title": "Goal",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Job Id"
          },
          "max_cpu_seconds": {
            "title": "Max Cpu Seconds",
            "type": "number"
          },
          "max_proposals": {
            "title": "Max Proposals",
            "type": "integer"
          },
          "max_trials": {
            "title": "Max Trials",
            "type": "integer"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "model_cutoff": {
            "description": "The model's training cutoff: validation windows start after it.",
            "format": "date",
            "title": "Model Cutoff",
            "type": "string"
          },
          "prompt_version": {
            "title": "Prompt Version",
            "type": "string"
          },
          "proposals": {
            "items": {
              "$ref": "#/components/schemas/ResearchProposalView"
            },
            "title": "Proposals",
            "type": "array"
          },
          "started_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started At"
          },
          "status": {
            "enum": [
              "queued",
              "running",
              "done",
              "stopped",
              "failed"
            ],
            "title": "Status",
            "type": "string"
          },
          "stop_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop Reason"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary"
          },
          "trials_used": {
            "title": "Trials Used",
            "type": "integer"
          },
          "universe": {
            "items": {
              "type": "string"
            },
            "title": "Universe",
            "type": "array"
          },
          "universe_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Universe Id"
          }
        },
        "required": [
          "id",
          "goal",
          "universe",
          "universe_id",
          "model",
          "model_cutoff",
          "prompt_version",
          "max_trials",
          "max_proposals",
          "max_cpu_seconds",
          "trials_used",
          "cpu_seconds_used",
          "status",
          "stop_reason",
          "summary",
          "job_id",
          "created_at",
          "started_at",
          "finished_at",
          "proposals"
        ],
        "title": "ResearchSessionDetailView",
        "type": "object"
      },
      "ResearchSessionView": {
        "properties": {
          "cpu_seconds_used": {
            "title": "Cpu Seconds Used",
            "type": "number"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "finished_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "goal": {
            "title": "Goal",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "job_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Job Id"
          },
          "max_cpu_seconds": {
            "title": "Max Cpu Seconds",
            "type": "number"
          },
          "max_proposals": {
            "title": "Max Proposals",
            "type": "integer"
          },
          "max_trials": {
            "title": "Max Trials",
            "type": "integer"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "model_cutoff": {
            "description": "The model's training cutoff: validation windows start after it.",
            "format": "date",
            "title": "Model Cutoff",
            "type": "string"
          },
          "prompt_version": {
            "title": "Prompt Version",
            "type": "string"
          },
          "started_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Started At"
          },
          "status": {
            "enum": [
              "queued",
              "running",
              "done",
              "stopped",
              "failed"
            ],
            "title": "Status",
            "type": "string"
          },
          "stop_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stop Reason"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary"
          },
          "trials_used": {
            "title": "Trials Used",
            "type": "integer"
          },
          "universe": {
            "items": {
              "type": "string"
            },
            "title": "Universe",
            "type": "array"
          },
          "universe_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Universe Id"
          }
        },
        "required": [
          "id",
          "goal",
          "universe",
          "universe_id",
          "model",
          "model_cutoff",
          "prompt_version",
          "max_trials",
          "max_proposals",
          "max_cpu_seconds",
          "trials_used",
          "cpu_seconds_used",
          "status",
          "stop_reason",
          "summary",
          "job_id",
          "created_at",
          "started_at",
          "finished_at"
        ],
        "title": "ResearchSessionView",
        "type": "object"
      },
      "ResearchStart": {
        "additionalProperties": false,
        "description": "A research session: what to look for, on which universe, and budgets\nthat may only be lower than the configured ones.",
        "properties": {
          "goal": {
            "description": "What to look for.",
            "maxLength": 2000,
            "minLength": 10,
            "title": "Goal",
            "type": "string"
          },
          "max_cpu_seconds": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "At most the setting.",
            "title": "Max Cpu Seconds"
          },
          "max_proposals": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "At most the setting.",
            "title": "Max Proposals"
          },
          "max_trials": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "At most the setting.",
            "title": "Max Trials"
          },
          "universe": {
            "items": {
              "type": "string"
            },
            "maxItems": 500,
            "title": "Universe",
            "type": "array"
          },
          "universe_id": {
            "anyOf": [
              {
                "pattern": "^[a-z0-9][a-z0-9_.-]{0,63}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Universe Id"
          }
        },
        "required": [
          "goal"
        ],
        "title": "ResearchStart",
        "type": "object"
      },
      "RestoreRequest": {
        "additionalProperties": false,
        "properties": {
          "confirmation": {
            "maxLength": 100,
            "title": "Confirmation",
            "type": "string"
          }
        },
        "required": [
          "confirmation"
        ],
        "title": "RestoreRequest",
        "type": "object"
      },
      "RestoreResultView": {
        "properties": {
          "backup_id": {
            "title": "Backup Id",
            "type": "string"
          },
          "data_dir": {
            "title": "Data Dir",
            "type": "string"
          },
          "lake_migrations_applied": {
            "items": {
              "type": "integer"
            },
            "title": "Lake Migrations Applied",
            "type": "array"
          },
          "next_steps": {
            "items": {
              "type": "string"
            },
            "title": "Next Steps",
            "type": "array"
          },
          "state_migrations_applied": {
            "items": {
              "type": "integer"
            },
            "title": "State Migrations Applied",
            "type": "array"
          }
        },
        "required": [
          "backup_id",
          "data_dir",
          "lake_migrations_applied",
          "state_migrations_applied",
          "next_steps"
        ],
        "title": "RestoreResultView",
        "type": "object"
      },
      "ResumeCheckView": {
        "properties": {
          "detail": {
            "title": "Detail",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "passed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Passed"
          },
          "portfolio_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Id"
          }
        },
        "required": [
          "name",
          "passed",
          "detail"
        ],
        "title": "ResumeCheckView",
        "type": "object"
      },
      "ResumeChecksView": {
        "description": "What is checked before a kill switch resume (roadmap 23.15): per\nportfolio at a real broker, the gateway, the last reconcile, the\naccount and the equity cover of the largest position.",
        "properties": {
          "checks": {
            "items": {
              "$ref": "#/components/schemas/ResumeCheckView"
            },
            "title": "Checks",
            "type": "array"
          },
          "halt_id": {
            "title": "Halt Id",
            "type": "integer"
          },
          "passed": {
            "title": "Passed",
            "type": "boolean"
          }
        },
        "required": [
          "halt_id",
          "passed",
          "checks"
        ],
        "title": "ResumeChecksView",
        "type": "object"
      },
      "ResumeRequest": {
        "additionalProperties": false,
        "properties": {
          "confirmation": {
            "maxLength": 64,
            "title": "Confirmation",
            "type": "string"
          },
          "override_checks": {
            "default": false,
            "title": "Override Checks",
            "type": "boolean"
          },
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "title": "Reason",
            "type": "string"
          }
        },
        "required": [
          "confirmation",
          "reason"
        ],
        "title": "ResumeRequest",
        "type": "object"
      },
      "RetrainOutcomeView": {
        "properties": {
          "detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Detail"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "strategy_id": {
            "title": "Strategy Id",
            "type": "string"
          },
          "train_end": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Train End"
          },
          "train_start": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Train Start"
          },
          "version": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Version"
          }
        },
        "required": [
          "strategy_id",
          "status",
          "version",
          "detail",
          "train_start",
          "train_end"
        ],
        "title": "RetrainOutcomeView",
        "type": "object"
      },
      "RetrainRequest": {
        "additionalProperties": false,
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          },
          "force": {
            "default": false,
            "title": "Force",
            "type": "boolean"
          },
          "strategy_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 200,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Ids"
          },
          "tickers": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 5000,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tickers"
          }
        },
        "title": "RetrainRequest",
        "type": "object"
      },
      "RetrainResultView": {
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "candidates": {
            "title": "Candidates",
            "type": "integer"
          },
          "failed": {
            "title": "Failed",
            "type": "integer"
          },
          "outcomes": {
            "items": {
              "$ref": "#/components/schemas/RetrainOutcomeView"
            },
            "title": "Outcomes",
            "type": "array"
          },
          "skipped": {
            "title": "Skipped",
            "type": "integer"
          }
        },
        "required": [
          "as_of",
          "candidates",
          "failed",
          "skipped",
          "outcomes"
        ],
        "title": "RetrainResultView",
        "type": "object"
      },
      "RiskAdjustmentView": {
        "description": "One order the risk policy clipped or dropped.",
        "properties": {
          "adjusted_quantity": {
            "title": "Adjusted Quantity",
            "type": "number"
          },
          "original_quantity": {
            "title": "Original Quantity",
            "type": "number"
          },
          "reason": {
            "title": "Reason",
            "type": "string"
          },
          "rule": {
            "title": "Rule",
            "type": "string"
          },
          "side": {
            "title": "Side",
            "type": "string"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "ticker",
          "side",
          "rule",
          "original_quantity",
          "adjusted_quantity",
          "reason"
        ],
        "title": "RiskAdjustmentView",
        "type": "object"
      },
      "RiskLimitsUpdate": {
        "additionalProperties": false,
        "properties": {
          "limits": {
            "additionalProperties": true,
            "title": "Limits",
            "type": "object"
          }
        },
        "required": [
          "limits"
        ],
        "title": "RiskLimitsUpdate",
        "type": "object"
      },
      "RiskLimitsView": {
        "properties": {
          "effective": {
            "$ref": "#/components/schemas/RiskPolicy"
          },
          "ignored": {
            "items": {
              "type": "string"
            },
            "title": "Ignored",
            "type": "array"
          },
          "mine": {
            "additionalProperties": true,
            "title": "Mine",
            "type": "object"
          },
          "system": {
            "$ref": "#/components/schemas/RiskPolicy"
          }
        },
        "required": [
          "system",
          "mine",
          "effective",
          "ignored"
        ],
        "title": "RiskLimitsView",
        "type": "object"
      },
      "RiskPerPositionSettings": {
        "additionalProperties": false,
        "properties": {
          "atr_multiple": {
            "default": 3.0,
            "exclusiveMinimum": 0.0,
            "title": "Atr Multiple",
            "type": "number"
          },
          "max_risk": {
            "anyOf": [
              {
                "maximum": 0.05,
                "minimum": 0.0025,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Risk"
          },
          "max_var": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "maximum": 1.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Var"
          }
        },
        "title": "RiskPerPositionSettings",
        "type": "object"
      },
      "RiskPolicy": {
        "additionalProperties": false,
        "description": "Portfolio construction limits applied between ``strategy.decide`` and\nthe broker (``[production.risk]``). Defaults are permissive, so an\nunconfigured install trades exactly what the strategy asks for.\n\nWeights are fractions of total portfolio value (cash + marked positions)\nbefore the tick's orders. Sells are never blocked, only clipped to the\nheld quantity so they cannot open a short.",
        "properties": {
          "cash_buffer_fraction": {
            "default": 0.0,
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Cash Buffer Fraction",
            "type": "number"
          },
          "enabled": {
            "default": true,
            "title": "Enabled",
            "type": "boolean"
          },
          "max_open_positions": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Open Positions"
          },
          "max_weight_per_asset_class": {
            "additionalProperties": {
              "maximum": 1.0,
              "minimum": 0.0,
              "type": "number"
            },
            "default": {},
            "propertyNames": {
              "enum": [
                "equity",
                "crypto",
                "commodity",
                "bond"
              ]
            },
            "title": "Max Weight Per Asset Class",
            "type": "object"
          },
          "max_weight_per_ticker": {
            "default": 1.0,
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Max Weight Per Ticker",
            "type": "number"
          },
          "min_order_notional": {
            "default": 0.0,
            "minimum": 0.0,
            "title": "Min Order Notional",
            "type": "number"
          },
          "rules": {
            "$ref": "#/components/schemas/RuleSettings",
            "default": {
              "account_rules": {
                "enabled": false,
                "margin_accounts": false,
                "margin_buffer": 0.1,
                "pdt_equity_threshold": 25000.0,
                "pdt_max_day_trades": 3,
                "pdt_window_days": 5,
                "settlement_days": {
                  "AS": 2,
                  "BR": 2,
                  "F": 2,
                  "LSE": 2,
                  "MC": 2,
                  "MI": 2,
                  "PA": 2,
                  "SW": 2,
                  "TO": 1,
                  "US": 1,
                  "XETRA": 2,
                  "default": 2
                },
                "short_disclosure_threshold": 0.001,
                "wash_sale_window_days": 30
              },
              "borrow_check": {
                "enabled": false
              },
              "capital_ramp": {
                "enabled": false
              },
              "circuit_breaker": {
                "cooldown": "rest_of_month",
                "week_sessions": 5
              },
              "drawdown_scaling": {},
              "gross_exposure": {},
              "intraday_drawdown": {},
              "intraday_loss_limit": {
                "flatten": false,
                "window_minutes": 5
              },
              "intraday_order_rate": {},
              "intraday_stale_data": {},
              "liquidity": {},
              "live_notional_caps": {},
              "losing_lock": {
                "lock_days": 30,
                "loss_window_days": 90
              },
              "manual_discipline": {
                "enabled": false,
                "require_stop_live": true
              },
              "margin_call": {
                "buffer": 0.0,
                "enabled": false,
                "margin": {
                  "debit_rate_annual": 0.0,
                  "model": "reg_t",
                  "overrides": {},
                  "rates": {
                    "initial_long": 0.5,
                    "initial_short": 0.5,
                    "maintenance_long": 0.25,
                    "maintenance_short": 0.3
                  }
                },
                "reduce_cushion": 0.1,
                "restore_cushion": 0.2,
                "warn_cushion": 0.15
              },
              "max_holding": {},
              "max_orders_per_run": {},
              "net_exposure": {},
              "operational_halt": {},
              "option_greek_limits": {},
              "option_margin": {
                "cash_buffer": 0.0,
                "enabled": false,
                "method": "reg_t"
              },
              "option_max_loss": {},
              "portfolio_vol": {},
              "price_band": {
                "delayed_band_pct": 0.01,
                "nbbo_band_pct": 0.01
              },
              "protective_stops": {
                "atr_multiple": 3.0,
                "atr_window": 14,
                "enabled": false,
                "fallback_pct": 0.1
              },
              "risk_per_position": {
                "atr_multiple": 3.0
              },
              "sector_cap": {
                "look_through": false
              },
              "short_caps": {},
              "short_option_guard": {
                "approval_level": 2,
                "cash_secured": true,
                "enabled": false,
                "min_dte": 0
              },
              "squeeze_guard": {
                "spike_bars": 5
              },
              "stop_cooldown": {},
              "stop_guard": {
                "window_days": 7
              },
              "style_exposure": {
                "styles": [
                  "momentum",
                  "size",
                  "value",
                  "volatility"
                ]
              }
            }
          }
        },
        "title": "RiskPolicy",
        "type": "object"
      },
      "RiskSnapshotView": {
        "description": "One book on one day. Figures are fractions of ``value``; a loss is\npositive. ``strategy_id`` is null for the whole portfolio.",
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "decay_days": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Decay Days"
          },
          "decay_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Decay Reason"
          },
          "decayed": {
            "title": "Decayed",
            "type": "boolean"
          },
          "es_95": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Es 95"
          },
          "es_99": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Es 99"
          },
          "expected_ir": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expected Ir"
          },
          "exposures": {
            "additionalProperties": {
              "type": "number"
            },
            "title": "Exposures",
            "type": "object"
          },
          "ir_long": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ir Long"
          },
          "ir_short": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ir Short"
          },
          "kupiec_p_95": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Kupiec P 95"
          },
          "kupiec_p_99": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Kupiec P 99"
          },
          "observations": {
            "title": "Observations",
            "type": "integer"
          },
          "pnl": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Pnl"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "ratio_out_of_band": {
            "title": "Ratio Out Of Band",
            "type": "boolean"
          },
          "realized_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Realized Return"
          },
          "sigma": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sigma"
          },
          "strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Id"
          },
          "tick_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tick Id"
          },
          "value": {
            "title": "Value",
            "type": "number"
          },
          "var_95": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Var 95"
          },
          "var_99": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Var 99"
          },
          "violation_95": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Violation 95"
          },
          "violation_99": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Violation 99"
          },
          "violation_ratio_95": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Violation Ratio 95"
          },
          "violation_ratio_99": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Violation Ratio 99"
          },
          "violations_95": {
            "title": "Violations 95",
            "type": "integer"
          },
          "violations_99": {
            "title": "Violations 99",
            "type": "integer"
          },
          "window_days": {
            "title": "Window Days",
            "type": "integer"
          }
        },
        "required": [
          "portfolio_id",
          "strategy_id",
          "as_of",
          "tick_id",
          "value",
          "exposures",
          "sigma",
          "var_95",
          "var_99",
          "es_95",
          "es_99",
          "observations",
          "realized_return",
          "pnl",
          "violation_95",
          "violation_99",
          "window_days",
          "violations_95",
          "violations_99",
          "violation_ratio_95",
          "violation_ratio_99",
          "kupiec_p_95",
          "kupiec_p_99",
          "ir_short",
          "ir_long",
          "expected_ir",
          "decay_days",
          "decayed",
          "decay_reason",
          "ratio_out_of_band"
        ],
        "title": "RiskSnapshotView",
        "type": "object"
      },
      "RiskStats": {
        "properties": {
          "current_drawdown": {
            "description": "Latest value against its peak, <= 0.",
            "title": "Current Drawdown",
            "type": "number"
          },
          "expected_shortfall_95": {
            "description": "Mean return at or below var_95.",
            "title": "Expected Shortfall 95",
            "type": "number"
          },
          "max_drawdown": {
            "description": "Worst fall from a peak, <= 0.",
            "title": "Max Drawdown",
            "type": "number"
          },
          "observations": {
            "description": "Daily returns the numbers use.",
            "title": "Observations",
            "type": "integer"
          },
          "var_95": {
            "description": "One-day historical value at risk, a return (loss < 0).",
            "title": "Var 95",
            "type": "number"
          },
          "volatility": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Annualized (252 days) standard deviation.",
            "title": "Volatility"
          }
        },
        "required": [
          "observations",
          "volatility",
          "max_drawdown",
          "current_drawdown",
          "var_95",
          "expected_shortfall_95"
        ],
        "title": "RiskStats",
        "type": "object"
      },
      "RiskSummaryView": {
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          },
          "portfolio": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RiskSnapshotView"
              },
              {
                "type": "null"
              }
            ]
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "strategies": {
            "items": {
              "$ref": "#/components/schemas/RiskSnapshotView"
            },
            "title": "Strategies",
            "type": "array"
          }
        },
        "required": [
          "portfolio_id",
          "as_of",
          "portfolio",
          "strategies"
        ],
        "title": "RiskSummaryView",
        "type": "object"
      },
      "RiskView": {
        "properties": {
          "concentration": {
            "$ref": "#/components/schemas/Concentration"
          },
          "history": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RiskStats"
              },
              {
                "type": "null"
              }
            ],
            "description": "From the portfolio's own daily values; null with under three days."
          },
          "holdings": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/RiskStats"
              },
              {
                "type": "null"
              }
            ],
            "description": "Today's weights applied to the last year of price returns; null without enough prices."
          },
          "returns_as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Last price day behind holdings risk and beta.",
            "title": "Returns As Of"
          }
        },
        "required": [
          "history",
          "holdings",
          "concentration",
          "returns_as_of"
        ],
        "title": "RiskView",
        "type": "object"
      },
      "Role": {
        "enum": [
          "viewer",
          "trader",
          "admin"
        ],
        "title": "Role",
        "type": "string"
      },
      "RuleSettings": {
        "additionalProperties": false,
        "properties": {
          "account_rules": {
            "$ref": "#/components/schemas/AccountRulesSettings",
            "default": {
              "enabled": false,
              "margin_accounts": false,
              "margin_buffer": 0.1,
              "pdt_equity_threshold": 25000.0,
              "pdt_max_day_trades": 3,
              "pdt_window_days": 5,
              "settlement_days": {
                "AS": 2,
                "BR": 2,
                "F": 2,
                "LSE": 2,
                "MC": 2,
                "MI": 2,
                "PA": 2,
                "SW": 2,
                "TO": 1,
                "US": 1,
                "XETRA": 2,
                "default": 2
              },
              "short_disclosure_threshold": 0.001,
              "wash_sale_window_days": 30
            }
          },
          "borrow_check": {
            "$ref": "#/components/schemas/BorrowCheckSettings",
            "default": {
              "enabled": false
            }
          },
          "capital_ramp": {
            "$ref": "#/components/schemas/CapitalRampSettings",
            "default": {
              "enabled": false
            }
          },
          "circuit_breaker": {
            "$ref": "#/components/schemas/CircuitBreakerSettings",
            "default": {
              "cooldown": "rest_of_month",
              "week_sessions": 5
            }
          },
          "drawdown_scaling": {
            "$ref": "#/components/schemas/DrawdownScalingSettings",
            "default": {}
          },
          "gross_exposure": {
            "$ref": "#/components/schemas/GrossExposureSettings",
            "default": {}
          },
          "intraday_drawdown": {
            "$ref": "#/components/schemas/IntradayDrawdownSettings",
            "default": {}
          },
          "intraday_loss_limit": {
            "$ref": "#/components/schemas/IntradayLossLimitSettings",
            "default": {
              "flatten": false,
              "window_minutes": 5
            }
          },
          "intraday_order_rate": {
            "$ref": "#/components/schemas/IntradayOrderRateSettings",
            "default": {}
          },
          "intraday_stale_data": {
            "$ref": "#/components/schemas/IntradayStaleDataSettings",
            "default": {}
          },
          "liquidity": {
            "$ref": "#/components/schemas/LiquiditySettings",
            "default": {}
          },
          "live_notional_caps": {
            "$ref": "#/components/schemas/LiveNotionalCapsSettings",
            "default": {}
          },
          "losing_lock": {
            "$ref": "#/components/schemas/LosingLockSettings",
            "default": {
              "lock_days": 30,
              "loss_window_days": 90
            }
          },
          "manual_discipline": {
            "$ref": "#/components/schemas/ManualDisciplineSettings",
            "default": {
              "enabled": false,
              "require_stop_live": true
            }
          },
          "margin_call": {
            "$ref": "#/components/schemas/MarginCallSettings",
            "default": {
              "buffer": 0.0,
              "enabled": false,
              "margin": {
                "debit_rate_annual": 0.0,
                "model": "reg_t",
                "overrides": {},
                "rates": {
                  "initial_long": 0.5,
                  "initial_short": 0.5,
                  "maintenance_long": 0.25,
                  "maintenance_short": 0.3
                }
              },
              "reduce_cushion": 0.1,
              "restore_cushion": 0.2,
              "warn_cushion": 0.15
            }
          },
          "max_holding": {
            "$ref": "#/components/schemas/MaxHoldingSettings",
            "default": {}
          },
          "max_orders_per_run": {
            "$ref": "#/components/schemas/MaxOrdersPerRunSettings",
            "default": {}
          },
          "net_exposure": {
            "$ref": "#/components/schemas/NetExposureSettings",
            "default": {}
          },
          "operational_halt": {
            "$ref": "#/components/schemas/OperationalHaltSettings",
            "default": {}
          },
          "option_greek_limits": {
            "$ref": "#/components/schemas/OptionGreekLimitsSettings",
            "default": {}
          },
          "option_margin": {
            "$ref": "#/components/schemas/OptionMarginSettings",
            "default": {
              "cash_buffer": 0.0,
              "enabled": false,
              "method": "reg_t"
            }
          },
          "option_max_loss": {
            "$ref": "#/components/schemas/OptionMaxLossSettings",
            "default": {}
          },
          "portfolio_vol": {
            "$ref": "#/components/schemas/PortfolioVolSettings",
            "default": {}
          },
          "price_band": {
            "$ref": "#/components/schemas/PriceBandSettings",
            "default": {
              "delayed_band_pct": 0.01,
              "nbbo_band_pct": 0.01
            }
          },
          "protective_stops": {
            "$ref": "#/components/schemas/ProtectiveStopSettings",
            "default": {
              "atr_multiple": 3.0,
              "atr_window": 14,
              "enabled": false,
              "fallback_pct": 0.1
            }
          },
          "risk_per_position": {
            "$ref": "#/components/schemas/RiskPerPositionSettings",
            "default": {
              "atr_multiple": 3.0
            }
          },
          "sector_cap": {
            "$ref": "#/components/schemas/SectorCapSettings",
            "default": {
              "look_through": false
            }
          },
          "short_caps": {
            "$ref": "#/components/schemas/ShortCapsSettings",
            "default": {}
          },
          "short_option_guard": {
            "$ref": "#/components/schemas/ShortOptionGuardSettings",
            "default": {
              "approval_level": 2,
              "cash_secured": true,
              "enabled": false,
              "min_dte": 0
            }
          },
          "squeeze_guard": {
            "$ref": "#/components/schemas/SqueezeGuardSettings",
            "default": {
              "spike_bars": 5
            }
          },
          "stop_cooldown": {
            "$ref": "#/components/schemas/StopCooldownSettings",
            "default": {}
          },
          "stop_guard": {
            "$ref": "#/components/schemas/StopGuardSettings",
            "default": {
              "window_days": 7
            }
          },
          "style_exposure": {
            "$ref": "#/components/schemas/StyleExposureSettings",
            "default": {
              "styles": [
                "momentum",
                "size",
                "value",
                "volatility"
              ]
            }
          }
        },
        "title": "RuleSettings",
        "type": "object"
      },
      "RuleTemplateView": {
        "properties": {
          "description": {
            "title": "Description",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "spec": {
            "additionalProperties": true,
            "title": "Spec",
            "type": "object"
          },
          "title": {
            "title": "Title",
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "description",
          "spec"
        ],
        "title": "RuleTemplateView",
        "type": "object"
      },
      "RunNowRequest": {
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          }
        },
        "title": "RunNowRequest",
        "type": "object"
      },
      "RunNowView": {
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "job": {
            "title": "Job",
            "type": "string"
          },
          "run_key": {
            "title": "Run Key",
            "type": "string"
          },
          "status": {
            "default": "started",
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "job",
          "run_key",
          "as_of"
        ],
        "title": "RunNowView",
        "type": "object"
      },
      "SavedScreenCreate": {
        "additionalProperties": false,
        "properties": {
          "name": {
            "maxLength": 80,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "spec": {
            "$ref": "#/components/schemas/ScreenSpec"
          }
        },
        "required": [
          "name",
          "spec"
        ],
        "title": "SavedScreenCreate",
        "type": "object"
      },
      "SavedScreenUpdate": {
        "additionalProperties": false,
        "description": "Rename, replace the spec, or both. Unset fields stay.",
        "properties": {
          "name": {
            "anyOf": [
              {
                "maxLength": 80,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "spec": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ScreenSpec"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "SavedScreenUpdate",
        "type": "object"
      },
      "SavedScreenView": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "spec": {
            "$ref": "#/components/schemas/ScreenSpec"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "spec",
          "created_at",
          "updated_at"
        ],
        "title": "SavedScreenView",
        "type": "object"
      },
      "ScheduleView": {
        "properties": {
          "backend": {
            "title": "Backend",
            "type": "string"
          },
          "hosted": {
            "title": "Hosted",
            "type": "boolean"
          },
          "jobs": {
            "items": {
              "$ref": "#/components/schemas/ScheduledJobView"
            },
            "title": "Jobs",
            "type": "array"
          },
          "market": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/MarketSessionsView"
              },
              {
                "type": "null"
              }
            ]
          },
          "recent": {
            "items": {
              "$ref": "#/components/schemas/ScheduledRunView"
            },
            "title": "Recent",
            "type": "array"
          },
          "running": {
            "default": false,
            "title": "Running",
            "type": "boolean"
          }
        },
        "required": [
          "backend",
          "hosted",
          "jobs",
          "recent"
        ],
        "title": "ScheduleView",
        "type": "object"
      },
      "ScheduledJobView": {
        "properties": {
          "action": {
            "title": "Action",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "next_as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next As Of"
          },
          "next_run_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Run At"
          },
          "off_reason": {
            "anyOf": [
              {
                "enum": [
                  "engine_off",
                  "options_off",
                  "no_gateway",
                  "no_live_portfolio",
                  "no_connections",
                  "no_learning_strategies"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Off Reason"
          },
          "trigger": {
            "title": "Trigger",
            "type": "string"
          },
          "trigger_text": {
            "default": "",
            "title": "Trigger Text",
            "type": "string"
          }
        },
        "required": [
          "name",
          "action",
          "trigger",
          "next_run_at",
          "next_as_of"
        ],
        "title": "ScheduledJobView",
        "type": "object"
      },
      "ScheduledRunView": {
        "properties": {
          "action": {
            "title": "Action",
            "type": "string"
          },
          "as_of": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          },
          "catch_up": {
            "title": "Catch Up",
            "type": "boolean"
          },
          "detail": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Detail"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "finished_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "job_name": {
            "title": "Job Name",
            "type": "string"
          },
          "origin": {
            "default": "schedule",
            "enum": [
              "schedule",
              "run_now",
              "outside"
            ],
            "title": "Origin",
            "type": "string"
          },
          "run_key": {
            "title": "Run Key",
            "type": "string"
          },
          "scheduled_for": {
            "format": "date-time",
            "title": "Scheduled For",
            "type": "string"
          },
          "started_at": {
            "format": "date-time",
            "title": "Started At",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "id",
          "job_name",
          "action",
          "run_key",
          "scheduled_for",
          "as_of",
          "status",
          "catch_up",
          "started_at",
          "finished_at",
          "detail",
          "error"
        ],
        "title": "ScheduledRunView",
        "type": "object"
      },
      "ScreenAlertEventView": {
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "matched": {
            "title": "Matched",
            "type": "integer"
          },
          "screen_id": {
            "title": "Screen Id",
            "type": "string"
          },
          "screen_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Screen Name"
          },
          "tickers": {
            "items": {
              "type": "string"
            },
            "title": "Tickers",
            "type": "array"
          }
        },
        "required": [
          "id",
          "screen_id",
          "screen_name",
          "as_of",
          "tickers",
          "matched",
          "created_at"
        ],
        "title": "ScreenAlertEventView",
        "type": "object"
      },
      "ScreenAlertRunRequest": {
        "additionalProperties": false,
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          }
        },
        "title": "ScreenAlertRunRequest",
        "type": "object"
      },
      "ScreenAlertRunView": {
        "properties": {
          "alerts": {
            "title": "Alerts",
            "type": "integer"
          },
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "baselines": {
            "title": "Baselines",
            "type": "integer"
          },
          "failed": {
            "title": "Failed",
            "type": "integer"
          },
          "fired": {
            "title": "Fired",
            "type": "integer"
          },
          "published": {
            "title": "Published",
            "type": "integer"
          },
          "ran": {
            "title": "Ran",
            "type": "integer"
          }
        },
        "required": [
          "as_of",
          "alerts",
          "ran",
          "baselines",
          "fired",
          "published",
          "failed"
        ],
        "title": "ScreenAlertRunView",
        "type": "object"
      },
      "ScreenAlertSet": {
        "additionalProperties": false,
        "description": "Turn an alert on for one of your saved screens, or change it.",
        "properties": {
          "cadence": {
            "default": "daily",
            "enum": [
              "daily",
              "weekly"
            ],
            "title": "Cadence",
            "type": "string"
          },
          "enabled": {
            "default": true,
            "title": "Enabled",
            "type": "boolean"
          },
          "weekday": {
            "anyOf": [
              {
                "maximum": 6.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "description": "Weekly: the day it runs, 0 = Monday.",
            "title": "Weekday"
          }
        },
        "title": "ScreenAlertSet",
        "type": "object"
      },
      "ScreenAlertView": {
        "properties": {
          "cadence": {
            "enum": [
              "daily",
              "weekly"
            ],
            "title": "Cadence",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "last_as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last As Of"
          },
          "last_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Error"
          },
          "matched": {
            "title": "Matched",
            "type": "integer"
          },
          "screen_id": {
            "title": "Screen Id",
            "type": "string"
          },
          "screen_name": {
            "title": "Screen Name",
            "type": "string"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "weekday": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Weekday"
          }
        },
        "required": [
          "screen_id",
          "screen_name",
          "enabled",
          "cadence",
          "weekday",
          "last_as_of",
          "last_error",
          "matched",
          "created_at",
          "updated_at"
        ],
        "title": "ScreenAlertView",
        "type": "object"
      },
      "ScreenResult": {
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "cached": {
            "default": false,
            "title": "Cached",
            "type": "boolean"
          },
          "candidates": {
            "title": "Candidates",
            "type": "integer"
          },
          "matched": {
            "title": "Matched",
            "type": "integer"
          },
          "metrics": {
            "items": {
              "type": "string"
            },
            "title": "Metrics",
            "type": "array"
          },
          "rows": {
            "items": {
              "$ref": "#/components/schemas/ScreenRow"
            },
            "title": "Rows",
            "type": "array"
          },
          "truncated": {
            "title": "Truncated",
            "type": "boolean"
          }
        },
        "required": [
          "as_of",
          "candidates",
          "matched",
          "truncated",
          "metrics",
          "rows"
        ],
        "title": "ScreenResult",
        "type": "object"
      },
      "ScreenRow": {
        "properties": {
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Currency"
          },
          "exchange": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exchange"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "sector": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sector"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "values": {
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            },
            "title": "Values",
            "type": "object"
          }
        },
        "required": [
          "ticker",
          "values"
        ],
        "title": "ScreenRow",
        "type": "object"
      },
      "ScreenRunRequest": {
        "additionalProperties": false,
        "description": "Run ``spec``, or one of your saved screens by ``screen_id``.",
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          },
          "screen_id": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Screen Id"
          },
          "spec": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ScreenSpec"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "title": "ScreenRunRequest",
        "type": "object"
      },
      "ScreenSize": {
        "description": "How big a screen is before any metric is read, and how to run it.",
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "candidates": {
            "title": "Candidates",
            "type": "integer"
          },
          "job_threshold": {
            "title": "Job Threshold",
            "type": "integer"
          },
          "max_candidates": {
            "title": "Max Candidates",
            "type": "integer"
          },
          "over_cap": {
            "title": "Over Cap",
            "type": "boolean"
          },
          "use_job": {
            "title": "Use Job",
            "type": "boolean"
          }
        },
        "required": [
          "as_of",
          "candidates",
          "max_candidates",
          "job_threshold",
          "over_cap",
          "use_job"
        ],
        "title": "ScreenSize",
        "type": "object"
      },
      "ScreenSpec": {
        "additionalProperties": false,
        "properties": {
          "adv_window_bars": {
            "default": 20,
            "maximum": 2520.0,
            "minimum": 1.0,
            "title": "Adv Window Bars",
            "type": "integer"
          },
          "asset_classes": {
            "anyOf": [
              {
                "items": {
                  "enum": [
                    "equity",
                    "crypto",
                    "commodity",
                    "bond"
                  ],
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Asset Classes"
          },
          "columns": {
            "items": {
              "type": "string"
            },
            "maxItems": 20,
            "title": "Columns",
            "type": "array"
          },
          "descending": {
            "default": true,
            "title": "Descending",
            "type": "boolean"
          },
          "exchanges": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exchanges"
          },
          "exclude_sectors": {
            "items": {
              "type": "string"
            },
            "title": "Exclude Sectors",
            "type": "array"
          },
          "filters": {
            "items": {
              "$ref": "#/components/schemas/MetricFilter"
            },
            "maxItems": 20,
            "title": "Filters",
            "type": "array"
          },
          "limit": {
            "anyOf": [
              {
                "maximum": 5000.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit"
          },
          "min_adv": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Min Adv"
          },
          "min_price": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Min Price"
          },
          "sectors": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sectors"
          },
          "sort_by": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sort By"
          },
          "universe_id": {
            "anyOf": [
              {
                "pattern": "^[a-z0-9][a-z0-9_.-]{0,63}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Universe Id"
          }
        },
        "title": "ScreenSpec",
        "type": "object"
      },
      "ScreenUniverseRequest": {
        "additionalProperties": false,
        "description": "Store a screen (``spec`` or ``screen_id``) as a universe.",
        "properties": {
          "description": {
            "anyOf": [
              {
                "maxLength": 2000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "end": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "End"
          },
          "mode": {
            "default": "rule",
            "enum": [
              "rule",
              "snapshot"
            ],
            "title": "Mode",
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "rebalance": {
            "default": "monthly",
            "enum": [
              "weekly",
              "monthly",
              "quarterly"
            ],
            "title": "Rebalance",
            "type": "string"
          },
          "refresh": {
            "default": true,
            "title": "Refresh",
            "type": "boolean"
          },
          "screen_id": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Screen Id"
          },
          "spec": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ScreenSpec"
              },
              {
                "type": "null"
              }
            ]
          },
          "start": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Start"
          },
          "universe_id": {
            "pattern": "^[a-z0-9][a-z0-9_.-]{0,63}$",
            "title": "Universe Id",
            "type": "string"
          }
        },
        "required": [
          "universe_id"
        ],
        "title": "ScreenUniverseRequest",
        "type": "object"
      },
      "ScreenUniverseView": {
        "properties": {
          "refresh_job": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Job"
              },
              {
                "type": "null"
              }
            ]
          },
          "universe": {
            "$ref": "#/components/schemas/UniverseView"
          },
          "warnings": {
            "items": {
              "type": "string"
            },
            "title": "Warnings",
            "type": "array"
          }
        },
        "required": [
          "universe"
        ],
        "title": "ScreenUniverseView",
        "type": "object"
      },
      "SectorCapSettings": {
        "additionalProperties": false,
        "properties": {
          "look_through": {
            "default": false,
            "title": "Look Through",
            "type": "boolean"
          },
          "max_weight_per_sector": {
            "anyOf": [
              {
                "maximum": 1.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Weight Per Sector"
          }
        },
        "title": "SectorCapSettings",
        "type": "object"
      },
      "SentimentDay": {
        "properties": {
          "article_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Article Count"
          },
          "day": {
            "format": "date",
            "title": "Day",
            "type": "string"
          },
          "sentiment": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Sentiment"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "ticker",
          "day"
        ],
        "title": "SentimentDay",
        "type": "object"
      },
      "SessionTimesView": {
        "properties": {
          "close": {
            "format": "date-time",
            "title": "Close",
            "type": "string"
          },
          "date": {
            "format": "date",
            "title": "Date",
            "type": "string"
          },
          "open": {
            "format": "date-time",
            "title": "Open",
            "type": "string"
          },
          "pre_open": {
            "format": "date-time",
            "title": "Pre Open",
            "type": "string"
          }
        },
        "required": [
          "date",
          "pre_open",
          "open",
          "close"
        ],
        "title": "SessionTimesView",
        "type": "object"
      },
      "ShadowDecisionView": {
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Price"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "side": {
            "title": "Side",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "strategy_id": {
            "title": "Strategy Id",
            "type": "string"
          },
          "strategy_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The strategy's plain title (a starter's), or null: the console names it from the id.",
            "title": "Strategy Name"
          },
          "tick_id": {
            "title": "Tick Id",
            "type": "string"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "id",
          "tick_id",
          "strategy_id",
          "as_of",
          "ticker",
          "side",
          "quantity",
          "price",
          "status",
          "created_at"
        ],
        "title": "ShadowDecisionView",
        "type": "object"
      },
      "ShadowOutcomeView": {
        "description": "How one shadow strategy was evaluated during the tick.",
        "properties": {
          "decisions": {
            "default": 0,
            "title": "Decisions",
            "type": "integer"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "fills": {
            "default": 0,
            "title": "Fills",
            "type": "integer"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "strategy_id": {
            "title": "Strategy Id",
            "type": "string"
          },
          "strategy_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The strategy's plain title (a starter's), or null: the console names it from the id.",
            "title": "Strategy Name"
          },
          "total_value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Value"
          }
        },
        "required": [
          "strategy_id",
          "status"
        ],
        "title": "ShadowOutcomeView",
        "type": "object"
      },
      "ShadowPnlSummary": {
        "properties": {
          "cumulative_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cumulative Return"
          },
          "days": {
            "title": "Days",
            "type": "integer"
          },
          "first_day": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "First Day"
          },
          "latest_day": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Latest Day"
          },
          "max_drawdown": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Drawdown"
          },
          "status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          },
          "strategy_id": {
            "title": "Strategy Id",
            "type": "string"
          },
          "strategy_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The strategy's plain title (a starter's), or null: the console names it from the id.",
            "title": "Strategy Name"
          },
          "total_value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Value"
          }
        },
        "required": [
          "strategy_id",
          "status",
          "days",
          "first_day",
          "latest_day",
          "total_value",
          "cumulative_return",
          "max_drawdown"
        ],
        "title": "ShadowPnlSummary",
        "type": "object"
      },
      "ShortCapsSettings": {
        "additionalProperties": false,
        "properties": {
          "max_short_total": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Short Total"
          },
          "max_short_weight": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Short Weight"
          }
        },
        "title": "ShortCapsSettings",
        "type": "object"
      },
      "ShortOptionGuardSettings": {
        "additionalProperties": false,
        "properties": {
          "approval_level": {
            "default": 2,
            "maximum": 4.0,
            "minimum": 1.0,
            "title": "Approval Level",
            "type": "integer"
          },
          "cash_secured": {
            "default": true,
            "title": "Cash Secured",
            "type": "boolean"
          },
          "enabled": {
            "default": false,
            "title": "Enabled",
            "type": "boolean"
          },
          "max_short_contracts": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Short Contracts"
          },
          "min_dte": {
            "default": 0,
            "minimum": 0.0,
            "title": "Min Dte",
            "type": "integer"
          }
        },
        "title": "ShortOptionGuardSettings",
        "type": "object"
      },
      "ShortfallView": {
        "description": "Implementation shortfall of one order. Costs are positive, in bps of\nthe filled quantity's value at the decision price; ``null`` while an\ninput is not known yet.",
        "properties": {
          "arrival_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Arrival Price"
          },
          "benchmark_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Benchmark Price"
          },
          "convention_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Convention Bps"
          },
          "decision_price": {
            "title": "Decision Price",
            "type": "number"
          },
          "delay_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Delay Bps"
          },
          "expected_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expected Bps"
          },
          "fee_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fee Bps"
          },
          "fill_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fill Price"
          },
          "filled_quantity": {
            "title": "Filled Quantity",
            "type": "number"
          },
          "impact_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Impact Bps"
          },
          "is_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Bps"
          },
          "is_cost": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Cost"
          },
          "opportunity_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Opportunity Bps"
          },
          "opportunity_cost": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Opportunity Cost"
          },
          "ordered_quantity": {
            "title": "Ordered Quantity",
            "type": "number"
          },
          "post_close_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Post Close Price"
          },
          "side": {
            "title": "Side",
            "type": "string"
          },
          "total_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Total Bps"
          }
        },
        "required": [
          "side",
          "ordered_quantity",
          "filled_quantity",
          "decision_price",
          "arrival_price",
          "fill_price",
          "benchmark_price",
          "post_close_price",
          "expected_bps",
          "delay_bps",
          "impact_bps",
          "fee_bps",
          "is_bps",
          "opportunity_bps",
          "convention_bps",
          "total_bps",
          "is_cost",
          "opportunity_cost"
        ],
        "title": "ShortfallView",
        "type": "object"
      },
      "SignalICRequest": {
        "properties": {
          "end": {
            "format": "date",
            "title": "End",
            "type": "string"
          },
          "every_bars": {
            "default": 5,
            "maximum": 504.0,
            "minimum": 1.0,
            "title": "Every Bars",
            "type": "integer"
          },
          "horizons": {
            "default": [
              1,
              5,
              21
            ],
            "items": {
              "type": "integer"
            },
            "maxItems": 20,
            "minItems": 1,
            "title": "Horizons",
            "type": "array"
          },
          "interval": {
            "default": "1d",
            "title": "Interval",
            "type": "string"
          },
          "min_names": {
            "default": 5,
            "maximum": 1000.0,
            "minimum": 2.0,
            "title": "Min Names",
            "type": "integer"
          },
          "n_quantiles": {
            "default": 5,
            "maximum": 20.0,
            "minimum": 2.0,
            "title": "N Quantiles",
            "type": "integer"
          },
          "start": {
            "format": "date",
            "title": "Start",
            "type": "string"
          },
          "strategy": {
            "$ref": "#/components/schemas/StrategyRef"
          },
          "universe": {
            "items": {
              "type": "string"
            },
            "maxItems": 5000,
            "minItems": 1,
            "title": "Universe",
            "type": "array"
          }
        },
        "required": [
          "strategy",
          "universe",
          "start",
          "end"
        ],
        "title": "SignalICRequest",
        "type": "object"
      },
      "SignalICView": {
        "description": ":class:`stonks.lab.signal_eval.SignalICResult`; NaN is null.",
        "properties": {
          "every_bars": {
            "title": "Every Bars",
            "type": "integer"
          },
          "horizons": {
            "items": {
              "$ref": "#/components/schemas/HorizonICView"
            },
            "title": "Horizons",
            "type": "array"
          },
          "ic_estimate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ic Estimate"
          },
          "ic_horizon": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ic Horizon"
          },
          "n_dates": {
            "title": "N Dates",
            "type": "integer"
          },
          "n_quantiles": {
            "title": "N Quantiles",
            "type": "integer"
          },
          "n_tickers": {
            "title": "N Tickers",
            "type": "integer"
          },
          "note": {
            "default": "",
            "title": "Note",
            "type": "string"
          },
          "score_turnover": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Score Turnover"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "strategy_id": {
            "title": "Strategy Id",
            "type": "string"
          },
          "top_quantile_turnover": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Top Quantile Turnover"
          },
          "window": {
            "maxItems": 2,
            "minItems": 2,
            "prefixItems": [
              {
                "type": "string"
              },
              {
                "type": "string"
              }
            ],
            "title": "Window",
            "type": "array"
          }
        },
        "required": [
          "strategy_id",
          "window",
          "n_tickers",
          "n_dates",
          "every_bars",
          "n_quantiles",
          "status"
        ],
        "title": "SignalICView",
        "type": "object"
      },
      "SliceView": {
        "properties": {
          "client_id": {
            "title": "Client Id",
            "type": "string"
          },
          "filled": {
            "title": "Filled",
            "type": "number"
          },
          "order_state": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Order State"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "send_after": {
            "format": "date-time",
            "title": "Send After",
            "type": "string"
          },
          "seq": {
            "title": "Seq",
            "type": "integer"
          },
          "status": {
            "enum": [
              "planned",
              "sent",
              "skipped"
            ],
            "title": "Status",
            "type": "string"
          },
          "status_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status Reason"
          }
        },
        "required": [
          "seq",
          "client_id",
          "quantity",
          "send_after",
          "status",
          "status_reason",
          "order_state",
          "filled"
        ],
        "title": "SliceView",
        "type": "object"
      },
      "SmokeCheck": {
        "properties": {
          "data": {
            "enum": [
              "lake",
              "sample"
            ],
            "title": "Data",
            "type": "string"
          },
          "errors": {
            "items": {
              "type": "string"
            },
            "title": "Errors",
            "type": "array"
          },
          "evaluations": {
            "title": "Evaluations",
            "type": "integer"
          },
          "ok": {
            "title": "Ok",
            "type": "boolean"
          },
          "signals": {
            "title": "Signals",
            "type": "integer"
          },
          "tickers": {
            "items": {
              "type": "string"
            },
            "title": "Tickers",
            "type": "array"
          }
        },
        "required": [
          "ok",
          "data",
          "tickers",
          "evaluations",
          "signals",
          "errors"
        ],
        "title": "SmokeCheck",
        "type": "object"
      },
      "SnapshotRef": {
        "description": "A lake snapshot by folder name; fetch it from\n``GET /api/lab/worker/snapshots/{name}``.",
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "fingerprint": {
            "title": "Fingerprint",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name",
          "created_at",
          "fingerprint"
        ],
        "title": "SnapshotRef",
        "type": "object"
      },
      "SnapshotView": {
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The trading day the snapshot is for (null on old rows).",
            "title": "As Of"
          },
          "cash": {
            "title": "Cash",
            "type": "number"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "positions": {
            "additionalProperties": {
              "type": "number"
            },
            "title": "Positions",
            "type": "object"
          },
          "taken_at": {
            "format": "date-time",
            "title": "Taken At",
            "type": "string"
          },
          "tick_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tick Id"
          },
          "total_value": {
            "title": "Total Value",
            "type": "number"
          }
        },
        "required": [
          "id",
          "tick_id",
          "taken_at",
          "cash",
          "positions",
          "total_value"
        ],
        "title": "SnapshotView",
        "type": "object"
      },
      "SpecValidateRequest": {
        "properties": {
          "spec": {
            "additionalProperties": true,
            "title": "Spec",
            "type": "object"
          }
        },
        "required": [
          "spec"
        ],
        "title": "SpecValidateRequest",
        "type": "object"
      },
      "SqueezeGuardSettings": {
        "additionalProperties": false,
        "properties": {
          "atr_multiple": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Atr Multiple"
          },
          "borrow": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/BorrowSettings"
              },
              {
                "type": "null"
              }
            ]
          },
          "max_adverse_pct": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Adverse Pct"
          },
          "max_borrow_fee": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Borrow Fee"
          },
          "spike_bars": {
            "default": 5,
            "minimum": 1.0,
            "title": "Spike Bars",
            "type": "integer"
          },
          "spike_pct": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Spike Pct"
          }
        },
        "title": "SqueezeGuardSettings",
        "type": "object"
      },
      "StageChangeView": {
        "properties": {
          "actor": {
            "title": "Actor",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "direction": {
            "enum": [
              "promote",
              "demote"
            ],
            "title": "Direction",
            "type": "string"
          },
          "from_stage": {
            "enum": [
              "sim_paper",
              "broker_paper",
              "live_small",
              "live_scale"
            ],
            "title": "From Stage",
            "type": "string"
          },
          "gate_report": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Gate Report"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "reason": {
            "title": "Reason",
            "type": "string"
          },
          "to_stage": {
            "enum": [
              "sim_paper",
              "broker_paper",
              "live_small",
              "live_scale"
            ],
            "title": "To Stage",
            "type": "string"
          }
        },
        "required": [
          "id",
          "from_stage",
          "to_stage",
          "direction",
          "actor",
          "reason",
          "gate_report",
          "created_at"
        ],
        "title": "StageChangeView",
        "type": "object"
      },
      "StageDemoteBody": {
        "additionalProperties": false,
        "properties": {
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "title": "Reason",
            "type": "string"
          },
          "to_stage": {
            "enum": [
              "sim_paper",
              "broker_paper",
              "live_small",
              "live_scale"
            ],
            "title": "To Stage",
            "type": "string"
          }
        },
        "required": [
          "to_stage",
          "reason"
        ],
        "title": "StageDemoteBody",
        "type": "object"
      },
      "StagePromoteBody": {
        "additionalProperties": false,
        "properties": {
          "confirm": {
            "maxLength": 40,
            "minLength": 1,
            "title": "Confirm",
            "type": "string"
          },
          "reason": {
            "maxLength": 500,
            "minLength": 1,
            "title": "Reason",
            "type": "string"
          },
          "to_stage": {
            "enum": [
              "sim_paper",
              "broker_paper",
              "live_small",
              "live_scale"
            ],
            "title": "To Stage",
            "type": "string"
          }
        },
        "required": [
          "to_stage",
          "reason",
          "confirm"
        ],
        "title": "StagePromoteBody",
        "type": "object"
      },
      "StartPortalRequest": {
        "additionalProperties": false,
        "properties": {
          "connection_id": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Connection Id"
          },
          "label": {
            "anyOf": [
              {
                "maxLength": 120,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Label"
          },
          "provider": {
            "maxLength": 64,
            "minLength": 1,
            "title": "Provider",
            "type": "string"
          },
          "redirect_uri": {
            "maxLength": 2048,
            "minLength": 1,
            "title": "Redirect Uri",
            "type": "string"
          }
        },
        "required": [
          "provider",
          "redirect_uri"
        ],
        "title": "StartPortalRequest",
        "type": "object"
      },
      "StarterInstallView": {
        "properties": {
          "next_steps": {
            "items": {
              "type": "string"
            },
            "title": "Next Steps",
            "type": "array"
          },
          "registered": {
            "description": "Starters put On trial by this call.",
            "items": {
              "type": "string"
            },
            "title": "Registered",
            "type": "array"
          },
          "skipped": {
            "description": "Starters that were already registered.",
            "items": {
              "type": "string"
            },
            "title": "Skipped",
            "type": "array"
          },
          "universe": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "The trading universe this call set, or null when one was configured.",
            "title": "Universe"
          }
        },
        "required": [
          "registered",
          "skipped",
          "universe",
          "next_steps"
        ],
        "title": "StarterInstallView",
        "type": "object"
      },
      "StarterLabelView": {
        "description": "Set on a strategy of the starter set (``stonks starter install``):\na simple reference shipped with Stonks, On trial like any other.",
        "properties": {
          "summary": {
            "title": "Summary",
            "type": "string"
          },
          "title": {
            "title": "Title",
            "type": "string"
          }
        },
        "required": [
          "title",
          "summary"
        ],
        "title": "StarterLabelView",
        "type": "object"
      },
      "StarterStrategyView": {
        "properties": {
          "id": {
            "title": "Id",
            "type": "string"
          },
          "status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Its status when registered (shadow = On trial), null when not installed.",
            "title": "Status"
          },
          "summary": {
            "title": "Summary",
            "type": "string"
          },
          "title": {
            "title": "Title",
            "type": "string"
          }
        },
        "required": [
          "id",
          "title",
          "summary",
          "status"
        ],
        "title": "StarterStrategyView",
        "type": "object"
      },
      "StarterView": {
        "properties": {
          "installed": {
            "description": "Every starter is registered (in any status).",
            "title": "Installed",
            "type": "boolean"
          },
          "strategies": {
            "items": {
              "$ref": "#/components/schemas/StarterStrategyView"
            },
            "title": "Strategies",
            "type": "array"
          },
          "universe": {
            "description": "The starter trading universe.",
            "items": {
              "type": "string"
            },
            "title": "Universe",
            "type": "array"
          }
        },
        "required": [
          "strategies",
          "universe",
          "installed"
        ],
        "title": "StarterView",
        "type": "object"
      },
      "StatementFlagView": {
        "properties": {
          "check_id": {
            "title": "Check Id",
            "type": "string"
          },
          "detail": {
            "title": "Detail",
            "type": "string"
          },
          "flagged_at": {
            "format": "date-time",
            "title": "Flagged At",
            "type": "string"
          },
          "frequency": {
            "title": "Frequency",
            "type": "string"
          },
          "period_end": {
            "format": "date",
            "title": "Period End",
            "type": "string"
          },
          "severity": {
            "enum": [
              "error",
              "warning"
            ],
            "title": "Severity",
            "type": "string"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "ticker",
          "period_end",
          "frequency",
          "check_id",
          "severity",
          "detail",
          "flagged_at"
        ],
        "title": "StatementFlagView",
        "type": "object"
      },
      "StatementImportRequest": {
        "additionalProperties": false,
        "description": "A CSV to preview or import, into ``portfolio_id`` (a broker portfolio\nof yours) or into a new portfolio named ``new_portfolio``.",
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The day a holdings export describes; blank is today.",
            "title": "As Of"
          },
          "content": {
            "description": "The CSV text.",
            "maxLength": 5000000,
            "minLength": 1,
            "title": "Content",
            "type": "string"
          },
          "currency": {
            "default": "USD",
            "maxLength": 3,
            "minLength": 3,
            "title": "Currency",
            "type": "string"
          },
          "filename": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filename"
          },
          "mapping": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ColumnMapping"
              },
              {
                "type": "null"
              }
            ],
            "description": "Column mapping; blank guesses it from the headers."
          },
          "new_portfolio": {
            "anyOf": [
              {
                "maxLength": 80,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "New Portfolio"
          },
          "portfolio_id": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Id"
          },
          "preset": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "A broker export preset id (GET /api/statement-imports/presets), 'auto' to find one from the headers, or 'none' to map the columns. Blank with no mapping also finds a preset first.",
            "title": "Preset"
          }
        },
        "required": [
          "content"
        ],
        "title": "StatementImportRequest",
        "type": "object"
      },
      "StatementImportView": {
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "filename": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filename"
          },
          "first_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "First Date"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "default": "activities",
            "enum": [
              "activities",
              "holdings"
            ],
            "title": "Kind",
            "type": "string"
          },
          "last_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Date"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "portfolio_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Name"
          },
          "preset": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preset"
          },
          "rows_added": {
            "title": "Rows Added",
            "type": "integer"
          },
          "rows_duplicate": {
            "title": "Rows Duplicate",
            "type": "integer"
          },
          "rows_skipped": {
            "title": "Rows Skipped",
            "type": "integer"
          },
          "rows_total": {
            "title": "Rows Total",
            "type": "integer"
          },
          "undone_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Undone At"
          }
        },
        "required": [
          "id",
          "portfolio_id",
          "portfolio_name",
          "filename",
          "rows_total",
          "rows_added",
          "rows_duplicate",
          "rows_skipped",
          "first_date",
          "last_date",
          "created_at",
          "undone_at"
        ],
        "title": "StatementImportView",
        "type": "object"
      },
      "StatementPresetView": {
        "description": "A broker export Stonks reads without a mapping.",
        "properties": {
          "broker": {
            "title": "Broker",
            "type": "string"
          },
          "how_to_export": {
            "title": "How To Export",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "enum": [
              "activities",
              "holdings"
            ],
            "title": "Kind",
            "type": "string"
          },
          "label": {
            "title": "Label",
            "type": "string"
          }
        },
        "required": [
          "id",
          "broker",
          "label",
          "kind",
          "how_to_export"
        ],
        "title": "StatementPresetView",
        "type": "object"
      },
      "StatementPreview": {
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          },
          "duplicate": {
            "title": "Duplicate",
            "type": "integer"
          },
          "duplicates_in": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/DuplicateSource"
              },
              {
                "type": "null"
              }
            ]
          },
          "first_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "First Date"
          },
          "guessed": {
            "title": "Guessed",
            "type": "boolean"
          },
          "headers": {
            "items": {
              "type": "string"
            },
            "title": "Headers",
            "type": "array"
          },
          "kind": {
            "default": "activities",
            "enum": [
              "activities",
              "holdings"
            ],
            "title": "Kind",
            "type": "string"
          },
          "last_date": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Date"
          },
          "locale": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Locale"
          },
          "mapping": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/ColumnMapping"
              },
              {
                "type": "null"
              }
            ]
          },
          "new": {
            "title": "New",
            "type": "integer"
          },
          "notes": {
            "items": {
              "type": "string"
            },
            "title": "Notes",
            "type": "array"
          },
          "preset": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preset"
          },
          "preset_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preset Label"
          },
          "rows": {
            "items": {
              "$ref": "#/components/schemas/StatementRowView"
            },
            "title": "Rows",
            "type": "array"
          },
          "skipped": {
            "title": "Skipped",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          },
          "unmapped": {
            "items": {
              "type": "string"
            },
            "title": "Unmapped",
            "type": "array"
          }
        },
        "required": [
          "headers",
          "mapping",
          "guessed",
          "rows",
          "total",
          "new",
          "duplicate",
          "skipped",
          "first_date",
          "last_date",
          "unmapped"
        ],
        "title": "StatementPreview",
        "type": "object"
      },
      "StatementRowView": {
        "properties": {
          "amount": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount"
          },
          "currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Currency"
          },
          "day": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Day"
          },
          "fee": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fee"
          },
          "kind": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Kind"
          },
          "line": {
            "title": "Line",
            "type": "integer"
          },
          "price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Price"
          },
          "quantity": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Quantity"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "status": {
            "enum": [
              "new",
              "duplicate",
              "skipped"
            ],
            "title": "Status",
            "type": "string"
          },
          "symbol": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Symbol"
          },
          "ticker": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ticker"
          }
        },
        "required": [
          "line",
          "status"
        ],
        "title": "StatementRowView",
        "type": "object"
      },
      "StatusChangeRequest": {
        "additionalProperties": false,
        "description": "Body of a status-change route (promote / retire / shadow, Studio\nenable / disable). Demotions need ``reason``; a promotion without a\npassing go-live check needs ``override`` plus a ``reason`` of at least\n20 characters.",
        "properties": {
          "actor": {
            "anyOf": [
              {
                "maxLength": 100,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Actor"
          },
          "override": {
            "default": false,
            "title": "Override",
            "type": "boolean"
          },
          "reason": {
            "anyOf": [
              {
                "maxLength": 2000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          }
        },
        "title": "StatusChangeRequest",
        "type": "object"
      },
      "StatusChangeView": {
        "description": "One audited status change or intervention (BL-24).",
        "properties": {
          "actor": {
            "title": "Actor",
            "type": "string"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "from_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "From Status"
          },
          "golive_passed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Golive Passed"
          },
          "golive_report": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Golive Report"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "override": {
            "title": "Override",
            "type": "boolean"
          },
          "reason": {
            "title": "Reason",
            "type": "string"
          },
          "to_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "To Status"
          }
        },
        "required": [
          "id",
          "kind",
          "from_status",
          "to_status",
          "actor",
          "reason",
          "override",
          "golive_passed",
          "golive_report",
          "created_at"
        ],
        "title": "StatusChangeView",
        "type": "object"
      },
      "StepUpdate": {
        "additionalProperties": false,
        "properties": {
          "state": {
            "enum": [
              "done",
              "skipped",
              "todo"
            ],
            "title": "State",
            "type": "string"
          }
        },
        "required": [
          "state"
        ],
        "title": "StepUpdate",
        "type": "object"
      },
      "StopCooldownSettings": {
        "additionalProperties": false,
        "properties": {
          "cooldown_days": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cooldown Days"
          },
          "count_losses": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Count Losses"
          }
        },
        "title": "StopCooldownSettings",
        "type": "object"
      },
      "StopGuardSettings": {
        "additionalProperties": false,
        "properties": {
          "count_losses": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Count Losses"
          },
          "max_stops": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Stops"
          },
          "window_days": {
            "default": 7,
            "minimum": 1.0,
            "title": "Window Days",
            "type": "integer"
          }
        },
        "title": "StopGuardSettings",
        "type": "object"
      },
      "StrategyClassInfo": {
        "properties": {
          "alpha_family": {
            "default": "other",
            "title": "Alpha Family",
            "type": "string"
          },
          "applicable_asset_classes": {
            "items": {
              "type": "string"
            },
            "title": "Applicable Asset Classes",
            "type": "array"
          },
          "class_path": {
            "title": "Class Path",
            "type": "string"
          },
          "description": {
            "title": "Description",
            "type": "string"
          },
          "is_wrapper": {
            "default": false,
            "title": "Is Wrapper",
            "type": "boolean"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "parameters": {
            "items": {
              "$ref": "#/components/schemas/ParameterInfo"
            },
            "title": "Parameters",
            "type": "array"
          },
          "source": {
            "title": "Source",
            "type": "string"
          },
          "title": {
            "default": "",
            "title": "Title",
            "type": "string"
          }
        },
        "required": [
          "class_path",
          "name",
          "source",
          "description",
          "applicable_asset_classes",
          "parameters"
        ],
        "title": "StrategyClassInfo",
        "type": "object"
      },
      "StrategyDetail": {
        "properties": {
          "applicable_asset_classes": {
            "items": {
              "type": "string"
            },
            "title": "Applicable Asset Classes",
            "type": "array"
          },
          "class_path": {
            "title": "Class Path",
            "type": "string"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "draft_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Draft Id"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "default": "",
            "title": "Kind",
            "type": "string"
          },
          "metadata": {
            "$ref": "#/components/schemas/StrategyMetadataView"
          },
          "name": {
            "default": "",
            "title": "Name",
            "type": "string"
          },
          "params": {
            "additionalProperties": true,
            "title": "Params",
            "type": "object"
          },
          "retrainable": {
            "default": false,
            "title": "Retrainable",
            "type": "boolean"
          },
          "starter": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StarterLabelView"
              },
              {
                "type": "null"
              }
            ],
            "description": "Set for a starter strategy: its plain title and summary."
          },
          "status": {
            "enum": [
              "active",
              "shadow",
              "retired"
            ],
            "title": "Status",
            "type": "string"
          },
          "status_history": {
            "items": {
              "$ref": "#/components/schemas/StatusChangeView"
            },
            "title": "Status History",
            "type": "array"
          },
          "survival_reports": {
            "items": {
              "$ref": "#/components/schemas/SurvivalReportView"
            },
            "title": "Survival Reports",
            "type": "array"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "class_path",
          "status",
          "params",
          "applicable_asset_classes",
          "metadata",
          "created_at",
          "updated_at",
          "survival_reports",
          "status_history"
        ],
        "title": "StrategyDetail",
        "type": "object"
      },
      "StrategyMetadataView": {
        "description": "The strategy's hypothesis card and capability hooks (BL-26).",
        "properties": {
          "alpha_family": {
            "enum": [
              "trend",
              "reversion",
              "carry",
              "value",
              "quality",
              "growth",
              "sentiment",
              "data_driven",
              "benchmark",
              "other"
            ],
            "title": "Alpha Family",
            "type": "string"
          },
          "hypothesis": {
            "title": "Hypothesis",
            "type": "string"
          },
          "label_horizon_bars": {
            "title": "Label Horizon Bars",
            "type": "integer"
          },
          "premise": {
            "enum": [
              "trend",
              "mean_reversion",
              "none"
            ],
            "title": "Premise",
            "type": "string"
          },
          "required_history_bars": {
            "title": "Required History Bars",
            "type": "integer"
          }
        },
        "required": [
          "hypothesis",
          "alpha_family",
          "premise",
          "label_horizon_bars",
          "required_history_bars"
        ],
        "title": "StrategyMetadataView",
        "type": "object"
      },
      "StrategyRef": {
        "description": "Which strategy to run: a registered id, or a catalog class + params.\n\nExactly one of ``strategy_id`` / ``class_path`` is set. Future sources\nof runnable strategies (e.g. a studio draft id) become one more\nalternative here and one more branch in :meth:`StrategyService.resolve`.",
        "properties": {
          "class_path": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Class Path"
          },
          "params": {
            "additionalProperties": true,
            "title": "Params",
            "type": "object"
          },
          "strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Id"
          }
        },
        "title": "StrategyRef",
        "type": "object"
      },
      "StrategyStatusCounts": {
        "description": "How many registered strategies are in each lifecycle status.",
        "properties": {
          "active": {
            "title": "Active",
            "type": "integer"
          },
          "retired": {
            "title": "Retired",
            "type": "integer"
          },
          "shadow": {
            "title": "Shadow",
            "type": "integer"
          },
          "total": {
            "title": "Total",
            "type": "integer"
          }
        },
        "required": [
          "active",
          "shadow",
          "retired",
          "total"
        ],
        "title": "StrategyStatusCounts",
        "type": "object"
      },
      "StrategySummary": {
        "properties": {
          "applicable_asset_classes": {
            "items": {
              "type": "string"
            },
            "title": "Applicable Asset Classes",
            "type": "array"
          },
          "class_path": {
            "title": "Class Path",
            "type": "string"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "draft_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Draft Id"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "default": "",
            "title": "Kind",
            "type": "string"
          },
          "metadata": {
            "$ref": "#/components/schemas/StrategyMetadataView"
          },
          "name": {
            "default": "",
            "title": "Name",
            "type": "string"
          },
          "params": {
            "additionalProperties": true,
            "title": "Params",
            "type": "object"
          },
          "retrainable": {
            "default": false,
            "title": "Retrainable",
            "type": "boolean"
          },
          "starter": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/StarterLabelView"
              },
              {
                "type": "null"
              }
            ],
            "description": "Set for a starter strategy: its plain title and summary."
          },
          "status": {
            "enum": [
              "active",
              "shadow",
              "retired"
            ],
            "title": "Status",
            "type": "string"
          },
          "updated_at": {
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "class_path",
          "status",
          "params",
          "applicable_asset_classes",
          "metadata",
          "created_at",
          "updated_at"
        ],
        "title": "StrategySummary",
        "type": "object"
      },
      "StreamHealthView": {
        "properties": {
          "backfills_failed": {
            "title": "Backfills Failed",
            "type": "integer"
          },
          "backfills_ok": {
            "title": "Backfills Ok",
            "type": "integer"
          },
          "bars_written": {
            "title": "Bars Written",
            "type": "integer"
          },
          "connected": {
            "title": "Connected",
            "type": "boolean"
          },
          "connected_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Connected At"
          },
          "connects": {
            "title": "Connects",
            "type": "integer"
          },
          "delayed_events": {
            "default": 0,
            "title": "Delayed Events",
            "type": "integer"
          },
          "delayed_only": {
            "default": false,
            "title": "Delayed Only",
            "type": "boolean"
          },
          "disconnects": {
            "title": "Disconnects",
            "type": "integer"
          },
          "gaps": {
            "title": "Gaps",
            "type": "integer"
          },
          "last_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Error"
          },
          "last_event_age_seconds": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Event Age Seconds"
          },
          "last_event_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Event At"
          },
          "late_ticks": {
            "title": "Late Ticks",
            "type": "integer"
          },
          "source": {
            "title": "Source",
            "type": "string"
          },
          "state": {
            "title": "State",
            "type": "string"
          },
          "write_errors": {
            "title": "Write Errors",
            "type": "integer"
          }
        },
        "required": [
          "source",
          "state",
          "connected",
          "connected_at",
          "last_event_at",
          "last_event_age_seconds",
          "connects",
          "disconnects",
          "bars_written",
          "late_ticks",
          "write_errors",
          "gaps",
          "backfills_ok",
          "backfills_failed",
          "last_error"
        ],
        "title": "StreamHealthView",
        "type": "object"
      },
      "StreamStatusView": {
        "properties": {
          "as_of": {
            "format": "date-time",
            "title": "As Of",
            "type": "string"
          },
          "deadman_minutes": {
            "title": "Deadman Minutes",
            "type": "integer"
          },
          "engines": {
            "items": {
              "$ref": "#/components/schemas/EngineView"
            },
            "title": "Engines",
            "type": "array"
          },
          "intraday_pnl": {
            "$ref": "#/components/schemas/IntradayPnlView"
          },
          "source": {
            "title": "Source",
            "type": "string"
          },
          "stale_after_seconds": {
            "title": "Stale After Seconds",
            "type": "number"
          },
          "streaming_enabled": {
            "title": "Streaming Enabled",
            "type": "boolean"
          }
        },
        "required": [
          "as_of",
          "streaming_enabled",
          "source",
          "deadman_minutes",
          "stale_after_seconds",
          "engines",
          "intraday_pnl"
        ],
        "title": "StreamStatusView",
        "type": "object"
      },
      "StreamToken": {
        "properties": {
          "events_url": {
            "title": "Events Url",
            "type": "string"
          },
          "expires_at": {
            "format": "date-time",
            "title": "Expires At",
            "type": "string"
          },
          "token": {
            "title": "Token",
            "type": "string"
          }
        },
        "required": [
          "token",
          "expires_at",
          "events_url"
        ],
        "title": "StreamToken",
        "type": "object"
      },
      "StudioCapabilities": {
        "description": "What this server lets the Studio do.",
        "properties": {
          "code_strategies": {
            "title": "Code Strategies",
            "type": "boolean"
          }
        },
        "required": [
          "code_strategies"
        ],
        "title": "StudioCapabilities",
        "type": "object"
      },
      "StyleExposureSettings": {
        "additionalProperties": false,
        "properties": {
          "max_abs_exposure": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Abs Exposure"
          },
          "styles": {
            "default": [
              "momentum",
              "size",
              "value",
              "volatility"
            ],
            "items": {
              "enum": [
                "momentum",
                "size",
                "value",
                "volatility"
              ],
              "type": "string"
            },
            "title": "Styles",
            "type": "array"
          }
        },
        "title": "StyleExposureSettings",
        "type": "object"
      },
      "SubscribeRequest": {
        "additionalProperties": false,
        "properties": {
          "mode": {
            "default": "notify",
            "enum": [
              "notify",
              "paper",
              "approve",
              "auto"
            ],
            "title": "Mode",
            "type": "string"
          },
          "portfolio_id": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Id"
          },
          "strategy_id": {
            "maxLength": 128,
            "minLength": 1,
            "title": "Strategy Id",
            "type": "string"
          },
          "weight": {
            "default": 1.0,
            "maximum": 100.0,
            "minimum": 0.0,
            "title": "Weight",
            "type": "number"
          }
        },
        "required": [
          "strategy_id"
        ],
        "title": "SubscribeRequest",
        "type": "object"
      },
      "SubscriptionUpdate": {
        "additionalProperties": false,
        "properties": {
          "enabled": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Enabled"
          },
          "mode": {
            "anyOf": [
              {
                "enum": [
                  "notify",
                  "paper",
                  "approve",
                  "auto"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mode"
          },
          "reason": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          }
        },
        "title": "SubscriptionUpdate",
        "type": "object"
      },
      "SubscriptionView": {
        "properties": {
          "auto_blockers": {
            "items": {
              "type": "string"
            },
            "title": "Auto Blockers",
            "type": "array"
          },
          "auto_enabled_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Auto Enabled At"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "enabled": {
            "title": "Enabled",
            "type": "boolean"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "mode": {
            "enum": [
              "notify",
              "paper",
              "approve",
              "auto"
            ],
            "title": "Mode",
            "type": "string"
          },
          "paper_days_completed": {
            "title": "Paper Days Completed",
            "type": "integer"
          },
          "paper_days_required": {
            "title": "Paper Days Required",
            "type": "integer"
          },
          "paused_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Paused Reason"
          },
          "portfolio_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Id"
          },
          "strategy_id": {
            "title": "Strategy Id",
            "type": "string"
          },
          "strategy_name": {
            "title": "Strategy Name",
            "type": "string"
          },
          "strategy_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Status"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          },
          "weight": {
            "title": "Weight",
            "type": "number"
          }
        },
        "required": [
          "id",
          "strategy_id",
          "strategy_name",
          "strategy_status",
          "portfolio_id",
          "mode",
          "weight",
          "enabled",
          "paper_days_completed",
          "paper_days_required",
          "auto_blockers",
          "paused_reason",
          "auto_enabled_at",
          "created_at",
          "updated_at"
        ],
        "title": "SubscriptionView",
        "type": "object"
      },
      "SurvivalPresetInfo": {
        "properties": {
          "name": {
            "title": "Name",
            "type": "string"
          },
          "options": {
            "additionalProperties": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Options",
            "type": "object"
          },
          "tests": {
            "items": {
              "type": "string"
            },
            "title": "Tests",
            "type": "array"
          }
        },
        "required": [
          "name",
          "tests",
          "options"
        ],
        "title": "SurvivalPresetInfo",
        "type": "object"
      },
      "SurvivalReportView": {
        "properties": {
          "metrics": {
            "additionalProperties": {
              "anyOf": [
                {
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ]
            },
            "title": "Metrics",
            "type": "object"
          },
          "notes": {
            "title": "Notes",
            "type": "string"
          },
          "passed": {
            "title": "Passed",
            "type": "boolean"
          },
          "test_id": {
            "title": "Test Id",
            "type": "string"
          }
        },
        "required": [
          "test_id",
          "passed",
          "metrics",
          "notes"
        ],
        "title": "SurvivalReportView",
        "type": "object"
      },
      "SurvivalTestInfo": {
        "description": "A survival test and the options a request's ``test_options[id]`` may\nset, as JSON Schema from the backend's own options model.",
        "properties": {
          "config_schema": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Config Schema"
          },
          "description": {
            "title": "Description",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "options_schema": {
            "additionalProperties": true,
            "title": "Options Schema",
            "type": "object"
          },
          "presets": {
            "items": {
              "type": "string"
            },
            "title": "Presets",
            "type": "array"
          }
        },
        "required": [
          "id",
          "description",
          "options_schema",
          "presets"
        ],
        "title": "SurvivalTestInfo",
        "type": "object"
      },
      "SwapCheckView": {
        "properties": {
          "detail": {
            "title": "Detail",
            "type": "string"
          },
          "limit": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "passed": {
            "title": "Passed",
            "type": "boolean"
          },
          "value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Value"
          }
        },
        "required": [
          "name",
          "passed",
          "value",
          "limit",
          "detail"
        ],
        "title": "SwapCheckView",
        "type": "object"
      },
      "SwapReportView": {
        "description": "The swap check of a candidate against the live version (``[lifecycle.swap]``).",
        "properties": {
          "candidate_drawdown": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Candidate Drawdown"
          },
          "candidate_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Candidate Return"
          },
          "checks": {
            "items": {
              "$ref": "#/components/schemas/SwapCheckView"
            },
            "title": "Checks",
            "type": "array"
          },
          "days": {
            "title": "Days",
            "type": "integer"
          },
          "live_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Live Return"
          },
          "live_version": {
            "title": "Live Version",
            "type": "integer"
          },
          "passed": {
            "title": "Passed",
            "type": "boolean"
          },
          "strategy_id": {
            "title": "Strategy Id",
            "type": "string"
          },
          "version": {
            "title": "Version",
            "type": "integer"
          }
        },
        "required": [
          "strategy_id",
          "version",
          "live_version",
          "passed",
          "days",
          "candidate_return",
          "live_return",
          "candidate_drawdown",
          "checks"
        ],
        "title": "SwapReportView",
        "type": "object"
      },
      "SweepRequest": {
        "description": "A sweep over a basket: ``universe`` (tickers) or ``universe_id`` (every\nmember during the window). ``strategies`` default to every catalogued\nnon-wrapper strategy. The lab options apply to every run; sweeps never\nregister strategies.",
        "properties": {
          "benchmark": {
            "anyOf": [
              {
                "description": "auto (SPY.US when priced, else EW), EW (equal-weight universe), a ticker such as QQQ.US, or none; default [lab] benchmark",
                "maxLength": 32,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Benchmark"
          },
          "budget": {
            "default": 20,
            "maximum": 1000.0,
            "minimum": 1.0,
            "title": "Budget",
            "type": "integer"
          },
          "cost_model": {
            "anyOf": [
              {
                "enum": [
                  "zero",
                  "realistic",
                  "ibkr_tiered",
                  "ibkr_fixed"
                ],
                "type": "string"
              },
              {
                "$ref": "#/components/schemas/CostModelSettings"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cost Model"
          },
          "embargo_bars": {
            "anyOf": [
              {
                "maximum": 10000.0,
                "minimum": 0.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Embargo Bars"
          },
          "end": {
            "format": "date",
            "title": "End",
            "type": "string"
          },
          "exclude": {
            "items": {
              "type": "string"
            },
            "maxItems": 200,
            "title": "Exclude",
            "type": "array"
          },
          "grid_size": {
            "anyOf": [
              {
                "maximum": 50.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true,
            "description": "Deprecated: use tuner_options.grid_size",
            "title": "Grid Size"
          },
          "heatmap": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/HeatmapOptions"
              },
              {
                "type": "null"
              }
            ]
          },
          "hypothesis": {
            "anyOf": [
              {
                "maxLength": 4000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Hypothesis"
          },
          "interval": {
            "default": "1d",
            "title": "Interval",
            "type": "string"
          },
          "mcpt": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/McptOptions"
              },
              {
                "type": "null"
              }
            ]
          },
          "objective": {
            "default": "sharpe",
            "enum": [
              "sharpe",
              "cagr",
              "final_return",
              "sortino",
              "calmar",
              "sharpe_dd",
              "multi",
              "cv_sharpe",
              "cv_cagr",
              "cv_final_return"
            ],
            "title": "Objective",
            "type": "string"
          },
          "preflight": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preflight"
          },
          "premortem": {
            "anyOf": [
              {
                "maxLength": 4000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Premortem"
          },
          "preset": {
            "anyOf": [
              {
                "enum": [
                  "promotion",
                  "quick",
                  "standard"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Preset"
          },
          "prune": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true,
            "description": "Deprecated: use tuner_options.prune",
            "title": "Prune"
          },
          "register_if_passes": {
            "default": false,
            "title": "Register If Passes",
            "type": "boolean"
          },
          "register_strategy": {
            "default": false,
            "title": "Register Strategy",
            "type": "boolean"
          },
          "sampler": {
            "anyOf": [
              {
                "maxLength": 32,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "deprecated": true,
            "description": "Deprecated: use tuner_options.sampler",
            "title": "Sampler"
          },
          "seed": {
            "default": 0,
            "title": "Seed",
            "type": "integer"
          },
          "start": {
            "format": "date",
            "title": "Start",
            "type": "string"
          },
          "strategies": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 200,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategies"
          },
          "strict_preflight": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strict Preflight"
          },
          "survival_tests": {
            "anyOf": [
              {
                "items": {
                  "enum": [
                    "benchmark_relative",
                    "cost_stress",
                    "cpcv",
                    "crisis",
                    "cross_instrument",
                    "data_snooping",
                    "deflated_sharpe",
                    "drift",
                    "event_study",
                    "forecast_skill",
                    "mc_trades",
                    "mcpt",
                    "oos",
                    "pbo",
                    "period_stability",
                    "permutation",
                    "perturbation",
                    "plateau",
                    "pool_correlation",
                    "runs_test",
                    "signal_ic",
                    "stress",
                    "vs_random",
                    "walk_forward",
                    "walk_forward_mcpt"
                  ],
                  "type": "string"
                },
                "minItems": 1,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Survival Tests"
          },
          "test_options": {
            "anyOf": [
              {
                "additionalProperties": {
                  "additionalProperties": true,
                  "type": "object"
                },
                "propertyNames": {
                  "enum": [
                    "benchmark_relative",
                    "cost_stress",
                    "cpcv",
                    "crisis",
                    "cross_instrument",
                    "data_snooping",
                    "deflated_sharpe",
                    "drift",
                    "event_study",
                    "forecast_skill",
                    "mc_trades",
                    "mcpt",
                    "oos",
                    "pbo",
                    "period_stability",
                    "permutation",
                    "perturbation",
                    "plateau",
                    "pool_correlation",
                    "runs_test",
                    "signal_ic",
                    "stress",
                    "vs_random",
                    "walk_forward",
                    "walk_forward_mcpt"
                  ]
                },
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Test Options"
          },
          "train_ratio": {
            "default": 0.7,
            "exclusiveMaximum": 1.0,
            "exclusiveMinimum": 0.0,
            "title": "Train Ratio",
            "type": "number"
          },
          "tuner": {
            "default": "random",
            "enum": [
              "grid",
              "optuna",
              "prescreen",
              "random"
            ],
            "title": "Tuner",
            "type": "string"
          },
          "tuner_options": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tuner Options"
          },
          "universe": {
            "items": {
              "type": "string"
            },
            "title": "Universe",
            "type": "array"
          },
          "universe_id": {
            "anyOf": [
              {
                "pattern": "^[a-z0-9][a-z0-9_.-]{0,63}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Universe Id"
          },
          "walk_forward": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/WalkForwardConfig"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "start",
          "end"
        ],
        "title": "SweepRequest",
        "type": "object"
      },
      "SweepResultView": {
        "properties": {
          "errors": {
            "title": "Errors",
            "type": "integer"
          },
          "failed": {
            "title": "Failed",
            "type": "integer"
          },
          "passed": {
            "title": "Passed",
            "type": "integer"
          },
          "rows": {
            "items": {
              "$ref": "#/components/schemas/SweepRowView"
            },
            "title": "Rows",
            "type": "array"
          },
          "universe": {
            "items": {
              "type": "string"
            },
            "title": "Universe",
            "type": "array"
          },
          "universe_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Universe Id"
          }
        },
        "required": [
          "universe",
          "rows",
          "passed",
          "failed",
          "errors"
        ],
        "title": "SweepResultView",
        "type": "object"
      },
      "SweepRowView": {
        "properties": {
          "best_params": {
            "additionalProperties": true,
            "title": "Best Params",
            "type": "object"
          },
          "best_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Best Score"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "n_trials": {
            "default": 0,
            "title": "N Trials",
            "type": "integer"
          },
          "run_id": {
            "default": "",
            "title": "Run Id",
            "type": "string"
          },
          "strategy": {
            "title": "Strategy",
            "type": "string"
          },
          "survival": {
            "additionalProperties": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Survival",
            "type": "object"
          },
          "ticker": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ticker"
          },
          "verdict": {
            "enum": [
              "pass",
              "fail",
              "error"
            ],
            "title": "Verdict",
            "type": "string"
          }
        },
        "required": [
          "strategy",
          "ticker",
          "verdict"
        ],
        "title": "SweepRowView",
        "type": "object"
      },
      "SyncResultView": {
        "properties": {
          "accounts_seen": {
            "title": "Accounts Seen",
            "type": "integer"
          },
          "connection_id": {
            "title": "Connection Id",
            "type": "string"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "next_sync_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Sync At"
          },
          "portfolios": {
            "items": {
              "$ref": "#/components/schemas/PortfolioSyncView"
            },
            "title": "Portfolios",
            "type": "array"
          },
          "status": {
            "enum": [
              "ok",
              "partial",
              "error"
            ],
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "connection_id",
          "status",
          "portfolios",
          "error",
          "next_sync_at",
          "accounts_seen"
        ],
        "title": "SyncResultView",
        "type": "object"
      },
      "SystemCheckView": {
        "properties": {
          "detail": {
            "title": "Detail",
            "type": "string"
          },
          "done": {
            "title": "Done",
            "type": "boolean"
          },
          "id": {
            "enum": [
              "data_source",
              "first_ingest",
              "strategies",
              "backup",
              "scheduler"
            ],
            "title": "Id",
            "type": "string"
          }
        },
        "required": [
          "id",
          "done",
          "detail"
        ],
        "title": "SystemCheckView",
        "type": "object"
      },
      "SystemChecklistView": {
        "properties": {
          "checks": {
            "items": {
              "$ref": "#/components/schemas/SystemCheckView"
            },
            "title": "Checks",
            "type": "array"
          },
          "complete": {
            "title": "Complete",
            "type": "boolean"
          }
        },
        "required": [
          "checks",
          "complete"
        ],
        "title": "SystemChecklistView",
        "type": "object"
      },
      "SystemSettingChange": {
        "properties": {
          "reason": {
            "description": "Why, kept in the audit log.",
            "maxLength": 500,
            "minLength": 3,
            "title": "Reason",
            "type": "string"
          },
          "value": {
            "description": "The new value; null turns an optional limit off.",
            "title": "Value"
          }
        },
        "required": [
          "value",
          "reason"
        ],
        "title": "SystemSettingChange",
        "type": "object"
      },
      "SystemSettingReset": {
        "properties": {
          "reason": {
            "maxLength": 500,
            "minLength": 3,
            "title": "Reason",
            "type": "string"
          }
        },
        "required": [
          "reason"
        ],
        "title": "SystemSettingReset",
        "type": "object"
      },
      "SystemSettingView": {
        "properties": {
          "applies": {
            "description": "next_run: the next trading run or job uses it. restart: the scheduler picks it up when it restarts.",
            "enum": [
              "next_run",
              "restart"
            ],
            "title": "Applies",
            "type": "string"
          },
          "choices": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "description": "The allowed values for a choice field (null: free input). For production.universe, the ids of the stored universes; a ticker list is also accepted.",
            "title": "Choices"
          },
          "default": {
            "description": "The value from the TOML config and environment.",
            "title": "Default"
          },
          "group": {
            "enum": [
              "risk",
              "trading",
              "notifications",
              "schedule"
            ],
            "title": "Group",
            "type": "string"
          },
          "help": {
            "title": "Help",
            "type": "string"
          },
          "key": {
            "description": "Dotted path in the config, e.g. production.risk.max_weight_per_ticker.",
            "title": "Key",
            "type": "string"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "overridden": {
            "title": "Overridden",
            "type": "boolean"
          },
          "problem": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Set when the stored override no longer validates and is skipped.",
            "title": "Problem"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          },
          "updated_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated By"
          },
          "value": {
            "description": "The value in effect now.",
            "title": "Value"
          }
        },
        "required": [
          "key",
          "group",
          "label",
          "help",
          "applies",
          "value",
          "default",
          "overridden"
        ],
        "title": "SystemSettingView",
        "type": "object"
      },
      "SystemSettingsView": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/SystemSettingView"
            },
            "title": "Items",
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "title": "SystemSettingsView",
        "type": "object"
      },
      "TaxPreviewView": {
        "description": "What a trade would realise now, before it is placed. An estimate at\nyour configured rates, not tax advice.",
        "properties": {
          "after_tax_proceeds": {
            "title": "After Tax Proceeds",
            "type": "number"
          },
          "currency": {
            "description": "The trade's currency; every amount is in it.",
            "title": "Currency",
            "type": "string"
          },
          "estimated_tax": {
            "description": "Tax on this trade's own gains (0 on a loss).",
            "title": "Estimated Tax",
            "type": "number"
          },
          "jurisdiction": {
            "enum": [
              "us",
              "eu",
              "uk"
            ],
            "title": "Jurisdiction",
            "type": "string"
          },
          "long_term_gain": {
            "title": "Long Term Gain",
            "type": "number"
          },
          "lot_method": {
            "enum": [
              "fifo",
              "specific"
            ],
            "title": "Lot Method",
            "type": "string"
          },
          "lots": {
            "description": "The lots the trade closes, in order.",
            "items": {
              "$ref": "#/components/schemas/PreviewLotView"
            },
            "title": "Lots",
            "type": "array"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "price": {
            "description": "The price used: yours, else the latest close.",
            "title": "Price",
            "type": "number"
          },
          "proceeds": {
            "title": "Proceeds",
            "type": "number"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "rates": {
            "$ref": "#/components/schemas/TaxRatesView"
          },
          "realized_gain": {
            "title": "Realized Gain",
            "type": "number"
          },
          "short_term_gain": {
            "title": "Short Term Gain",
            "type": "number"
          },
          "side": {
            "enum": [
              "buy",
              "sell"
            ],
            "title": "Side",
            "type": "string"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "wash_sale_disallowed": {
            "title": "Wash Sale Disallowed",
            "type": "number"
          },
          "wash_sale_warning": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Wash Sale Warning"
          },
          "year_tax_change": {
            "description": "How much the trade changes this year's estimated tax (negative lowers it).",
            "title": "Year Tax Change",
            "type": "number"
          }
        },
        "required": [
          "portfolio_id",
          "ticker",
          "side",
          "quantity",
          "price",
          "currency",
          "jurisdiction",
          "lot_method",
          "lots",
          "proceeds",
          "realized_gain",
          "short_term_gain",
          "long_term_gain",
          "wash_sale_disallowed",
          "estimated_tax",
          "after_tax_proceeds",
          "year_tax_change",
          "rates"
        ],
        "title": "TaxPreviewView",
        "type": "object"
      },
      "TaxRatesView": {
        "properties": {
          "long_term": {
            "description": "Rate on gains held more than one year.",
            "title": "Long Term",
            "type": "number"
          },
          "short_term": {
            "description": "Rate on gains held one year or less.",
            "title": "Short Term",
            "type": "number"
          }
        },
        "required": [
          "short_term",
          "long_term"
        ],
        "title": "TaxRatesView",
        "type": "object"
      },
      "TaxSettingsUpdate": {
        "additionalProperties": false,
        "properties": {
          "base_currency": {
            "anyOf": [
              {
                "pattern": "^[A-Z]{3}$",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Base Currency"
          },
          "jurisdiction": {
            "anyOf": [
              {
                "enum": [
                  "us",
                  "eu",
                  "uk"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Jurisdiction"
          },
          "lot_method": {
            "anyOf": [
              {
                "enum": [
                  "fifo",
                  "specific"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Lot Method"
          },
          "wash_sales": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Wash Sales"
          }
        },
        "title": "TaxSettingsUpdate",
        "type": "object"
      },
      "TaxSettingsView": {
        "properties": {
          "base_currency": {
            "description": "Reporting currency of values, P&L and exports.",
            "title": "Base Currency",
            "type": "string"
          },
          "jurisdiction": {
            "description": "us applies wash sales when switched on.",
            "enum": [
              "us",
              "eu",
              "uk"
            ],
            "title": "Jurisdiction",
            "type": "string"
          },
          "locked": {
            "default": false,
            "description": "True while the portfolio trades real money: the base currency and jurisdiction are the live account profile's too and cannot change.",
            "title": "Locked",
            "type": "boolean"
          },
          "lot_method": {
            "description": "fifo, or specific: your picks first, then FIFO for the rest.",
            "enum": [
              "fifo",
              "specific"
            ],
            "title": "Lot Method",
            "type": "string"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          },
          "wash_sales": {
            "description": "US wash sale adjustment (us jurisdiction only).",
            "title": "Wash Sales",
            "type": "boolean"
          }
        },
        "required": [
          "portfolio_id",
          "base_currency",
          "jurisdiction",
          "lot_method",
          "wash_sales"
        ],
        "title": "TaxSettingsView",
        "type": "object"
      },
      "TaxYearView": {
        "description": "Gains realised this year and the estimated tax on them, in the base\ncurrency. Short and long term losses offset gains first.",
        "properties": {
          "base_currency": {
            "title": "Base Currency",
            "type": "string"
          },
          "disposals": {
            "title": "Disposals",
            "type": "integer"
          },
          "estimated_tax": {
            "title": "Estimated Tax",
            "type": "number"
          },
          "jurisdiction": {
            "enum": [
              "us",
              "eu",
              "uk"
            ],
            "title": "Jurisdiction",
            "type": "string"
          },
          "long_term_gain": {
            "title": "Long Term Gain",
            "type": "number"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "rates": {
            "$ref": "#/components/schemas/TaxRatesView"
          },
          "short_term_gain": {
            "title": "Short Term Gain",
            "type": "number"
          },
          "unconverted": {
            "description": "Disposals left out for want of an FX rate.",
            "title": "Unconverted",
            "type": "integer"
          },
          "wash_sale_disallowed": {
            "title": "Wash Sale Disallowed",
            "type": "number"
          },
          "year": {
            "title": "Year",
            "type": "integer"
          }
        },
        "required": [
          "portfolio_id",
          "year",
          "base_currency",
          "jurisdiction",
          "short_term_gain",
          "long_term_gain",
          "wash_sale_disallowed",
          "estimated_tax",
          "disposals",
          "unconverted",
          "rates"
        ],
        "title": "TaxYearView",
        "type": "object"
      },
      "TcaGroupView": {
        "description": "Costs of a group of orders, weighted by notional, in bps.",
        "properties": {
          "convention_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Convention Bps"
          },
          "delay_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Delay Bps"
          },
          "expected_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expected Bps"
          },
          "fee_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fee Bps"
          },
          "filled_notional": {
            "title": "Filled Notional",
            "type": "number"
          },
          "filled_orders": {
            "title": "Filled Orders",
            "type": "integer"
          },
          "impact_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Impact Bps"
          },
          "is_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Bps"
          },
          "is_cost": {
            "title": "Is Cost",
            "type": "number"
          },
          "key": {
            "title": "Key",
            "type": "string"
          },
          "model_gap_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Model Gap Bps"
          },
          "opportunity_bps": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Opportunity Bps"
          },
          "opportunity_cost": {
            "title": "Opportunity Cost",
            "type": "number"
          },
          "orders": {
            "title": "Orders",
            "type": "integer"
          }
        },
        "required": [
          "key",
          "orders",
          "filled_orders",
          "filled_notional",
          "is_cost",
          "is_bps",
          "delay_bps",
          "impact_bps",
          "fee_bps",
          "opportunity_cost",
          "opportunity_bps",
          "convention_bps",
          "expected_bps",
          "model_gap_bps"
        ],
        "title": "TcaGroupView",
        "type": "object"
      },
      "TcaMoneyView": {
        "description": "A group's money figures in the portfolio's base currency (roadmap\n20.5), each order converted at the FX rate of its decision day. Null\nwhen an order's currency has no rate.",
        "properties": {
          "filled_notional": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Filled Notional"
          },
          "is_cost": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Cost"
          },
          "key": {
            "title": "Key",
            "type": "string"
          },
          "opportunity_cost": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Opportunity Cost"
          }
        },
        "required": [
          "key",
          "filled_notional",
          "is_cost",
          "opportunity_cost"
        ],
        "title": "TcaMoneyView",
        "type": "object"
      },
      "TcaSummaryView": {
        "properties": {
          "base_currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Base Currency"
          },
          "by": {
            "enum": [
              "all",
              "strategy",
              "ticker",
              "portfolio",
              "algo",
              "day",
              "week",
              "month"
            ],
            "title": "By",
            "type": "string"
          },
          "fx_missing": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Fx Missing",
            "type": "array"
          },
          "groups": {
            "items": {
              "$ref": "#/components/schemas/TcaGroupView"
            },
            "title": "Groups",
            "type": "array"
          },
          "groups_base": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/TcaMoneyView"
            },
            "title": "Groups Base",
            "type": "array"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "since": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Since"
          },
          "until": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Until"
          }
        },
        "required": [
          "portfolio_id",
          "by",
          "since",
          "until",
          "groups"
        ],
        "title": "TcaSummaryView",
        "type": "object"
      },
      "TearSheetView": {
        "properties": {
          "book_trades": {
            "title": "Book Trades",
            "type": "integer"
          },
          "curve": {
            "items": {
              "$ref": "#/components/schemas/PnlRowView"
            },
            "title": "Curve",
            "type": "array"
          },
          "golive": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/GoLiveReport"
              },
              {
                "type": "null"
              }
            ]
          },
          "live_since": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Live Since"
          },
          "monthly_returns": {
            "items": {
              "$ref": "#/components/schemas/MonthlyReturn"
            },
            "title": "Monthly Returns",
            "type": "array"
          },
          "paper": {
            "$ref": "#/components/schemas/PaperFigures"
          },
          "recent_trades": {
            "items": {
              "$ref": "#/components/schemas/ShadowDecisionView"
            },
            "title": "Recent Trades",
            "type": "array"
          },
          "status_history": {
            "items": {
              "$ref": "#/components/schemas/StatusChangeView"
            },
            "title": "Status History",
            "type": "array"
          },
          "strategy": {
            "$ref": "#/components/schemas/StrategyDetail"
          }
        },
        "required": [
          "strategy",
          "paper",
          "curve",
          "monthly_returns",
          "recent_trades",
          "book_trades",
          "live_since",
          "golive",
          "status_history"
        ],
        "title": "TearSheetView",
        "type": "object"
      },
      "TelegramLinkCodeView": {
        "properties": {
          "bot_username": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bot Username"
          },
          "code": {
            "description": "Shown once. Send /link CODE to the bot.",
            "title": "Code",
            "type": "string"
          },
          "expires_at": {
            "format": "date-time",
            "title": "Expires At",
            "type": "string"
          }
        },
        "required": [
          "code",
          "expires_at"
        ],
        "title": "TelegramLinkCodeView",
        "type": "object"
      },
      "TelegramLinkView": {
        "properties": {
          "bot_configured": {
            "description": "The server has a bot token, so it can send.",
            "title": "Bot Configured",
            "type": "boolean"
          },
          "bot_enabled": {
            "description": "The server answers commands ([telegram].enabled).",
            "title": "Bot Enabled",
            "type": "boolean"
          },
          "bot_username": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Bot Username"
          },
          "linked": {
            "title": "Linked",
            "type": "boolean"
          },
          "linked_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Linked At"
          },
          "username": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The linked chat's @username.",
            "title": "Username"
          }
        },
        "required": [
          "bot_configured",
          "bot_enabled",
          "linked"
        ],
        "title": "TelegramLinkView",
        "type": "object"
      },
      "TestNotificationView": {
        "description": "What a test notification queued: its feed id and one delivery per\nenabled channel target (a push device, the webhook, email).",
        "properties": {
          "channels": {
            "items": {
              "type": "string"
            },
            "title": "Channels",
            "type": "array"
          },
          "deliveries": {
            "title": "Deliveries",
            "type": "integer"
          },
          "notification_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notification Id"
          }
        },
        "required": [
          "notification_id",
          "deliveries",
          "channels"
        ],
        "title": "TestNotificationView",
        "type": "object"
      },
      "TickRequest": {
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          },
          "asset_class": {
            "anyOf": [
              {
                "enum": [
                  "equity",
                  "crypto",
                  "commodity",
                  "bond"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Asset Class"
          },
          "bars_due_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Buy only tickers whose latest session that closed by this time has its daily bar in the lake (scheduled ticks send their fire time). Tickers whose bar is missing are marked and sellable, not buyable.",
            "title": "Bars Due At"
          },
          "dry_run": {
            "default": false,
            "title": "Dry Run",
            "type": "boolean"
          },
          "scoped": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "description": "Trade only the tick's tickers and leave other holdings alone, not even selling them. Default: true when tickers or asset_class narrow the universe.",
            "title": "Scoped"
          },
          "tickers": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tickers"
          }
        },
        "title": "TickRequest",
        "type": "object"
      },
      "TickResultView": {
        "properties": {
          "broker_mode": {
            "default": "simulated",
            "description": "Whose money the default book traded: simulated fills, a broker's paper account, or a live (real money) account.",
            "enum": [
              "simulated",
              "paper",
              "live"
            ],
            "title": "Broker Mode",
            "type": "string"
          },
          "dry_run": {
            "title": "Dry Run",
            "type": "boolean"
          },
          "fills": {
            "title": "Fills",
            "type": "integer"
          },
          "orders_placed": {
            "title": "Orders Placed",
            "type": "integer"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "tick_id": {
            "title": "Tick Id",
            "type": "string"
          },
          "winner_strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Winner Strategy Id"
          },
          "winner_strategy_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Winner Strategy Name"
          }
        },
        "required": [
          "tick_id",
          "status",
          "winner_strategy_id",
          "orders_placed",
          "fills",
          "dry_run"
        ],
        "title": "TickResultView",
        "type": "object"
      },
      "TickRun": {
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The trading date the tick ran for (null for rows that predate it).",
            "title": "As Of"
          },
          "finished_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "started_at": {
            "format": "date-time",
            "title": "Started At",
            "type": "string"
          },
          "status": {
            "enum": [
              "running",
              "ok",
              "partial",
              "error"
            ],
            "title": "Status",
            "type": "string"
          },
          "summary": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TickSummary"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "started_at",
          "finished_at",
          "status",
          "summary"
        ],
        "title": "TickRun",
        "type": "object"
      },
      "TickRunWithOrders": {
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The trading date the tick ran for (null for rows that predate it).",
            "title": "As Of"
          },
          "finished_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "orders": {
            "items": {
              "$ref": "#/components/schemas/OrderView"
            },
            "title": "Orders",
            "type": "array"
          },
          "started_at": {
            "format": "date-time",
            "title": "Started At",
            "type": "string"
          },
          "status": {
            "enum": [
              "running",
              "ok",
              "partial",
              "error"
            ],
            "title": "Status",
            "type": "string"
          },
          "summary": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/TickSummary"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "started_at",
          "finished_at",
          "status",
          "summary",
          "orders"
        ],
        "title": "TickRunWithOrders",
        "type": "object"
      },
      "TickSummary": {
        "additionalProperties": true,
        "properties": {
          "broker_mode": {
            "anyOf": [
              {
                "enum": [
                  "simulated",
                  "paper",
                  "live"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Broker Mode"
          },
          "deferred_corporate_actions": {
            "default": [],
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Deferred Corporate Actions",
            "type": "array"
          },
          "dry_run": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Dry Run"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "error_type": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Type"
          },
          "exit_strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exit Strategy Id"
          },
          "exit_strategy_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exit Strategy Name"
          },
          "fills": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fills"
          },
          "orders_placed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Orders Placed"
          },
          "outside_universe_skipped": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Outside Universe Skipped",
            "type": "array"
          },
          "portfolio_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Id"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "risk_adjustments": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/RiskAdjustmentView"
            },
            "title": "Risk Adjustments",
            "type": "array"
          },
          "shadow": {
            "default": [],
            "items": {
              "$ref": "#/components/schemas/ShadowOutcomeView"
            },
            "title": "Shadow",
            "type": "array"
          },
          "shadow_error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Shadow Error"
          },
          "stale_buys_dropped": {
            "default": [],
            "items": {
              "type": "string"
            },
            "title": "Stale Buys Dropped",
            "type": "array"
          },
          "winner_expected_return": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Winner Expected Return"
          },
          "winner_strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Winner Strategy Id"
          },
          "winner_strategy_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Winner Strategy Name"
          }
        },
        "title": "TickSummary",
        "type": "object"
      },
      "TicketApproval": {
        "additionalProperties": false,
        "properties": {
          "ticket_ids": {
            "items": {
              "pattern": "^tkt_[a-f0-9]{8,32}$",
              "type": "string"
            },
            "maxItems": 200,
            "minItems": 1,
            "title": "Ticket Ids",
            "type": "array"
          }
        },
        "required": [
          "ticket_ids"
        ],
        "title": "TicketApproval",
        "type": "object"
      },
      "TicketList": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/TicketView"
            },
            "title": "Items",
            "type": "array"
          }
        },
        "required": [
          "items"
        ],
        "title": "TicketList",
        "type": "object"
      },
      "TicketRejection": {
        "additionalProperties": false,
        "properties": {
          "reason": {
            "maxLength": 500,
            "minLength": 3,
            "title": "Reason",
            "type": "string"
          }
        },
        "required": [
          "reason"
        ],
        "title": "TicketRejection",
        "type": "object"
      },
      "TicketSubmitResult": {
        "properties": {
          "expired": {
            "title": "Expired",
            "type": "integer"
          },
          "failed": {
            "title": "Failed",
            "type": "integer"
          },
          "portfolios": {
            "items": {
              "$ref": "#/components/schemas/PortfolioSubmitView"
            },
            "title": "Portfolios",
            "type": "array"
          },
          "sent": {
            "title": "Sent",
            "type": "integer"
          },
          "settled": {
            "title": "Settled",
            "type": "integer"
          }
        },
        "required": [
          "sent",
          "failed",
          "expired",
          "settled",
          "portfolios"
        ],
        "title": "TicketSubmitResult",
        "type": "object"
      },
      "TicketSummary": {
        "description": "Tickets waiting for you, for the badge in the menu.",
        "properties": {
          "awaiting_approval": {
            "title": "Awaiting Approval",
            "type": "integer"
          },
          "by_portfolio": {
            "additionalProperties": {
              "type": "integer"
            },
            "title": "By Portfolio",
            "type": "object"
          }
        },
        "required": [
          "awaiting_approval",
          "by_portfolio"
        ],
        "title": "TicketSummary",
        "type": "object"
      },
      "TicketView": {
        "description": "One order ticket: the order a live book decided, why, and what\nbecame of it.",
        "properties": {
          "as_of": {
            "description": "The day the book decided.",
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "client_id": {
            "description": "The order the ticket becomes at the broker.",
            "title": "Client Id",
            "type": "string"
          },
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "decided_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Decided At"
          },
          "decided_by": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Decided By"
          },
          "decision_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Decision Reason"
          },
          "expires_at": {
            "description": "The submit deadline: unsent, it expires.",
            "format": "date-time",
            "title": "Expires At",
            "type": "string"
          },
          "hold": {
            "anyOf": [
              {
                "enum": [
                  "approve_mode",
                  "runaway",
                  "hard_to_borrow",
                  "options"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Why it waits for a person (approve mode, a runaway run, a hard to borrow short sale, or a live option order).",
            "title": "Hold"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "limit_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Limit Price"
          },
          "notional": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "quantity x (limit, else the reference price).",
            "title": "Notional"
          },
          "order_type": {
            "title": "Order Type",
            "type": "string"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "portfolio_name": {
            "title": "Portfolio Name",
            "type": "string"
          },
          "position_effect": {
            "anyOf": [
              {
                "enum": [
                  "open",
                  "close"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Position Effect"
          },
          "quantity": {
            "title": "Quantity",
            "type": "number"
          },
          "reason": {
            "additionalProperties": true,
            "description": "Signal score, rank, target weight, trigger.",
            "title": "Reason",
            "type": "object"
          },
          "reference_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "The price the book decided at.",
            "title": "Reference Price"
          },
          "rules": {
            "description": "The risk and account rules that touched it.",
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Rules",
            "type": "array"
          },
          "side": {
            "enum": [
              "buy",
              "sell"
            ],
            "title": "Side",
            "type": "string"
          },
          "status": {
            "enum": [
              "awaiting_approval",
              "approved",
              "rejected",
              "expired",
              "submitted",
              "filled",
              "unfilled",
              "cancelled",
              "failed"
            ],
            "title": "Status",
            "type": "string"
          },
          "status_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status Reason"
          },
          "strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Id"
          },
          "strategy_name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The strategy's plain title (a starter's), or null: the console names it from the id.",
            "title": "Strategy Name"
          },
          "submit_after": {
            "format": "date-time",
            "title": "Submit After",
            "type": "string"
          },
          "submitted_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Submitted At"
          },
          "tick_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tick Id"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          },
          "what_if": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "description": "The broker's preview: commission and margin (when it has one).",
            "title": "What If"
          }
        },
        "required": [
          "id",
          "portfolio_id",
          "portfolio_name",
          "tick_id",
          "as_of",
          "client_id",
          "strategy_id",
          "ticker",
          "side",
          "quantity",
          "order_type",
          "limit_price",
          "position_effect",
          "reference_price",
          "notional",
          "what_if",
          "reason",
          "rules",
          "hold",
          "status",
          "submit_after",
          "expires_at",
          "decided_by",
          "decided_at",
          "decision_reason",
          "submitted_at",
          "status_reason",
          "created_at"
        ],
        "title": "TicketView",
        "type": "object"
      },
      "TokenCreateRequest": {
        "properties": {
          "expires_in_days": {
            "anyOf": [
              {
                "maximum": 365.0,
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires In Days"
          },
          "name": {
            "maxLength": 100,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "scopes": {
            "items": {
              "$ref": "#/components/schemas/ApiScope"
            },
            "minItems": 1,
            "title": "Scopes",
            "type": "array"
          },
          "toolsets": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 64,
                "minItems": 1,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Toolsets"
          }
        },
        "required": [
          "name",
          "scopes"
        ],
        "title": "TokenCreateRequest",
        "type": "object"
      },
      "TokenCreatedView": {
        "properties": {
          "info": {
            "$ref": "#/components/schemas/TokenView"
          },
          "token": {
            "title": "Token",
            "type": "string"
          }
        },
        "required": [
          "token",
          "info"
        ],
        "title": "TokenCreatedView",
        "type": "object"
      },
      "TokenView": {
        "properties": {
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "revoked_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Revoked At"
          },
          "scopes": {
            "items": {
              "$ref": "#/components/schemas/ApiScope"
            },
            "title": "Scopes",
            "type": "array"
          },
          "toolsets": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Toolsets"
          }
        },
        "required": [
          "id",
          "name",
          "scopes",
          "created_at",
          "last_used_at",
          "expires_at",
          "revoked_at"
        ],
        "title": "TokenView",
        "type": "object"
      },
      "ToolCallView": {
        "properties": {
          "arguments": {
            "additionalProperties": true,
            "title": "Arguments",
            "type": "object"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "arguments"
        ],
        "title": "ToolCallView",
        "type": "object"
      },
      "ToolsetView": {
        "description": "One MCP tool group a token can be limited to.",
        "properties": {
          "about": {
            "title": "About",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          }
        },
        "required": [
          "name",
          "about"
        ],
        "title": "ToolsetView",
        "type": "object"
      },
      "TradeDecisionView": {
        "description": "One ticker in one book on one tick: the step that kept it out or\ntrimmed it. ``step`` is one of universe, rank, constructor, buffer,\nstale_price, risk_rule, lots, scope, external, halt, held or traded.",
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "detail": {
            "additionalProperties": true,
            "title": "Detail",
            "type": "object"
          },
          "outcome": {
            "title": "Outcome",
            "type": "string"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Score"
          },
          "step": {
            "title": "Step",
            "type": "string"
          },
          "step_text": {
            "title": "Step Text",
            "type": "string"
          },
          "strategies": {
            "items": {
              "type": "string"
            },
            "title": "Strategies",
            "type": "array"
          },
          "strategy_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Strategy Id"
          },
          "summary": {
            "title": "Summary",
            "type": "string"
          },
          "tick_id": {
            "title": "Tick Id",
            "type": "string"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "tick_id",
          "portfolio_id",
          "as_of",
          "ticker",
          "step",
          "outcome",
          "strategy_id",
          "strategies",
          "score",
          "detail",
          "summary",
          "step_text"
        ],
        "title": "TradeDecisionView",
        "type": "object"
      },
      "TradePlanRequest": {
        "additionalProperties": false,
        "description": "Size an entry from the risk you choose and the distance to the stop.",
        "properties": {
          "entry_price": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Your entry, e.g. a limit. Default: the latest close.",
            "title": "Entry Price"
          },
          "portfolio_id": {
            "anyOf": [
              {
                "maxLength": 64,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Id"
          },
          "risk_amount": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Risk as an amount in the book's currency.",
            "title": "Risk Amount"
          },
          "risk_percent": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "maximum": 100.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "Risk as a percent of the book's value.",
            "title": "Risk Percent"
          },
          "side": {
            "enum": [
              "buy",
              "sell"
            ],
            "title": "Side",
            "type": "string"
          },
          "stop_price": {
            "exclusiveMinimum": 0.0,
            "title": "Stop Price",
            "type": "number"
          },
          "target_price": {
            "anyOf": [
              {
                "exclusiveMinimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Price"
          },
          "ticker": {
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._\\-^=]{0,31}$",
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "ticker",
          "side",
          "stop_price"
        ],
        "title": "TradePlanRequest",
        "type": "object"
      },
      "TradePlanView": {
        "properties": {
          "capped_by": {
            "anyOf": [
              {
                "const": "cash",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "cash: the cash cut the size.",
            "title": "Capped By"
          },
          "cash": {
            "title": "Cash",
            "type": "number"
          },
          "entry_is_close": {
            "description": "The entry is the latest close.",
            "title": "Entry Is Close",
            "type": "boolean"
          },
          "entry_price": {
            "title": "Entry Price",
            "type": "number"
          },
          "equity": {
            "description": "The book's value at the latest closes.",
            "title": "Equity",
            "type": "number"
          },
          "note": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Note"
          },
          "notional": {
            "title": "Notional",
            "type": "number"
          },
          "quantity": {
            "description": "Whole shares whose loss at the stop fits the risk.",
            "title": "Quantity",
            "type": "integer"
          },
          "reward_risk": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "description": "The gain at the target over the risk.",
            "title": "Reward Risk"
          },
          "risk_amount": {
            "description": "The loss at the stop for that quantity.",
            "title": "Risk Amount",
            "type": "number"
          },
          "risk_budget": {
            "description": "The risk you chose, as an amount.",
            "title": "Risk Budget",
            "type": "number"
          },
          "risk_per_share": {
            "title": "Risk Per Share",
            "type": "number"
          },
          "side": {
            "enum": [
              "buy",
              "sell"
            ],
            "title": "Side",
            "type": "string"
          },
          "stop_price": {
            "title": "Stop Price",
            "type": "number"
          },
          "target_price": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Target Price"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "ticker",
          "side",
          "entry_price",
          "entry_is_close",
          "stop_price",
          "target_price",
          "equity",
          "cash",
          "risk_budget",
          "risk_per_share",
          "quantity",
          "risk_amount",
          "notional",
          "reward_risk",
          "capped_by"
        ],
        "title": "TradePlanView",
        "type": "object"
      },
      "TradeStatsView": {
        "description": "Trade-level statistics of a backtest (``backtest.trades.TradeStats``).\nWin/loss figures are over closed round trips; ``None`` marks an\nunbounded ratio (no losing trades).",
        "properties": {
          "avg_bars_held": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Bars Held"
          },
          "avg_loss": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Loss"
          },
          "avg_win": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Win"
          },
          "cost_drag_annual": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cost Drag Annual"
          },
          "costs_paid": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Costs Paid"
          },
          "expectancy": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expectancy"
          },
          "exposure": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Exposure"
          },
          "n_open": {
            "title": "N Open",
            "type": "integer"
          },
          "n_trades": {
            "title": "N Trades",
            "type": "integer"
          },
          "payoff_ratio": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Payoff Ratio"
          },
          "trade_profit_factor": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trade Profit Factor"
          },
          "turnover_annual": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Turnover Annual"
          },
          "win_rate": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Win Rate"
          }
        },
        "required": [
          "n_trades",
          "n_open",
          "win_rate",
          "avg_win",
          "avg_loss",
          "payoff_ratio",
          "expectancy",
          "trade_profit_factor",
          "avg_bars_held",
          "exposure",
          "turnover_annual",
          "costs_paid",
          "cost_drag_annual"
        ],
        "title": "TradeStatsView",
        "type": "object"
      },
      "TradeView": {
        "description": "One round trip (a lot, or part of one, from buy to sell or to the end).",
        "properties": {
          "bars_held": {
            "title": "Bars Held",
            "type": "integer"
          },
          "entry_px": {
            "title": "Entry Px",
            "type": "number"
          },
          "entry_ts": {
            "format": "date-time",
            "title": "Entry Ts",
            "type": "string"
          },
          "exit_px": {
            "title": "Exit Px",
            "type": "number"
          },
          "exit_ts": {
            "format": "date-time",
            "title": "Exit Ts",
            "type": "string"
          },
          "fees": {
            "title": "Fees",
            "type": "number"
          },
          "is_open": {
            "title": "Is Open",
            "type": "boolean"
          },
          "pnl": {
            "title": "Pnl",
            "type": "number"
          },
          "qty": {
            "title": "Qty",
            "type": "number"
          },
          "return_pct": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Return Pct"
          },
          "ticker": {
            "title": "Ticker",
            "type": "string"
          }
        },
        "required": [
          "ticker",
          "entry_ts",
          "exit_ts",
          "qty",
          "entry_px",
          "exit_px",
          "pnl",
          "return_pct",
          "bars_held",
          "fees",
          "is_open"
        ],
        "title": "TradeView",
        "type": "object"
      },
      "TradingModeView": {
        "description": "Whether a portfolio trades paper or live money, and through what.",
        "properties": {
          "broker": {
            "description": "simulated (the Stonks ledger), alpaca (the configured account, default portfolio only), ibkr (the IB Gateway that serves the default portfolio) or connection (a linked broker account, synced read-only).",
            "enum": [
              "simulated",
              "alpaca",
              "ibkr",
              "connection"
            ],
            "title": "Broker",
            "type": "string"
          },
          "detail": {
            "title": "Detail",
            "type": "string"
          },
          "live_stage": {
            "default": "sim_paper",
            "description": "Where the portfolio stands on the way to real money. A broker portfolio trades real money only at live_small or live_scale.",
            "enum": [
              "sim_paper",
              "broker_paper",
              "live_small",
              "live_scale"
            ],
            "title": "Live Stage",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "portfolio_id": {
            "title": "Portfolio Id",
            "type": "string"
          },
          "trading": {
            "description": "paper: simulated fills or a paper broker account. live: real money.",
            "enum": [
              "paper",
              "live"
            ],
            "title": "Trading",
            "type": "string"
          }
        },
        "required": [
          "portfolio_id",
          "name",
          "trading",
          "broker",
          "detail"
        ],
        "title": "TradingModeView",
        "type": "object"
      },
      "TunerInfo": {
        "description": "A tuner a lab request can name in ``tuner``, with the JSON Schema of\nwhat ``tuner_options`` may set for it.",
        "properties": {
          "description": {
            "title": "Description",
            "type": "string"
          },
          "label": {
            "title": "Label",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "options_schema": {
            "additionalProperties": true,
            "title": "Options Schema",
            "type": "object"
          }
        },
        "required": [
          "name",
          "label",
          "description",
          "options_schema"
        ],
        "title": "TunerInfo",
        "type": "object"
      },
      "TurnView": {
        "description": "One recorded turn: the model, the prompt version, every tool call and\nresult, and the drafts it made.",
        "properties": {
          "draft_ids": {
            "items": {
              "type": "string"
            },
            "title": "Draft Ids",
            "type": "array"
          },
          "finished_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Finished At"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "model": {
            "title": "Model",
            "type": "string"
          },
          "prompt_version": {
            "title": "Prompt Version",
            "type": "string"
          },
          "started_at": {
            "format": "date-time",
            "title": "Started At",
            "type": "string"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "steps": {
            "title": "Steps",
            "type": "integer"
          },
          "trace": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "title": "Trace",
            "type": "array"
          }
        },
        "required": [
          "id",
          "model",
          "prompt_version",
          "status",
          "steps",
          "trace",
          "draft_ids",
          "started_at",
          "finished_at"
        ],
        "title": "TurnView",
        "type": "object"
      },
      "UniverseCreate": {
        "properties": {
          "csv": {
            "anyOf": [
              {
                "maxLength": 5000000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Csv"
          },
          "description": {
            "anyOf": [
              {
                "maxLength": 2000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "pattern": "^[a-z0-9][a-z0-9_.-]{0,63}$",
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "enum": [
              "list",
              "exchange",
              "rule",
              "index"
            ],
            "title": "Kind",
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "spec": {
            "additionalProperties": true,
            "title": "Spec",
            "type": "object"
          }
        },
        "required": [
          "kind",
          "id"
        ],
        "title": "UniverseCreate",
        "type": "object"
      },
      "UniverseMembers": {
        "properties": {
          "as_of": {
            "format": "date",
            "title": "As Of",
            "type": "string"
          },
          "count": {
            "title": "Count",
            "type": "integer"
          },
          "tickers": {
            "items": {
              "type": "string"
            },
            "title": "Tickers",
            "type": "array"
          },
          "universe_id": {
            "title": "Universe Id",
            "type": "string"
          }
        },
        "required": [
          "universe_id",
          "as_of",
          "tickers",
          "count"
        ],
        "title": "UniverseMembers",
        "type": "object"
      },
      "UniverseRefreshView": {
        "properties": {
          "current_members": {
            "title": "Current Members",
            "type": "integer"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "members": {
            "title": "Members",
            "type": "integer"
          },
          "refreshed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Refreshed At"
          },
          "spans": {
            "title": "Spans",
            "type": "integer"
          },
          "universe_id": {
            "title": "Universe Id",
            "type": "string"
          },
          "warnings": {
            "items": {
              "type": "string"
            },
            "title": "Warnings",
            "type": "array"
          }
        },
        "required": [
          "universe_id",
          "kind",
          "members",
          "current_members",
          "spans"
        ],
        "title": "UniverseRefreshView",
        "type": "object"
      },
      "UniverseUpdate": {
        "description": "A universe's new definition. The members stay as they are until the\nnext refresh.",
        "properties": {
          "csv": {
            "anyOf": [
              {
                "maxLength": 5000000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Csv"
          },
          "description": {
            "anyOf": [
              {
                "maxLength": 2000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "kind": {
            "enum": [
              "list",
              "exchange",
              "rule",
              "index"
            ],
            "title": "Kind",
            "type": "string"
          },
          "name": {
            "anyOf": [
              {
                "maxLength": 200,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "spec": {
            "additionalProperties": true,
            "title": "Spec",
            "type": "object"
          }
        },
        "required": [
          "kind"
        ],
        "title": "UniverseUpdate",
        "type": "object"
      },
      "UniverseView": {
        "properties": {
          "created_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "kind": {
            "enum": [
              "list",
              "exchange",
              "rule",
              "index"
            ],
            "title": "Kind",
            "type": "string"
          },
          "member_count": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Member Count"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "refreshed_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Refreshed At"
          },
          "spec": {
            "additionalProperties": true,
            "title": "Spec",
            "type": "object"
          },
          "updated_at": {
            "anyOf": [
              {
                "format": "date-time",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          }
        },
        "required": [
          "id",
          "kind",
          "spec"
        ],
        "title": "UniverseView",
        "type": "object"
      },
      "UsRegulatoryFees": {
        "additionalProperties": false,
        "description": "US regulatory transaction fees, passed through by IBKR on either plan.",
        "properties": {
          "cat_per_share": {
            "default": 3.5e-05,
            "minimum": 0.0,
            "title": "Cat Per Share",
            "type": "number"
          },
          "sec_rate_per_million": {
            "default": 27.8,
            "minimum": 0.0,
            "title": "Sec Rate Per Million",
            "type": "number"
          },
          "taf_max": {
            "default": 8.3,
            "minimum": 0.0,
            "title": "Taf Max",
            "type": "number"
          },
          "taf_per_share": {
            "default": 0.000166,
            "minimum": 0.0,
            "title": "Taf Per Share",
            "type": "number"
          }
        },
        "title": "UsRegulatoryFees",
        "type": "object"
      },
      "UserCreateRequest": {
        "properties": {
          "display_name": {
            "maxLength": 100,
            "minLength": 1,
            "title": "Display Name",
            "type": "string"
          },
          "email": {
            "maxLength": 320,
            "minLength": 3,
            "title": "Email",
            "type": "string"
          },
          "password": {
            "maxLength": 1024,
            "minLength": 1,
            "title": "Password",
            "type": "string"
          },
          "role": {
            "$ref": "#/components/schemas/Role"
          }
        },
        "required": [
          "email",
          "display_name",
          "role",
          "password"
        ],
        "title": "UserCreateRequest",
        "type": "object"
      },
      "UserUpdateRequest": {
        "properties": {
          "role": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/Role"
              },
              {
                "type": "null"
              }
            ]
          },
          "status": {
            "anyOf": [
              {
                "enum": [
                  "active",
                  "disabled"
                ],
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          }
        },
        "title": "UserUpdateRequest",
        "type": "object"
      },
      "UserView": {
        "description": "Identity and status only. Admins never see holdings here.",
        "properties": {
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "display_name": {
            "title": "Display Name",
            "type": "string"
          },
          "email": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Email"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "last_login_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Login At"
          },
          "mfa_enrolled": {
            "title": "Mfa Enrolled",
            "type": "boolean"
          },
          "role": {
            "$ref": "#/components/schemas/Role"
          },
          "status": {
            "enum": [
              "active",
              "disabled"
            ],
            "title": "Status",
            "type": "string"
          }
        },
        "required": [
          "id",
          "email",
          "display_name",
          "role",
          "status",
          "mfa_enrolled",
          "created_at",
          "last_login_at"
        ],
        "title": "UserView",
        "type": "object"
      },
      "ValidateRequest": {
        "description": "Smoke-run on these lake tickers (sample data when empty), over the\nlast ``bars`` bars up to ``as_of`` (latest data when omitted).",
        "properties": {
          "as_of": {
            "anyOf": [
              {
                "format": "date",
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of"
          },
          "bars": {
            "default": 20,
            "maximum": 250.0,
            "minimum": 1.0,
            "title": "Bars",
            "type": "integer"
          },
          "tickers": {
            "items": {
              "type": "string"
            },
            "maxItems": 20,
            "title": "Tickers",
            "type": "array"
          }
        },
        "title": "ValidateRequest",
        "type": "object"
      },
      "ValidationIssue": {
        "properties": {
          "message": {
            "title": "Message",
            "type": "string"
          },
          "path": {
            "title": "Path",
            "type": "string"
          }
        },
        "required": [
          "path",
          "message"
        ],
        "title": "ValidationIssue",
        "type": "object"
      },
      "VapidKeyView": {
        "properties": {
          "public_key": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Public Key"
          }
        },
        "required": [
          "public_key"
        ],
        "title": "VapidKeyView",
        "type": "object"
      },
      "VerifyReportView": {
        "properties": {
          "changed_tickers": {
            "items": {
              "type": "string"
            },
            "title": "Changed Tickers",
            "type": "array"
          },
          "class_path": {
            "title": "Class Path",
            "type": "string"
          },
          "code_changed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Code Changed"
          },
          "config_changed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Config Changed"
          },
          "current_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Current Score"
          },
          "data_changed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Data Changed"
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "moved": {
            "title": "Moved",
            "type": "boolean"
          },
          "objective": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Objective"
          },
          "restated_tickers": {
            "items": {
              "type": "string"
            },
            "title": "Restated Tickers",
            "type": "array"
          },
          "run_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Run Id"
          },
          "score_delta": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Score Delta"
          },
          "stored_score": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Stored Score"
          },
          "target": {
            "title": "Target",
            "type": "string"
          },
          "tolerance": {
            "title": "Tolerance",
            "type": "number"
          }
        },
        "required": [
          "target",
          "kind",
          "class_path",
          "run_id",
          "objective",
          "tolerance",
          "stored_score",
          "current_score",
          "score_delta",
          "moved",
          "data_changed",
          "changed_tickers",
          "config_changed",
          "code_changed",
          "error"
        ],
        "title": "VerifyReportView",
        "type": "object"
      },
      "VerifyRequest": {
        "additionalProperties": false,
        "properties": {
          "alert": {
            "default": false,
            "title": "Alert",
            "type": "boolean"
          },
          "targets": {
            "items": {
              "type": "string"
            },
            "maxItems": 200,
            "title": "Targets",
            "type": "array"
          },
          "tolerance": {
            "anyOf": [
              {
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tolerance"
          }
        },
        "title": "VerifyRequest",
        "type": "object"
      },
      "VerifyResultView": {
        "properties": {
          "alerted": {
            "default": false,
            "title": "Alerted",
            "type": "boolean"
          },
          "checked": {
            "title": "Checked",
            "type": "integer"
          },
          "moved": {
            "items": {
              "type": "string"
            },
            "title": "Moved",
            "type": "array"
          },
          "reports": {
            "items": {
              "$ref": "#/components/schemas/VerifyReportView"
            },
            "title": "Reports",
            "type": "array"
          }
        },
        "required": [
          "checked",
          "moved",
          "reports"
        ],
        "title": "VerifyResultView",
        "type": "object"
      },
      "VerifyView": {
        "properties": {
          "backup_id": {
            "title": "Backup Id",
            "type": "string"
          },
          "ok": {
            "title": "Ok",
            "type": "boolean"
          },
          "problems": {
            "items": {
              "type": "string"
            },
            "title": "Problems",
            "type": "array"
          }
        },
        "required": [
          "backup_id",
          "ok",
          "problems"
        ],
        "title": "VerifyView",
        "type": "object"
      },
      "VersionChangeRequest": {
        "additionalProperties": false,
        "description": "Body of a swap or a reject. A reject needs ``reason``. A swap without\na passing check needs ``override`` plus a ``reason`` of at least 20\ncharacters.",
        "properties": {
          "override": {
            "default": false,
            "title": "Override",
            "type": "boolean"
          },
          "reason": {
            "anyOf": [
              {
                "maxLength": 2000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          }
        },
        "title": "VersionChangeRequest",
        "type": "object"
      },
      "VersionEventView": {
        "description": "One row of the append-only version log.",
        "properties": {
          "actor": {
            "title": "Actor",
            "type": "string"
          },
          "check_passed": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Check Passed"
          },
          "check_report": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Check Report"
          },
          "created_at": {
            "title": "Created At",
            "type": "string"
          },
          "from_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "From Status"
          },
          "id": {
            "title": "Id",
            "type": "integer"
          },
          "kind": {
            "title": "Kind",
            "type": "string"
          },
          "override": {
            "title": "Override",
            "type": "boolean"
          },
          "reason": {
            "title": "Reason",
            "type": "string"
          },
          "to_status": {
            "title": "To Status",
            "type": "string"
          },
          "version": {
            "title": "Version",
            "type": "integer"
          }
        },
        "required": [
          "id",
          "version",
          "kind",
          "from_status",
          "to_status",
          "actor",
          "reason",
          "override",
          "check_passed",
          "check_report",
          "created_at"
        ],
        "title": "VersionEventView",
        "type": "object"
      },
      "WalkForwardConfig": {
        "additionalProperties": false,
        "description": "Walk-forward settings. ``test_days=None`` splits the dataset's\nvalidation window evenly over the folds;\n``train_days=None`` means \"everything before the first test window\".",
        "properties": {
          "anchored": {
            "default": false,
            "title": "Anchored",
            "type": "boolean"
          },
          "matrix": {
            "default": false,
            "title": "Matrix",
            "type": "boolean"
          },
          "matrix_min_pass_share": {
            "default": 0.6666666666666666,
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Matrix Min Pass Share",
            "type": "number"
          },
          "matrix_test_bars": {
            "default": [
              126,
              252
            ],
            "items": {
              "type": "integer"
            },
            "minItems": 1,
            "title": "Matrix Test Bars",
            "type": "array"
          },
          "matrix_train_bars": {
            "default": [
              504,
              756,
              1008
            ],
            "items": {
              "type": "integer"
            },
            "minItems": 1,
            "title": "Matrix Train Bars",
            "type": "array"
          },
          "max_workers": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Max Workers"
          },
          "metric": {
            "default": "sharpe",
            "enum": [
              "sharpe",
              "cagr",
              "final_return"
            ],
            "title": "Metric",
            "type": "string"
          },
          "min_mean_score": {
            "default": 0.0,
            "title": "Min Mean Score",
            "type": "number"
          },
          "min_positive_share": {
            "default": 0.5,
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Min Positive Share",
            "type": "number"
          },
          "min_wfe": {
            "anyOf": [
              {
                "maximum": 1.0,
                "minimum": 0.0,
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "default": 0.5,
            "title": "Min Wfe"
          },
          "n_splits": {
            "default": 4,
            "minimum": 1.0,
            "title": "N Splits",
            "type": "integer"
          },
          "seed": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "default": 0,
            "title": "Seed"
          },
          "test_days": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Test Days"
          },
          "train_days": {
            "anyOf": [
              {
                "minimum": 1.0,
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Train Days"
          }
        },
        "title": "WalkForwardConfig",
        "type": "object"
      },
      "WatchlistCreate": {
        "additionalProperties": false,
        "properties": {
          "name": {
            "maxLength": 80,
            "minLength": 1,
            "title": "Name",
            "type": "string"
          },
          "tickers": {
            "items": {
              "type": "string"
            },
            "maxItems": 500,
            "title": "Tickers",
            "type": "array"
          }
        },
        "required": [
          "name"
        ],
        "title": "WatchlistCreate",
        "type": "object"
      },
      "WatchlistUpdate": {
        "additionalProperties": false,
        "description": "Rename, replace the tickers, or both. Unset fields stay.",
        "properties": {
          "name": {
            "anyOf": [
              {
                "maxLength": 80,
                "minLength": 1,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name"
          },
          "tickers": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "maxItems": 500,
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Tickers"
          }
        },
        "title": "WatchlistUpdate",
        "type": "object"
      },
      "WatchlistView": {
        "properties": {
          "created_at": {
            "format": "date-time",
            "title": "Created At",
            "type": "string"
          },
          "id": {
            "title": "Id",
            "type": "string"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "tickers": {
            "items": {
              "type": "string"
            },
            "title": "Tickers",
            "type": "array"
          },
          "updated_at": {
            "format": "date-time",
            "title": "Updated At",
            "type": "string"
          }
        },
        "required": [
          "id",
          "name",
          "tickers",
          "created_at",
          "updated_at"
        ],
        "title": "WatchlistView",
        "type": "object"
      },
      "WebhookUpdate": {
        "description": "Your own webhook (a public ``https`` URL). Write-only: responses show\nits scheme and host only. Null removes it.",
        "properties": {
          "url": {
            "anyOf": [
              {
                "format": "password",
                "maxLength": 2048,
                "type": "string",
                "writeOnly": true
              },
              {
                "type": "null"
              }
            ],
            "title": "Url"
          }
        },
        "title": "WebhookUpdate",
        "type": "object"
      },
      "WhatIfView": {
        "properties": {
          "commission": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Commission"
          },
          "commission_currency": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Commission Currency"
          },
          "equity_with_loan_after": {
            "title": "Equity With Loan After",
            "type": "number"
          },
          "initial_margin_change": {
            "title": "Initial Margin Change",
            "type": "number"
          },
          "maintenance_margin_change": {
            "title": "Maintenance Margin Change",
            "type": "number"
          },
          "warning": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Warning"
          }
        },
        "required": [
          "initial_margin_change",
          "maintenance_margin_change",
          "equity_with_loan_after",
          "commission",
          "commission_currency",
          "warning"
        ],
        "title": "WhatIfView",
        "type": "object"
      },
      "WorkerConfig": {
        "description": "The server's ``[lab.offload]`` timing, which the worker follows.",
        "properties": {
          "executor": {
            "title": "Executor",
            "type": "string"
          },
          "heartbeat_seconds": {
            "title": "Heartbeat Seconds",
            "type": "number"
          },
          "kinds": {
            "items": {
              "type": "string"
            },
            "title": "Kinds",
            "type": "array"
          },
          "lease_seconds": {
            "title": "Lease Seconds",
            "type": "number"
          },
          "poll_seconds": {
            "title": "Poll Seconds",
            "type": "number"
          }
        },
        "required": [
          "executor",
          "kinds",
          "heartbeat_seconds",
          "poll_seconds",
          "lease_seconds"
        ],
        "title": "WorkerConfig",
        "type": "object"
      },
      "WorkerHeartbeat": {
        "properties": {
          "message": {
            "anyOf": [
              {
                "maxLength": 500,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Message"
          },
          "progress": {
            "default": 0.0,
            "maximum": 1.0,
            "minimum": 0.0,
            "title": "Progress",
            "type": "number"
          },
          "worker_id": {
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
            "title": "Worker Id",
            "type": "string"
          }
        },
        "required": [
          "worker_id"
        ],
        "title": "WorkerHeartbeat",
        "type": "object"
      },
      "WorkerHello": {
        "properties": {
          "cpus": {
            "maximum": 4096.0,
            "minimum": 1.0,
            "title": "Cpus",
            "type": "integer"
          },
          "host": {
            "maxLength": 255,
            "minLength": 1,
            "title": "Host",
            "type": "string"
          },
          "pid": {
            "minimum": 0.0,
            "title": "Pid",
            "type": "integer"
          },
          "worker_id": {
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
            "title": "Worker Id",
            "type": "string"
          }
        },
        "required": [
          "worker_id",
          "host",
          "pid",
          "cpus"
        ],
        "title": "WorkerHello",
        "type": "object"
      },
      "WorkerOutcome": {
        "properties": {
          "error": {
            "anyOf": [
              {
                "maxLength": 20000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error"
          },
          "error_detail": {
            "anyOf": [
              {
                "maxLength": 20000,
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Detail"
          },
          "research": {
            "$ref": "#/components/schemas/ResearchRows"
          },
          "result": {
            "title": "Result"
          },
          "status": {
            "enum": [
              "succeeded",
              "failed",
              "cancelled"
            ],
            "title": "Status",
            "type": "string"
          },
          "worker_id": {
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
            "title": "Worker Id",
            "type": "string"
          }
        },
        "required": [
          "worker_id",
          "status"
        ],
        "title": "WorkerOutcome",
        "type": "object"
      },
      "WorkerRef": {
        "properties": {
          "worker_id": {
            "pattern": "^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$",
            "title": "Worker Id",
            "type": "string"
          }
        },
        "required": [
          "worker_id"
        ],
        "title": "WorkerRef",
        "type": "object"
      },
      "WorkerStopped": {
        "properties": {
          "stopped": {
            "title": "Stopped",
            "type": "boolean"
          },
          "worker_id": {
            "title": "Worker Id",
            "type": "string"
          }
        },
        "required": [
          "worker_id",
          "stopped"
        ],
        "title": "WorkerStopped",
        "type": "object"
      },
      "stonks__app__brokers__BrokerAccountView": {
        "properties": {
          "buying_power": {
            "title": "Buying Power",
            "type": "number"
          },
          "can_trade": {
            "title": "Can Trade",
            "type": "boolean"
          },
          "cash": {
            "title": "Cash",
            "type": "number"
          },
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "equity": {
            "title": "Equity",
            "type": "number"
          },
          "pattern_day_trader": {
            "title": "Pattern Day Trader",
            "type": "boolean"
          },
          "status": {
            "title": "Status",
            "type": "string"
          },
          "trading_blocked": {
            "title": "Trading Blocked",
            "type": "boolean"
          }
        },
        "required": [
          "cash",
          "equity",
          "buying_power",
          "currency",
          "status",
          "trading_blocked",
          "pattern_day_trader",
          "can_trade"
        ],
        "title": "BrokerAccountView",
        "type": "object"
      },
      "stonks__app__connections__BrokerAccountView": {
        "properties": {
          "connection_id": {
            "title": "Connection Id",
            "type": "string"
          },
          "currency": {
            "title": "Currency",
            "type": "string"
          },
          "external_account_id": {
            "title": "External Account Id",
            "type": "string"
          },
          "institution": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Institution"
          },
          "name": {
            "title": "Name",
            "type": "string"
          },
          "number_mask": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Number Mask"
          },
          "portfolio_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Portfolio Id"
          }
        },
        "required": [
          "connection_id",
          "external_account_id",
          "name",
          "institution",
          "number_mask",
          "currency",
          "portfolio_id"
        ],
        "title": "BrokerAccountView",
        "type": "object"
      }
    },
    "securitySchemes": {
      "HTTPBearer": {
        "description": "A personal API token (stk_...) or, while it lasts, STONKS_API_TOKEN",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "description": "Research + trading system: portfolio, strategies, market data, lab runs and background jobs.",
    "title": "Stonks API",
    "version": "1.0.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/api/alerts": {
      "get": {
        "description": "Your notifications, newest first. Admins also see the admin audience\n(operational alerts with no single recipient). ``category`` keeps only\nthose categories (repeat it for more). ``system`` also keeps the\noperator alerts, which carry no category.",
        "operationId": "listAlerts",
        "parameters": [
          {
            "in": "query",
            "name": "level",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "info",
                    "warning",
                    "error"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Level"
            }
          },
          {
            "in": "query",
            "name": "category",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "items": {
                    "enum": [
                      "signal",
                      "order",
                      "risk",
                      "system",
                      "price_alert",
                      "event_alert",
                      "screen_alert"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Category"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_AlertView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Alerts",
        "tags": [
          "alerts"
        ]
      }
    },
    "/api/assistant/briefings/prefs": {
      "get": {
        "description": "Your research-only briefings before the open and after the close,\nand whether this install sends them at all.",
        "operationId": "getBriefingPrefs",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BriefingPrefsView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Briefing Prefs",
        "tags": [
          "assistant"
        ]
      },
      "put": {
        "description": "Turn your briefings on or off. They come through your notification\nchannels (the feed, push, email, Telegram).",
        "operationId": "setBriefingPrefs",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BriefingPrefsUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BriefingPrefsView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set Briefing Prefs",
        "tags": [
          "assistant"
        ],
        "x-permission": "notifications.manage"
      }
    },
    "/api/assistant/briefings/run": {
      "post": {
        "description": "Send one kind of briefing to everyone who turned it on now (the\nscheduler runs this before the open and after the close). Research\nonly: each briefing runs with read tools only.",
        "operationId": "runBriefings",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BriefingRunRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BriefingRunView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Run Briefings",
        "tags": [
          "assistant"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/assistant/conversations": {
      "get": {
        "description": "Your conversations, most recent first.",
        "operationId": "listAssistantConversations",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_ConversationView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Conversations",
        "tags": [
          "assistant"
        ]
      },
      "post": {
        "operationId": "createAssistantConversation",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConversationCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversationView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Conversation",
        "tags": [
          "assistant"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/assistant/conversations/{conversation_id}": {
      "delete": {
        "operationId": "deleteAssistantConversation",
        "parameters": [
          {
            "in": "path",
            "name": "conversation_id",
            "required": true,
            "schema": {
              "title": "Conversation Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Conversation",
        "tags": [
          "assistant"
        ],
        "x-permission": "data.read"
      },
      "get": {
        "description": "One of your conversations with its messages and pending actions.",
        "operationId": "getAssistantConversation",
        "parameters": [
          {
            "in": "path",
            "name": "conversation_id",
            "required": true,
            "schema": {
              "title": "Conversation Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConversationDetailView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Conversation",
        "tags": [
          "assistant"
        ]
      }
    },
    "/api/assistant/conversations/{conversation_id}/actions/{action_id}": {
      "post": {
        "description": "Approve (run) or reject a write action the assistant asked for. The\nturn then continues as a new event stream.",
        "operationId": "decideAssistantAction",
        "parameters": [
          {
            "in": "path",
            "name": "conversation_id",
            "required": true,
            "schema": {
              "title": "Conversation Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "action_id",
            "required": true,
            "schema": {
              "title": "Action Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActionDecision"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "itemSchema": {
                  "properties": {
                    "data": {
                      "contentMediaType": "application/json",
                      "contentSchema": {
                        "$ref": "#/components/schemas/AssistantEventView"
                      },
                      "type": "string"
                    },
                    "event": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "retry": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Decide Action",
        "tags": [
          "assistant"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/assistant/conversations/{conversation_id}/messages": {
      "post": {
        "description": "Send a message. The answer streams as events (text pieces, tool\ncalls and results) and ends with ``done``. A write action stops the\nturn with ``confirm_required``: approve or reject it with the actions\nroute.",
        "operationId": "sendAssistantMessage",
        "parameters": [
          {
            "in": "path",
            "name": "conversation_id",
            "required": true,
            "schema": {
              "title": "Conversation Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MessageCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "itemSchema": {
                  "properties": {
                    "data": {
                      "contentMediaType": "application/json",
                      "contentSchema": {
                        "$ref": "#/components/schemas/AssistantEventView"
                      },
                      "type": "string"
                    },
                    "event": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "retry": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "data"
                  ],
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Send Message",
        "tags": [
          "assistant"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/assistant/conversations/{conversation_id}/turns": {
      "get": {
        "description": "The trace of one of your conversations: each turn's model, prompt\nversion, tool calls and results, and the order drafts it made.",
        "operationId": "listAssistantTurns",
        "parameters": [
          {
            "in": "path",
            "name": "conversation_id",
            "required": true,
            "schema": {
              "title": "Conversation Id",
              "type": "string"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_TurnView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Turns",
        "tags": [
          "assistant"
        ]
      }
    },
    "/api/assistant/freeze": {
      "delete": {
        "description": "Unfreeze your assistant after a burst of writes. Needs a fresh\nsecond factor.",
        "operationId": "clearAssistantFreeze",
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Clear Freeze",
        "tags": [
          "assistant"
        ],
        "x-permission": "killswitch.resume"
      }
    },
    "/api/assistant/research": {
      "get": {
        "description": "Your research sessions, newest first.",
        "operationId": "listAssistantResearch",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_ResearchSessionView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Research",
        "tags": [
          "assistant"
        ]
      },
      "post": {
        "description": "Start a research session: the assistant proposes lab trials for your\ngoal and runs them under the session's budgets. Every proposal is\nrecorded with its hypothesis before it runs, every trial is counted in\nthe trial ledger, and validation windows start after the model's\ntraining cutoff. It never registers or promotes a strategy. Follow the\njob, then read the session.",
        "operationId": "startAssistantResearch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResearchStart"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Start Research",
        "tags": [
          "assistant"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/assistant/research/{session_id}": {
      "get": {
        "description": "One of your research sessions with every proposal: its hypothesis,\nwhether it ran or why not, and its lab run in the trial ledger.",
        "operationId": "getAssistantResearch",
        "parameters": [
          {
            "in": "path",
            "name": "session_id",
            "required": true,
            "schema": {
              "title": "Session Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResearchSessionDetailView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Research",
        "tags": [
          "assistant"
        ]
      }
    },
    "/api/assistant/status": {
      "get": {
        "description": "Whether a model endpoint is configured, its model and the turn limits.",
        "operationId": "getAssistantStatus",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssistantStatusView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Assistant Status",
        "tags": [
          "assistant"
        ]
      }
    },
    "/api/auth/check": {
      "get": {
        "description": "200 when the credential is valid, 401 otherwise (503 when a legacy\ntoken is sent but the server has none configured).",
        "operationId": "checkAuth",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthCheck"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Check Auth",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/auth/login": {
      "post": {
        "description": "Check email and password and open a pending session. The second\nfactor is always required next (``next_step``). Five failures per 15\nminutes per account or per IP lock further attempts (429).",
        "operationId": "login",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoginRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Login",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/auth/logout": {
      "post": {
        "description": "End the browser session (safe to call when already signed out).",
        "operationId": "logout",
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Logout",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/auth/me": {
      "get": {
        "description": "Who the credential belongs to, its scopes and second-factor state.",
        "operationId": "getMe",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Me",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/auth/mfa/enrol": {
      "post": {
        "description": "A new authenticator secret (show it as a QR code of ``otpauth_uri``).\nOnly while no second factor is set up.",
        "operationId": "startMfaEnrolment",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnrolStartView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Start Enrolment",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/auth/mfa/enrol/confirm": {
      "post": {
        "description": "Confirm the authenticator with a code. Completes the sign-in and\nreturns ten recovery codes, shown once.",
        "operationId": "confirmMfaEnrolment",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MfaCodeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MfaView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Confirm Enrolment",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/auth/mfa/verify": {
      "post": {
        "description": "Send a TOTP ``code`` or a ``recovery_code``. On a pending session\nthis completes the sign-in; on a signed-in session it refreshes the\nstep-up window for sensitive actions.",
        "operationId": "verifyMfa",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MfaCodeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MfaView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Verify Mfa",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/auth/password": {
      "post": {
        "description": "Change your password (fresh second factor needed). Your other\nsessions are signed out.",
        "operationId": "changePassword",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordChangeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Change Password",
        "tags": [
          "auth"
        ],
        "x-permission": "password.change"
      }
    },
    "/api/auth/recovery-codes": {
      "post": {
        "description": "Ten new recovery codes; the old ones stop working. Needs a fresh\nsecond factor.",
        "operationId": "regenerateRecoveryCodes",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecoveryCodesView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Regenerate Recovery Codes",
        "tags": [
          "auth"
        ],
        "x-permission": "mfa.recovery_codes"
      }
    },
    "/api/auth/tokens": {
      "get": {
        "description": "Your API tokens (never the secret), revoked ones included.",
        "operationId": "listApiTokens",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_TokenView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Tokens",
        "tags": [
          "auth"
        ]
      },
      "post": {
        "description": "Create a token for scripts or the MCP server, from a signed-in\nsession only. Scopes can't exceed your role; ``trade`` and ``admin``\nneed a fresh second factor. The token is shown once.",
        "operationId": "createApiToken",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TokenCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenCreatedView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Token",
        "tags": [
          "auth"
        ],
        "x-permission": "tokens.manage"
      }
    },
    "/api/auth/tokens/{token_id}": {
      "delete": {
        "description": "Revoke one of your tokens (another user's token is a 404).",
        "operationId": "revokeApiToken",
        "parameters": [
          {
            "in": "path",
            "name": "token_id",
            "required": true,
            "schema": {
              "title": "Token Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Revoke Token",
        "tags": [
          "auth"
        ],
        "x-permission": "tokens.revoke"
      }
    },
    "/api/auth/toolsets": {
      "get": {
        "description": "The MCP tool groups a token can be limited to, in the order the MCP\nserver registers them. A limited token keeps ``whoami`` too.",
        "operationId": "listMcpToolsets",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_ToolsetView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Toolsets",
        "tags": [
          "auth"
        ]
      }
    },
    "/api/auth/users": {
      "get": {
        "description": "Every person with an account: identity, role, status. No holdings.",
        "operationId": "listUsers",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_UserView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Users",
        "tags": [
          "auth"
        ],
        "x-permission": "users.read"
      },
      "post": {
        "description": "Add a person (fresh second factor needed). They set up their own\nsecond factor at first login.",
        "operationId": "createUser",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserCreateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create User",
        "tags": [
          "auth"
        ],
        "x-permission": "users.manage"
      }
    },
    "/api/auth/users/{user_id}": {
      "patch": {
        "description": "Change role or status. Disabling signs the person out everywhere and\nrevokes their tokens. The last active admin stays an admin.",
        "operationId": "updateUser",
        "parameters": [
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UserUpdateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update User",
        "tags": [
          "auth"
        ],
        "x-permission": "users.manage"
      }
    },
    "/api/auth/users/{user_id}/mfa": {
      "delete": {
        "description": "Clear a person's second factor (lost phone). They set it up again at\nthe next login.",
        "operationId": "resetUserMfa",
        "parameters": [
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Reset User Mfa",
        "tags": [
          "auth"
        ],
        "x-permission": "users.manage"
      }
    },
    "/api/auth/users/{user_id}/password": {
      "post": {
        "description": "Set a new password for a person and sign them out.",
        "operationId": "resetUserPassword",
        "parameters": [
          {
            "in": "path",
            "name": "user_id",
            "required": true,
            "schema": {
              "title": "User Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PasswordResetRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Forbidden"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Reset User Password",
        "tags": [
          "auth"
        ],
        "x-permission": "users.manage"
      }
    },
    "/api/backups": {
      "get": {
        "description": "Backups under ``[backup].dir``, newest first.",
        "operationId": "listBackups",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_BackupView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Backups",
        "tags": [
          "backups"
        ],
        "x-permission": "operations.run"
      },
      "post": {
        "description": "Queue a backup of the lake, state DB and artifacts to ``[backup]``'s\ntarget, pruned by its retention. Runs beside no ingest (lake lock).",
        "operationId": "startBackup",
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Start Backup",
        "tags": [
          "backups"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/backups/jobs/{job_id}/result": {
      "get": {
        "description": "The result of a succeeded backup job (409 until it has succeeded).",
        "operationId": "getBackupResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BackupResultView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Backup Result",
        "tags": [
          "backups"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/backups/restores/{job_id}/result": {
      "get": {
        "description": "Where a succeeded restore job put the data (409 until it has succeeded).",
        "operationId": "getRestoreResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RestoreResultView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Restore Result",
        "tags": [
          "backups"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/backups/{backup_id}/restore": {
      "post": {
        "description": "Queue a staged restore: the backup is verified and restored into a new\ndata folder beside the backups, with migrations applied. The live data\nis not touched; the result says how to switch. Needs a second factor\nfrom the last few minutes and ``confirmation`` = ``RESTORE <backup id>``.",
        "operationId": "restoreBackup",
        "parameters": [
          {
            "in": "path",
            "name": "backup_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Backup Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RestoreRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Restore Backup",
        "tags": [
          "backups"
        ],
        "x-permission": "backups.restore"
      }
    },
    "/api/backups/{backup_id}/verify": {
      "post": {
        "description": "Re-check a backup's checksums, schema versions and row counts. Takes a\nwhile for a large lake.",
        "operationId": "verifyBackup",
        "parameters": [
          {
            "in": "path",
            "name": "backup_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Backup Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Verify Backup",
        "tags": [
          "backups"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/brokers": {
      "get": {
        "description": "The broker the production tick trades through (keys never shown).",
        "operationId": "getBrokerInfo",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BrokerInfo"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Broker Info",
        "tags": [
          "brokers"
        ]
      }
    },
    "/api/brokers/alpaca/status": {
      "get": {
        "description": "Connect to Alpaca and read the account and market clock (read-only).\nOnly the owner of the book the account backs may read it (404 for\nanyone else). Answers are cached for 30 seconds. 409 unless\n``[brokers].kind`` is ``alpaca``; missing keys or API errors come back\nas ``connected=false`` with the reason.",
        "operationId": "getAlpacaStatus",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlpacaStatus"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Alpaca Status",
        "tags": [
          "brokers"
        ]
      }
    },
    "/api/brokers/gateways": {
      "get": {
        "description": "Each IB Gateway the broker health check watches: connected or not,\nthe last good check, and the auto subscriptions it paused. Portfolio\nnames and paused books show for your own portfolios only.",
        "operationId": "getBrokerGateways",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GatewayHealthView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Broker Gateways",
        "tags": [
          "brokers"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/calendars": {
      "get": {
        "description": "Earnings, ex-dividend dates and economic releases from ``start``\n(default today) to ``end`` (default two weeks on, at most 120 days).",
        "operationId": "getCalendar",
        "parameters": [
          {
            "description": "holdings (default), watchlists, tickers or all",
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "default": "holdings",
              "description": "holdings (default), watchlists, tickers or all",
              "enum": [
                "all",
                "holdings",
                "watchlists",
                "tickers"
              ],
              "title": "Scope",
              "type": "string"
            }
          },
          {
            "description": "one of your watchlists (scope watchlists)",
            "in": "query",
            "name": "watchlist_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "one of your watchlists (scope watchlists)",
              "title": "Watchlist Id"
            }
          },
          {
            "description": "one of your portfolios (scope holdings)",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "one of your portfolios (scope holdings)",
              "title": "Portfolio Id"
            }
          },
          {
            "description": "comma-separated instrument ids",
            "in": "query",
            "name": "tickers",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 8000,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "comma-separated instrument ids",
              "title": "Tickers"
            }
          },
          {
            "in": "query",
            "name": "start",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Start"
            }
          },
          {
            "in": "query",
            "name": "end",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "End"
            }
          },
          {
            "description": "economic events of these ISO alpha-2 codes",
            "in": "query",
            "name": "countries",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 400,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "economic events of these ISO alpha-2 codes",
              "title": "Countries"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Calendar",
        "tags": [
          "calendars"
        ]
      }
    },
    "/api/calendars/alert-kinds": {
      "get": {
        "description": "The upcoming-event alert kinds (earnings, ex-dividend), how many\ndays ahead each looks by default, and the notification switch it follows.",
        "operationId": "listEventAlertKinds",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/EventAlertKindView"
                  },
                  "title": "Response Listeventalertkinds",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Event Alert Kinds",
        "tags": [
          "calendars"
        ]
      }
    },
    "/api/calendars/earnings-warnings": {
      "get": {
        "description": "Which of ``tickers`` report earnings before the next open of their\nmarket. The order ticket shows these as a warning.",
        "operationId": "getEarningsWarnings",
        "parameters": [
          {
            "description": "comma-separated instrument ids",
            "in": "query",
            "name": "tickers",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 8000,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "comma-separated instrument ids",
              "title": "Tickers"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EarningsWarningsView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Earnings Warnings",
        "tags": [
          "calendars"
        ]
      }
    },
    "/api/calendars/news": {
      "get": {
        "description": "The newest articles on the scope's tickers, and their daily\nsentiment over the last 30 days. Scope ``all`` is refused.",
        "operationId": "getNews",
        "parameters": [
          {
            "description": "holdings (default), watchlists, tickers or all",
            "in": "query",
            "name": "scope",
            "required": false,
            "schema": {
              "default": "holdings",
              "description": "holdings (default), watchlists, tickers or all",
              "enum": [
                "all",
                "holdings",
                "watchlists",
                "tickers"
              ],
              "title": "Scope",
              "type": "string"
            }
          },
          {
            "description": "one of your watchlists (scope watchlists)",
            "in": "query",
            "name": "watchlist_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "one of your watchlists (scope watchlists)",
              "title": "Watchlist Id"
            }
          },
          {
            "description": "one of your portfolios (scope holdings)",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "one of your portfolios (scope holdings)",
              "title": "Portfolio Id"
            }
          },
          {
            "description": "comma-separated instrument ids",
            "in": "query",
            "name": "tickers",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 8000,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "comma-separated instrument ids",
              "title": "Tickers"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NewsView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get News",
        "tags": [
          "calendars"
        ]
      }
    },
    "/api/calendars/refresh": {
      "post": {
        "description": "Queue a calendar refresh from the data source, then the\nupcoming-event notifications. Poll ``/api/jobs/{id}``.",
        "operationId": "refreshCalendars",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CalendarRefreshRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Refresh Calendars",
        "tags": [
          "calendars"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/calendars/refresh/{job_id}/result": {
      "get": {
        "description": "The result of a succeeded refresh job (409 until it has succeeded).",
        "operationId": "getCalendarRefreshResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalendarRefreshView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Refresh Result",
        "tags": [
          "calendars"
        ]
      }
    },
    "/api/catalog/asset-classes": {
      "get": {
        "operationId": "listAssetClasses",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "type": "string"
                  },
                  "title": "Response Listassetclasses",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Asset Classes",
        "tags": [
          "catalog"
        ]
      }
    },
    "/api/catalog/intervals": {
      "get": {
        "operationId": "listIntervals",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/IntervalInfo"
                  },
                  "title": "Response Listintervals",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Intervals",
        "tags": [
          "catalog"
        ]
      }
    },
    "/api/catalog/strategies": {
      "get": {
        "operationId": "listStrategyClasses",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/StrategyClassInfo"
                  },
                  "title": "Response Liststrategyclasses",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Strategy Classes",
        "tags": [
          "catalog"
        ]
      }
    },
    "/api/charts/compare": {
      "get": {
        "description": "Daily adjusted closes of up to six tickers rebased to 100 on the\nfirst day they all have a price, each with its drawdown from the\nrunning peak and its rolling Sharpe (annualized, 365 days for crypto).\nTickers without prices are listed in ``missing``.",
        "operationId": "compareCharts",
        "parameters": [
          {
            "description": "comma-separated instrument ids, at most 6, e.g. AAPL.US,MSFT.US",
            "in": "query",
            "name": "tickers",
            "required": true,
            "schema": {
              "description": "comma-separated instrument ids, at most 6, e.g. AAPL.US,MSFT.US",
              "maxLength": 400,
              "minLength": 1,
              "title": "Tickers",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "start",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Start"
            }
          },
          {
            "in": "query",
            "name": "end",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "End"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 750,
              "maximum": 5000,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "bars behind each rolling Sharpe point",
            "in": "query",
            "name": "window",
            "required": false,
            "schema": {
              "default": 63,
              "description": "bars behind each rolling Sharpe point",
              "maximum": 252,
              "minimum": 5,
              "title": "Window",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CompareView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Compare Charts",
        "tags": [
          "charts"
        ]
      }
    },
    "/api/charts/{ticker}": {
      "get": {
        "description": "Bars of one ticker (the latest ``limit`` in the window), your fills\nof it in one of your portfolios (default your own book; none when you\nhave no portfolio) and every strategy's signal events for it.",
        "operationId": "getChart",
        "parameters": [
          {
            "description": "instrument id, e.g. AAPL.US",
            "in": "path",
            "name": "ticker",
            "required": true,
            "schema": {
              "description": "instrument id, e.g. AAPL.US",
              "maxLength": 40,
              "title": "Ticker",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "interval",
            "required": false,
            "schema": {
              "default": "1d",
              "title": "Interval",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "start",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Start"
            }
          },
          {
            "in": "query",
            "name": "end",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "End"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 750,
              "maximum": 5000,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise).",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise).",
              "title": "Portfolio Id"
            }
          },
          {
            "description": "only this strategy's signals",
            "in": "query",
            "name": "strategy_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "only this strategy's signals",
              "title": "Strategy Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChartView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Chart",
        "tags": [
          "charts"
        ]
      }
    },
    "/api/connections": {
      "get": {
        "description": "The caller's connections, oldest first.",
        "operationId": "listConnections",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_ConnectionView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Connections",
        "tags": [
          "connections"
        ]
      }
    },
    "/api/connections/callback": {
      "get": {
        "description": "Finish a hosted-login connection: checks the one-time ``state`` and\nlists the accounts the user linked at the provider.",
        "operationId": "completeConnectionPortal",
        "parameters": [
          {
            "in": "query",
            "name": "connection_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "minLength": 1,
              "title": "Connection Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "state",
            "required": true,
            "schema": {
              "maxLength": 256,
              "minLength": 1,
              "title": "State",
              "type": "string"
            }
          },
          {
            "description": "the provider's outcome, if it sends one",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "the provider's outcome, if it sends one",
              "title": "Status"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Complete Portal",
        "tags": [
          "connections"
        ]
      }
    },
    "/api/connections/keys": {
      "post": {
        "description": "Connect with API keys. The keys are checked against the provider\nfirst (refused keys are never stored), then sealed at rest; they are\nnever returned or logged. New accounts get a broker portfolio each.",
        "operationId": "connectWithKeys",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConnectWithKeysRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Connect With Keys",
        "tags": [
          "connections"
        ],
        "x-permission": "connection.manage"
      }
    },
    "/api/connections/portal": {
      "post": {
        "description": "Start a hosted-login connection: returns the one-time provider URL.\nThe provider redirects to ``redirect_uri`` with ``connection_id`` and\n``state``; pass both to ``GET /api/connections/callback``.",
        "operationId": "startConnectionPortal",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StartPortalRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortalLinkView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Start Portal",
        "tags": [
          "connections"
        ],
        "x-permission": "connection.manage"
      }
    },
    "/api/connections/providers": {
      "get": {
        "description": "Every provider. ``enabled`` marks the ones an admin turned on\n(``[connections].enabled_providers``) and configured: nothing else can\nbe connected. ``has_paper`` marks providers with paper accounts.",
        "operationId": "listProviders",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ProviderView"
                  },
                  "title": "Response Listproviders",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Providers",
        "tags": [
          "connections"
        ]
      }
    },
    "/api/connections/{connection_id}": {
      "delete": {
        "description": "Remove the connection, its credentials, accounts and activities.\nLinked portfolios are archived (their snapshots stay).",
        "operationId": "deleteConnection",
        "parameters": [
          {
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "title": "Connection Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DisconnectView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Connection",
        "tags": [
          "connections"
        ],
        "x-permission": "connection.manage"
      },
      "get": {
        "operationId": "getConnection",
        "parameters": [
          {
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "title": "Connection Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ConnectionView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Connection",
        "tags": [
          "connections"
        ]
      }
    },
    "/api/connections/{connection_id}/accounts": {
      "get": {
        "description": "External accounts seen on the connection, with the linked portfolio.",
        "operationId": "listConnectionAccounts",
        "parameters": [
          {
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "title": "Connection Id",
              "type": "string"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_BrokerAccountView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Accounts",
        "tags": [
          "connections"
        ]
      }
    },
    "/api/connections/{connection_id}/link": {
      "post": {
        "description": "Link an external account to one of your broker portfolios (a new one\nwhen ``portfolio_id`` is omitted).",
        "operationId": "linkConnectionAccount",
        "parameters": [
          {
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "title": "Connection Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LinkAccountRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LinkResultView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Link Account",
        "tags": [
          "connections"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/connections/{connection_id}/sync": {
      "post": {
        "description": "Sync now (read-only at the provider). A provider failure is a 200\nwith ``status = \"error\"``; the connection records it and backs off.",
        "operationId": "syncConnection",
        "parameters": [
          {
            "in": "path",
            "name": "connection_id",
            "required": true,
            "schema": {
              "title": "Connection Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyncResultView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Sync Connection",
        "tags": [
          "connections"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/decisions": {
      "get": {
        "description": "Why a ticker did or did not trade in one of your portfolios, newest\nfirst: the step that kept it out or trimmed it (universe, rank,\nconstructor, buffer, stale price, a named risk rule, a halt).",
        "operationId": "listTradeDecisions",
        "parameters": [
          {
            "description": "one ticker, e.g. AAPL.US",
            "in": "query",
            "name": "ticker",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "one ticker, e.g. AAPL.US",
              "title": "Ticker"
            }
          },
          {
            "description": "rows this strategy owned or scored",
            "in": "query",
            "name": "strategy_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "rows this strategy owned or scored",
              "title": "Strategy Id"
            }
          },
          {
            "description": "one tick",
            "in": "query",
            "name": "tick_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "one tick",
              "title": "Tick Id"
            }
          },
          {
            "description": "days on or after this one",
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "days on or after this one",
              "title": "Since"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_TradeDecisionView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Trade Decisions",
        "tags": [
          "portfolio"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/demo": {
      "delete": {
        "description": "Remove your demo portfolio. Nothing real changes.",
        "operationId": "removeDemoPortfolio",
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Remove Demo",
        "tags": [
          "demo"
        ],
        "x-permission": "data.read"
      },
      "get": {
        "description": "Your demo portfolio, or ``exists: false`` when you have not opened one.",
        "operationId": "getDemoPortfolio",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoPortfolioView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Demo",
        "tags": [
          "demo"
        ]
      },
      "post": {
        "description": "Open your demo portfolio: sample holdings and a year of made-up\nprices. Opening it again shows the same one.",
        "operationId": "openDemoPortfolio",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DemoPortfolioView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Open Demo",
        "tags": [
          "demo"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/execution/algos": {
      "get": {
        "description": "Every execution algo: its parameters, defaults and the costs the\nbacktest assumes for it.",
        "operationId": "listExecutionAlgos",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlgoList"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Execution Algos",
        "tags": [
          "execution"
        ]
      }
    },
    "/api/exports/fills": {
      "get": {
        "description": "Every fill of one of your portfolios, newest first.",
        "operationId": "exportFills",
        "parameters": [
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "A CSV file with a header row"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Fills as CSV",
        "tags": [
          "exports"
        ]
      }
    },
    "/api/exports/journal": {
      "get": {
        "description": "The trade journal: each order with its reason, costs and your notes.",
        "operationId": "exportJournal",
        "parameters": [
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "A CSV file with a header row"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Trade journal as CSV",
        "tags": [
          "exports"
        ]
      }
    },
    "/api/exports/lab-trials": {
      "get": {
        "description": "Every tuning trial of the recorded lab runs: parameters, score and\nstatus, newest run first.",
        "operationId": "exportLabTrials",
        "parameters": [
          {
            "description": "one lab run; default every run",
            "in": "query",
            "name": "run_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 100,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "one lab run; default every run",
              "title": "Run Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "A CSV file with a header row"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Lab trial results as CSV",
        "tags": [
          "exports"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/exports/orders": {
      "get": {
        "description": "Every order of one of your portfolios, newest first.",
        "operationId": "exportOrders",
        "parameters": [
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "A CSV file with a header row"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Orders as CSV",
        "tags": [
          "exports"
        ]
      }
    },
    "/api/exports/pnl": {
      "get": {
        "description": "Daily value, change, return and drawdown, oldest first.",
        "operationId": "exportPnl",
        "parameters": [
          {
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Since"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "A CSV file with a header row"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Daily P&L as CSV",
        "tags": [
          "exports"
        ]
      }
    },
    "/api/exports/snapshots": {
      "get": {
        "description": "Every stored snapshot: cash, total value and positions, newest first.",
        "operationId": "exportSnapshots",
        "parameters": [
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "A CSV file with a header row"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Portfolio snapshots as CSV",
        "tags": [
          "exports"
        ]
      }
    },
    "/api/factors": {
      "get": {
        "description": "The factor library (Alpha158, classic price factors, fundamentals\nscores), optionally one family, set or kind, with the sets and families.",
        "operationId": "listFactors",
        "parameters": [
          {
            "in": "query",
            "name": "family",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "minLength": 1,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Family"
            }
          },
          {
            "in": "query",
            "name": "set",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "minLength": 1,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Set"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "expression",
                    "fundamental"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Kind"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FactorCatalogView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Factors",
        "tags": [
          "factors"
        ]
      }
    },
    "/api/factors/check": {
      "post": {
        "description": "Whether a formula parses and is point in time, its canonical form and\nits warm-up in bars. A bad formula is ``ok: false`` with the reason.",
        "operationId": "checkFactorExpression",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpressionCheckRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExpressionCheckView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Check Expression",
        "tags": [
          "factors"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/factors/tearsheets": {
      "post": {
        "description": "Queue a factor tear sheet: IC per horizon and by sector, asset class\nand size, returns per quantile, factor alpha and beta, a monthly IC\nheatmap and turnover. Fetch it from ``GET\n/api/factors/tearsheets/{job_id}/result``. Universes under 10 tickers\ncome back ``n/a``.",
        "operationId": "startFactorTearsheet",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FactorTearSheetRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Start Tearsheet",
        "tags": [
          "factors"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/factors/tearsheets/{job_id}/result": {
      "get": {
        "description": "The result of a succeeded factor tear sheet job (409 until it has\nsucceeded).",
        "operationId": "getFactorTearsheetResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FactorTearSheetView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Tearsheet Result",
        "tags": [
          "factors"
        ]
      }
    },
    "/api/factors/values": {
      "post": {
        "description": "Each universe name's factor value known at the close of ``as_of``,\nbest first in the factor's direction.",
        "operationId": "getFactorValues",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FactorValuesRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FactorValuesView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Factor Values",
        "tags": [
          "factors"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/factors/{factor_id}": {
      "get": {
        "description": "One library factor: formula, family, direction, hypothesis, warm-up.",
        "operationId": "getFactor",
        "parameters": [
          {
            "in": "path",
            "name": "factor_id",
            "required": true,
            "schema": {
              "title": "Factor Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FactorView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Factor",
        "tags": [
          "factors"
        ]
      }
    },
    "/api/fx/rate": {
      "get": {
        "description": "The rate the system converts with: the latest on or before ``day``\n(default today), the inverse pair, or a cross through USD.",
        "operationId": "getFxRate",
        "parameters": [
          {
            "in": "query",
            "name": "base",
            "required": true,
            "schema": {
              "pattern": "^[A-Za-z]{3}$",
              "title": "Base",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "quote",
            "required": true,
            "schema": {
              "pattern": "^[A-Za-z]{3}$",
              "title": "Quote",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "day",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Day"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FxRateView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Fx Rate",
        "tags": [
          "fx"
        ]
      }
    },
    "/api/halts": {
      "get": {
        "description": "Halts you can see, newest first: global ones, your own and those of\nyour portfolios. By default only those in force today.",
        "operationId": "listHalts",
        "parameters": [
          {
            "description": "also cleared and expired halts",
            "in": "query",
            "name": "include_cleared",
            "required": false,
            "schema": {
              "default": false,
              "description": "also cleared and expired halts",
              "title": "Include Cleared",
              "type": "boolean"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_HaltView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Halts",
        "tags": [
          "halts"
        ]
      }
    },
    "/api/halts/kill": {
      "post": {
        "description": "Stop new orders: every portfolio (``global``, admins only), all of\nyours (``user``) or one of yours (``portfolio``). ``buys_only`` stops\nbuys only, so sells and exits still go through and no position is\nclosed (``flatten`` is its deprecated name). Returns the open kill switch\nwhen one is already on at that scope.",
        "operationId": "engageKillSwitch",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/KillSwitchRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HaltView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Engage Kill Switch",
        "tags": [
          "halts"
        ],
        "x-permission": "killswitch.user"
      }
    },
    "/api/halts/{halt_id}": {
      "get": {
        "operationId": "getHalt",
        "parameters": [
          {
            "in": "path",
            "name": "halt_id",
            "required": true,
            "schema": {
              "title": "Halt Id",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HaltView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Halt",
        "tags": [
          "halts"
        ]
      }
    },
    "/api/halts/{halt_id}/clear": {
      "post": {
        "description": "The logged reset of a circuit-breaker or operational halt (not the\nkill switch). A latched drawdown halt stays until this is called.",
        "operationId": "clearHalt",
        "parameters": [
          {
            "in": "path",
            "name": "halt_id",
            "required": true,
            "schema": {
              "title": "Halt Id",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ClearHaltRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HaltView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Clear Halt",
        "tags": [
          "halts"
        ],
        "x-permission": "risk.reset"
      }
    },
    "/api/halts/{halt_id}/resume": {
      "post": {
        "description": "Turn a kill switch off. ``confirmation`` must be exactly\n``RESUME TRADING``; the reason is audited. Needs a second factor from\nthe last few minutes (step-up), so API tokens get 403. A failed resume\ncheck is a 409 unless ``override_checks`` is set (audited).",
        "operationId": "resumeKillSwitch",
        "parameters": [
          {
            "in": "path",
            "name": "halt_id",
            "required": true,
            "schema": {
              "title": "Halt Id",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResumeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HaltView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Resume Kill Switch",
        "tags": [
          "halts"
        ],
        "x-permission": "killswitch.resume"
      }
    },
    "/api/halts/{halt_id}/resume-checks": {
      "get": {
        "description": "What a resume of this kill switch checks, read now: per covered\nportfolio at a real broker, the gateway is up, the last reconcile was\nclean, the account reads and its equity covers a multiple of the\nlargest position. Read only.",
        "operationId": "getResumeChecks",
        "parameters": [
          {
            "in": "path",
            "name": "halt_id",
            "required": true,
            "schema": {
              "title": "Halt Id",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResumeChecksView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Resume Checks",
        "tags": [
          "halts"
        ],
        "x-permission": "killswitch.user"
      }
    },
    "/api/health": {
      "get": {
        "operationId": "getHealth",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            },
            "description": "Successful Response"
          }
        },
        "summary": "Liveness probe",
        "tags": [
          "health"
        ]
      }
    },
    "/api/health/live": {
      "get": {
        "operationId": "getLiveness",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProbeView"
                }
              }
            },
            "description": "Successful Response"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Liveness probe (process and hosted scheduler)",
        "tags": [
          "health"
        ]
      }
    },
    "/api/health/price-check": {
      "get": {
        "description": "The newest second-source price check (roadmap 23.6): each held and\nsignalled ticker's vendor close and adjusted return against a second\nsource, and the tickers whose opening orders the tick holds. Null\nbefore the first check.",
        "operationId": "getPriceCheck",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/PriceCheckView"
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "title": "Response Getpricecheck"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Latest Price Check",
        "tags": [
          "health"
        ]
      }
    },
    "/api/health/price-check/run": {
      "post": {
        "description": "The scheduled price check job: compare now and store the result. A\nsystematic gap opens the global operational halt. Skips while\n``[production.price_check] enabled = false``.",
        "operationId": "runPriceCheck",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PriceCheckRunBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceCheckRunView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Run Price Check",
        "tags": [
          "health"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/health/ready": {
      "get": {
        "operationId": "getReadiness",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProbeView"
                }
              }
            },
            "description": "Successful Response"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "summary": "Readiness probe (state migrated, lake present)",
        "tags": [
          "health"
        ]
      }
    },
    "/api/health/report": {
      "get": {
        "description": "Every ``stonks health`` check: bar freshness, stuck ticks and ingest\nruns, recent ingest failures, open halts. Always 200; see ``healthy``.\nRead-only: it never opens or clears the operational halt.",
        "operationId": "getHealthReport",
        "parameters": [
          {
            "description": "freshness check tickers; default [production].universe",
            "in": "query",
            "name": "tickers",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                {
                  "type": "null"
                }
              ],
              "description": "freshness check tickers; default [production].universe",
              "title": "Tickers"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthReportView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Health Report",
        "tags": [
          "health"
        ]
      }
    },
    "/api/health/run": {
      "post": {
        "description": "The scheduled health job: every check, then the global operational\nhalt is opened on stale data or a stuck run and cleared when the checks\npass again. The caller is recorded as the actor.",
        "operationId": "runHealthChecks",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HealthRunRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HealthReportView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Run Health Checks",
        "tags": [
          "health"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/ingest/jobs/{job_id}/result": {
      "get": {
        "description": "The result of a succeeded ingest job (409 until it has succeeded).",
        "operationId": "getIngestResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IngestResultView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Ingest Result",
        "tags": [
          "ingest"
        ]
      }
    },
    "/api/ingest/runs": {
      "get": {
        "operationId": "listIngestRuns",
        "parameters": [
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Kind"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_IngestRunView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Runs",
        "tags": [
          "ingest"
        ]
      },
      "post": {
        "description": "Queue an ingest run; poll ``/api/jobs/{id}`` or stream its events.",
        "operationId": "startIngest",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IngestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Start Ingest",
        "tags": [
          "ingest"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/insights": {
      "get": {
        "description": "Allocation (asset class, sector, currency, ticker), exposure (gross,\nnet, beta), P&L over periods and risk (volatility, drawdown, VaR,\nconcentration) of one of your portfolios.",
        "operationId": "getInsights",
        "parameters": [
          {
            "description": "Ticker beta is measured against. Default SPY.US.",
            "in": "query",
            "name": "benchmark",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 32,
                  "pattern": "^[A-Za-z0-9_.\\-]+$",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Ticker beta is measured against. Default SPY.US.",
              "title": "Benchmark"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InsightsView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Insights",
        "tags": [
          "insights"
        ]
      }
    },
    "/api/insights/agreement": {
      "get": {
        "description": "For each holding, whether every active strategy's latest signal\nagrees or disagrees with it, and why.",
        "operationId": "getStrategyAgreement",
        "parameters": [
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AgreementView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Agreement",
        "tags": [
          "insights"
        ]
      }
    },
    "/api/insights/behaviour": {
      "get": {
        "description": "How you trade by hand: your manual orders and synced broker trades as\nround trips. P&L by holding time and weekday, win rate, the disposition\neffect, overtrading, revenge trades after a loss, and what trading\nagainst the active strategies cost.",
        "operationId": "getBehaviourReport",
        "parameters": [
          {
            "description": "First day to include, YYYY-MM-DD",
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "First day to include, YYYY-MM-DD",
              "title": "Since"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BehaviourView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Behaviour",
        "tags": [
          "insights"
        ]
      }
    },
    "/api/insights/look-through": {
      "get": {
        "description": "Exposure by sector, country and single name with each held fund\n(an ETF) split into what it holds, from the latest holdings lists. Your\nreal weight in Apple counts AAPL plus its share of SPY and QQQ.",
        "operationId": "getLookThrough",
        "parameters": [
          {
            "description": "Single names to list.",
            "in": "query",
            "name": "top",
            "required": false,
            "schema": {
              "default": 20,
              "description": "Single names to list.",
              "maximum": 100,
              "minimum": 1,
              "title": "Top",
              "type": "integer"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LookThroughView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Look Through",
        "tags": [
          "insights"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/insights/totals": {
      "get": {
        "description": "Admins: asset-class allocation and exposure summed over every active\nportfolio. No tickers and no per-person numbers.",
        "operationId": "getInsightsTotals",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InsightsTotalsView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Totals",
        "tags": [
          "insights"
        ],
        "x-permission": "portfolio.totals"
      }
    },
    "/api/jobs": {
      "get": {
        "description": "Your jobs, newest first. Admins see every job.",
        "operationId": "listJobs",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "queued",
                    "running",
                    "succeeded",
                    "failed",
                    "cancelled"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "in": "query",
            "name": "kind",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Kind"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_Job_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Jobs",
        "tags": [
          "jobs"
        ]
      }
    },
    "/api/jobs/{job_id}": {
      "get": {
        "description": "One of your jobs (another user's job is a 404; admins see all).",
        "operationId": "getJob",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Job",
        "tags": [
          "jobs"
        ]
      }
    },
    "/api/jobs/{job_id}/cancel": {
      "post": {
        "description": "Cancel a queued job, or ask a running lab run to stop at its next\ntrial (it ends ``cancelled``). Other running jobs cannot be interrupted\n(409). Ticks, ingests and backups need an admin. Another user's job\nis a 404 (admins may cancel any job).",
        "operationId": "cancelJob",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Cancel Job",
        "tags": [
          "jobs"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/jobs/{job_id}/events": {
      "get": {
        "description": "Server-sent events with the job's status/progress until it finishes.\n\nEvents: ``status`` on every change, then ``done`` when the job reaches\na terminal status, or ``end`` (with ``reason``) when the stream gives up\nfirst: after ``api.sse_max_stream_seconds``, or when no worker in this\nprocess tracks the job any more. The stream also ends when the client\ndisconnects; the store is polled off the event loop.",
        "operationId": "streamJobEvents",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          },
          {
            "description": "Stream token from POST /api/jobs/{job_id}/stream-token, for clients (browser EventSource) that cannot send the bearer header.",
            "in": "query",
            "name": "token",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 512,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Stream token from POST /api/jobs/{job_id}/stream-token, for clients (browser EventSource) that cannot send the bearer header.",
              "title": "Token"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/event-stream": {
                "itemSchema": {
                  "properties": {
                    "data": {
                      "contentMediaType": "application/json",
                      "contentSchema": {
                        "$ref": "#/components/schemas/JobEvent"
                      }
                    },
                    "event": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "retry": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Stream Job Events",
        "tags": [
          "jobs"
        ]
      }
    },
    "/api/jobs/{job_id}/stream-token": {
      "post": {
        "description": "A short-lived token (``api.stream_token_ttl_seconds``) that lets a\nclient which cannot send the bearer header (browser ``EventSource``)\nread this job's event stream, and nothing else. It is tied to your\nuser and stops working if your account is disabled.",
        "operationId": "createStreamToken",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StreamToken"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Stream Token",
        "tags": [
          "jobs"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/journal/breakdown": {
      "get": {
        "description": "Win rate, P&L, profit factor, average R and exit efficiency per\ngroup of trades.",
        "operationId": "getJournalBreakdown",
        "parameters": [
          {
            "description": "sleeve, origin, ticker, side, exit_trigger, tag, mistake, playbook, plan",
            "in": "query",
            "name": "by",
            "required": false,
            "schema": {
              "default": "all",
              "description": "sleeve, origin, ticker, side, exit_trigger, tag, mistake, playbook, plan",
              "enum": [
                "all",
                "sleeve",
                "origin",
                "ticker",
                "side",
                "exit_trigger",
                "tag",
                "mistake",
                "playbook",
                "plan"
              ],
              "title": "By",
              "type": "string"
            }
          },
          {
            "description": "closed on or after this day (open: entered)",
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "closed on or after this day (open: entered)",
              "title": "Since"
            }
          },
          {
            "description": "closed on or before this day (open: entered)",
            "in": "query",
            "name": "until",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "closed on or before this day (open: entered)",
              "title": "Until"
            }
          },
          {
            "description": "one strategy id, or manual",
            "in": "query",
            "name": "sleeve",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 128,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "one strategy id, or manual",
              "title": "Sleeve"
            }
          },
          {
            "description": "strategy or manual orders",
            "in": "query",
            "name": "origin",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "strategy",
                    "manual"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "strategy or manual orders",
              "title": "Origin"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BreakdownView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Journal Breakdown",
        "tags": [
          "journal"
        ]
      }
    },
    "/api/journal/calendar": {
      "get": {
        "description": "Realised P&L by exit day with weekly and monthly totals, in the\nportfolio's base currency.",
        "operationId": "getPnlCalendar",
        "parameters": [
          {
            "description": "closed on or after this day (open: entered)",
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "closed on or after this day (open: entered)",
              "title": "Since"
            }
          },
          {
            "description": "closed on or before this day (open: entered)",
            "in": "query",
            "name": "until",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "closed on or before this day (open: entered)",
              "title": "Until"
            }
          },
          {
            "description": "one strategy id, or manual",
            "in": "query",
            "name": "sleeve",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 128,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "one strategy id, or manual",
              "title": "Sleeve"
            }
          },
          {
            "description": "strategy or manual orders",
            "in": "query",
            "name": "origin",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "strategy",
                    "manual"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "strategy or manual orders",
              "title": "Origin"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PnlCalendarView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Pnl Calendar",
        "tags": [
          "journal"
        ]
      }
    },
    "/api/journal/labels": {
      "get": {
        "description": "The tags and mistakes you already used in this portfolio.",
        "operationId": "listJournalLabels",
        "parameters": [
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalLabelsView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Journal Labels",
        "tags": [
          "journal"
        ]
      }
    },
    "/api/journal/playbooks": {
      "get": {
        "description": "Your playbooks: the setups you trade, with their rules.",
        "operationId": "listPlaybooks",
        "parameters": [
          {
            "in": "query",
            "name": "include_archived",
            "required": false,
            "schema": {
              "default": false,
              "title": "Include Archived",
              "type": "boolean"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_PlaybookView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Playbooks",
        "tags": [
          "journal"
        ]
      },
      "post": {
        "description": "Add a playbook.",
        "operationId": "createPlaybook",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlaybookCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Playbook",
        "tags": [
          "journal"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/journal/playbooks/{playbook_id}": {
      "patch": {
        "description": "Rename a playbook, change its rules, or archive it.",
        "operationId": "updatePlaybook",
        "parameters": [
          {
            "in": "path",
            "name": "playbook_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Playbook Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlaybookUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlaybookView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Playbook",
        "tags": [
          "journal"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/journal/trades": {
      "get": {
        "description": "Your round trips built from fills, open first then newest exit\nfirst: P&L, holding time, excursions, R multiple and exit efficiency,\nwith your tags, mistakes and playbook.",
        "operationId": "listJournalTrades",
        "parameters": [
          {
            "description": "all, open or closed",
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "default": "all",
              "description": "all, open or closed",
              "enum": [
                "all",
                "open",
                "closed"
              ],
              "title": "Status",
              "type": "string"
            }
          },
          {
            "description": "one strategy id, or manual",
            "in": "query",
            "name": "sleeve",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 128,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "one strategy id, or manual",
              "title": "Sleeve"
            }
          },
          {
            "description": "strategy or manual orders",
            "in": "query",
            "name": "origin",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "strategy",
                    "manual"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "strategy or manual orders",
              "title": "Origin"
            }
          },
          {
            "in": "query",
            "name": "ticker",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Ticker"
            }
          },
          {
            "description": "closed on or after this day (open: entered)",
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "closed on or after this day (open: entered)",
              "title": "Since"
            }
          },
          {
            "description": "closed on or before this day (open: entered)",
            "in": "query",
            "name": "until",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "closed on or before this day (open: entered)",
              "title": "Until"
            }
          },
          {
            "in": "query",
            "name": "tag",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 40,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Tag"
            }
          },
          {
            "in": "query",
            "name": "mistake",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 40,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Mistake"
            }
          },
          {
            "in": "query",
            "name": "playbook_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Playbook Id"
            }
          },
          {
            "description": "followed, broke or not_said",
            "in": "query",
            "name": "plan",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "followed",
                    "broke",
                    "not_said"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "followed, broke or not_said",
              "title": "Plan"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_JournalTradeView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Journal Trades",
        "tags": [
          "journal"
        ]
      }
    },
    "/api/journal/trades/{trade_id}": {
      "get": {
        "description": "One trade with every leg and its review.",
        "operationId": "getJournalTrade",
        "parameters": [
          {
            "description": "the id of the fill that opened the trade",
            "in": "path",
            "name": "trade_id",
            "required": true,
            "schema": {
              "description": "the id of the fill that opened the trade",
              "minimum": 1,
              "title": "Trade Id",
              "type": "integer"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalTradeDetailView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Journal Trade",
        "tags": [
          "journal"
        ]
      }
    },
    "/api/journal/trades/{trade_id}/review": {
      "put": {
        "description": "Set a trade's tags, mistakes, playbook, whether you followed the\nplan, and a short review. Replaces what was there.",
        "operationId": "reviewJournalTrade",
        "parameters": [
          {
            "description": "the id of the fill that opened the trade",
            "in": "path",
            "name": "trade_id",
            "required": true,
            "schema": {
              "description": "the id of the fill that opened the trade",
              "minimum": 1,
              "title": "Trade Id",
              "type": "integer"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AnnotationRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AnnotationView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Review Journal Trade",
        "tags": [
          "journal"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/lab/backtests": {
      "post": {
        "description": "Queue a backtest; fetch the typed result from\n``GET /api/lab/backtests/{job_id}/result`` once it succeeds.",
        "operationId": "startBacktest",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BacktestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Start Backtest",
        "tags": [
          "lab"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/lab/backtests/{job_id}/result": {
      "get": {
        "description": "The result of a succeeded backtest job (409 until it has succeeded).",
        "operationId": "getBacktestResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BacktestResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Backtest Result",
        "tags": [
          "lab"
        ]
      }
    },
    "/api/lab/cost-models": {
      "get": {
        "description": "Transaction-cost presets a backtest request can name in ``cost_model``.",
        "operationId": "listCostModels",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/CostModelPreset"
                  },
                  "title": "Response Listcostmodels",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Cost Models",
        "tags": [
          "lab"
        ]
      }
    },
    "/api/lab/ensure/{job_id}/result": {
      "get": {
        "description": "The report of a lab run's chained data job (``ensure_data``; the\nrun's ``ensure_job_id``), 409 until it has succeeded.",
        "operationId": "getLabEnsureResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnsureReport"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Lab Ensure Result",
        "tags": [
          "lab"
        ]
      }
    },
    "/api/lab/ledger": {
      "get": {
        "description": "Recorded lab runs, newest first: the strategy class, hypothesis,\ntuner and budget, how many trials ran and the verdict. Shared across\nusers, like the strategy list, because trial counts are.",
        "operationId": "listLedgerRuns",
        "parameters": [
          {
            "description": "only runs of this module:Class",
            "in": "query",
            "name": "strategy_class",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "only runs of this module:Class",
              "title": "Strategy Class"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_LedgerRunView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Ledger Runs",
        "tags": [
          "lab"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/lab/ledger/{run_id}": {
      "get": {
        "description": "One recorded lab run with every trial (parameters, score, status)\nand the trial count of its class across all runs.",
        "operationId": "getLedgerRun",
        "parameters": [
          {
            "in": "path",
            "name": "run_id",
            "required": true,
            "schema": {
              "maxLength": 80,
              "title": "Run Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LedgerRunDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Ledger Run",
        "tags": [
          "lab"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/lab/objectives": {
      "get": {
        "description": "Every objective a lab run can name in ``objective``, with a label and\na description from the objective's docstring (plugins included).",
        "operationId": "listLabObjectives",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/ObjectiveInfo"
                  },
                  "title": "Response Listlabobjectives",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Lab Objectives",
        "tags": [
          "lab"
        ]
      }
    },
    "/api/lab/runs": {
      "post": {
        "description": "Queue tune → fit → survival suite; fetch the typed result from\n``GET /api/lab/runs/{job_id}/result`` once it succeeds. Registering the\nresult in the catalog (``register_strategy``, ``register_if_passes``)\nneeds an admin.",
        "operationId": "startLabRun",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LabRunRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Start Lab Run",
        "tags": [
          "lab"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/lab/runs/{job_id}/result": {
      "get": {
        "description": "The result of a succeeded lab-run job (409 until it has succeeded).",
        "operationId": "getLabRunResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LabRunView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Lab Run Result",
        "tags": [
          "lab"
        ]
      }
    },
    "/api/lab/signal-ic": {
      "post": {
        "description": "Queue a signal IC analysis of a strategy's ``estimate_return`` (mean\nIC, ICIR, HAC t-stat, decay, quantile spread, turnover); fetch it from\n``GET /api/lab/signal-ic/{job_id}/result`` once it succeeds. Universes\nunder 10 tickers come back ``n/a``.",
        "operationId": "startSignalIc",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignalICRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Start Signal Ic",
        "tags": [
          "lab"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/lab/signal-ic/{job_id}/result": {
      "get": {
        "description": "The result of a succeeded signal IC job (409 until it has succeeded).",
        "operationId": "getSignalIcResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignalICView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Signal Ic Result",
        "tags": [
          "lab"
        ]
      }
    },
    "/api/lab/survival-presets": {
      "get": {
        "description": "The named suites, their tests and the options they give them.",
        "operationId": "listSurvivalPresets",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SurvivalPresetInfo"
                  },
                  "title": "Response Listsurvivalpresets",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Survival Presets",
        "tags": [
          "lab"
        ]
      }
    },
    "/api/lab/survival-tests": {
      "get": {
        "description": "Every survival test with the JSON Schema of its options (what\n``test_options[id]`` on a lab run may set) and the presets that run it.",
        "operationId": "listSurvivalTests",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/SurvivalTestInfo"
                  },
                  "title": "Response Listsurvivaltests",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Survival Tests",
        "tags": [
          "lab"
        ]
      }
    },
    "/api/lab/sweeps": {
      "post": {
        "description": "Queue a sweep: every catalogued strategy (or ``strategies``) through\nthe lab on one basket. Nothing is registered; every run lands in the\ntrial ledger. Fetch the rows from ``GET /api/lab/sweeps/{job_id}/result``.",
        "operationId": "startSweep",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SweepRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Start Sweep",
        "tags": [
          "lab"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/lab/sweeps/{job_id}/result": {
      "get": {
        "description": "The rows of a succeeded sweep job (409 until it has succeeded).",
        "operationId": "getSweepResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SweepResultView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Sweep Result",
        "tags": [
          "lab"
        ]
      }
    },
    "/api/lab/tuners": {
      "get": {
        "description": "Every tuner a lab run can name in ``tuner``, with a label and the JSON\nSchema of what ``tuner_options`` may set for it (plugins included).",
        "operationId": "listLabTuners",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/TunerInfo"
                  },
                  "title": "Response Listlabtuners",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Lab Tuners",
        "tags": [
          "lab"
        ]
      }
    },
    "/api/lab/verify": {
      "post": {
        "description": "Queue a rerun of lab runs or strategies from their stored manifests\n(every strategy of ``[lab.verify].statuses`` when ``targets`` is empty).\nFetch the result from ``GET /api/lab/verify/jobs/{job_id}/result``.",
        "operationId": "startLabVerify",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/VerifyRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Start Verify",
        "tags": [
          "lab"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/lab/verify/jobs/{job_id}/result": {
      "get": {
        "description": "The result of a succeeded verify job (409 until it has succeeded):\nper target, the stored and rerun score, whether it moved, and the\ntickers whose data changed.",
        "operationId": "getLabVerifyResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VerifyResultView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Verify Result",
        "tags": [
          "lab"
        ]
      }
    },
    "/api/lab/worker/claim": {
      "post": {
        "description": "Claim the oldest queued lab job a remote worker can run, with the\nsnapshot to read and the research seed; ``job`` is null when none waits.",
        "operationId": "claimLabWorkerJob",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkerRef"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ClaimResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Claim Job",
        "tags": [
          "lab-worker"
        ],
        "x-permission": "lab.worker"
      }
    },
    "/api/lab/worker/jobs/{job_id}/complete": {
      "post": {
        "description": "Store the job's outcome and import the ledger rows and strategies it\nwrote (409 when the job is no longer this worker's).",
        "operationId": "completeLabWorkerJob",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "pattern": "^[A-Za-z0-9_-]+$",
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkerOutcome"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Complete Job",
        "tags": [
          "lab-worker"
        ],
        "x-permission": "lab.worker"
      }
    },
    "/api/lab/worker/jobs/{job_id}/heartbeat": {
      "post": {
        "description": "Keep the job's lease and store its progress. The reply says whether\na user asked to cancel it, or it is no longer this worker's.",
        "operationId": "heartbeatLabWorkerJob",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "pattern": "^[A-Za-z0-9_-]+$",
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkerHeartbeat"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HeartbeatReply"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Heartbeat Job",
        "tags": [
          "lab-worker"
        ],
        "x-permission": "lab.worker"
      }
    },
    "/api/lab/worker/jobs/{job_id}/release": {
      "post": {
        "description": "A stopping worker hands its running job back to the queue (it ends\ncancelled instead when a user asked to cancel it).",
        "operationId": "releaseLabWorkerJob",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "pattern": "^[A-Za-z0-9_-]+$",
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkerRef"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Release Job",
        "tags": [
          "lab-worker"
        ],
        "x-permission": "lab.worker"
      }
    },
    "/api/lab/worker/register": {
      "post": {
        "description": "Add the worker (or restart it under the same id) and return the\nserver's lease and heartbeat timing.",
        "operationId": "registerLabWorker",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkerHello"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkerConfig"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Register Worker",
        "tags": [
          "lab-worker"
        ],
        "x-permission": "lab.worker"
      }
    },
    "/api/lab/worker/snapshots/{name}": {
      "get": {
        "description": "A read-only lake snapshot, streamed as a tar. The worker keeps it\nuntil a newer one is named in a claim.",
        "operationId": "downloadLabSnapshot",
        "parameters": [
          {
            "in": "path",
            "name": "name",
            "required": true,
            "schema": {
              "maxLength": 64,
              "pattern": "^[0-9A-Za-z][0-9A-Za-z_-]*$",
              "title": "Name",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/x-tar": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "The snapshot folder as an uncompressed tar"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Download Snapshot",
        "tags": [
          "lab-worker"
        ],
        "x-permission": "lab.worker"
      }
    },
    "/api/lab/worker/stop": {
      "post": {
        "description": "Mark the worker stopped (health and metrics stop counting it).",
        "operationId": "stopLabWorker",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkerRef"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkerStopped"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Stop Worker",
        "tags": [
          "lab-worker"
        ],
        "x-permission": "lab.worker"
      }
    },
    "/api/market/bars": {
      "get": {
        "description": "Bars in ``[start, end]``; the most recent ``limit`` when truncated.",
        "operationId": "getBars",
        "parameters": [
          {
            "in": "query",
            "name": "ticker",
            "required": true,
            "schema": {
              "title": "Ticker",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "interval",
            "required": false,
            "schema": {
              "default": "1d",
              "title": "Interval",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "start",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Start"
            }
          },
          {
            "in": "query",
            "name": "end",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "End"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 5000,
              "maximum": 50000,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BarSeries"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Bars",
        "tags": [
          "market"
        ]
      }
    },
    "/api/market/breadth": {
      "get": {
        "description": "How many stocks take part in the market's move: advances and\ndeclines, the share above the 50 and 200 day averages, new one year\nhighs and lows, and distribution days on the index, with plain words.\nDisplay only.",
        "operationId": "getMarketBreadth",
        "parameters": [
          {
            "description": "Measure on this day. Default: the last day with bars.",
            "in": "query",
            "name": "as_of",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Measure on this day. Default: the last day with bars.",
              "title": "As Of"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BreadthView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Breadth",
        "tags": [
          "market"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/market/coverage": {
      "get": {
        "description": "First/last bar and row count per (ticker, interval).",
        "operationId": "listCoverage",
        "parameters": [
          {
            "in": "query",
            "name": "ticker",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Ticker"
            }
          },
          {
            "in": "query",
            "name": "interval",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Interval"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_CoverageRow_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Coverage",
        "tags": [
          "market"
        ]
      }
    },
    "/api/market/data-coverage": {
      "get": {
        "description": "Which kinds of data are stored at all: fundamentals, calendars, news\nand option chains (each needs a data plan that includes it).",
        "operationId": "getDataCoverage",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataCoverage"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Data Coverage",
        "tags": [
          "market"
        ]
      }
    },
    "/api/market/instruments": {
      "get": {
        "operationId": "listInstruments",
        "parameters": [
          {
            "description": "id or name substring",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 100,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "id or name substring",
              "title": "Q"
            }
          },
          {
            "in": "query",
            "name": "asset_class",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "equity",
                    "crypto",
                    "commodity",
                    "bond"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Asset Class"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_InstrumentView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Instruments",
        "tags": [
          "market"
        ]
      }
    },
    "/api/model-versions/candidates": {
      "get": {
        "description": "Every candidate version running as a model book, across strategies.",
        "operationId": "listModelCandidates",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_ModelVersionView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Candidates",
        "tags": [
          "model-versions"
        ]
      }
    },
    "/api/model-versions/jobs/{job_id}/result": {
      "get": {
        "description": "The result of a succeeded retrain job (409 until it has succeeded).",
        "operationId": "getModelRetrainResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RetrainResultView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Retrain Result",
        "tags": [
          "model-versions"
        ]
      }
    },
    "/api/model-versions/retrain": {
      "post": {
        "description": "Queue a retrain of the strategies that learn from data. Each fit\nbecomes a candidate version, and nothing trades until a swap. Fetch the\nresult from ``GET /api/model-versions/jobs/{job_id}/result``.",
        "operationId": "startModelRetrain",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/RetrainRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Start Retrain",
        "tags": [
          "model-versions"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/notifications": {
      "get": {
        "description": "Your in-app feed, newest first, with the unread count.",
        "operationId": "listNotifications",
        "parameters": [
          {
            "in": "query",
            "name": "unread_only",
            "required": false,
            "schema": {
              "default": false,
              "title": "Unread Only",
              "type": "boolean"
            }
          },
          {
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          },
          {
            "description": "page: ids below this",
            "in": "query",
            "name": "before_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page: ids below this",
              "title": "Before Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FeedView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Notifications",
        "tags": [
          "notifications"
        ]
      }
    },
    "/api/notifications/preferences": {
      "get": {
        "operationId": "getNotificationPreferences",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreferencesView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Preferences",
        "tags": [
          "notifications"
        ]
      },
      "put": {
        "description": "Set per-category (and optionally per-strategy) channel switches.",
        "operationId": "updateNotificationPreferences",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PreferencesUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreferencesView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Preferences",
        "tags": [
          "notifications"
        ],
        "x-permission": "notifications.manage"
      }
    },
    "/api/notifications/quiet-hours": {
      "put": {
        "description": "Hold low and normal urgency deliveries for a morning digest; high\nurgency (halts, failed auto orders) always goes.",
        "operationId": "setQuietHours",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuietHoursUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreferencesView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set Quiet Hours",
        "tags": [
          "notifications"
        ],
        "x-permission": "notifications.manage"
      }
    },
    "/api/notifications/read": {
      "post": {
        "description": "Mark notifications read (all of yours when ``ids`` is omitted). Only\ntouches your own rows, so viewers may do it too.",
        "operationId": "markNotificationsRead",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/MarkReadRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarkReadView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Mark Read",
        "tags": [
          "notifications"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/notifications/test": {
      "post": {
        "description": "Send yourself a test notification on every channel you turned on\n(push devices, email, your webhook), to check that alerts reach you.\nIt skips quiet hours. Only ever reaches you, so viewers may do it too.\nOne a minute: a second call in the same minute answers 429.",
        "operationId": "sendTestNotification",
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TestNotificationView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "429": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Too Many Requests"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Send Test",
        "tags": [
          "notifications"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/notifications/webhook": {
      "put": {
        "description": "Your fallback webhook. Write-only: never shown back in full.",
        "operationId": "setNotificationWebhook",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WebhookUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PreferencesView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set Webhook",
        "tags": [
          "notifications"
        ],
        "x-permission": "notifications.manage"
      }
    },
    "/api/onboarding": {
      "get": {
        "description": "Your first-run steps (account, portfolio, data, follow, alerts), each\ndone, skipped or still to do, and whether to show the guide.",
        "operationId": "getOnboarding",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Onboarding",
        "tags": [
          "onboarding"
        ]
      },
      "put": {
        "description": "Close the guide (``dismissed: true``) or bring it back.",
        "operationId": "updateOnboarding",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OnboardingUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Onboarding",
        "tags": [
          "onboarding"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/onboarding/steps/{step}": {
      "put": {
        "description": "Mark one of your steps done or skipped, or back to ``todo``. A step\nthe data shows done stays done.",
        "operationId": "updateOnboardingStep",
        "parameters": [
          {
            "description": "the step to mark",
            "in": "path",
            "name": "step",
            "required": true,
            "schema": {
              "description": "the step to mark",
              "enum": [
                "account",
                "portfolio",
                "data",
                "follow",
                "alerts"
              ],
              "title": "Step",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StepUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnboardingView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Onboarding Step",
        "tags": [
          "onboarding"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/onboarding/system": {
      "get": {
        "description": "Admins: is the install ready? A data source key, a first data load,\na backup on disk and a running scheduler.",
        "operationId": "getSystemChecklist",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemChecklistView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get System Checklist",
        "tags": [
          "onboarding"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/options/backtests": {
      "post": {
        "description": "Queue an options backtest on the stored chains, with its validation\nchecks unless ``validation`` is false. Fetch it from ``GET\n/api/options/backtests/{job_id}/result``.",
        "operationId": "startOptionsBacktest",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OptionsBacktestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Start Backtest",
        "tags": [
          "options"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/options/backtests/{job_id}/result": {
      "get": {
        "description": "The result of a succeeded options backtest job (409 until it has\nsucceeded).",
        "operationId": "getOptionsBacktestResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OptionsBacktestView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Backtest Result",
        "tags": [
          "options"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/options/chains/{underlying}": {
      "get": {
        "description": "One expiry of a stored chain with our implied vol and Greeks, calls\nand puts side by side by strike. ``as_of`` picks the last stored day on\nor before it (the latest without it). ``expiry`` defaults to the one\nnearest 30 days out.",
        "operationId": "getOptionChain",
        "parameters": [
          {
            "in": "path",
            "name": "underlying",
            "required": true,
            "schema": {
              "maxLength": 32,
              "minLength": 1,
              "pattern": "^[A-Za-z0-9._\\-]+$",
              "title": "Underlying",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "as_of",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "As Of"
            }
          },
          {
            "in": "query",
            "name": "expiry",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Expiry"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OptionChainView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Chain",
        "tags": [
          "options"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/options/payoff": {
      "post": {
        "description": "One unit of a structure picked from a stored chain by delta and days\nto expiry, and its profit at expiry over a range of underlying prices,\nwith max loss, max gain and breakevens. A read sent as a POST.",
        "operationId": "getOptionPayoff",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OptionPayoffRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OptionPayoffView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Payoff",
        "tags": [
          "options"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/options/strategies": {
      "get": {
        "description": "The options strategy catalog with each hypothesis and parameters.",
        "operationId": "listOptionStrategies",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/OptionStrategyView"
                  },
                  "title": "Response Listoptionstrategies",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Strategies",
        "tags": [
          "options"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/options/structures": {
      "get": {
        "description": "Structures a payoff can be drawn for, with the parameters each reads.",
        "operationId": "listOptionStructures",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/OptionStructureView"
                  },
                  "title": "Response Listoptionstructures",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Structures",
        "tags": [
          "options"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/options/underlyings": {
      "get": {
        "description": "Underlyings with stored option chains, and the days they cover.",
        "operationId": "listOptionUnderlyings",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_OptionUnderlyingView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Underlyings",
        "tags": [
          "options"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/orders": {
      "get": {
        "operationId": "listOrders",
        "parameters": [
          {
            "in": "query",
            "name": "tick_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Tick Id"
            }
          },
          {
            "in": "query",
            "name": "strategy_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Strategy Id"
            }
          },
          {
            "in": "query",
            "name": "ticker",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Ticker"
            }
          },
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "in": "query",
            "name": "origin",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "strategy",
                    "manual"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Origin"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_OrderView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Orders",
        "tags": [
          "orders"
        ]
      }
    },
    "/api/orders/drafts": {
      "get": {
        "description": "Your order drafts, newest first.",
        "operationId": "listOrderDrafts",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "pending",
                    "placed",
                    "rejected",
                    "expired",
                    "cancelled"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_OrderDraftView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Order Drafts",
        "tags": [
          "orders"
        ]
      },
      "post": {
        "description": "Propose an order. The server prices it at the latest close, checks\nthe price band and caps, and keeps it until you approve, reject or it\nexpires. The same retry_key returns the draft already made.",
        "operationId": "createOrderDraft",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderDraftCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderDraftView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Order Draft",
        "tags": [
          "orders"
        ],
        "x-permission": "portfolio.trade"
      }
    },
    "/api/orders/drafts/{draft_id}/approve": {
      "post": {
        "description": "Place a pending draft as a manual order, through the kill switch,\nevery halt and every risk rule. Needs a fresh second factor.",
        "operationId": "approveOrderDraft",
        "parameters": [
          {
            "in": "path",
            "name": "draft_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Draft Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderDraftApproval"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Approve Order Draft",
        "tags": [
          "orders"
        ],
        "x-permission": "orders.approve"
      }
    },
    "/api/orders/drafts/{draft_id}/reject": {
      "post": {
        "operationId": "rejectOrderDraft",
        "parameters": [
          {
            "in": "path",
            "name": "draft_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Draft Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderDraftDecision"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderDraftView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Reject Order Draft",
        "tags": [
          "orders"
        ],
        "x-permission": "portfolio.trade"
      }
    },
    "/api/orders/fills": {
      "get": {
        "operationId": "listFills",
        "parameters": [
          {
            "in": "query",
            "name": "tick_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Tick Id"
            }
          },
          {
            "in": "query",
            "name": "ticker",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Ticker"
            }
          },
          {
            "in": "query",
            "name": "order_client_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Order Client Id"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_FillView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Fills",
        "tags": [
          "orders"
        ]
      }
    },
    "/api/orders/manual": {
      "post": {
        "description": "Place an order on one of your portfolios. A simulated book fills at\nonce at the latest close. A book at a broker sends it through the broker.\nThe same ``client_id`` places the order once.",
        "operationId": "placeManualOrder",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManualOrderRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManualOrderResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Place Manual Order",
        "tags": [
          "orders"
        ],
        "x-permission": "portfolio.trade"
      }
    },
    "/api/orders/manual/plan": {
      "post": {
        "description": "Size an entry from the risk you choose (a percent of the book or an\namount) and the distance to your stop, in whole shares within the cash.\nNothing is placed.",
        "operationId": "planManualOrder",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TradePlanRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TradePlanView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Plan Manual Order",
        "tags": [
          "orders"
        ],
        "x-permission": "portfolio.trade"
      }
    },
    "/api/orders/manual/preview": {
      "post": {
        "description": "Run every check of an order and say what would be placed. Nothing is\nrecorded or sent.",
        "operationId": "previewManualOrder",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManualOrderRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManualOrderResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Preview Manual Order",
        "tags": [
          "orders"
        ],
        "x-permission": "portfolio.trade"
      }
    },
    "/api/orders/{client_id}/cancel": {
      "post": {
        "description": "Cancel one working order of your portfolio, yours or a strategy's.",
        "operationId": "cancelOrder",
        "parameters": [
          {
            "description": "The order's client id",
            "in": "path",
            "name": "client_id",
            "required": true,
            "schema": {
              "description": "The order's client id",
              "maxLength": 200,
              "title": "Client Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderCancelRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderCancelResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Cancel Order",
        "tags": [
          "orders"
        ],
        "x-permission": "portfolio.trade"
      }
    },
    "/api/orders/{client_id}/change": {
      "post": {
        "description": "Change the quantity or limit of one of your working manual orders:\nit is cancelled at the broker and a new order replaces it.",
        "operationId": "changeManualOrder",
        "parameters": [
          {
            "description": "The order's client id",
            "in": "path",
            "name": "client_id",
            "required": true,
            "schema": {
              "description": "The order's client id",
              "maxLength": 200,
              "title": "Client Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ManualOrderChange"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ManualOrderResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Change Manual Order",
        "tags": [
          "orders"
        ],
        "x-permission": "portfolio.trade"
      }
    },
    "/api/planner/confirm": {
      "post": {
        "description": "One order ticket per trade of the plan. Each waits for your approval\n(a fresh second factor) before it is sent in the submit window.",
        "operationId": "confirmRebalance",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlanConfirm"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PlanConfirmResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Confirm Rebalance",
        "tags": [
          "execution"
        ],
        "x-permission": "portfolio.trade"
      }
    },
    "/api/planner/plan": {
      "post": {
        "description": "The trades that move a portfolio to a strategy's model weights or to\nyour own list: whole shares, costs, turnover and a tax preview. Nothing\nis written or sent.",
        "operationId": "planRebalance",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PlanRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RebalancePlanView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Plan Rebalance",
        "tags": [
          "execution"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/pnl": {
      "get": {
        "description": "Daily P&L of one of your portfolios (last snapshot per UTC day).\nReturns and drawdown are measured from inception even when ``since``\ntrims it.",
        "operationId": "getPnl",
        "parameters": [
          {
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Since"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PnlSeries"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Pnl",
        "tags": [
          "pnl"
        ]
      }
    },
    "/api/portfolio": {
      "get": {
        "description": "Latest snapshot, positions valued at the latest stored closes.",
        "operationId": "getPortfolio",
        "parameters": [
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortfolioView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Portfolio",
        "tags": [
          "portfolio"
        ]
      }
    },
    "/api/portfolio/snapshots": {
      "get": {
        "operationId": "listPortfolioSnapshots",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_SnapshotView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Snapshots",
        "tags": [
          "portfolio"
        ]
      }
    },
    "/api/portfolio/totals": {
      "get": {
        "description": "Admins: cash and value summed across every active portfolio. No\ntickers and no per-person numbers.",
        "operationId": "getPortfolioTotals",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortfolioTotalsView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Totals",
        "tags": [
          "portfolio"
        ],
        "x-permission": "portfolio.totals"
      }
    },
    "/api/portfolios": {
      "get": {
        "description": "Your portfolios, oldest first, each marked paper or live. Empty\nfor someone who only follows strategies for signals.",
        "operationId": "listPortfolios",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_PortfolioSummaryView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Portfolios",
        "tags": [
          "portfolio"
        ],
        "x-permission": "data.read"
      },
      "post": {
        "description": "Open a new paper portfolio of yours: simulated fills on the Stonks\nledger, starting from ``initial_cash``. Subscribe strategies to it in\n``paper`` mode to trade it.",
        "operationId": "createPortfolio",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PortfolioCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortfolioSummaryView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Portfolio",
        "tags": [
          "portfolio"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/portfolios/trading-modes": {
      "get": {
        "description": "For each of your portfolios: does it trade paper or live money, and\nthrough which broker.",
        "operationId": "listTradingModes",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_TradingModeView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Trading Modes",
        "tags": [
          "portfolio"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/portfolios/{portfolio_id}": {
      "patch": {
        "description": "Rename one of your portfolios (404 when it isn't yours).",
        "operationId": "renamePortfolio",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PortfolioRename"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortfolioSummaryView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Rename Portfolio",
        "tags": [
          "portfolio"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/portfolios/{portfolio_id}/algo-parents": {
      "get": {
        "description": "Parent orders Stonks works as child slices, with each slice.",
        "operationId": "listAlgoParents",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ParentOrderList"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Algo Parents",
        "tags": [
          "execution"
        ]
      }
    },
    "/api/portfolios/{portfolio_id}/cash-flows": {
      "get": {
        "description": "Every deposit and withdrawal of one of your portfolios, oldest first:\nrecorded ones and those a broker sync brought in.",
        "operationId": "listCashFlows",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_CashFlowView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Cash Flows",
        "tags": [
          "portfolio"
        ]
      },
      "post": {
        "description": "Record a deposit or a withdrawal on one of your simulated portfolios.\nIt moves the book's cash. Broker books get theirs from the sync.",
        "operationId": "recordCashFlow",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CashFlowCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CashFlowView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Record Cash Flow",
        "tags": [
          "portfolio"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/portfolios/{portfolio_id}/execution-algos": {
      "delete": {
        "description": "Back to plain orders, or a strategy back to the portfolio's setting.",
        "operationId": "clearExecutionAlgo",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "strategy_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Strategy Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Clear Execution Algo",
        "tags": [
          "execution"
        ],
        "x-permission": "portfolio.manage"
      },
      "get": {
        "description": "The portfolio's algo setting and each strategy's override. Empty:\nplain orders.",
        "operationId": "listExecutionAlgoSettings",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlgoSettingList"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Execution Algo Settings",
        "tags": [
          "execution"
        ]
      },
      "put": {
        "description": "Work the portfolio's orders (or one strategy's, with strategy_id)\nwith an algo. Stops, options and one-cancels-other orders stay plain.",
        "operationId": "setExecutionAlgo",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AlgoSettingUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlgoSettingView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set Execution Algo",
        "tags": [
          "execution"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/portfolios/{portfolio_id}/live/account-profile": {
      "get": {
        "description": "The account profile (404 until one is set).",
        "operationId": "getAccountProfile",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountProfileView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Account Profile",
        "tags": [
          "live"
        ]
      },
      "put": {
        "description": "Set where the account is held and its type. Shorts need a margin\naccount. Needs a fresh second factor. A margin account also needs margin\naccounts turned on by the admin, the account rules and the margin call\nrule on, ``acknowledge_margin_risks`` and the broker reporting a margin\naccount (409 otherwise).",
        "operationId": "setAccountProfile",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AccountProfileBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountProfileView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set Account Profile",
        "tags": [
          "live"
        ],
        "x-permission": "live.manage"
      }
    },
    "/api/portfolios/{portfolio_id}/live/allocation": {
      "get": {
        "description": "How much Stonks may trade in this live portfolio. ``amount`` is\n``null`` until you set it, and then nothing opens.",
        "operationId": "getLiveAllocation",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveAllocationView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Live Allocation",
        "tags": [
          "live"
        ]
      },
      "put": {
        "description": "Set the amount by hand, with a reason. Needs a fresh second factor.\nThe book's gross exposure is capped at it (``capital_ramp``).",
        "operationId": "setLiveAllocation",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LiveAllocationUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveAllocationView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set Live Allocation",
        "tags": [
          "live"
        ],
        "x-permission": "live.manage"
      }
    },
    "/api/portfolios/{portfolio_id}/live/gate-report": {
      "get": {
        "description": "What a promotion to the next stage needs, checked now. A check with\n``passed: null`` has no data yet and does not block.",
        "operationId": "getLiveGateReport",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GateReportView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Live Gate Report",
        "tags": [
          "live"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/portfolios/{portfolio_id}/live/margin": {
      "get": {
        "description": "Buying power and margin use, read from the broker now, with the\nmargin cushion, the safety buffer, the pattern day trader state and the\nlatest margin check. ``account`` is ``null`` when the broker cannot be\nread (``read_error`` says why). Read only.",
        "operationId": "getLiveMargin",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MarginView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Live Margin",
        "tags": [
          "live"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/portfolios/{portfolio_id}/live/options": {
      "get": {
        "description": "Whether an option order may open in this portfolio, and every\nreason it may not: the admin's switch, the live stage and the options\napproval level. Off by default.",
        "operationId": "getOptionsLive",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OptionsLiveView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Options Live",
        "tags": [
          "live"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/portfolios/{portfolio_id}/live/options/approval": {
      "put": {
        "description": "Set the options approval level (none, covered, spreads or naked)\nwith a reason. Needs a fresh second factor. It never turns options on\nby itself: the switch and the stage still apply.",
        "operationId": "setOptionsApproval",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OptionsApprovalUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OptionsLiveView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set Options Approval",
        "tags": [
          "live"
        ],
        "x-permission": "live.manage"
      }
    },
    "/api/portfolios/{portfolio_id}/live/preview": {
      "post": {
        "description": "The orders the live book would send now: a dry run through every\nrule and the broker's what-if. It never transmits an order.",
        "operationId": "previewLiveOrders",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LivePreviewView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Preview Live Orders",
        "tags": [
          "live"
        ],
        "x-permission": "portfolio.trade"
      }
    },
    "/api/portfolios/{portfolio_id}/live/rules": {
      "get": {
        "description": "Which live safeguards and account rules act on this portfolio, as its\nbook follows them. Read only: the limits are set by the admin and your\nown risk limits.",
        "operationId": "getLiveRules",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveRulesView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Live Rules",
        "tags": [
          "live"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/portfolios/{portfolio_id}/live/stage": {
      "get": {
        "description": "The portfolio's live stage, its changes and the last sessions' gate\nmetrics (orders, rejections, stuck orders, fill quality, tracking and\ndrift).",
        "operationId": "getLiveStage",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "days",
            "required": false,
            "schema": {
              "default": 30,
              "maximum": 260,
              "minimum": 1,
              "title": "Days",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveStageView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Live Stage",
        "tags": [
          "live"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/portfolios/{portfolio_id}/live/stage/demote": {
      "post": {
        "description": "Down to any lower stage, with a reason. It only reduces risk, so it\nneeds no second factor.",
        "operationId": "demoteLiveStage",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StageDemoteBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveStageView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Demote Live Stage",
        "tags": [
          "live"
        ],
        "x-permission": "portfolio.trade"
      }
    },
    "/api/portfolios/{portfolio_id}/live/stage/promote": {
      "post": {
        "description": "One stage up. The gate report is computed now and must pass. Type\nthe target stage in ``confirm``. Needs a fresh second factor.",
        "operationId": "promoteLiveStage",
        "parameters": [
          {
            "in": "path",
            "name": "portfolio_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Portfolio Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StagePromoteBody"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiveStageView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Promote Live Stage",
        "tags": [
          "live"
        ],
        "x-permission": "live.manage"
      }
    },
    "/api/price-alerts": {
      "get": {
        "description": "Your price alert rules, oldest first, with the price each last saw.",
        "operationId": "listPriceAlerts",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_PriceAlertView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Price Alerts",
        "tags": [
          "price-alerts"
        ]
      },
      "post": {
        "description": "A new rule: crosses_above or crosses_below a level, or moves_pct by a\npercent over window_days, on a ticker or on one of your watchlists.",
        "operationId": "createPriceAlert",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PriceAlertCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceAlertView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Price Alert",
        "tags": [
          "price-alerts"
        ],
        "x-permission": "notifications.manage"
      }
    },
    "/api/price-alerts/evaluate": {
      "post": {
        "description": "Check every enabled rule of every person against the latest closes\nnow (the scheduler runs this after each price ingest).",
        "operationId": "evaluatePriceAlerts",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/PriceAlertRunRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceAlertRunView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Evaluate Price Alerts",
        "tags": [
          "price-alerts"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/price-alerts/events": {
      "get": {
        "description": "When your rules fired, newest first.",
        "operationId": "listPriceAlertEvents",
        "parameters": [
          {
            "in": "query",
            "name": "rule_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Rule Id"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_PriceAlertEventView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Price Alert Events",
        "tags": [
          "price-alerts"
        ]
      }
    },
    "/api/price-alerts/{alert_id}": {
      "delete": {
        "operationId": "deletePriceAlert",
        "parameters": [
          {
            "in": "path",
            "name": "alert_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Alert Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Price Alert",
        "tags": [
          "price-alerts"
        ],
        "x-permission": "notifications.manage"
      },
      "get": {
        "operationId": "getPriceAlert",
        "parameters": [
          {
            "in": "path",
            "name": "alert_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Alert Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceAlertView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Price Alert",
        "tags": [
          "price-alerts"
        ]
      },
      "patch": {
        "description": "Rename a rule, change its thresholds, or switch it on or off.",
        "operationId": "updatePriceAlert",
        "parameters": [
          {
            "in": "path",
            "name": "alert_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Alert Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PriceAlertUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PriceAlertView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Price Alert",
        "tags": [
          "price-alerts"
        ],
        "x-permission": "notifications.manage"
      }
    },
    "/api/push/subscriptions": {
      "delete": {
        "description": "Unregister a browser by its endpoint (404 when it isn't yours).",
        "operationId": "deletePushSubscription",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PushUnsubscribeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Push Subscription",
        "tags": [
          "push"
        ],
        "x-permission": "notifications.manage"
      },
      "get": {
        "description": "Your registered browsers and installed apps (no endpoints or keys).",
        "operationId": "listPushSubscriptions",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_PushDeviceView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Push Subscriptions",
        "tags": [
          "push"
        ]
      },
      "post": {
        "description": "Register this browser (``PushSubscription.toJSON()``). The endpoint\nmust be a known push service; re-registering refreshes it in place.",
        "operationId": "createPushSubscription",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PushSubscriptionRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushDeviceView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Push Subscription",
        "tags": [
          "push"
        ],
        "x-permission": "notifications.manage"
      }
    },
    "/api/push/subscriptions/{device_id}": {
      "delete": {
        "description": "Unregister one of your devices by the id the list shows, for\nremoving another browser from Settings (404 when it isn't yours).",
        "operationId": "deletePushDevice",
        "parameters": [
          {
            "in": "path",
            "name": "device_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Device Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Push Device",
        "tags": [
          "push"
        ],
        "x-permission": "notifications.manage"
      }
    },
    "/api/push/vapid-key": {
      "get": {
        "description": "The VAPID public key browsers subscribe with; null when this server\ncan't send Web Push (the console then doesn't subscribe).",
        "operationId": "getVapidKey",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/VapidKeyView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Vapid Key",
        "tags": [
          "push"
        ]
      }
    },
    "/api/reconcile/reports": {
      "get": {
        "description": "The latest checks of your live portfolios against their brokers,\nnewest first. ``drift`` opened a ``broker_drift`` halt and paused auto.\n``outage`` skipped the day. ``fault`` paused auto.",
        "operationId": "listReconcileReports",
        "parameters": [
          {
            "description": "one of your portfolios",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "one of your portfolios",
              "title": "Portfolio Id"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_ReconcileReportView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Reconcile Reports",
        "tags": [
          "reconcile"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/reconcile/reports/{report_id}": {
      "get": {
        "description": "One check: every unexplained item, what it explained itself, and the\nowner's own positions and orders it kept apart.",
        "operationId": "getReconcileReport",
        "parameters": [
          {
            "in": "path",
            "name": "report_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Report Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconcileReportView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Reconcile Report",
        "tags": [
          "reconcile"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/risk/intraday": {
      "get": {
        "description": "Intraday P&L and risk snapshots of one of your portfolios for one\nday, newest first: realised and unrealised P&L from live marks, fees,\nthe drawdown from the day's high, exposure and mark freshness.",
        "operationId": "listIntradaySnapshots",
        "parameters": [
          {
            "description": "the trading day; default the latest day with rows",
            "in": "query",
            "name": "day",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "the trading day; default the latest day with rows",
              "title": "Day"
            }
          },
          {
            "description": "one strategy's sleeve; default the whole portfolio",
            "in": "query",
            "name": "strategy_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "one strategy's sleeve; default the whole portfolio",
              "title": "Strategy Id"
            }
          },
          {
            "description": "every book: the whole portfolio and each sleeve",
            "in": "query",
            "name": "all_books",
            "required": false,
            "schema": {
              "default": false,
              "description": "every book: the whole portfolio and each sleeve",
              "title": "All Books",
              "type": "boolean"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_IntradaySnapshotView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Intraday Snapshots",
        "tags": [
          "risk"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/risk/limits": {
      "get": {
        "description": "Your own risk limits next to the system policy, and what your\nportfolios follow: the system policy tightened by yours.",
        "operationId": "getMyRiskLimits",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RiskLimitsView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get My Risk Limits",
        "tags": [
          "risk"
        ]
      },
      "put": {
        "description": "Replace your own risk limits (a partial risk policy). They can only\nmake the system limits stricter; a looser value is listed in\n``ignored``. Audited.",
        "operationId": "setMyRiskLimits",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RiskLimitsUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RiskLimitsView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set My Risk Limits",
        "tags": [
          "risk"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/risk/live": {
      "get": {
        "description": "One of your portfolios on its latest tick day: one-day 95% and 99%\nVaR and expected shortfall, the rolling violation ratio and Kupiec test,\nand per strategy sleeve the same plus the alpha-decay check (BL-47).",
        "operationId": "getLiveRisk",
        "parameters": [
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RiskSummaryView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Live Risk",
        "tags": [
          "risk"
        ]
      }
    },
    "/api/risk/policy": {
      "get": {
        "description": "The ``[production.risk]`` limits applied between a strategy's orders\nand the broker.",
        "operationId": "getRiskPolicy",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RiskPolicy"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Risk Policy",
        "tags": [
          "risk"
        ]
      }
    },
    "/api/risk/snapshots": {
      "get": {
        "description": "Daily risk snapshots of one of your portfolios, newest first.",
        "operationId": "listRiskSnapshots",
        "parameters": [
          {
            "description": "one strategy's sleeve; default the whole portfolio",
            "in": "query",
            "name": "strategy_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "one strategy's sleeve; default the whole portfolio",
              "title": "Strategy Id"
            }
          },
          {
            "description": "days on or after this one",
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "days on or after this one",
              "title": "Since"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_RiskSnapshotView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Risk Snapshots",
        "tags": [
          "risk"
        ]
      }
    },
    "/api/schedule": {
      "get": {
        "description": "Scheduled jobs with their next fire, and the most recent runs.",
        "operationId": "getSchedule",
        "parameters": [
          {
            "description": "recent runs",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "default": 50,
              "description": "recent runs",
              "maximum": 200,
              "minimum": 1,
              "title": "Limit",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduleView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Schedule",
        "tags": [
          "schedule"
        ]
      }
    },
    "/api/schedule/{job}/run-now": {
      "post": {
        "description": "Run a scheduled job now (a ``manual:`` run, audited). It runs in the\nbackground; its row shows up in ``GET /api/schedule``.",
        "operationId": "runScheduledJobNow",
        "parameters": [
          {
            "in": "path",
            "name": "job",
            "required": true,
            "schema": {
              "title": "Job",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RunNowRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunNowView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Run Now",
        "tags": [
          "schedule"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/screener/alerts": {
      "get": {
        "description": "Your screen alerts, oldest first, with the last day each ran.",
        "operationId": "listScreenAlerts",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_ScreenAlertView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Screen Alerts",
        "tags": [
          "screener"
        ]
      }
    },
    "/api/screener/alerts/evaluate": {
      "post": {
        "description": "Run every due screen alert of every person now (the scheduler runs\nthis after each price ingest).",
        "operationId": "evaluateScreenAlerts",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ScreenAlertRunRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScreenAlertRunView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Evaluate Screen Alerts",
        "tags": [
          "screener"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/screener/alerts/events": {
      "get": {
        "description": "When your screens found new names, newest first.",
        "operationId": "listScreenAlertEvents",
        "parameters": [
          {
            "in": "query",
            "name": "screen_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Screen Id"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_ScreenAlertEventView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Screen Alert Events",
        "tags": [
          "screener"
        ]
      }
    },
    "/api/screener/jobs": {
      "post": {
        "description": "Run a large screen as a background job; follow ``/api/jobs/{id}``\nor its event stream, then read ``/api/screener/jobs/{id}/result``.",
        "operationId": "submitScreenJob",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScreenRunRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Submit Screen Job",
        "tags": [
          "screener"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/screener/jobs/{job_id}/result": {
      "get": {
        "description": "The rows of a finished screen job (409 until it has succeeded).",
        "operationId": "getScreenJobResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScreenResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Screen Job Result",
        "tags": [
          "screener"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/screener/metrics": {
      "get": {
        "description": "Every metric a screen may filter or sort on, with its unit.",
        "operationId": "listScreenMetrics",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/MetricView"
                  },
                  "title": "Response Listscreenmetrics",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Metrics",
        "tags": [
          "screener"
        ]
      }
    },
    "/api/screener/run": {
      "post": {
        "description": "Run a screen (or one of your saved ones) on the lake as it was on\n``as_of`` (default today). Only data known on that day counts.",
        "operationId": "runScreen",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScreenRunRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScreenResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Run Screen",
        "tags": [
          "screener"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/screener/screens": {
      "get": {
        "description": "Your saved screens, oldest first.",
        "operationId": "listScreens",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_SavedScreenView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Screens",
        "tags": [
          "screener"
        ]
      },
      "post": {
        "description": "Save a screen. Names are unique per person (409).",
        "operationId": "createScreen",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SavedScreenCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedScreenView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Screen",
        "tags": [
          "screener"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/screener/screens/{screen_id}": {
      "delete": {
        "operationId": "deleteScreen",
        "parameters": [
          {
            "in": "path",
            "name": "screen_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Screen Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Screen",
        "tags": [
          "screener"
        ],
        "x-permission": "portfolio.manage"
      },
      "get": {
        "operationId": "getScreen",
        "parameters": [
          {
            "in": "path",
            "name": "screen_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Screen Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedScreenView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Screen",
        "tags": [
          "screener"
        ]
      },
      "patch": {
        "description": "Rename a saved screen, replace its spec, or both.",
        "operationId": "updateScreen",
        "parameters": [
          {
            "in": "path",
            "name": "screen_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Screen Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SavedScreenUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SavedScreenView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Screen",
        "tags": [
          "screener"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/screener/screens/{screen_id}/alert": {
      "delete": {
        "description": "Remove the alert (the screen stays).",
        "operationId": "deleteScreenAlert",
        "parameters": [
          {
            "in": "path",
            "name": "screen_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Screen Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Screen Alert",
        "tags": [
          "screener"
        ],
        "x-permission": "notifications.manage"
      },
      "get": {
        "description": "The alert on one of your saved screens (404 when it has none).",
        "operationId": "getScreenAlert",
        "parameters": [
          {
            "in": "path",
            "name": "screen_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Screen Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScreenAlertView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Screen Alert",
        "tags": [
          "screener"
        ]
      },
      "put": {
        "description": "Turn the alert on for a saved screen, daily or weekly, or change it.\nThe first run stores the matches and sends nothing.",
        "operationId": "setScreenAlert",
        "parameters": [
          {
            "in": "path",
            "name": "screen_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Screen Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScreenAlertSet"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScreenAlertView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set Screen Alert",
        "tags": [
          "screener"
        ],
        "x-permission": "notifications.manage"
      }
    },
    "/api/screener/size": {
      "post": {
        "description": "Count a screen's candidates before running it (no metric is read):\nover the cap it would fail, above the job threshold run it as a job.",
        "operationId": "sizeScreen",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScreenRunRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScreenSize"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Size Screen",
        "tags": [
          "screener"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/screener/universes": {
      "post": {
        "description": "Store a screen as a universe (409 when the id exists) and queue its\nrefresh. Rule mode reruns the screen at each rebalance date, so the\nlab sees who passed on each day. Snapshot mode stores today's matches.",
        "operationId": "saveScreenAsUniverse",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScreenUniverseRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScreenUniverseView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Save As Universe",
        "tags": [
          "screener"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/settings/system": {
      "get": {
        "description": "Every setting an admin may change here, with the value in effect, the\nTOML value, and who changed it last and why.",
        "operationId": "listSystemSettings",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemSettingsView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List System Settings",
        "tags": [
          "system-settings"
        ],
        "x-permission": "settings.read"
      }
    },
    "/api/settings/system/{key}": {
      "get": {
        "description": "One editable setting (404 for a key that is not editable).",
        "operationId": "getSystemSetting",
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "required": true,
            "schema": {
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.-]+$",
              "title": "Key",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemSettingView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get System Setting",
        "tags": [
          "system-settings"
        ],
        "x-permission": "settings.read"
      },
      "put": {
        "description": "Change one setting. The value is validated like the TOML config (422\nwhen it would not load), stored with an audit row, and used from the\nnext run on (``applies``). Needs a fresh second factor.",
        "operationId": "changeSystemSetting",
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "required": true,
            "schema": {
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.-]+$",
              "title": "Key",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SystemSettingChange"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemSettingView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Change System Setting",
        "tags": [
          "system-settings"
        ],
        "x-permission": "settings.manage"
      }
    },
    "/api/settings/system/{key}/reset": {
      "post": {
        "description": "Drop the override, so the TOML value applies again. Audited.",
        "operationId": "resetSystemSetting",
        "parameters": [
          {
            "in": "path",
            "name": "key",
            "required": true,
            "schema": {
              "maxLength": 128,
              "pattern": "^[A-Za-z0-9_.-]+$",
              "title": "Key",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SystemSettingReset"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SystemSettingView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Reset System Setting",
        "tags": [
          "system-settings"
        ],
        "x-permission": "settings.manage"
      }
    },
    "/api/shadow/decisions": {
      "get": {
        "description": "Virtual orders shadow strategies placed, newest first.",
        "operationId": "listShadowDecisions",
        "parameters": [
          {
            "in": "query",
            "name": "strategy_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Strategy Id"
            }
          },
          {
            "in": "query",
            "name": "ticker",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Ticker"
            }
          },
          {
            "in": "query",
            "name": "as_of",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "As Of"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_ShadowDecisionView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Shadow Decisions",
        "tags": [
          "shadow"
        ]
      }
    },
    "/api/shadow/pnl": {
      "get": {
        "description": "Latest value, return and worst drawdown of every shadow portfolio.",
        "operationId": "listShadowPnl",
        "parameters": [
          {
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Since"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_ShadowPnlSummary_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Shadow Pnl",
        "tags": [
          "shadow"
        ]
      }
    },
    "/api/shadow/strategies/{strategy_id}/pnl": {
      "get": {
        "description": "Daily P&L of one shadow strategy's virtual portfolio.",
        "operationId": "getShadowPnl",
        "parameters": [
          {
            "in": "path",
            "name": "strategy_id",
            "required": true,
            "schema": {
              "title": "Strategy Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Since"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PnlSeries"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Shadow Pnl",
        "tags": [
          "shadow"
        ]
      }
    },
    "/api/sources": {
      "get": {
        "description": "Data sources an ingest request can name, and whether each is configured.",
        "operationId": "listDataSources",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/DataSourceInfo"
                  },
                  "title": "Response Listdatasources",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Sources",
        "tags": [
          "sources"
        ]
      }
    },
    "/api/starter": {
      "get": {
        "description": "The starter strategies, whether each is registered, and the starter\ntrading universe.",
        "operationId": "getStarterSet",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StarterView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Starter Set",
        "tags": [
          "starter"
        ]
      }
    },
    "/api/starter/install": {
      "post": {
        "description": "Register the missing starters On trial (never approved: they go\nthrough the go-live check like any strategy) and set the trading\nuniverse when none is configured. Safe to call again.",
        "operationId": "installStarterSet",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StarterInstallView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Install Starter Set",
        "tags": [
          "starter"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/statement-imports": {
      "get": {
        "description": "Your CSV imports, newest first, undone ones included.",
        "operationId": "listStatementImports",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_StatementImportView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Statement Imports",
        "tags": [
          "statement-imports"
        ]
      },
      "post": {
        "description": "Import the new rows (409 when every row is a duplicate or skipped).",
        "operationId": "commitStatementImport",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatementImportRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatementImportView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Commit Statement Import",
        "tags": [
          "statement-imports"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/statement-imports/presets": {
      "get": {
        "description": "The broker exports Stonks reads without a column mapping (DEGIRO\nTransactions, Account statement and Portfolio), with where to find each.",
        "operationId": "listStatementPresets",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/StatementPresetView"
                  },
                  "title": "Response Liststatementpresets",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Statement Presets",
        "tags": [
          "statement-imports"
        ]
      }
    },
    "/api/statement-imports/preview": {
      "post": {
        "description": "Each row as new, duplicate or skipped, and the column mapping or the\nbroker preset used (a known broker export is found from its headers,\nelse the mapping is guessed from them). Writes nothing.",
        "operationId": "previewStatementImport",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/StatementImportRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatementPreview"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Preview Statement Import",
        "tags": [
          "statement-imports"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/statement-imports/{import_id}/undo": {
      "post": {
        "description": "Remove exactly the rows this import added and rebuild the holdings.",
        "operationId": "undoStatementImport",
        "parameters": [
          {
            "in": "path",
            "name": "import_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Import Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatementImportView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Undo Statement Import",
        "tags": [
          "statement-imports"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/statements/flags": {
      "get": {
        "description": "Statement periods the audit flagged, by ticker, period and check.\nLab preflight warns about ``error`` flags in a run's universe.",
        "operationId": "listStatementFlags",
        "parameters": [
          {
            "in": "query",
            "name": "ticker",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 32,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Ticker"
            }
          },
          {
            "in": "query",
            "name": "severity",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "error",
                    "warning"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Severity"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_StatementFlagView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Statement Flags",
        "tags": [
          "statements"
        ]
      }
    },
    "/api/strategies": {
      "get": {
        "operationId": "listStrategies",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "active",
                    "shadow",
                    "retired"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "description": "case-insensitive substring of the id or class path",
            "in": "query",
            "name": "q",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 200,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "case-insensitive substring of the id or class path",
              "title": "Q"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_StrategySummary_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Strategies",
        "tags": [
          "strategies"
        ]
      }
    },
    "/api/strategies/leaderboard": {
      "get": {
        "description": "Every strategy ranked by its risk-adjusted paper result (the model\nbook the tick keeps for it): return, Sharpe, Sortino and worst\ndrawdown, trade counts, survival tests passed and the go-live verdict.",
        "operationId": "getLeaderboard",
        "parameters": [
          {
            "description": "rank by paper Sharpe, total return, drawdown or trades",
            "in": "query",
            "name": "sort",
            "required": false,
            "schema": {
              "default": "sharpe",
              "description": "rank by paper Sharpe, total return, drawdown or trades",
              "enum": [
                "sharpe",
                "return",
                "drawdown",
                "trades"
              ],
              "title": "Sort",
              "type": "string"
            }
          },
          {
            "description": "also list stopped strategies",
            "in": "query",
            "name": "include_retired",
            "required": false,
            "schema": {
              "default": false,
              "description": "also list stopped strategies",
              "title": "Include Retired",
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LeaderboardView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Leaderboard",
        "tags": [
          "strategies"
        ]
      }
    },
    "/api/strategies/summary": {
      "get": {
        "description": "Registered strategies counted by lifecycle status, in one call.",
        "operationId": "getStrategySummary",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StrategyStatusCounts"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Strategy Summary",
        "tags": [
          "strategies"
        ]
      }
    },
    "/api/strategies/{strategy_id}": {
      "get": {
        "operationId": "getStrategy",
        "parameters": [
          {
            "in": "path",
            "name": "strategy_id",
            "required": true,
            "schema": {
              "title": "Strategy Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StrategyDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Strategy",
        "tags": [
          "strategies"
        ]
      }
    },
    "/api/strategies/{strategy_id}/golive": {
      "get": {
        "description": "Every go-live check of the strategy's paper period against\n``[golive]`` (same as ``stonks golive check``). Reports only; promotion\nstays a human action. An active strategy's P&L figures come from the\ndefault book: only its owner and admins see them.",
        "operationId": "getGoLiveReport",
        "parameters": [
          {
            "in": "path",
            "name": "strategy_id",
            "required": true,
            "schema": {
              "title": "Strategy Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Since"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GoLiveReport"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Golive",
        "tags": [
          "strategies"
        ]
      }
    },
    "/api/strategies/{strategy_id}/history": {
      "get": {
        "description": "The strategy's audited status changes and interventions, oldest first.",
        "operationId": "getStrategyHistory",
        "parameters": [
          {
            "in": "path",
            "name": "strategy_id",
            "required": true,
            "schema": {
              "title": "Strategy Id",
              "type": "string"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_StatusChangeView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Strategy History",
        "tags": [
          "strategies"
        ]
      }
    },
    "/api/strategies/{strategy_id}/promote": {
      "post": {
        "description": "Move to ``active``. Needs a passing go-live check (409 with the\nfailing checks otherwise), or ``override`` with a ``reason`` of at\nleast 20 characters (422 when shorter).",
        "operationId": "promoteStrategy",
        "parameters": [
          {
            "in": "path",
            "name": "strategy_id",
            "required": true,
            "schema": {
              "title": "Strategy Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/StatusChangeRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StrategyDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Promote",
        "tags": [
          "strategies"
        ],
        "x-permission": "strategy.promote"
      }
    },
    "/api/strategies/{strategy_id}/retire": {
      "post": {
        "description": "Move to ``retired``; needs a ``reason`` (422 without one).",
        "operationId": "retireStrategy",
        "parameters": [
          {
            "in": "path",
            "name": "strategy_id",
            "required": true,
            "schema": {
              "title": "Strategy Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/StatusChangeRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StrategyDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Retire",
        "tags": [
          "strategies"
        ],
        "x-permission": "strategy.promote"
      }
    },
    "/api/strategies/{strategy_id}/shadow": {
      "post": {
        "description": "Move to ``shadow``; needs a ``reason`` (422 without one).",
        "operationId": "shadowStrategy",
        "parameters": [
          {
            "in": "path",
            "name": "strategy_id",
            "required": true,
            "schema": {
              "title": "Strategy Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/StatusChangeRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StrategyDetail"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Shadow",
        "tags": [
          "strategies"
        ],
        "x-permission": "strategy.promote"
      }
    },
    "/api/strategies/{strategy_id}/tearsheet": {
      "get": {
        "description": "One strategy on one page: paper figures and value curve, monthly\nreturns, recent model-book trades, survival verdicts, the go-live report\nand the status history. Stored data only; backtests run in the lab.",
        "operationId": "getTearSheet",
        "parameters": [
          {
            "in": "path",
            "name": "strategy_id",
            "required": true,
            "schema": {
              "title": "Strategy Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TearSheetView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Tear Sheet",
        "tags": [
          "strategies"
        ]
      }
    },
    "/api/strategies/{strategy_id}/versions": {
      "get": {
        "description": "The strategy's model versions, oldest first: the live one, candidates\nrunning as model books, and archived, rejected or failed fits.",
        "operationId": "listModelVersions",
        "parameters": [
          {
            "in": "path",
            "name": "strategy_id",
            "required": true,
            "schema": {
              "title": "Strategy Id",
              "type": "string"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_ModelVersionView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Versions",
        "tags": [
          "model-versions"
        ]
      }
    },
    "/api/strategies/{strategy_id}/versions/history": {
      "get": {
        "description": "The strategy's append-only version log, oldest first.",
        "operationId": "getModelVersionHistory",
        "parameters": [
          {
            "in": "path",
            "name": "strategy_id",
            "required": true,
            "schema": {
              "title": "Strategy Id",
              "type": "string"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_VersionEventView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Version History",
        "tags": [
          "model-versions"
        ]
      }
    },
    "/api/strategies/{strategy_id}/versions/{version}/calibration": {
      "get": {
        "description": "Live calibration of a classifier version's forecasts (roadmap 23.9):\nBrier score, base rate and reliability table.",
        "operationId": "getModelCalibration",
        "parameters": [
          {
            "in": "path",
            "name": "strategy_id",
            "required": true,
            "schema": {
              "title": "Strategy Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "maximum": 1000000,
              "minimum": 1,
              "title": "Version",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CalibrationView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Model Calibration",
        "tags": [
          "model-versions"
        ]
      }
    },
    "/api/strategies/{strategy_id}/versions/{version}/check": {
      "get": {
        "description": "The swap check of a candidate against the live version\n(``[lifecycle.swap]``). Reports only.",
        "operationId": "checkModelSwap",
        "parameters": [
          {
            "in": "path",
            "name": "strategy_id",
            "required": true,
            "schema": {
              "title": "Strategy Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "maximum": 1000000,
              "minimum": 1,
              "title": "Version",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SwapReportView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Check Swap",
        "tags": [
          "model-versions"
        ]
      }
    },
    "/api/strategies/{strategy_id}/versions/{version}/reject": {
      "post": {
        "description": "Drop a candidate. Needs a ``reason`` (422 without one).",
        "operationId": "rejectModelVersion",
        "parameters": [
          {
            "in": "path",
            "name": "strategy_id",
            "required": true,
            "schema": {
              "title": "Strategy Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "maximum": 1000000,
              "minimum": 1,
              "title": "Version",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/VersionChangeRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelVersionView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Reject Version",
        "tags": [
          "model-versions"
        ],
        "x-permission": "strategy.promote"
      }
    },
    "/api/strategies/{strategy_id}/versions/{version}/swap": {
      "post": {
        "description": "Make the candidate live: the next tick trades it. Needs a passing\nswap check (409 with the failing checks otherwise), or ``override``\nwith a ``reason`` of at least 20 characters (422 when shorter).",
        "operationId": "swapModelVersion",
        "parameters": [
          {
            "in": "path",
            "name": "strategy_id",
            "required": true,
            "schema": {
              "title": "Strategy Id",
              "type": "string"
            }
          },
          {
            "in": "path",
            "name": "version",
            "required": true,
            "schema": {
              "maximum": 1000000,
              "minimum": 1,
              "title": "Version",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/VersionChangeRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelVersionView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Swap Version",
        "tags": [
          "model-versions"
        ],
        "x-permission": "strategy.promote"
      }
    },
    "/api/stream/status": {
      "get": {
        "description": "Each live engine: live or not, its market, the dead-man, the stream\n(connected, last event age, bars built, late ticks), dispatch lag and\nevent to order latency. ``engines`` is empty until an engine runs.\n``intraday_pnl`` says whether per-book intraday P&L is available.",
        "operationId": "getStreamStatus",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StreamStatusView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Stream Status",
        "tags": [
          "stream"
        ],
        "x-permission": "data.read"
      }
    },
    "/api/studio/capabilities": {
      "get": {
        "description": "Which Studio features this server allows (e.g. code strategies), so a\nclient can hide what would answer 403.",
        "operationId": "getStudioCapabilities",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StudioCapabilities"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Code strategies are disabled"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Capabilities",
        "tags": [
          "studio"
        ]
      }
    },
    "/api/studio/drafts": {
      "get": {
        "description": "Your drafts, newest first. Admins see every draft.",
        "operationId": "listDrafts",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_Draft_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Code strategies are disabled"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Drafts",
        "tags": [
          "studio"
        ]
      },
      "post": {
        "operationId": "createDraft",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DraftCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Draft"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Code strategies are disabled"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Draft",
        "tags": [
          "studio"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/studio/drafts/{draft_id}": {
      "delete": {
        "description": "Delete a draft (returns it); a strategy registered from it stays.",
        "operationId": "deleteDraft",
        "parameters": [
          {
            "in": "path",
            "name": "draft_id",
            "required": true,
            "schema": {
              "title": "Draft Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Draft"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Code strategies are disabled"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Draft",
        "tags": [
          "studio"
        ],
        "x-permission": "lab.run"
      },
      "get": {
        "description": "One of your drafts (another user's draft is a 404; admins see all).",
        "operationId": "getDraft",
        "parameters": [
          {
            "in": "path",
            "name": "draft_id",
            "required": true,
            "schema": {
              "title": "Draft Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Draft"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Code strategies are disabled"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Draft",
        "tags": [
          "studio"
        ]
      },
      "patch": {
        "operationId": "updateDraft",
        "parameters": [
          {
            "in": "path",
            "name": "draft_id",
            "required": true,
            "schema": {
              "title": "Draft Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DraftUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Draft"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Code strategies are disabled"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Draft",
        "tags": [
          "studio"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/studio/drafts/{draft_id}/backtests": {
      "post": {
        "description": "Queue a backtest of the draft; the job result is a ``BacktestResult``.",
        "operationId": "startDraftBacktest",
        "parameters": [
          {
            "in": "path",
            "name": "draft_id",
            "required": true,
            "schema": {
              "title": "Draft Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DraftBacktestRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Code strategies are disabled"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Start Backtest",
        "tags": [
          "studio"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/studio/drafts/{draft_id}/disable": {
      "post": {
        "description": "Move the registered strategy back to ``shadow``; needs a ``reason``\n(422 without one).",
        "operationId": "disableDraft",
        "parameters": [
          {
            "in": "path",
            "name": "draft_id",
            "required": true,
            "schema": {
              "title": "Draft Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/StatusChangeRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Draft"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Code strategies are disabled"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Disable Draft",
        "tags": [
          "studio"
        ],
        "x-permission": "strategy.promote"
      }
    },
    "/api/studio/drafts/{draft_id}/enable": {
      "post": {
        "description": "Promote the registered strategy to ``active``: the same go-live gate\nas ``POST /api/strategies/{id}/promote`` (409 when refused; ``override``\nneeds a ``reason`` of at least 20 characters).",
        "operationId": "enableDraft",
        "parameters": [
          {
            "in": "path",
            "name": "draft_id",
            "required": true,
            "schema": {
              "title": "Draft Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/StatusChangeRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Draft"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Code strategies are disabled"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Enable Draft",
        "tags": [
          "studio"
        ],
        "x-permission": "strategy.promote"
      }
    },
    "/api/studio/drafts/{draft_id}/lab-runs": {
      "post": {
        "description": "Queue tune → fit → survival suite for the draft; the job result is a\n``LabRunView``. Registering the result needs an admin.",
        "operationId": "startDraftLabRun",
        "parameters": [
          {
            "in": "path",
            "name": "draft_id",
            "required": true,
            "schema": {
              "title": "Draft Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DraftLabRunRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Code strategies are disabled"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Start Lab Run",
        "tags": [
          "studio"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/studio/drafts/{draft_id}/register": {
      "post": {
        "description": "Put the draft's strategy On trial (``shadow``). Only the draft's owner\n(or an admin) may: another user's draft is a 404.",
        "operationId": "registerDraft",
        "parameters": [
          {
            "in": "path",
            "name": "draft_id",
            "required": true,
            "schema": {
              "title": "Draft Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Draft"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Code strategies are disabled"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Register Draft",
        "tags": [
          "studio"
        ],
        "x-permission": "strategy.trial"
      }
    },
    "/api/studio/drafts/{draft_id}/validate": {
      "post": {
        "description": "Validate the draft and smoke-run ``estimate_return`` (on the given\nlake tickers, or on synthetic sample data).",
        "operationId": "validateDraft",
        "parameters": [
          {
            "in": "path",
            "name": "draft_id",
            "required": true,
            "schema": {
              "title": "Draft Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "anyOf": [
                  {
                    "$ref": "#/components/schemas/ValidateRequest"
                  },
                  {
                    "type": "null"
                  }
                ],
                "title": "Body"
              }
            }
          }
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftValidation"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Code strategies are disabled"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Validate Draft",
        "tags": [
          "studio"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/studio/schema": {
      "get": {
        "description": "JSON Schema of a rule spec (version 1).",
        "operationId": "getRuleSpecSchema",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "additionalProperties": true,
                  "title": "Response Getrulespecschema",
                  "type": "object"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Code strategies are disabled"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Schema",
        "tags": [
          "studio"
        ]
      }
    },
    "/api/studio/spec/validate": {
      "post": {
        "description": "Validate a rule spec without saving it (no smoke run).",
        "operationId": "validateRuleSpec",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SpecValidateRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DraftValidation"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Code strategies are disabled"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Validate Spec",
        "tags": [
          "studio"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/studio/templates": {
      "get": {
        "description": "Starter rule specs for the rule builder.",
        "operationId": "listStudioTemplates",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/RuleTemplateView"
                  },
                  "title": "Response Liststudiotemplates",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "403": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Code strategies are disabled"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Templates",
        "tags": [
          "studio"
        ]
      }
    },
    "/api/subscriptions": {
      "get": {
        "description": "Your subscriptions, with the paper-day count and what still blocks auto.",
        "operationId": "listSubscriptions",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_SubscriptionView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Subscriptions",
        "tags": [
          "subscriptions"
        ],
        "x-permission": "data.read"
      },
      "post": {
        "description": "Follow a strategy: ``notify`` (signals only) or ``paper`` on one of\nyour portfolios. ``auto`` is never the starting mode (409).",
        "operationId": "subscribe",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscribeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Subscribe",
        "tags": [
          "subscriptions"
        ],
        "x-permission": "portfolio.trade"
      }
    },
    "/api/subscriptions/{subscription_id}": {
      "patch": {
        "description": "Turn a subscription on or off, or change its mode. Switching to\n``auto`` needs a second factor from the last few minutes (403\n``step_up_required``) and a passing checklist, including 20 paper\ntrading days (409 ``auto_blocked`` with ``blockers``).",
        "operationId": "updateSubscription",
        "parameters": [
          {
            "in": "path",
            "name": "subscription_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Subscription Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubscriptionUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubscriptionView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Subscription",
        "tags": [
          "subscriptions"
        ],
        "x-permission": "portfolio.trade"
      }
    },
    "/api/tax/exports/dividends": {
      "get": {
        "description": "Every dividend with its ex-date in ``year``: gross, withholding, net.",
        "operationId": "exportTaxDividends",
        "parameters": [
          {
            "description": "Calendar year, e.g. 2025",
            "in": "query",
            "name": "year",
            "required": true,
            "schema": {
              "description": "Calendar year, e.g. 2025",
              "maximum": 2200,
              "minimum": 1900,
              "title": "Year",
              "type": "integer"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "A CSV file with a header row"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Dividends and withholding as CSV",
        "tags": [
          "tax"
        ]
      }
    },
    "/api/tax/exports/gains": {
      "get": {
        "description": "Every lot disposed in ``year``: FIFO or your specific lots, US wash\nsales when on, amounts in the trade and the base currency.",
        "operationId": "exportTaxGains",
        "parameters": [
          {
            "description": "Calendar year, e.g. 2025",
            "in": "query",
            "name": "year",
            "required": true,
            "schema": {
              "description": "Calendar year, e.g. 2025",
              "maximum": 2200,
              "minimum": 1900,
              "title": "Year",
              "type": "integer"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "A CSV file with a header row"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Realized gains per lot as CSV",
        "tags": [
          "tax"
        ]
      }
    },
    "/api/tax/exports/lots": {
      "get": {
        "description": "Every lot still open at the end of ``as_of``: quantity, acquired day,\ncost basis (fee and wash sale basis in), days held, holding period, the\nday it turns long term, and the value and unrealized gain at the latest\nclose. Your lot method decides which lots earlier sells closed.",
        "operationId": "exportTaxLots",
        "parameters": [
          {
            "description": "YYYY-MM-DD; default today",
            "in": "query",
            "name": "as_of",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "YYYY-MM-DD; default today",
              "title": "As Of"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "text/csv": {
                "schema": {
                  "format": "binary",
                  "type": "string"
                }
              }
            },
            "description": "A CSV file with a header row"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Open tax lots as CSV",
        "tags": [
          "tax"
        ]
      }
    },
    "/api/tax/lots/picks": {
      "get": {
        "description": "The specific lots each sell closes (used with lot_method specific).",
        "operationId": "listTaxLotPicks",
        "parameters": [
          {
            "in": "query",
            "name": "sell_fill_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Sell Fill Id"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_LotPickView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Tax Lot Picks",
        "tags": [
          "tax"
        ]
      },
      "put": {
        "description": "Replace the lots one sell fill closes (an empty list clears them).\nThe buys must be this portfolio's, the same ticker, filled before the\nsell, and fit the sell's and each buy's quantity. Audited.",
        "operationId": "setTaxLotPicks",
        "parameters": [
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LotPicksUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/LotPickView"
                  },
                  "title": "Response Settaxlotpicks",
                  "type": "array"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Set Tax Lot Picks",
        "tags": [
          "tax"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/tax/preview": {
      "get": {
        "description": "Before you trade: the lots a sell closes under your lot method, the\nrealised gain and holding period, the estimated tax at the configured\nrate, the after-tax proceeds and a wash sale warning. An estimate, not\ntax advice. Nothing is placed.",
        "operationId": "previewTradeTax",
        "parameters": [
          {
            "in": "query",
            "name": "ticker",
            "required": true,
            "schema": {
              "pattern": "^[A-Za-z0-9][A-Za-z0-9._\\-^=]{0,31}$",
              "title": "Ticker",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "side",
            "required": true,
            "schema": {
              "enum": [
                "buy",
                "sell"
              ],
              "title": "Side",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "quantity",
            "required": true,
            "schema": {
              "exclusiveMinimum": 0,
              "maximum": 1000000000.0,
              "title": "Quantity",
              "type": "number"
            }
          },
          {
            "description": "Default: the latest close",
            "in": "query",
            "name": "price",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "exclusiveMinimum": 0,
                  "type": "number"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Default: the latest close",
              "title": "Price"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxPreviewView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Preview Trade Tax",
        "tags": [
          "tax"
        ]
      }
    },
    "/api/tax/settings": {
      "get": {
        "description": "Base currency, jurisdiction, lot method and wash sale switch of one\nof your portfolios (defaults when never set).",
        "operationId": "getTaxSettings",
        "parameters": [
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxSettingsView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Tax Settings",
        "tags": [
          "tax"
        ]
      },
      "put": {
        "description": "Change the fields you send. Audited.",
        "operationId": "updateTaxSettings",
        "parameters": [
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TaxSettingsUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxSettingsView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Tax Settings",
        "tags": [
          "tax"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/tax/year": {
      "get": {
        "description": "Gains realised this year so far and the estimated tax owed on them,\nin the base currency. An estimate at the configured rates.",
        "operationId": "getTaxYear",
        "parameters": [
          {
            "description": "Default: this year",
            "in": "query",
            "name": "year",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maximum": 2200,
                  "minimum": 1900,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Default: this year",
              "title": "Year"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TaxYearView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Tax Year",
        "tags": [
          "tax"
        ]
      }
    },
    "/api/tca/journal": {
      "get": {
        "description": "The trade journal, newest first: each order with its reason, the\nsignal context, the outcome and your notes.",
        "operationId": "listJournal",
        "parameters": [
          {
            "description": "orders decided on or after this day",
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "orders decided on or after this day",
              "title": "Since"
            }
          },
          {
            "in": "query",
            "name": "strategy_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Strategy Id"
            }
          },
          {
            "in": "query",
            "name": "ticker",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Ticker"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_JournalEntryView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Journal",
        "tags": [
          "tca"
        ]
      }
    },
    "/api/tca/notes/{note_id}": {
      "put": {
        "description": "Replace the text of a note you wrote.",
        "operationId": "updateJournalNote",
        "parameters": [
          {
            "in": "path",
            "name": "note_id",
            "required": true,
            "schema": {
              "title": "Note Id",
              "type": "integer"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NoteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalNoteView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Journal Note",
        "tags": [
          "tca"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/tca/orders/{client_id}": {
      "get": {
        "description": "One of your orders in full: decision, context, shortfall and notes.",
        "operationId": "getOrderTca",
        "parameters": [
          {
            "description": "the order's client id",
            "in": "path",
            "name": "client_id",
            "required": true,
            "schema": {
              "description": "the order's client id",
              "maxLength": 200,
              "title": "Client Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalEntryView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Order Tca",
        "tags": [
          "tca"
        ]
      }
    },
    "/api/tca/orders/{client_id}/notes": {
      "post": {
        "description": "Add a free-text note to one of your orders.",
        "operationId": "addJournalNote",
        "parameters": [
          {
            "description": "the order's client id",
            "in": "path",
            "name": "client_id",
            "required": true,
            "schema": {
              "description": "the order's client id",
              "maxLength": 200,
              "title": "Client Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NoteRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JournalNoteView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Add Journal Note",
        "tags": [
          "tca"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/tca/summary": {
      "get": {
        "description": "Implementation shortfall (delay, impact, fees, opportunity) against\nthe cost model's estimate, weighted by notional, in bps.",
        "operationId": "getTcaSummary",
        "parameters": [
          {
            "description": "group by strategy, ticker, portfolio, algo, day, week or month",
            "in": "query",
            "name": "by",
            "required": false,
            "schema": {
              "default": "all",
              "description": "group by strategy, ticker, portfolio, algo, day, week or month",
              "enum": [
                "all",
                "strategy",
                "ticker",
                "portfolio",
                "algo",
                "day",
                "week",
                "month"
              ],
              "title": "By",
              "type": "string"
            }
          },
          {
            "description": "orders decided on or after this day",
            "in": "query",
            "name": "since",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "orders decided on or after this day",
              "title": "Since"
            }
          },
          {
            "description": "orders decided on or before this day",
            "in": "query",
            "name": "until",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "orders decided on or before this day",
              "title": "Until"
            }
          },
          {
            "in": "query",
            "name": "strategy_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Strategy Id"
            }
          },
          {
            "in": "query",
            "name": "ticker",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Ticker"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise). Default: your own book.",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise). Default: your own book.",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TcaSummaryView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Tca Summary",
        "tags": [
          "tca"
        ]
      }
    },
    "/api/telegram/link": {
      "delete": {
        "description": "Unlink your chat. Nothing more is sent there. Idempotent.",
        "operationId": "deleteTelegramLink",
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Link",
        "tags": [
          "telegram"
        ],
        "x-permission": "notifications.manage"
      },
      "get": {
        "description": "Whether the server has a bot, and which chat is linked to you.",
        "operationId": "getTelegramLink",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TelegramLinkView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Link",
        "tags": [
          "telegram"
        ]
      }
    },
    "/api/telegram/link-code": {
      "post": {
        "description": "A one-time code (valid for a few minutes). Send ``/link CODE`` to the\nbot from the chat to link. A new code retires your older ones. 503 when\nthe server has no bot token.",
        "operationId": "createTelegramLinkCode",
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TelegramLinkCodeView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Link Code",
        "tags": [
          "telegram"
        ],
        "x-permission": "notifications.manage"
      }
    },
    "/api/tickets": {
      "get": {
        "description": "Your order tickets, newest first.",
        "operationId": "listTickets",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "awaiting_approval",
                    "approved",
                    "rejected",
                    "expired",
                    "submitted",
                    "filled",
                    "unfilled",
                    "cancelled",
                    "failed"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Portfolio Id"
            }
          },
          {
            "in": "query",
            "name": "tick_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Tick Id"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_TicketView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Tickets",
        "tags": [
          "orders"
        ]
      }
    },
    "/api/tickets/approve": {
      "post": {
        "description": "Approve tickets that wait for you, all or none. Needs a fresh second\nfactor. Approved tickets are sent in their submit window.",
        "operationId": "approveTickets",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TicketApproval"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TicketList"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Approve Tickets",
        "tags": [
          "orders"
        ],
        "x-permission": "orders.approve"
      }
    },
    "/api/tickets/submit": {
      "post": {
        "description": "Send the approved tickets inside their window now (the live_submit\njob does this before each open).",
        "operationId": "submitTickets",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TicketSubmitResult"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Submit Tickets",
        "tags": [
          "orders"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/tickets/summary": {
      "get": {
        "description": "How many of your tickets wait for approval, per portfolio.",
        "operationId": "getTicketSummary",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TicketSummary"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Ticket Summary",
        "tags": [
          "orders"
        ]
      }
    },
    "/api/tickets/{ticket_id}": {
      "get": {
        "operationId": "getTicket",
        "parameters": [
          {
            "in": "path",
            "name": "ticket_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Ticket Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TicketView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Ticket",
        "tags": [
          "orders"
        ]
      }
    },
    "/api/tickets/{ticket_id}/reject": {
      "post": {
        "description": "Reject a ticket that waits for you, with a reason. Nothing is sent.",
        "operationId": "rejectTicket",
        "parameters": [
          {
            "in": "path",
            "name": "ticket_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Ticket Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TicketRejection"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TicketView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Reject Ticket",
        "tags": [
          "orders"
        ],
        "x-permission": "portfolio.trade"
      }
    },
    "/api/ticks": {
      "get": {
        "description": "Every tick run, newest first. Summaries keep the global outcome\nand the parts about your own portfolios only: ``orders_placed`` and\n``fills`` count your own books and are null when none took part.\nAdmins find a run's whole counts in ``/api/portfolio/totals``.",
        "operationId": "listTicks",
        "parameters": [
          {
            "in": "query",
            "name": "status",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "running",
                    "ok",
                    "partial",
                    "error"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_TickRun_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Ticks",
        "tags": [
          "ticks"
        ]
      },
      "post": {
        "description": "Queue a production tick (``dry_run`` ranks and logs only).",
        "operationId": "startTick",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TickRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Start Tick",
        "tags": [
          "ticks"
        ],
        "x-permission": "operations.run"
      }
    },
    "/api/ticks/jobs/{job_id}/result": {
      "get": {
        "description": "The result of a succeeded tick job (409 until it has succeeded).",
        "operationId": "getTickResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TickResultView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Tick Result",
        "tags": [
          "ticks"
        ]
      }
    },
    "/api/ticks/{tick_id}": {
      "get": {
        "description": "One tick run with the orders it placed in your portfolios (or in\n``portfolio_id`` only). Another user's portfolio is a 404.",
        "operationId": "getTick",
        "parameters": [
          {
            "in": "path",
            "name": "tick_id",
            "required": true,
            "schema": {
              "title": "Tick Id",
              "type": "string"
            }
          },
          {
            "description": "One of your portfolios (404 otherwise).",
            "in": "query",
            "name": "portfolio_id",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "One of your portfolios (404 otherwise).",
              "title": "Portfolio Id"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TickRunWithOrders"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Tick",
        "tags": [
          "ticks"
        ]
      }
    },
    "/api/universes": {
      "get": {
        "description": "Every stored universe, by id.",
        "operationId": "listUniverses",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_UniverseView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Universes",
        "tags": [
          "universes"
        ]
      },
      "post": {
        "description": "Store a universe definition (409 when the id exists). It has no\nmembers until its first refresh.",
        "operationId": "createUniverse",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UniverseCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UniverseView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Universe",
        "tags": [
          "universes"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/universes/ensure/{job_id}/result": {
      "get": {
        "description": "The result of a succeeded ensure-data job (409 until it has succeeded).",
        "operationId": "getUniverseEnsureResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EnsureReport"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Ensure Result",
        "tags": [
          "universes"
        ]
      }
    },
    "/api/universes/exchanges": {
      "get": {
        "description": "Exchanges our instruments name, with counts, for picking an\n``exchange`` universe. A source may list more than we hold.",
        "operationId": "listUniverseExchanges",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_ExchangeView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Exchanges",
        "tags": [
          "universes"
        ]
      }
    },
    "/api/universes/index-history": {
      "post": {
        "description": "Import an index's constituents and changes (CSV or JSON) for\n``index`` universes to rebuild membership from. The index the trading\nuniverse follows needs ``strategy.promote``.",
        "operationId": "importIndexHistory",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/IndexHistoryImport"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/IndexHistoryView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Import Index History",
        "tags": [
          "universes"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/universes/refresh/{job_id}/result": {
      "get": {
        "description": "The result of a succeeded refresh job (409 until it has succeeded).",
        "operationId": "getUniverseRefreshResult",
        "parameters": [
          {
            "in": "path",
            "name": "job_id",
            "required": true,
            "schema": {
              "title": "Job Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UniverseRefreshView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Refresh Result",
        "tags": [
          "universes"
        ]
      }
    },
    "/api/universes/{universe_id}": {
      "delete": {
        "description": "Delete the definition and its membership rows (returns the definition).",
        "operationId": "deleteUniverse",
        "parameters": [
          {
            "in": "path",
            "name": "universe_id",
            "required": true,
            "schema": {
              "title": "Universe Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UniverseView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Universe",
        "tags": [
          "universes"
        ],
        "x-permission": "strategy.promote"
      },
      "get": {
        "operationId": "getUniverse",
        "parameters": [
          {
            "in": "path",
            "name": "universe_id",
            "required": true,
            "schema": {
              "title": "Universe Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UniverseView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Universe",
        "tags": [
          "universes"
        ]
      },
      "put": {
        "description": "Replace the definition. The members stay as they are until the next\nrefresh. The trading universe (``[production].universe``) needs\n``strategy.promote``.",
        "operationId": "updateUniverse",
        "parameters": [
          {
            "in": "path",
            "name": "universe_id",
            "required": true,
            "schema": {
              "title": "Universe Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UniverseUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UniverseView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Universe",
        "tags": [
          "universes"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/universes/{universe_id}/ensure": {
      "post": {
        "description": "Queue a job that fetches the missing bars of every member over the\nwindow, delisted names included.",
        "operationId": "ensureUniverseData",
        "parameters": [
          {
            "in": "path",
            "name": "universe_id",
            "required": true,
            "schema": {
              "title": "Universe Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnsureDataRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Ensure Data",
        "tags": [
          "universes"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/universes/{universe_id}/history": {
      "get": {
        "description": "Membership spans, latest change first: who joined and left, when.",
        "operationId": "getUniverseHistory",
        "parameters": [
          {
            "in": "path",
            "name": "universe_id",
            "required": true,
            "schema": {
              "title": "Universe Id",
              "type": "string"
            }
          },
          {
            "description": "tickers containing this",
            "in": "query",
            "name": "ticker",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "maxLength": 64,
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "tickers containing this",
              "title": "Ticker"
            }
          },
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_MembershipSpanView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get History",
        "tags": [
          "universes"
        ]
      }
    },
    "/api/universes/{universe_id}/members": {
      "get": {
        "description": "Members on ``as_of`` (default today), point in time.",
        "operationId": "getUniverseMembers",
        "parameters": [
          {
            "in": "path",
            "name": "universe_id",
            "required": true,
            "schema": {
              "title": "Universe Id",
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "as_of",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "format": "date",
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "As Of"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UniverseMembers"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Members",
        "tags": [
          "universes"
        ]
      }
    },
    "/api/universes/{universe_id}/refresh": {
      "post": {
        "description": "Queue a refresh that rebuilds the universe's membership; poll\n``/api/jobs/{id}`` or stream its events.",
        "operationId": "refreshUniverse",
        "parameters": [
          {
            "in": "path",
            "name": "universe_id",
            "required": true,
            "schema": {
              "title": "Universe Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Refresh Universe",
        "tags": [
          "universes"
        ],
        "x-permission": "lab.run"
      }
    },
    "/api/watchlists": {
      "get": {
        "description": "Your watchlists, oldest first.",
        "operationId": "listWatchlists",
        "parameters": [
          {
            "description": "page size",
            "in": "query",
            "name": "limit",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "minimum": 1,
                  "type": "integer"
                },
                {
                  "type": "null"
                }
              ],
              "description": "page size",
              "title": "Limit"
            }
          },
          {
            "in": "query",
            "name": "offset",
            "required": false,
            "schema": {
              "default": 0,
              "minimum": 0,
              "title": "Offset",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_WatchlistView_"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "List Watchlists",
        "tags": [
          "watchlists"
        ]
      },
      "post": {
        "description": "Start a watchlist. Tickers are trimmed, upper-cased and kept once, in\norder. Names are unique per person (409).",
        "operationId": "createWatchlist",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WatchlistCreate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WatchlistView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Create Watchlist",
        "tags": [
          "watchlists"
        ],
        "x-permission": "portfolio.manage"
      }
    },
    "/api/watchlists/{watchlist_id}": {
      "delete": {
        "operationId": "deleteWatchlist",
        "parameters": [
          {
            "in": "path",
            "name": "watchlist_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Watchlist Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Delete Watchlist",
        "tags": [
          "watchlists"
        ],
        "x-permission": "portfolio.manage"
      },
      "get": {
        "operationId": "getWatchlist",
        "parameters": [
          {
            "in": "path",
            "name": "watchlist_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Watchlist Id",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WatchlistView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Get Watchlist",
        "tags": [
          "watchlists"
        ]
      },
      "patch": {
        "description": "Rename a watchlist, replace its tickers, or both.",
        "operationId": "updateWatchlist",
        "parameters": [
          {
            "in": "path",
            "name": "watchlist_id",
            "required": true,
            "schema": {
              "maxLength": 64,
              "title": "Watchlist Id",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WatchlistUpdate"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WatchlistView"
                }
              }
            },
            "description": "Successful Response"
          },
          "401": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unauthorized"
          },
          "404": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Not Found"
          },
          "409": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Conflict"
          },
          "422": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Unprocessable Content"
          },
          "503": {
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                }
              }
            },
            "description": "Service Unavailable"
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "summary": "Update Watchlist",
        "tags": [
          "watchlists"
        ],
        "x-permission": "portfolio.manage"
      }
    }
  }
}
