{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tradingstrategies-work/json-schema/tradingstrategies-work-btc-cycle-timeline-response-schema.json",
  "title": "BtcCycleTimelineResponse",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tradingstrategies-work-openapi.yml#/components/schemas/BtcCycleTimelineResponse",
  "type": "object",
  "properties": {
    "as_of": {
      "type": "string",
      "format": "date"
    },
    "resolution": {
      "type": "string",
      "enum": [
        "week",
        "day"
      ]
    },
    "from": {
      "type": "string",
      "format": "date"
    },
    "to": {
      "type": "string",
      "format": "date"
    },
    "data_start_date": {
      "type": "string",
      "format": "date"
    },
    "data_end_date": {
      "type": "string",
      "format": "date"
    },
    "days_total": {
      "type": "integer",
      "description": "Calendar days from data_start_date to data_end_date, inclusive."
    },
    "days_missing": {
      "type": "integer",
      "description": "Calendar days in that span without a snapshot row (measured, not assumed)."
    },
    "flip_hold_days": {
      "type": "integer",
      "description": "A flip reverted within this many days is marked flicker."
    },
    "bands": {
      "type": "object",
      "additionalProperties": {
        "type": "array",
        "items": {
          "type": "number"
        },
        "minItems": 2,
        "maxItems": 2
      },
      "description": "Score band [lo, hi) per label — the same signalFromScore() as the pulse tile."
    },
    "rows": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "'composite' or a component key (pi_top, pi_bot, mayer, rsi_w, ma200w, halving, fg, btc_dom, mining)."
          },
          "label_de": {
            "type": "string"
          },
          "label_en": {
            "type": "string"
          },
          "short": {
            "type": "string"
          },
          "weight": {
            "type": [
              "number",
              "null"
            ],
            "description": "Component weight in the composite (null for the composite row)."
          },
          "cells": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "date": {
                  "type": "string",
                  "format": "date",
                  "description": "Weekly resolution: the LAST available day of the ISO week."
                },
                "score": {
                  "type": [
                    "integer",
                    "null"
                  ],
                  "description": "Stored score 0–100, rounded; null = no snapshot / component not scored."
                },
                "band": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "enum": [
                    "accumulation",
                    "recovery",
                    "expansion",
                    "distribution",
                    "overheated",
                    null
                  ]
                }
              }
            }
          }
        }
      }
    },
    "flips": {
      "type": "array",
      "description": "Day-to-day band changes per row, newest first.",
      "items": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "key": {
            "type": "string"
          },
          "from": {
            "type": "string"
          },
          "to": {
            "type": "string"
          },
          "score_from": {
            "type": "number"
          },
          "score_to": {
            "type": "number"
          },
          "flicker": {
            "type": "boolean"
          }
        }
      }
    },
    "consensus": {
      "type": "object",
      "properties": {
        "as_of": {
          "type": "string",
          "format": "date"
        },
        "above_neutral": {
          "type": "object",
          "properties": {
            "n": {
              "type": "integer"
            },
            "of": {
              "type": "integer"
            },
            "keys": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "rising_30d": {
          "type": "object",
          "properties": {
            "n": {
              "type": "integer"
            },
            "of": {
              "type": "integer"
            },
            "keys": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "independence": {
          "type": "object",
          "properties": {
            "effective_rows": {
              "type": [
                "number",
                "null"
              ],
              "description": "Participation ratio (Σλ)²/Σλ² of the eigenvalues of the correlation matrix of first differences of the component scores over window_days; null when fewer than 30 observations."
            },
            "nominal_rows": {
              "type": "integer"
            },
            "evaluated_rows": {
              "type": "integer",
              "description": "Components with non-zero variance in the window."
            },
            "window_days": {
              "type": "integer"
            },
            "n_obs": {
              "type": "integer"
            },
            "basis": {
              "type": "string",
              "enum": [
                "score_change"
              ]
            }
          }
        }
      }
    },
    "note": {
      "type": "string"
    }
  }
}