{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/cryptoetf-today/json-schema/cryptoetf-today-cefi-index-dto-schema.json",
  "title": "CefiIndexDto",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/cryptoetf-today-v1-openapi.json#/components/schemas/CefiIndexDto",
  "type": "object",
  "properties": {
    "index": {
      "type": "string",
      "description": "Index id. Always CEFI-Composite: there is one index for all 16 assets."
    },
    "current": {
      "type": "number",
      "description": "Latest value: an integer 0–100. 50 = zero net flow; a typical inflow day is about 69, a typical outflow day about 31."
    },
    "components": {
      "nullable": true,
      "description": "Components of the current value; null while the history is too short to score all three.",
      "allOf": [
        {
          "$ref": "#/$defs/CefiComponentsDto"
        }
      ]
    },
    "date": {
      "type": "string",
      "description": "Trading day of the current value (UTC, YYYY-MM-DD)."
    },
    "windowDays": {
      "type": "number",
      "description": "Days of history this key can read: 30 for every key."
    },
    "history": {
      "description": "Index history for trading days, ordered oldest → newest.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/IndexPointDto"
      }
    }
  },
  "required": [
    "index",
    "current",
    "components",
    "date",
    "windowDays",
    "history"
  ],
  "$defs": {
    "CefiComponentsDto": {
      "type": "object",
      "properties": {
        "flow": {
          "type": "number",
          "description": "Flow: today's net flow, smoothed (40% of the index)."
        },
        "trend": {
          "type": "number",
          "description": "Trend: net flow over 20 trading days (30% of the index)."
        },
        "breadth": {
          "type": "number",
          "description": "Breadth: share of funds with inflows (30% of the index)."
        }
      },
      "required": [
        "flow",
        "trend",
        "breadth"
      ]
    },
    "IndexPointDto": {
      "type": "object",
      "properties": {
        "date": {
          "type": "string",
          "description": "Date (UTC, YYYY-MM-DD)."
        },
        "value": {
          "type": "number",
          "description": "CEFI value for that trading day: an integer 0–100, 50 = zero net flow."
        }
      },
      "required": [
        "date",
        "value"
      ]
    }
  }
}