{
  "openapi": "3.1.0",
  "info": {
    "title": "The Day Before Research REST API",
    "version": "1.0.0",
    "description": "Authenticated GET-only probabilistic research. Obtain delegated OAuth credentials using protected-resource discovery; no MCP protocol required."
  },
  "servers": [
    {
      "url": "https://thedaybefore.email/api/public/v1"
    }
  ],
  "security": [
    {
      "approvedOAuth": []
    }
  ],
  "paths": {
    "/forecasts/latest": {
      "get": {
        "operationId": "forecasts_latest",
        "summary": "Read the latest compatible market issue: dated forecasts, trade research, editorial, predictions, drivers, sectors, earnings, and economic events with explicit units and timestamps.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Versioned research JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/get_latest_forecast"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Approved OAuth bearer required"
          },
          "403": {
            "description": "Not permitted"
          },
          "404": {
            "description": "Research not found or unknown endpoint"
          },
          "405": {
            "description": "GET only"
          },
          "503": {
            "description": "Research unavailable"
          }
        }
      }
    },
    "/issues": {
      "get": {
        "operationId": "issues",
        "summary": "List issue summaries newest first; use the returned next_before cursor to page backward without duplicates.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            }
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Exclusive target-date cursor."
          }
        ],
        "responses": {
          "200": {
            "description": "Versioned research JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/list_recent_issues"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Approved OAuth bearer required"
          },
          "403": {
            "description": "Not permitted"
          },
          "404": {
            "description": "Research not found or unknown endpoint"
          },
          "405": {
            "description": "GET only"
          },
          "503": {
            "description": "Research unavailable"
          }
        }
      }
    },
    "/issues/{date}": {
      "get": {
        "operationId": "issues_date",
        "summary": "Read a complete archived issue for a valid YYYY-MM-DD target trading date, including machine-readable forecasts and company editorial.",
        "parameters": [
          {
            "name": "date",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Target trading session, YYYY-MM-DD."
          }
        ],
        "responses": {
          "200": {
            "description": "Versioned research JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/get_issue_by_date"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Approved OAuth bearer required"
          },
          "403": {
            "description": "Not permitted"
          },
          "404": {
            "description": "Research not found or unknown endpoint"
          },
          "405": {
            "description": "GET only"
          },
          "503": {
            "description": "Research unavailable"
          }
        }
      }
    },
    "/insights/latest": {
      "get": {
        "operationId": "insights_latest",
        "summary": "Read the latest compatible market issue: dated forecasts, trade research, editorial, predictions, drivers, sectors, earnings, and economic events with explicit units and timestamps.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Versioned research JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Insights"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Approved OAuth bearer required"
          },
          "403": {
            "description": "Not permitted"
          },
          "404": {
            "description": "Research not found or unknown endpoint"
          },
          "405": {
            "description": "GET only"
          },
          "503": {
            "description": "Research unavailable"
          }
        }
      }
    },
    "/insights/{date}": {
      "get": {
        "operationId": "insights_date",
        "summary": "Read a complete archived issue for a valid YYYY-MM-DD target trading date, including machine-readable forecasts and company editorial.",
        "parameters": [
          {
            "name": "date",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Target trading session, YYYY-MM-DD."
          }
        ],
        "responses": {
          "200": {
            "description": "Versioned research JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Insights"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Approved OAuth bearer required"
          },
          "403": {
            "description": "Not permitted"
          },
          "404": {
            "description": "Research not found or unknown endpoint"
          },
          "405": {
            "description": "GET only"
          },
          "503": {
            "description": "Research unavailable"
          }
        }
      }
    },
    "/results/latest": {
      "get": {
        "operationId": "results_latest",
        "summary": "Read how forecasts performed against actual market data: grades, correct counts, accuracy, calibration, and individual outcomes. Omit date for latest graded issue.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Versioned research JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/get_scorecard"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Approved OAuth bearer required"
          },
          "403": {
            "description": "Not permitted"
          },
          "404": {
            "description": "Research not found or unknown endpoint"
          },
          "405": {
            "description": "GET only"
          },
          "503": {
            "description": "Research unavailable"
          }
        }
      }
    },
    "/results/{date}": {
      "get": {
        "operationId": "results_date",
        "summary": "Read how forecasts performed against actual market data: grades, correct counts, accuracy, calibration, and individual outcomes. Omit date for latest graded issue.",
        "parameters": [
          {
            "name": "date",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Target trading session, YYYY-MM-DD."
          }
        ],
        "responses": {
          "200": {
            "description": "Versioned research JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/get_scorecard"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Approved OAuth bearer required"
          },
          "403": {
            "description": "Not permitted"
          },
          "404": {
            "description": "Research not found or unknown endpoint"
          },
          "405": {
            "description": "GET only"
          },
          "503": {
            "description": "Research unavailable"
          }
        }
      }
    },
    "/lessons": {
      "get": {
        "operationId": "lessons",
        "summary": "Read the active forecasting playbook, why it changed, and the scored trading date that informed it. Never triggers generation or reflection.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "Versioned research JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/get_algorithm_lessons"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "401": {
            "description": "Approved OAuth bearer required"
          },
          "403": {
            "description": "Not permitted"
          },
          "404": {
            "description": "Research not found or unknown endpoint"
          },
          "405": {
            "description": "GET only"
          },
          "503": {
            "description": "Research unavailable"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "approvedOAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "OAuth 2.1 JWT",
        "description": "Approved OAuth client access token. Discover authorization server via https://thedaybefore.email/.well-known/oauth-protected-resource. Browser login session tokens are rejected."
      }
    },
    "schemas": {
      "get_latest_forecast": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "api_version": {
            "type": "string",
            "const": "1.0"
          },
          "retrieved_at": {
            "type": "string"
          },
          "timezone": {
            "type": "string",
            "const": "America/New_York"
          },
          "source_url": {
            "type": "string"
          },
          "units": {
            "type": "object",
            "properties": {
              "probabilities": {
                "type": "string"
              },
              "percent_changes": {
                "type": "string"
              },
              "prices": {
                "type": "string"
              }
            },
            "required": [
              "probabilities",
              "percent_changes",
              "prices"
            ],
            "additionalProperties": false
          },
          "forecast_horizon": {
            "type": "string"
          },
          "disclaimer": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "not_found"
            ]
          },
          "issue": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "target_date": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "published_at": {
                    "type": "string"
                  },
                  "schema_version": {
                    "type": "number"
                  },
                  "headline": {
                    "type": "string"
                  },
                  "subheadline": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sentiment": {
                    "type": "string"
                  },
                  "probability": {
                    "type": "number"
                  },
                  "confidence": {
                    "type": "number"
                  }
                },
                "required": [
                  "id",
                  "target_date",
                  "published_at",
                  "schema_version",
                  "headline",
                  "subheadline",
                  "sentiment",
                  "probability",
                  "confidence"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "forecasts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "asset": {
                  "type": "string"
                },
                "symbol": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "prob_up": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "prob_down": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "expected_pct": {
                  "type": "number",
                  "description": "Signed percent change from prior close to target-session close."
                },
                "confidence": {
                  "type": "number"
                },
                "range_low": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "range_high": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "biggest_risk": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "biggest_tailwind": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "asset",
                "symbol",
                "prob_up",
                "prob_down",
                "expected_pct",
                "confidence",
                "range_low",
                "range_high",
                "biggest_risk",
                "biggest_tailwind"
              ],
              "additionalProperties": false
            }
          },
          "trades": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "ticker": {
                  "type": "string"
                },
                "company": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "direction": {
                  "type": "string"
                },
                "timeframe": {
                  "type": "string"
                },
                "conviction": {
                  "type": "number"
                },
                "probability": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "entry": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "stop": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "target": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "expected_return_pct": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "risk_reward": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "thesis": {
                  "type": "string"
                },
                "biggest_risk": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "ticker",
                "company",
                "direction",
                "timeframe",
                "conviction",
                "probability",
                "entry",
                "stop",
                "target",
                "expected_return_pct",
                "risk_reward",
                "thesis",
                "biggest_risk"
              ],
              "additionalProperties": false
            }
          },
          "predictions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "category": {
                  "type": "string"
                },
                "statement": {
                  "type": "string"
                },
                "probability": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "expected_impact": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "explanation": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "category",
                "statement",
                "probability",
                "expected_impact",
                "explanation"
              ],
              "additionalProperties": false
            }
          },
          "drivers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "direction": {
                  "type": "string"
                },
                "importance": {
                  "type": "number"
                },
                "move_probability": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "explanation": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "direction",
                "importance",
                "move_probability",
                "explanation"
              ],
              "additionalProperties": false
            }
          },
          "editorial": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "dek": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "body_markdown": {
                    "type": "string"
                  }
                },
                "required": [
                  "title",
                  "slug",
                  "dek",
                  "body_markdown"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "sectors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sector": {
                  "type": "string"
                },
                "bullish_pct": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                }
              },
              "required": [
                "sector",
                "bullish_pct"
              ],
              "additionalProperties": false
            }
          },
          "earnings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ticker": {
                  "type": "string"
                },
                "company": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "report_date": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "report_time": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "beat_prob": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "miss_prob": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "expected_move": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "call_url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "ticker",
                "company",
                "report_date",
                "report_time",
                "beat_prob",
                "miss_prob",
                "expected_move",
                "call_url"
              ],
              "additionalProperties": false
            }
          },
          "economic_events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "event": {
                  "type": "string"
                },
                "event_date": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "release_time": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "consensus": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "previous": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "upside_surprise_prob": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "downside_surprise_prob": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "why_it_matters": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "markets_affected": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "source_url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "event",
                "event_date",
                "release_time",
                "consensus",
                "previous",
                "upside_surprise_prob",
                "downside_surprise_prob",
                "why_it_matters",
                "markets_affected",
                "source_url"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "api_version",
          "retrieved_at",
          "timezone",
          "source_url",
          "units",
          "forecast_horizon",
          "disclaimer",
          "status",
          "issue",
          "forecasts",
          "trades",
          "predictions",
          "drivers",
          "editorial",
          "sectors",
          "earnings",
          "economic_events"
        ],
        "additionalProperties": false
      },
      "list_recent_issues": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "api_version": {
            "type": "string",
            "const": "1.0"
          },
          "retrieved_at": {
            "type": "string"
          },
          "timezone": {
            "type": "string",
            "const": "America/New_York"
          },
          "source_url": {
            "type": "string"
          },
          "units": {
            "type": "object",
            "properties": {
              "probabilities": {
                "type": "string"
              },
              "percent_changes": {
                "type": "string"
              },
              "prices": {
                "type": "string"
              }
            },
            "required": [
              "probabilities",
              "percent_changes",
              "prices"
            ],
            "additionalProperties": false
          },
          "forecast_horizon": {
            "type": "string"
          },
          "disclaimer": {
            "type": "string"
          },
          "issues": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "target_date": {
                  "type": "string",
                  "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                },
                "published_at": {
                  "type": "string"
                },
                "schema_version": {
                  "type": "number"
                },
                "headline": {
                  "type": "string"
                },
                "subheadline": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "sentiment": {
                  "type": "string"
                },
                "probability": {
                  "type": "number"
                },
                "confidence": {
                  "type": "number"
                }
              },
              "required": [
                "id",
                "target_date",
                "published_at",
                "schema_version",
                "headline",
                "subheadline",
                "sentiment",
                "probability",
                "confidence"
              ],
              "additionalProperties": false
            }
          },
          "next_before": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "api_version",
          "retrieved_at",
          "timezone",
          "source_url",
          "units",
          "forecast_horizon",
          "disclaimer",
          "issues",
          "next_before"
        ],
        "additionalProperties": false
      },
      "get_issue_by_date": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "api_version": {
            "type": "string",
            "const": "1.0"
          },
          "retrieved_at": {
            "type": "string"
          },
          "timezone": {
            "type": "string",
            "const": "America/New_York"
          },
          "source_url": {
            "type": "string"
          },
          "units": {
            "type": "object",
            "properties": {
              "probabilities": {
                "type": "string"
              },
              "percent_changes": {
                "type": "string"
              },
              "prices": {
                "type": "string"
              }
            },
            "required": [
              "probabilities",
              "percent_changes",
              "prices"
            ],
            "additionalProperties": false
          },
          "forecast_horizon": {
            "type": "string"
          },
          "disclaimer": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "not_found"
            ]
          },
          "issue": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "target_date": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "published_at": {
                    "type": "string"
                  },
                  "schema_version": {
                    "type": "number"
                  },
                  "headline": {
                    "type": "string"
                  },
                  "subheadline": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sentiment": {
                    "type": "string"
                  },
                  "probability": {
                    "type": "number"
                  },
                  "confidence": {
                    "type": "number"
                  }
                },
                "required": [
                  "id",
                  "target_date",
                  "published_at",
                  "schema_version",
                  "headline",
                  "subheadline",
                  "sentiment",
                  "probability",
                  "confidence"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "forecasts": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "asset": {
                  "type": "string"
                },
                "symbol": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "prob_up": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "prob_down": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "expected_pct": {
                  "type": "number",
                  "description": "Signed percent change from prior close to target-session close."
                },
                "confidence": {
                  "type": "number"
                },
                "range_low": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "range_high": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "biggest_risk": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "biggest_tailwind": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "asset",
                "symbol",
                "prob_up",
                "prob_down",
                "expected_pct",
                "confidence",
                "range_low",
                "range_high",
                "biggest_risk",
                "biggest_tailwind"
              ],
              "additionalProperties": false
            }
          },
          "trades": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "ticker": {
                  "type": "string"
                },
                "company": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "direction": {
                  "type": "string"
                },
                "timeframe": {
                  "type": "string"
                },
                "conviction": {
                  "type": "number"
                },
                "probability": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "entry": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "stop": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "target": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "expected_return_pct": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "risk_reward": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "thesis": {
                  "type": "string"
                },
                "biggest_risk": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "ticker",
                "company",
                "direction",
                "timeframe",
                "conviction",
                "probability",
                "entry",
                "stop",
                "target",
                "expected_return_pct",
                "risk_reward",
                "thesis",
                "biggest_risk"
              ],
              "additionalProperties": false
            }
          },
          "predictions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "category": {
                  "type": "string"
                },
                "statement": {
                  "type": "string"
                },
                "probability": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "expected_impact": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "explanation": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "category",
                "statement",
                "probability",
                "expected_impact",
                "explanation"
              ],
              "additionalProperties": false
            }
          },
          "drivers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "direction": {
                  "type": "string"
                },
                "importance": {
                  "type": "number"
                },
                "move_probability": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "explanation": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "direction",
                "importance",
                "move_probability",
                "explanation"
              ],
              "additionalProperties": false
            }
          },
          "editorial": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "dek": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "body_markdown": {
                    "type": "string"
                  }
                },
                "required": [
                  "title",
                  "slug",
                  "dek",
                  "body_markdown"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "sectors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sector": {
                  "type": "string"
                },
                "bullish_pct": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                }
              },
              "required": [
                "sector",
                "bullish_pct"
              ],
              "additionalProperties": false
            }
          },
          "earnings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "ticker": {
                  "type": "string"
                },
                "company": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "report_date": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "report_time": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "beat_prob": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "miss_prob": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "expected_move": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "call_url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "ticker",
                "company",
                "report_date",
                "report_time",
                "beat_prob",
                "miss_prob",
                "expected_move",
                "call_url"
              ],
              "additionalProperties": false
            }
          },
          "economic_events": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "event": {
                  "type": "string"
                },
                "event_date": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "release_time": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "consensus": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "previous": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "upside_surprise_prob": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "downside_surprise_prob": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "why_it_matters": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "markets_affected": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "source_url": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "event",
                "event_date",
                "release_time",
                "consensus",
                "previous",
                "upside_surprise_prob",
                "downside_surprise_prob",
                "why_it_matters",
                "markets_affected",
                "source_url"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "api_version",
          "retrieved_at",
          "timezone",
          "source_url",
          "units",
          "forecast_horizon",
          "disclaimer",
          "status",
          "issue",
          "forecasts",
          "trades",
          "predictions",
          "drivers",
          "editorial",
          "sectors",
          "earnings",
          "economic_events"
        ],
        "additionalProperties": false
      },
      "get_scorecard": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "api_version": {
            "type": "string",
            "const": "1.0"
          },
          "retrieved_at": {
            "type": "string"
          },
          "timezone": {
            "type": "string",
            "const": "America/New_York"
          },
          "source_url": {
            "type": "string"
          },
          "units": {
            "type": "object",
            "properties": {
              "probabilities": {
                "type": "string"
              },
              "percent_changes": {
                "type": "string"
              },
              "prices": {
                "type": "string"
              }
            },
            "required": [
              "probabilities",
              "percent_changes",
              "prices"
            ],
            "additionalProperties": false
          },
          "forecast_horizon": {
            "type": "string"
          },
          "disclaimer": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "not_found"
            ]
          },
          "scorecard": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "$ref": "#/$defs/__schema0"
                }
              },
              {
                "type": "null"
              }
            ]
          },
          "outcomes": {
            "type": "array",
            "items": {
              "type": "object",
              "propertyNames": {
                "type": "string"
              },
              "additionalProperties": {
                "$ref": "#/$defs/__schema1"
              }
            }
          }
        },
        "required": [
          "api_version",
          "retrieved_at",
          "timezone",
          "source_url",
          "units",
          "forecast_horizon",
          "disclaimer",
          "status",
          "scorecard",
          "outcomes"
        ],
        "additionalProperties": false,
        "$defs": {
          "__schema0": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/$defs/__schema0"
                }
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "$ref": "#/$defs/__schema0"
                }
              }
            ]
          },
          "__schema1": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/$defs/__schema1"
                }
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "$ref": "#/$defs/__schema1"
                }
              }
            ]
          }
        }
      },
      "get_algorithm_lessons": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "api_version": {
            "type": "string",
            "const": "1.0"
          },
          "retrieved_at": {
            "type": "string"
          },
          "timezone": {
            "type": "string",
            "const": "America/New_York"
          },
          "source_url": {
            "type": "string"
          },
          "units": {
            "type": "object",
            "properties": {
              "probabilities": {
                "type": "string"
              },
              "percent_changes": {
                "type": "string"
              },
              "prices": {
                "type": "string"
              }
            },
            "required": [
              "probabilities",
              "percent_changes",
              "prices"
            ],
            "additionalProperties": false
          },
          "forecast_horizon": {
            "type": "string"
          },
          "disclaimer": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "not_found"
            ]
          },
          "playbook": {
            "anyOf": [
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "$ref": "#/$defs/__schema0"
                }
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "api_version",
          "retrieved_at",
          "timezone",
          "source_url",
          "units",
          "forecast_horizon",
          "disclaimer",
          "status",
          "playbook"
        ],
        "additionalProperties": false,
        "$defs": {
          "__schema0": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "number"
              },
              {
                "type": "boolean"
              },
              {
                "type": "null"
              },
              {
                "type": "array",
                "items": {
                  "$ref": "#/$defs/__schema0"
                }
              },
              {
                "type": "object",
                "propertyNames": {
                  "type": "string"
                },
                "additionalProperties": {
                  "$ref": "#/$defs/__schema0"
                }
              }
            ]
          }
        }
      },
      "Insights": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "api_version": {
            "type": "string",
            "const": "1.0"
          },
          "retrieved_at": {
            "type": "string"
          },
          "timezone": {
            "type": "string",
            "const": "America/New_York"
          },
          "source_url": {
            "type": "string"
          },
          "units": {
            "type": "object",
            "properties": {
              "probabilities": {
                "type": "string"
              },
              "percent_changes": {
                "type": "string"
              },
              "prices": {
                "type": "string"
              }
            },
            "required": [
              "probabilities",
              "percent_changes",
              "prices"
            ],
            "additionalProperties": false
          },
          "forecast_horizon": {
            "type": "string"
          },
          "disclaimer": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "ok",
              "not_found"
            ]
          },
          "issue": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "target_date": {
                    "type": "string",
                    "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
                  },
                  "published_at": {
                    "type": "string"
                  },
                  "schema_version": {
                    "type": "number"
                  },
                  "headline": {
                    "type": "string"
                  },
                  "subheadline": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "sentiment": {
                    "type": "string"
                  },
                  "probability": {
                    "type": "number"
                  },
                  "confidence": {
                    "type": "number"
                  }
                },
                "required": [
                  "id",
                  "target_date",
                  "published_at",
                  "schema_version",
                  "headline",
                  "subheadline",
                  "sentiment",
                  "probability",
                  "confidence"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "predictions": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "category": {
                  "type": "string"
                },
                "statement": {
                  "type": "string"
                },
                "probability": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "expected_impact": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "explanation": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "category",
                "statement",
                "probability",
                "expected_impact",
                "explanation"
              ],
              "additionalProperties": false
            }
          },
          "drivers": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "direction": {
                  "type": "string"
                },
                "importance": {
                  "type": "number"
                },
                "move_probability": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                },
                "explanation": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "id",
                "name",
                "direction",
                "importance",
                "move_probability",
                "explanation"
              ],
              "additionalProperties": false
            }
          },
          "editorial": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "title": {
                    "type": "string"
                  },
                  "slug": {
                    "type": "string"
                  },
                  "dek": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "body_markdown": {
                    "type": "string"
                  }
                },
                "required": [
                  "title",
                  "slug",
                  "dek",
                  "body_markdown"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "sectors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "sector": {
                  "type": "string"
                },
                "bullish_pct": {
                  "type": "number",
                  "description": "Probability in percentage points (0–100)."
                }
              },
              "required": [
                "sector",
                "bullish_pct"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "api_version",
          "retrieved_at",
          "timezone",
          "source_url",
          "units",
          "forecast_horizon",
          "disclaimer",
          "status",
          "issue",
          "predictions",
          "drivers",
          "editorial",
          "sectors"
        ],
        "additionalProperties": false
      }
    }
  }
}
