Skip to main content

Candles

Get historical price candles for an index.

Endpoint

https://api.marketdata.app/v1/indices/candles/{resolution}/{symbol}/

Method

GET

Request Example

Response Example

{
"s": "ok",
"c": [22.84, 23.93, 21.95, 21.44, 21.15],
"h": [23.27, 24.68, 23.92, 22.66, 22.58],
"l": [22.26, 22.67, 21.68, 21.44, 20.76],
"o": [22.41, 24.08, 23.86, 22.06, 21.5],
"t": [1659326400, 1659412800, 1659499200, 1659585600, 1659672000]
}

Request Parameters

  • resolution string

    The duration of each candle.

    Minutely Resolutions: (minutely, 1, 3, 5, 15, 30, 45, ...) Hourly Resolutions: (hourly, H, 1H, 2H, ...) Daily Resolutions: (daily, D, 1D, 2D, ...) Weekly Resolutions: (weekly, W, 1W, 2W, ...) Monthly Resolutions: (monthly, M, 1M, 2M, ...) Yearly Resolutions:(yearly, Y, 1Y, 2Y, ...)

  • symbol string

    The index symbol, without any leading or trailing index identifiers. For example, use DJI do not use $DJI, ^DJI, .DJI, DJI.X, etc.

  • from date

    The leftmost candle on a chart (inclusive). If you use countback, to is not required. Accepted timestamp inputs: ISO 8601, unix, spreadsheet.

  • to date

    The rightmost candle on a chart (inclusive). Accepted timestamp inputs: ISO 8601, unix, spreadsheet.

  • countback number

    Will fetch a number of candles before (to the left of) to. If you use from, countback is not required.

Response Attributes

  • s string

    Will always be ok when there is data for the candles requested.

  • o array[number]

    Open price.

  • h array[number]

    High price.

  • l array[number]

    Low price.

  • c array[number]

    Close price.

  • t array[number]

    Candle time (Unix timestamp, UTC). Daily, weekly, monthly, yearly candles are returned without times.