> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reportify.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# 日线行情

> 获取单只股票的日线行情数据

获取单只股票的 OHLCV（开高低收量）日线数据。

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://api.reportify.cn/v1/quant/quotes/ohlcv?symbol=000001&market=cn&start_date=2026-01-01&end_date=2026-01-10" \
    -H "Authorization: Bearer <token>"
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      "https://api.reportify.cn/v1/quant/quotes/ohlcv",
      headers={"Authorization": "Bearer <token>"},
      params={
          "symbol": "000001",
          "market": "cn",
          "start_date": "2026-01-01",
          "end_date": "2026-01-10"
      }
  )
  print(response.json())
  ```

  ```typescript TypeScript theme={null}
  const params = new URLSearchParams({
    symbol: '000001',
    market: 'cn',
    start_date: '2026-01-01',
    end_date: '2026-01-10'
  });

  const response = await fetch(
    `https://api.reportify.cn/v1/quant/quotes/ohlcv?${params}`,
    {
      headers: {
        'Authorization': 'Bearer <token>'
      }
    }
  );
  const data = await response.json();
  ```
</CodeGroup>

## 请求参数

<ParamField query="symbol" type="string" required>
  股票代码
</ParamField>

<ParamField query="market" type="string" default="cn">
  股票市场：`cn`（A股）, `hk`（港股）, `us`（美股）, `global`（其他全球市场）。获取指数行情（`stock_type=index`）时，除 A 股（`cn`）、港股（`hk`）、美股（`us`）外，其余指数统一通过 `global` 查询。
</ParamField>

<ParamField query="start_date" type="string">
  开始日期，格式：`YYYY-MM-DD`（默认：1 个月前）
</ParamField>

<ParamField query="end_date" type="string">
  结束日期，格式：`YYYY-MM-DD`（默认：今天）
</ParamField>

## 响应参数

<ResponseField name="datas" type="array">
  OHLCV 数据列表，按日期排序

  <Expandable title="数据字段">
    <ResponseField name="market" type="string">
      股票市场（cn / hk / us / global）
    </ResponseField>

    <ResponseField name="date" type="string">
      日期，格式：`YYYY-MM-DD`
    </ResponseField>

    <ResponseField name="symbol" type="string">
      股票代码
    </ResponseField>

    <ResponseField name="open" type="number">
      开盘价（复权）
    </ResponseField>

    <ResponseField name="high" type="number">
      最高价（复权）
    </ResponseField>

    <ResponseField name="low" type="number">
      最低价（复权）
    </ResponseField>

    <ResponseField name="close" type="number">
      收盘价（复权）
    </ResponseField>

    <ResponseField name="volume" type="integer">
      成交量（股）
    </ResponseField>

    <ResponseField name="amount" type="number">
      成交额（元）
    </ResponseField>

    <ResponseField name="chg_percent" type="number">
      涨跌幅（%）
    </ResponseField>

    <ResponseField name="turnover_rate" type="number">
      换手率，ETF 不返回
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="metadata" type="object">
  查询元数据

  <Expandable title="元数据字段">
    <ResponseField name="symbol" type="string">
      股票代码
    </ResponseField>

    <ResponseField name="market" type="string">
      股票市场
    </ResponseField>

    <ResponseField name="start_date" type="string">
      查询开始日期
    </ResponseField>

    <ResponseField name="end_date" type="string">
      查询结束日期
    </ResponseField>

    <ResponseField name="count" type="integer">
      返回数据条数
    </ResponseField>
  </Expandable>
</ResponseField>

## 响应示例

```json theme={null}
{
  "datas": [
    {
      "market": "cn",
      "date": "2026-04-02",
      "symbol": "000001",
      "open": 10.98,
      "high": 11.02,
      "low": 10.93,
      "close": 11.0,
      "volume": 17744106,
      "amount": 194464864.8,
      "chg_percent": 0.1821,
      "turnover_rate": 0.0004
    },
    {
      "market": "cn",
      "date": "2026-04-01",
      "symbol": "000001",
      "open": 10.95,
      "high": 11.0,
      "low": 10.90,
      "close": 10.98,
      "volume": 15321456,
      "amount": 168123456.5,
      "chg_percent": 0.2752,
      "turnover_rate": 0.0004
    }
  ],
  "metadata": {
    "symbol": "000001",
    "market": "cn",
    "start_date": "2026-04-01",
    "end_date": "2026-04-10",
    "count": 2
  }
}
```

## 使用示例

### 获取最近行情

不传日期参数，默认获取最近 1 个月数据：

```python theme={null}
import requests

response = requests.get(
    "https://api.reportify.cn/v1/quant/quotes/ohlcv",
    headers={"Authorization": "Bearer <token>"},
    params={"symbol": "600519", "market": "cn"}
)
data = response.json()

for row in data["datas"][:5]:
    print(f"{row['date']}: 开{row['open']} 高{row['high']} 低{row['low']} 收{row['close']}")
```

### 获取港股数据

```python theme={null}
response = requests.get(
    "https://api.reportify.cn/v1/quant/quotes/ohlcv",
    headers={"Authorization": "Bearer <token>"},
    params={
        "symbol": "00700",
        "market": "hk",
        "start_date": "2026-01-01"
    }
)
```

### 获取美股数据

```python theme={null}
response = requests.get(
    "https://api.reportify.cn/v1/quant/quotes/ohlcv",
    headers={"Authorization": "Bearer <token>"},
    params={
        "symbol": "AAPL",
        "market": "us",
        "start_date": "2026-01-01"
    }
)
```


## OpenAPI

````yaml GET /v1/quant/quotes/ohlcv
openapi: 3.1.0
info:
  title: Reportify API
  version: 1.0.0
  description: API documentation for Reportify's document management and search services.
servers:
  - url: https://api.reportify.cn
    description: Production server
security:
  - BearerAuth: []
paths:
  /v1/quant/quotes/ohlcv:
    get:
      tags:
        - openapi-quant
      summary: Get OHLCV data
      description: >
        Get OHLCV (Open, High, Low, Close, Volume) daily data for a single
        symbol.


        - **symbol**: Stock code (required)

        - **market**: Stock market (cn, hk, us, global), default: cn. For index
        quotes (stock_type=index), indices other than A-share (cn), HK (hk) and
        US (us) are queried via global.

        - **start_date**: Start date (optional, default: 1 months ago)

        - **end_date**: End date (optional, default: today)
      operationId: quote_ohlcv
      parameters:
        - name: symbol
          in: query
          required: true
          schema:
            type: string
            title: Symbol
          description: Stock code (e.g., 600519, 00700, AAPL)
          example: '000001'
        - name: market
          in: query
          required: false
          schema:
            $ref: '#/components/schemas/StockMarket'
            default: cn
        - name: start_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date
              - type: 'null'
            title: Start Date
          example: '2026-04-01'
        - name: end_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                format: date
              - type: 'null'
            title: End Date
          example: '2026-04-28'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OHLCVOutput'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    StockMarket:
      type: string
      enum:
        - cn
        - hk
        - us
        - global
      title: StockMarket
      description: Stock market identifier
    OHLCVOutput:
      type: object
      required:
        - datas
        - metadata
      properties:
        datas:
          type: array
          title: Datas
          description: OHLCV data list sorted by date
          items:
            type: object
            additionalProperties: true
        metadata:
          type: object
          title: Metadata
          description: Query metadata
          additionalProperties: true
      title: OHLCVOutput
      description: OHLCV data response.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Enter your Bearer token

````