{
  "openapi": "3.1.0",
  "info": {
    "title": "Aeolus Data API",
    "version": "2026-05-27",
    "description": "Aeolus Data REST API for China A-share daily OHLCV aggregates.\n\nDocumentation: https://docs.aeolus-ai.com\nAI index: https://docs.aeolus-ai.com/llms.txt\n\nv1 endpoint: GET /v1/ohlc/range/1/day/{from}/{to} (Custom Bars).\n",
    "contact": {
      "name": "Aeolus",
      "url": "https://aeolus-ai.com"
    },
    "license": {
      "name": "Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://api.aeolus-ai.com",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "Market Data",
      "description": "行情与 K 线"
    }
  ],
  "paths": {
    "/v1/ohlc/range/{multiplier}/{timespan}/{from}/{to}": {
      "get": {
        "operationId": "getOhlcRange",
        "tags": [
          "Market Data"
        ],
        "summary": "Custom Bars (OHLC)",
        "description": "按交易日返回 A 股股票日线 OHLCV 序列。\nv1 固定 `multiplier=1`、`timespan=day`。\n多标的用 query `symbol` 逗号分隔，响应按标的分组（`results[]`）。\n",
        "parameters": [
          {
            "name": "multiplier",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "enum": [
                1
              ]
            }
          },
          {
            "name": "timespan",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "day"
              ]
            }
          },
          {
            "name": "from",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "example": "2026-01-01"
          },
          {
            "name": "to",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date"
            },
            "example": "2026-05-26"
          },
          {
            "$ref": "#/components/parameters/symbol"
          },
          {
            "name": "adjusted",
            "in": "query",
            "schema": {
              "type": "boolean",
              "default": true
            },
            "description": "If true, OHLC is split-adjusted for display. If false, prices use factor on each bar."
          },
          {
            "name": "sort",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "asc",
                "desc"
              ],
              "default": "asc"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "maximum": 5000
            },
            "description": "在 from/to 窗口内按 sort 取前 N 条"
          },
          {
            "name": "include",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "summary"
              ]
            },
            "description": "返回区间统计 summary"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OhlcRangeResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/InsufficientCredits"
          },
          "403": {
            "$ref": "#/components/responses/PlanLimit"
          },
          "500": {
            "$ref": "#/components/responses/InternalError"
          }
        }
      }
    }
  },
  "components": {
    "parameters": {
      "symbol": {
        "name": "symbol",
        "in": "query",
        "required": true,
        "schema": {
          "type": "string",
          "example": "600519.SH"
        },
        "description": "股票代码；多个用英文逗号分隔"
      }
    },
    "schemas": {
      "Bar": {
        "type": "object",
        "required": [
          "trade_date",
          "t",
          "open",
          "high",
          "low",
          "close",
          "volume",
          "turnover",
          "change_pct",
          "factor"
        ],
        "properties": {
          "trade_date": {
            "type": "string",
            "format": "date"
          },
          "t": {
            "type": "integer",
            "description": "Unix 毫秒（+08:00 日切）"
          },
          "open": {
            "type": "number"
          },
          "high": {
            "type": "number"
          },
          "low": {
            "type": "number"
          },
          "close": {
            "type": "number",
            "description": "Close price; interpretation depends on adjusted"
          },
          "volume": {
            "type": "number",
            "description": "成交量（股）"
          },
          "turnover": {
            "type": "number",
            "description": "成交额（元）"
          },
          "change_pct": {
            "type": "number",
            "description": "涨跌幅（%），如 1.24 表示 1.24%"
          },
          "factor": {
            "type": "number",
            "description": "Adjustment factor for the bar"
          }
        }
      },
      "Summary": {
        "type": "object",
        "properties": {
          "from": {
            "type": "string",
            "format": "date"
          },
          "to": {
            "type": "string",
            "format": "date"
          },
          "bars_count": {
            "type": "integer"
          },
          "return_pct": {
            "type": "number"
          },
          "open_first": {
            "type": "number"
          },
          "close_last": {
            "type": "number"
          }
        }
      },
      "SymbolResult": {
        "type": "object",
        "properties": {
          "symbol": {
            "type": "string"
          },
          "resultsCount": {
            "type": "integer"
          },
          "ohlc": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Bar"
            }
          },
          "summary": {
            "$ref": "#/components/schemas/Summary"
          },
          "error": {
            "$ref": "#/components/schemas/SymbolError"
          }
        }
      },
      "SymbolError": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string"
          },
          "message": {
            "type": "string"
          }
        }
      },
      "Meta": {
        "type": "object",
        "properties": {
          "as_of": {
            "type": "string",
            "format": "date"
          },
          "source": {
            "type": "string",
            "example": "qlib"
          },
          "schema_version": {
            "type": "string",
            "example": "2026-05-27"
          },
          "credits_charged": {
            "type": "integer",
            "description": "Credits charged for this request; present only when charged"
          }
        }
      },
      "OhlcRangeResponse": {
        "type": "object",
        "required": [
          "status",
          "request_id",
          "adjusted",
          "multiplier",
          "timespan",
          "from",
          "to",
          "resultsCount",
          "meta"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "OK",
              "PARTIAL"
            ]
          },
          "request_id": {
            "type": "string"
          },
          "symbol": {
            "type": "string",
            "description": "单标的时返回"
          },
          "adjusted": {
            "type": "boolean"
          },
          "multiplier": {
            "type": "integer"
          },
          "timespan": {
            "type": "string"
          },
          "from": {
            "type": "string",
            "format": "date"
          },
          "to": {
            "type": "string",
            "format": "date"
          },
          "resultsCount": {
            "type": "integer"
          },
          "ohlc": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Bar"
            },
            "description": "单标的时返回"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SymbolResult"
            },
            "description": "多标的时返回"
          },
          "summary": {
            "$ref": "#/components/schemas/Summary"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "INVALID_SYMBOL",
                  "INVALID_PARAMETER",
                  "UNSUPPORTED_INTERVAL",
                  "UNAUTHORIZED",
                  "INSUFFICIENT_CREDITS",
                  "PLAN_LIMIT",
                  "INTERNAL_ERROR"
                ]
              },
              "message": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "responses": {
      "BadRequest": {
        "description": "参数或 Symbol 错误",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "无效或缺失 API Key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "InsufficientCredits": {
        "description": "积分不足",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "PlanLimit": {
        "description": "套餐限制",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "InternalError": {
        "description": "服务器错误",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API Key",
        "description": "Authorization: Bearer <API_KEY>"
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    }
  ]
}
