> For the complete documentation index, see [llms.txt](https://gitbook-docs.coinmetrics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook-docs.coinmetrics.io/cm-api-spec/timeseries/timeseries-stream/market-candles.md).

# Market candles

Returns a stream of candles for specified markets.\
If you are falling behind (slow client) you will get `warning` message first, then `error` message and disconnection will happen.

```json
{"openapi":"3.0.2","info":{"title":"Coin Metrics API v4","version":"4.0.0"},"tags":[{"name":"Timeseries stream","description":"WebSocket endpoints for getting a real-time stream of metrics, market data, indexes and other time series data.\n\n**Endpoints on this page:**\n- `GET /timeseries-stream/asset-metrics` — Asset metrics\n- `GET /timeseries-stream/asset-quotes` — Asset quotes\n- `GET /timeseries-stream/index-levels` — Index levels\n- `GET /timeseries-stream/market-candles` — Market candles\n- `GET /timeseries-stream/market-contract-prices` — Market contract prices\n- `GET /timeseries-stream/market-liquidations` — Market liquidations\n- `GET /timeseries-stream/market-openinterest` — Market open interest\n- `GET /timeseries-stream/market-orderbooks` — Market orderbooks\n- `GET /timeseries-stream/market-quotes` — Market quotes\n- `GET /timeseries-stream/market-trades` — Market trades\n- `GET /timeseries-stream/pair-quotes` — Pair quotes"}],"servers":[{"url":"https://api.coinmetrics.io/v4"},{"url":"wss://api.coinmetrics.io/v4"},{"url":"https://community-api.coinmetrics.io/v4"}],"security":[{"api_key":[]}],"components":{"securitySchemes":{"api_key":{"description":"Coin Metrics API key can be specified as `?api_key=` query parameter.","in":"query","name":"api_key","type":"apiKey"}},"parameters":{"MarketId":{"description":"Comma separated list of markets or market patterns like `exchange-*` or `exchange-*-spot` or `*USDT-future`.<br/> Use a corresponding `/catalog-all-v2/market-{dataType}` endpoint for the full list of supported markets for a given data type.","in":"query","name":"markets","required":true,"schema":{"type":"array","items":{"type":"string"}},"explode":false},"StreamingCandleFrequency":{"description":"Candle duration. Supported values are `1m`, `5m`, `10m`, `15m`, `30m`, `1h`, `4h`, `1d`.","in":"query","name":"frequency","schema":{"default":"1m","type":"string"}},"Backfill":{"description":"What data should be sent upon a connection.<br/> By default the latest values are sent just before real-time data.","in":"query","name":"backfill","schema":{"type":"string","default":"latest","enum":["latest","none"]}},"Pretty":{"description":"Human-readable formatting of JSON responses.","in":"query","name":"pretty","schema":{"type":"boolean","default":false}}},"responses":{"StreamingMarketCandles":{"description":"Candle WebSocket message.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StreamingMarketCandle"}}}},"Unauthorized":{"description":"Requested resource requires authorization.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Requested resource is not available with supplied credentials."},"UriTooLong":{"description":"Provided URI is too long. It must not be greater than 10000 symbols."}},"schemas":{"StreamingMarketCandle":{"allOf":[{"$ref":"#/components/schemas/MarketCandle"},{"type":"object","properties":{"cm_sequence_id":{"$ref":"#/components/schemas/cmSequenceId"}},"required":["cm_sequence_id"]}]},"MarketCandle":{"description":"Information about market candle.","properties":{"market":{"$ref":"#/components/schemas/MarketId"},"time":{"$ref":"#/components/schemas/Time"},"price_open":{"$ref":"#/components/schemas/CandlePriceOpen"},"price_close":{"$ref":"#/components/schemas/CandlePriceClose"},"price_high":{"$ref":"#/components/schemas/CandlePriceHigh"},"price_low":{"$ref":"#/components/schemas/CandlePriceLow"},"vwap":{"$ref":"#/components/schemas/CandleVwap"},"volume":{"$ref":"#/components/schemas/CandleVolume"},"candle_usd_volume":{"$ref":"#/components/schemas/CandleUsdVolume"},"candle_trades_count":{"$ref":"#/components/schemas/CandleTradesCount"}},"type":"object","required":["market","time","price_open","price_close","price_high","price_low","vwap","volume","candle_usd_volume","candle_trades_count"]},"MarketId":{"description":"Unique name of the market.","type":"string"},"Time":{"description":"The time in ISO 8601 date-time format. Always with nanoseconds precision.","type":"string","format":"date-time"},"CandlePriceOpen":{"description":"The opening price of the candle.","type":"string","format":"decimal"},"CandlePriceClose":{"description":"The closing price of the candle.","type":"string","format":"decimal"},"CandlePriceHigh":{"description":"The high price of the candle.","type":"string","format":"decimal"},"CandlePriceLow":{"description":"The low price of the candle.","type":"string","format":"decimal"},"CandleVwap":{"description":"The volume-weighted average price of the candle.","type":"string","format":"decimal"},"CandleVolume":{"description":"The volume of the candle in units of the base asset.","type":"string","format":"decimal"},"CandleUsdVolume":{"description":"The volume of the candle in USD.","type":"string","format":"decimal"},"CandleTradesCount":{"description":"The number of trades used for candle calculation.","type":"string","format":"int64"},"cmSequenceId":{"description":"The monotonically increasing message number, resets on disconnection.","type":"string"},"ErrorResponse":{"properties":{"error":{"$ref":"#/components/schemas/ErrorObject"}},"required":["error"],"type":"object"},"ErrorObject":{"properties":{"type":{"description":"Error type string. Can be used for error identification.","type":"string"},"message":{"description":"Human-friendly error description. Can be amended without prior notification. Do not use for error identification in your code.","type":"string"}},"required":["type","description"],"type":"object"}}},"paths":{"/timeseries-stream/market-candles":{"get":{"summary":"Market candles","description":"Returns a stream of candles for specified markets.<br/> If you are falling behind (slow client) you will get `warning` message first, then `error` message and disconnection will happen.","operationId":"getTimeseriesStreamMarketCandles","tags":["Timeseries stream"],"parameters":[{"$ref":"#/components/parameters/MarketId"},{"$ref":"#/components/parameters/StreamingCandleFrequency"},{"$ref":"#/components/parameters/Backfill"},{"$ref":"#/components/parameters/Pretty"}],"responses":{"200":{"$ref":"#/components/responses/StreamingMarketCandles"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"414":{"$ref":"#/components/responses/UriTooLong"}}}}}}
```


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gitbook-docs.coinmetrics.io/cm-api-spec/timeseries/timeseries-stream/market-candles.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
