{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/proofprice-com/json-schema/proofprice-com-history-answer-schema.json",
  "title": "HistoryAnswer",
  "description": "A daily series from the ProofPrice price library: date, median, typical range and sample size, with the change over the period.",
  "x-generated": "2026-11-22",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/proofprice-com-openapi.json#/components/schemas/HistoryAnswer",
  "type": "object",
  "properties": {
    "query": {
      "type": "object",
      "propertyNames": {
        "type": "string"
      },
      "additionalProperties": true
    },
    "status": {
      "type": "string",
      "enum": [
        "ok",
        "insufficient_history",
        "no_history_yet"
      ]
    },
    "currency": {
      "type": [
        "string",
        "null"
      ]
    },
    "unit": {
      "type": [
        "string",
        "null"
      ]
    },
    "series": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string"
          },
          "median": {
            "type": "number"
          },
          "typical_low": {
            "type": "number"
          },
          "typical_high": {
            "type": "number"
          },
          "sample_size": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "date",
          "median",
          "typical_low",
          "typical_high",
          "sample_size"
        ],
        "additionalProperties": true
      }
    },
    "period": {
      "type": "object",
      "properties": {
        "from": {
          "type": [
            "string",
            "null"
          ]
        },
        "to": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "from",
        "to"
      ],
      "additionalProperties": true
    },
    "change": {
      "description": "Change over the period; null with fewer than two days.",
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "from_median": {
              "type": "number"
            },
            "to_median": {
              "type": "number"
            },
            "absolute": {
              "type": "number"
            },
            "percent": {
              "type": "number"
            }
          },
          "required": [
            "from_median",
            "to_median",
            "absolute",
            "percent"
          ],
          "additionalProperties": true
        },
        {
          "type": "null"
        }
      ]
    },
    "price_type": {
      "type": "string"
    },
    "sample_size_note": {
      "description": "Present when the publisher gives no record count: sample_size in the series is null.",
      "type": "string"
    },
    "source": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Source id, e.g. es-fuel."
        },
        "name": {
          "type": "string"
        },
        "publisher": {
          "type": "string",
          "description": "Who publishes the data."
        },
        "licence": {
          "type": "string"
        },
        "licence_url": {
          "type": "string"
        },
        "attribution": {
          "type": "string",
          "description": "The attribution line to show with the figure."
        },
        "url": {
          "type": "string",
          "description": "The publisher's page for this data."
        }
      },
      "required": [
        "id",
        "name",
        "publisher",
        "licence",
        "licence_url",
        "attribution",
        "url"
      ],
      "additionalProperties": true,
      "description": "Where the figure comes from, under which licence, and the attribution line to show."
    },
    "library": {
      "type": "object",
      "properties": {
        "first_date": {
          "type": [
            "string",
            "null"
          ]
        },
        "last_date": {
          "type": [
            "string",
            "null"
          ]
        },
        "days_collected": {
          "type": "number"
        },
        "days_since_last_snapshot": {
          "type": [
            "number",
            "null"
          ]
        }
      },
      "required": [
        "first_date",
        "last_date",
        "days_collected",
        "days_since_last_snapshot"
      ],
      "additionalProperties": true
    },
    "method": {
      "type": "string"
    },
    "method_url": {
      "type": "string"
    },
    "summary": {
      "type": "string"
    },
    "notice": {
      "type": "string"
    }
  },
  "required": [
    "query",
    "status",
    "series",
    "source",
    "summary",
    "notice"
  ],
  "additionalProperties": true
}