{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/sharpapi/main/json-schema/sharpapi-middle-opportunity-schema.json",
  "title": "MiddleOpportunity",
  "x-generated": "2026-10-14",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/sharpapi-openapi.json#/components/schemas/MiddleOpportunity",
  "type": "object",
  "required": [
    "id",
    "event_id",
    "event_name",
    "sport",
    "league",
    "market_type",
    "home_team",
    "away_team",
    "start_time",
    "side1",
    "side2",
    "middle_size",
    "middle_numbers",
    "middle_probability",
    "expected_value",
    "roi_percentage",
    "worst_case_loss",
    "best_case_profit",
    "break_even_percent",
    "is_live",
    "is_player_prop",
    "player_name",
    "stat_category",
    "odds_age_seconds",
    "is_guaranteed_profit",
    "guaranteed_roi",
    "key_numbers",
    "key_number_probability",
    "quality_score",
    "market_overround",
    "warnings",
    "is_team_total",
    "team_name",
    "detected_at"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "event_id": {
      "type": "string"
    },
    "event_name": {
      "type": "string"
    },
    "sport": {
      "type": "string"
    },
    "league": {
      "type": "string"
    },
    "market_type": {
      "type": "string"
    },
    "home_team": {
      "type": "string"
    },
    "away_team": {
      "type": "string"
    },
    "start_time": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "side1": {
      "$ref": "#/$defs/MiddleSide"
    },
    "side2": {
      "$ref": "#/$defs/MiddleSide"
    },
    "middle_size": {
      "type": "number",
      "description": "Gap between the two lines"
    },
    "middle_numbers": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "description": "The numbers that fall in the middle"
    },
    "middle_probability": {
      "type": "number",
      "description": "Probability of landing in the middle"
    },
    "expected_value": {
      "type": "number"
    },
    "roi_percentage": {
      "type": "number"
    },
    "worst_case_loss": {
      "type": "number",
      "description": "Maximum loss if the middle doesn't hit"
    },
    "best_case_profit": {
      "type": "number",
      "description": "Profit if the result lands in the middle"
    },
    "break_even_percent": {
      "type": "number"
    },
    "is_live": {
      "type": "boolean"
    },
    "is_player_prop": {
      "type": "boolean"
    },
    "player_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "stat_category": {
      "type": [
        "string",
        "null"
      ]
    },
    "odds_age_seconds": {
      "type": [
        "number",
        "null"
      ]
    },
    "is_guaranteed_profit": {
      "type": "boolean",
      "description": "Whether this middle guarantees profit regardless of outcome"
    },
    "guaranteed_roi": {
      "type": [
        "number",
        "null"
      ]
    },
    "key_numbers": {
      "type": "array",
      "items": {
        "type": "number"
      },
      "description": "Key numbers in this sport (e.g., 3 and 7 in NFL)"
    },
    "key_number_probability": {
      "type": "number"
    },
    "quality_score": {
      "type": "number",
      "description": "Overall quality score combining multiple factors"
    },
    "market_overround": {
      "type": "number",
      "description": "Combined implied probability of both sides"
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "is_team_total": {
      "type": "boolean"
    },
    "team_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "alt_side1": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "book": {
            "type": "string"
          },
          "odds": {
            "type": "number"
          }
        }
      },
      "description": "Alternative books offering side 1"
    },
    "alt_side2": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "book": {
            "type": "string"
          },
          "odds": {
            "type": "number"
          }
        }
      },
      "description": "Alternative books offering side 2"
    },
    "detected_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "MiddleSide": {
      "type": "object",
      "required": [
        "book",
        "selection",
        "line",
        "odds",
        "stake_percent",
        "odds_age_seconds",
        "deep_link"
      ],
      "properties": {
        "book": {
          "type": "string"
        },
        "selection": {
          "type": "string"
        },
        "line": {
          "type": "number"
        },
        "odds": {
          "type": "object",
          "required": [
            "american",
            "decimal",
            "probability",
            "fair_probability"
          ],
          "properties": {
            "american": {
              "type": "number"
            },
            "decimal": {
              "type": "number"
            },
            "probability": {
              "type": "number"
            },
            "fair_probability": {
              "type": "number"
            }
          }
        },
        "stake_percent": {
          "type": "number"
        },
        "odds_age_seconds": {
          "type": [
            "number",
            "null"
          ]
        },
        "deep_link": {
          "type": [
            "string",
            "null"
          ],
          "format": "uri"
        }
      }
    }
  }
}