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

# Lấy dữ liệu nến

> Trả về dữ liệu nến cho biểu đồ và phân tích chuỗi thời gian.

## Endpoint

```text theme={null}
GET /oapi/priceboard/candlestick-data
```

Trả về dữ liệu nến cho biểu đồ và phân tích chuỗi thời gian.

## Các trường bắt buộc

* `symbol` — Mã chứng khoán. Ví dụ: `ACB`
* `resolution` — Độ phân giải của nến. Ví dụ: `1D`
* `from` — Thời gian bắt đầu dưới dạng Unix timestamp. Ví dụ: `1735257600`
* `to` — Thời gian kết thúc dưới dạng Unix timestamp. Ví dụ: `1774051200`

## Khung thời gian hỗ trợ

`1`, `5`, `15`, `30`, `60`, `120`, `1D`, `1W`, `1M`

## Mô tả trường

* `t` (`number[]`) — Thời gian dưới dạng Unix timestamp. Ví dụ: `1744685220`, `1744685280`
* `o` (`number[]`) — Giá mở cửa. Ví dụ: `64200`, `60000`
* `h` (`number[]`) — Giá cao nhất. Ví dụ: `64200`, `60000`
* `l` (`number[]`) — Giá thấp nhất. Ví dụ: `64200`, `60000`
* `c` (`number[]`) — Giá đóng cửa. Ví dụ: `64200`, `60000`
* `v` (`number[]`) — Khối lượng khớp tương ứng. Ví dụ: `60400`, `1200`
* `s` (`string`) — Trạng thái. Ví dụ: `ok`
* `nextTime` (`number | null`) — Dùng cho truy vấn tiếp theo.

## cURL

```bash theme={null}
curl -G "$BASE_URL/oapi/priceboard/candlestick-data" \
  --data-urlencode "symbol=ACB" \
  --data-urlencode "resolution=1D" \
  --data-urlencode "from=1735257600" \
  --data-urlencode "to=1774051200"
```

## Python

```python theme={null}
import requests

BASE_URL = "https://api.example.com"

params = {
    "symbol": "ACB",
    "resolution": "1D",
    "from": 1735257600,
    "to": 1774051200,
}

response = requests.get(
    f"{BASE_URL}/oapi/priceboard/candlestick-data",
    params=params,
)
response.raise_for_status()

print(response.json())
```

## Ví dụ phản hồi

```json theme={null}
{
    "t": [
        1735278140,
        1735536640
    ],
    "o": [
        25600,
        25350
    ],
    "h": [
        25700,
        25650
    ],
    "l": [
        25500,
        25350
    ],
    "c": [
        25550,
        25400
    ],
    "v": [
        7689900,
        5000400
    ],
    "s": "ok",
    "nextTime": null
}
```

> Thay `BASE_URL` bằng host API của bạn.
