> For the complete documentation index, see [llms.txt](https://docs.lighter.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lighter.xyz/api/candlesticks/candles.md).

# candles

Get candles data. Returns at most 500 candles per call. Zero values are omitted from the response.

```json
{"openapi":"3.0.0","info":{"title":"Lighter API","version":"1.0.0"},"tags":[{"name":"candlesticks"}],"servers":[{"url":"https://mainnet.zklighter.elliot.ai","description":"Lighter mainnet"},{"url":"https://api.testnet.lighter.xyz","description":"Lighter testnet"},{"url":"https://api.rh.lighter.xyz","description":"Lighter on Robinhood Chain mainnet"},{"url":"https://api.rh-testnet.lighter.xyz","description":"Lighter on Robinhood Chain testnet"}],"paths":{"/api/v1/candles":{"get":{"summary":"candles","operationId":"candles","tags":["candlesticks"],"description":"Get candles data. Returns at most 500 candles per call. Zero values are omitted from the response.","parameters":[{"name":"market_id","in":"query","required":true,"schema":{"type":"integer","format":"int16"},"description":"Public market identifier returned by orderBooks or events."},{"name":"resolution","in":"query","required":true,"schema":{"type":"string","enum":["1m","5m","15m","30m","1h","4h","12h","1d"]},"description":"Time interval for each returned data point. Allowed values: 1m, 5m, 15m, 30m, 1h, 4h, 12h, 1d."},{"name":"start_timestamp","in":"query","required":true,"schema":{"type":"integer","format":"int64","minimum":0,"maximum":5000000000000},"description":"Inclusive start of the requested time range, as a Unix timestamp in milliseconds. These history endpoints also accept Unix seconds."},{"name":"end_timestamp","in":"query","required":true,"schema":{"type":"integer","format":"int64","minimum":0,"maximum":5000000000000},"description":"End of the requested time range, as a Unix timestamp in milliseconds. These history endpoints also accept Unix seconds."},{"name":"count_back","in":"query","required":true,"schema":{"type":"integer","format":"int64"},"description":"Backward-window sizing hint when start_timestamp is 0. An explicit start/end range takes precedence; this is not a strict limit on response length."},{"name":"set_timestamp_to_end","in":"query","required":false,"schema":{"type":"boolean","default":false},"description":"Use the end of each candle interval for its timestamp instead of the start."},{"name":"merge_mark_price","in":"query","required":false,"schema":{"type":"boolean","default":false},"description":"Merge mark-price samples into trade candle prices."}],"responses":{"200":{"description":"A successful response.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Candles"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultCode"}}}}}}}},"components":{"schemas":{"Candles":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"r":{"type":"string","description":"Resolution"},"c":{"type":"array","items":{"$ref":"#/components/schemas/Candle"},"description":"Array of candles (max 500 per call)"},"message":{"type":"string"}},"title":"Candles","required":["code","r","c"]},"Candle":{"type":"object","properties":{"t":{"type":"integer","format":"int64","description":"Timestamp Unix timestamp in milliseconds."},"o":{"type":"number","format":"double","description":"Open price"},"h":{"type":"number","format":"double","description":"High price"},"l":{"type":"number","format":"double","description":"Low price"},"c":{"type":"number","format":"double","description":"Close price"},"v":{"type":"number","format":"double","description":"Base token volume (volume0)"},"V":{"type":"number","format":"double","description":"Quote token volume (volume1)"},"i":{"type":"integer","format":"int64","description":"Last trade ID"},"C":{"type":"number","format":"double","description":"Unadjusted close price, present only when it differs from c."},"H":{"type":"number","format":"double","description":"Unadjusted high price, present only when it differs from h."},"L":{"type":"number","format":"double","description":"Unadjusted low price, present only when it differs from l."},"O":{"type":"number","format":"double","description":"Unadjusted open price, present only when it differs from o."}},"title":"Candle","description":"Abbreviated candle format. Zero values are omitted. Fields with zero or empty values may be omitted; handle optional properties when decoding responses.","required":["t","o","h","l","c","v","V","i"]},"ResultCode":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}},"title":"ResultCode","required":["code"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.lighter.xyz/api/candlesticks/candles.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
