{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/clearstreet8e71/json-schema/clearstreet8e71-market-hours-detail-list-schema.json",
  "title": "MarketHoursDetailList",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/clearstreet8e71-calendar-api-openapi.yml#/components/schemas/MarketHoursDetailList",
  "type": "array",
  "items": {
    "$ref": "#/$defs/MarketHoursDetail"
  },
  "$defs": {
    "DayType": {
      "type": "string",
      "description": "Day type for market hours - indicates the type of trading day",
      "enum": [
        "TRADING_DAY",
        "EARLY_CLOSE",
        "HOLIDAY",
        "WEEKEND"
      ]
    },
    "MarketHoursDetail": {
      "type": "object",
      "description": "Comprehensive market hours information for a specific market and date",
      "required": [
        "market",
        "market_name",
        "date",
        "timezone",
        "current_time",
        "status",
        "today_sessions",
        "next_sessions"
      ],
      "properties": {
        "current_time": {
          "type": "string",
          "format": "date-time",
          "description": "Current time in market timezone with offset"
        },
        "date": {
          "type": "string",
          "format": "date",
          "description": "The date for which market hours are provided"
        },
        "market": {
          "$ref": "#/$defs/MarketType",
          "description": "Market type identifier"
        },
        "market_name": {
          "type": "string",
          "description": "Human-readable market name"
        },
        "next_sessions": {
          "$ref": "#/$defs/TradingSessions",
          "description": "Next trading day's session schedules (without time_until fields)"
        },
        "status": {
          "$ref": "#/$defs/MarketStatus",
          "description": "Market status information"
        },
        "timezone": {
          "type": "string",
          "description": "IANA timezone identifier for the market"
        },
        "today_sessions": {
          "$ref": "#/$defs/TradingSessions",
          "description": "Trading session schedules for the requested date with time_until fields"
        }
      }
    },
    "MarketSessionType": {
      "type": "string",
      "description": "Session type for market hours",
      "enum": [
        "overnight",
        "pre_market",
        "regular",
        "after_hours"
      ]
    },
    "MarketStatus": {
      "type": "object",
      "description": "Market status information",
      "required": [
        "day_type",
        "is_open"
      ],
      "properties": {
        "current_session": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/MarketSessionType",
              "description": "Current session type if market is open, null if closed\nWhen a null/undefined value is observed, it indicates it does not apply."
            }
          ]
        },
        "day_type": {
          "$ref": "#/$defs/DayType",
          "description": "The type of trading day"
        },
        "is_open": {
          "type": "boolean",
          "description": "Whether the market is currently open (real-time)"
        }
      }
    },
    "MarketType": {
      "type": "string",
      "description": "Market type for market hours calendar endpoint",
      "enum": [
        "us_equities",
        "us_options"
      ]
    },
    "SessionSchedule": {
      "type": "object",
      "description": "Session schedule with open and close timestamps",
      "required": [
        "open",
        "close"
      ],
      "properties": {
        "close": {
          "type": "string",
          "format": "date-time",
          "description": "Session close timestamp with timezone offset"
        },
        "open": {
          "type": "string",
          "format": "date-time",
          "description": "Session open timestamp with timezone offset"
        },
        "time_until_close": {
          "type": [
            "string",
            "null"
          ],
          "format": "duration",
          "description": "ISO 8601 duration until session closes. Null if session is not currently open.\nWhen a null/undefined value is observed, it indicates it does not apply."
        },
        "time_until_open": {
          "type": [
            "string",
            "null"
          ],
          "format": "duration",
          "description": "ISO 8601 duration until session opens. Null if session has already started or closed.\nWhen a null/undefined value is observed, it indicates it does not apply."
        }
      }
    },
    "TradingSessions": {
      "type": "object",
      "description": "Trading sessions for a market day with full timestamps",
      "properties": {
        "after_hours": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/SessionSchedule",
              "description": "After-hours session schedule, null if not available\nWhen a null/undefined value is observed, it indicates it does not apply."
            }
          ]
        },
        "overnight": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/SessionSchedule",
              "description": "Overnight session schedule (prior evening through early morning), null if not available\nWhen a null/undefined value is observed, it indicates it does not apply."
            }
          ]
        },
        "pre_market": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/SessionSchedule",
              "description": "Pre-market session schedule, null if not available\nWhen a null/undefined value is observed, it indicates it does not apply."
            }
          ]
        },
        "regular": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/SessionSchedule",
              "description": "Regular trading session schedule, null if holiday/weekend\nWhen a null/undefined value is observed, it indicates it does not apply."
            }
          ]
        }
      }
    }
  }
}