{
  "openapi": "3.1.0",
  "info": {
    "title": "AHR999 Dataset API",
    "version": "1.0.0",
    "description": "Public read-only endpoints for the daily AHR999 BTC hoarding index dataset. The data is self-computed from Binance BTCUSDT daily closes and published for research, education, and observability. It is not financial advice.",
    "license": {
      "name": "Code MIT; data CC BY 4.0",
      "url": "https://github.com/RuochenLyu/ahr999-dataset"
    }
  },
  "externalDocs": {
    "description": "Repository documentation and methodology",
    "url": "https://github.com/RuochenLyu/ahr999-dataset"
  },
  "servers": [
    {
      "url": "https://ahr999.aix4u.com",
      "description": "Canonical public dataset host"
    }
  ],
  "security": [],
  "tags": [
    {
      "name": "dataset",
      "description": "Public read-only AHR999 dataset downloads"
    }
  ],
  "paths": {
    "/datasets/ahr999.json": {
      "get": {
        "tags": ["dataset"],
        "summary": "Download the full AHR999 dataset as JSON",
        "description": "Returns an array of daily AHR999 rows ordered by UTC date ascending. No authentication is required.",
        "operationId": "getAhr999DatasetJson",
        "security": [],
        "responses": {
          "200": {
            "description": "AHR999 dataset as JSON",
            "headers": {
              "Access-Control-Allow-Origin": {
                "description": "The static host allows cross-origin reads of this public dataset.",
                "schema": {
                  "type": "string",
                  "const": "*"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Ahr999Point"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/datasets/ahr999.csv": {
      "get": {
        "tags": ["dataset"],
        "summary": "Download the full AHR999 dataset as CSV",
        "description": "Returns the same rows and columns as the JSON dataset, serialized as UTF-8 CSV with a header row. Empty CSV cells represent JSON null values. No authentication is required.",
        "operationId": "getAhr999DatasetCsv",
        "security": [],
        "responses": {
          "200": {
            "description": "AHR999 dataset as CSV",
            "headers": {
              "Access-Control-Allow-Origin": {
                "description": "The static host allows cross-origin reads of this public dataset.",
                "schema": {
                  "type": "string",
                  "const": "*"
                }
              }
            },
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string",
                  "contentMediaType": "text/csv"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Ahr999Point": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "date",
          "close",
          "ma200",
          "ahr999",
          "quantile5y",
          "windowKind"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "description": "UTC calendar date for the daily close."
          },
          "close": {
            "type": "number",
            "description": "BTCUSDT daily close from Binance public market data."
          },
          "ma200": {
            "type": ["number", "null"],
            "description": "200-day simple moving average of close. Null until 200 closes are available."
          },
          "ahr999": {
            "type": ["number", "null"],
            "description": "(close / ma200) * (close / fitted). Null when ma200 is null."
          },
          "quantile5y": {
            "type": ["number", "null"],
            "minimum": 0,
            "maximum": 1,
            "description": "Empirical rank of ahr999 inside the active recent window. Null until enough valid AHR observations exist."
          },
          "windowKind": {
            "type": "string",
            "enum": [
              "insufficient_samples",
              "expanding",
              "rolling_5y"
            ],
            "description": "Window regime used for quantile5y."
          }
        }
      }
    }
  }
}
