{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://intraalpha.com/schemas/company-discovery-v1.json",
  "title": "IntraAlpha public derived company data v1",
  "$defs": {
    "observation": {
      "type": "object",
      "required": [
        "symbol",
        "expiry",
        "observed_at",
        "captured_at",
        "price",
        "iv_pct",
        "implied_move_pct",
        "put_call_skew_pp",
        "model_version",
        "source_url",
        "source_hash"
      ],
      "properties": {
        "symbol": {
          "type": "string"
        },
        "expiry": {
          "type": "string",
          "format": "date"
        },
        "observed_at": {
          "type": "string",
          "format": "date-time"
        },
        "captured_at": {
          "type": "string",
          "format": "date-time"
        },
        "last_trade_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "price": {
          "type": "number"
        },
        "iv_pct": {
          "type": "number"
        },
        "implied_move_pct": {
          "type": "number"
        },
        "put_call_skew_pp": {
          "type": "number"
        },
        "model_version": {
          "type": "string"
        },
        "source_url": {
          "type": "string",
          "format": "uri"
        },
        "source_hash": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$"
        }
      }
    },
    "rankingRow": {
      "type": "object",
      "required": [
        "symbol",
        "expiry",
        "capturedAt",
        "optionObservedAt",
        "validUntil",
        "price",
        "iv_pct",
        "implied_move_pct",
        "put_call_skew_pp",
        "url"
      ],
      "properties": {
        "symbol": {
          "type": "string"
        },
        "expiry": {
          "type": "string",
          "format": "date"
        },
        "capturedAt": {
          "type": "string",
          "format": "date-time"
        },
        "optionObservedAt": {
          "type": "string",
          "format": "date-time"
        },
        "validUntil": {
          "type": "string",
          "format": "date-time"
        },
        "price": {
          "type": "number"
        },
        "iv_pct": {
          "type": "number"
        },
        "implied_move_pct": {
          "type": "number"
        },
        "put_call_skew_pp": {
          "type": "number"
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "history": {
      "type": "object",
      "required": [
        "schemaVersion",
        "symbol",
        "observations",
        "expiries",
        "url",
        "units"
      ],
      "properties": {
        "schemaVersion": {
          "const": 1
        },
        "symbol": {
          "type": "string"
        },
        "observations": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/observation"
          }
        },
        "expiries": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "date"
          }
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "units": {
          "type": "object"
        }
      }
    },
    "rankings": {
      "type": "object",
      "required": [
        "schemaVersion",
        "expiry",
        "rows",
        "eligibleCount",
        "universeCount",
        "unavailable",
        "units"
      ],
      "properties": {
        "schemaVersion": {
          "const": 1
        },
        "expiry": {
          "type": "string",
          "format": "date"
        },
        "rows": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/rankingRow"
          }
        },
        "eligibleCount": {
          "type": "integer",
          "minimum": 0
        },
        "universeCount": {
          "type": "integer",
          "minimum": 0
        },
        "unavailable": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "units": {
          "type": "object"
        }
      }
    }
  },
  "oneOf": [
    {
      "$ref": "#/$defs/history"
    },
    {
      "$ref": "#/$defs/rankings"
    }
  ]
}
