{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.untamedbots.live/data/schema",
  "title": "untamedbots_index_export_v1",
  "description": "Daily closes of the untamedbots.live bot index (base 100 on 2026-10-22), as published by https://www.untamedbots.live/api/summary. Downloads: https://www.untamedbots.live/data/untamedbots-index.json (this schema) and https://www.untamedbots.live/data/untamedbots-index.csv (same rows, see x-csv). They contain only what the site already publishes: index values and percentages, never amounts, addresses or trades. Licence: CC BY 4.0, credit \"untamedbots.live · strateva.ai\".",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "schema_url",
    "title",
    "source_url",
    "license",
    "base",
    "base_date",
    "timezone",
    "method",
    "source_cut_utc",
    "updated_at",
    "last_closed_date",
    "closed_day_corrections",
    "daily"
  ],
  "properties": {
    "schema": {
      "const": "untamedbots_index_export_v1",
      "description": "Format identifier. A breaking change gets a new identifier."
    },
    "schema_url": {
      "type": "string",
      "format": "uri",
      "description": "Where this schema is published."
    },
    "title": {
      "type": "string",
      "description": "Human-readable name of the dataset."
    },
    "source_url": {
      "type": "string",
      "format": "uri",
      "description": "Public endpoint the file was built from, at the moment of the request."
    },
    "license": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "url",
        "attribution",
        "attribution_url"
      ],
      "description": "Licence of the data and the credit to give when reusing it.",
      "properties": {
        "id": {
          "const": "CC-BY-4.0",
          "description": "SPDX licence identifier."
        },
        "name": {
          "type": "string",
          "description": "Licence name."
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Licence text."
        },
        "attribution": {
          "type": "string",
          "description": "Credit line to show when reusing the data."
        },
        "attribution_url": {
          "type": "string",
          "format": "uri",
          "description": "Link to include with the credit."
        }
      }
    },
    "base": {
      "type": "number",
      "description": "Index value before the first day (100)."
    },
    "base_date": {
      "type": "string",
      "format": "date",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
      "description": "First day of the index (2026-10-22). Its change_pct is applied to base."
    },
    "timezone": {
      "const": "Europe/Lisbon",
      "description": "Time zone that defines the day boundaries (a day closes at Lisbon midnight)."
    },
    "method": {
      "type": "string",
      "description": "How every index value is reproduced from the change_pct column."
    },
    "source_cut_utc": {
      "type": "string",
      "format": "date-time",
      "description": "UTC time of the bots’ publication these figures come from (freshness.source_cut_utc in /api/summary)."
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "description": "The same cut rounded down to 5 minutes, as shown on the site (updated_at in /api/summary)."
    },
    "last_closed_date": {
      "anyOf": [
        {
          "type": "string",
          "format": "date",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
          "description": "Most recent closed day."
        },
        {
          "type": "null"
        }
      ],
      "description": "Date of the last row with partial = false (null if none)."
    },
    "closed_day_corrections": {
      "type": "array",
      "description": "Every documented change to a closed day: the published row before (from) and after (to). Later closed days may have a re-chained index with their own change_pct unchanged; they need no entry.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "date",
          "from",
          "to",
          "reason",
          "recorded_at_utc"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "Closed day that was corrected."
          },
          "from": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "index",
              "change_pct"
            ],
            "properties": {
              "index": {
                "type": "number",
                "description": "Index value of the row."
              },
              "change_pct": {
                "type": "number",
                "description": "Daily change of the row, in percent."
              }
            },
            "description": "Row as it was published before the correction."
          },
          "to": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "index",
              "change_pct"
            ],
            "properties": {
              "index": {
                "type": "number",
                "description": "Index value of the row."
              },
              "change_pct": {
                "type": "number",
                "description": "Daily change of the row, in percent."
              }
            },
            "description": "Row as it is published now (equals that day’s row in daily)."
          },
          "reason": {
            "type": "string",
            "pattern": "^[a-z0-9_]{1,64}$",
            "description": "Reason code (e.g. twr_split_at_external_flow_v3: the day was split at a verified external flow)."
          },
          "recorded_at_utc": {
            "type": "string",
            "format": "date-time",
            "description": "When the correction was recorded (UTC)."
          }
        }
      }
    },
    "daily": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "date",
          "index",
          "change_pct",
          "partial"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "description": "Session day (ISO 8601, Europe/Lisbon calendar day). Rows are consecutive days from base_date, one per day."
          },
          "index": {
            "type": "number",
            "description": "Index value at the end of the day (or at the cut, if partial). Equals round2(base * product of (1 + change_pct/100)) over all rows up to and including this one."
          },
          "change_pct": {
            "type": "number",
            "description": "Time-weighted return of the day in percent (e.g. 13.7 = +13.7 %), net of fees, with external deposits and withdrawals neutralised."
          },
          "partial": {
            "type": "boolean",
            "description": "true only for the last row while its day is still open; that row changes until Lisbon midnight. Closed rows (false) are frozen unless an entry in closed_day_corrections documents the change."
          }
        }
      },
      "description": "One row per day, oldest first, from base_date to the day of the cut."
    }
  },
  "x-csv": {
    "url": "https://www.untamedbots.live/data/untamedbots-index.csv",
    "media_type": "text/csv; charset=utf-8; header=present",
    "dialect": "RFC 4180: UTF-8 without BOM, comma separator, CRLF line endings, one header row, no comments, no quoting needed.",
    "columns": [
      "date",
      "index",
      "change_pct",
      "partial"
    ],
    "description": "Same rows as daily in the JSON file and the same column meanings (see $defs.row). Numbers use a dot as decimal separator and are written in full (shortest exact decimal, no exponent). partial is true or false. The metadata (base, licence, cut, corrections) is in the JSON file."
  },
  "$defs": {
    "row": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "date",
        "index",
        "change_pct",
        "partial"
      ],
      "properties": {
        "date": {
          "type": "string",
          "format": "date",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
          "description": "Session day (ISO 8601, Europe/Lisbon calendar day). Rows are consecutive days from base_date, one per day."
        },
        "index": {
          "type": "number",
          "description": "Index value at the end of the day (or at the cut, if partial). Equals round2(base * product of (1 + change_pct/100)) over all rows up to and including this one."
        },
        "change_pct": {
          "type": "number",
          "description": "Time-weighted return of the day in percent (e.g. 13.7 = +13.7 %), net of fees, with external deposits and withdrawals neutralised."
        },
        "partial": {
          "type": "boolean",
          "description": "true only for the last row while its day is still open; that row changes until Lisbon midnight. Closed rows (false) are frozen unless an entry in closed_day_corrections documents the change."
        }
      }
    }
  }
}
