{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://bidapi.com/assets/examples/bid-observation.schema.json",
  "title": "BidAPI.com illustrative quote observation",
  "description": "A local teaching schema, not a hosted API or provider contract.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "example",
    "schema_version",
    "kind",
    "source",
    "asset",
    "bid",
    "ask",
    "observed_at",
    "received_at"
  ],
  "properties": {
    "example": {
      "const": true
    },
    "schema_version": {
      "const": "1.0"
    },
    "kind": {
      "const": "quote"
    },
    "source": {
      "type": "object",
      "required": [
        "id",
        "market"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "market": {
          "const": "stocks"
        }
      }
    },
    "asset": {
      "type": "object",
      "required": [
        "id",
        "type"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "const": "equity"
        }
      }
    },
    "bid": {
      "$ref": "#/$defs/amount"
    },
    "ask": {
      "$ref": "#/$defs/amount"
    },
    "observed_at": {
      "type": "string",
      "format": "date-time"
    },
    "received_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "amount": {
      "type": "object",
      "required": [
        "value",
        "currency"
      ],
      "additionalProperties": false,
      "properties": {
        "value": {
          "type": "string",
          "pattern": "^[0-9]+(\\.[0-9]+)?$"
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        }
      }
    }
  }
}
