Skip to content

Get candles data by count

GetChartDataByCount

Description:
Returns candle data from local quote storage for the requested symbol and timeframe using only a candle count.

Unlike GetChartData, this method does not use from or to. It reads candles from the end of available history.

If the symbol has an external source, the server resolves it and reads history using that source name.

HTTP route exposed by the same handler:

GET /quotes/candles/count

Parameters

Name Type Required Description
symbol string Yes Internal symbol name
frame string Yes Candle timeframe, for example 1M, 5M, 1H, 1D
count int No Maximum number of candles to return. 0 or omitted means all available candles after offset
offset int No Number of latest candles to skip before applying count. 0 or omitted means no skip

Behavior

  • The method aggregates stored minute history into the requested frame.
  • The current in-memory candle is included when available.
  • count > 0 returns up to count candles.
  • count = 0 or missing count returns all available candles after offset.
  • offset = 1 skips the latest candle and returns data before it.
  • Negative offset values are treated as 0.
  • If offset is greater than or equal to available candle count, data is empty.

Response

Field Type Description
structure array Candle field order
data array Candle list

Each candle is returned as:

[open, high, low, close, volume, time]

Example Request

{
  "symbol": "EURUSD",
  "frame": "1H",
  "count": 100,
  "offset": 0
}

Example Successful Response

{
  "structure": ["open", "high", "low", "close", "volume", "time"],
  "data": [
    [1.1000, 1.1020, 1.0990, 1.1015, 1200, 1712448000],
    [1.1015, 1.1050, 1.1000, 1.1045, 980, 1712451600]
  ]
}

Errors

Code Description
400 Invalid request payload
401 Symbol not found or symbol resolution failed