---
title: "GetHistoricalPrices"
method: POST
path: "/price_service.v1.PriceService/GetHistoricalPrices"
tags: ["Prices"]
---

# GetHistoricalPrices

`POST /price_service.v1.PriceService/GetHistoricalPrices`

## Request

- Base URL: `https://api.fairground.fi`
- URL: `https://api.fairground.fi/price_service.v1.PriceService/GetHistoricalPrices`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/fairground/apis/fairground-fi-api/docs/price_service.v1.PriceService/GetHistoricalPrices/post.ts> (a function with typed inputs; its response is checked against the schema)

Returns OHLC candlestick data for one market over a time range.

 Unlike most other endpoints, `market` only accepts the numeric
 `market_id` form of `MarketSelector`.

## Headers

- `Connect-Protocol-Version` 1, required: Define the version of the Connect protocol. If omitted, use 1.
- `Connect-Timeout-Ms` number: Define the timeout, in ms

## Request body

- PriceServiceV1GetHistoricalPricesRequest
  - `market` union, required: Market to fetch history for. Only the `market_id` form is supported. `market_symbol` selector is not resolved and is treated as unset. Must be non-zero.
    - object
      - `marketId` string, int64, required
    - object
      - `marketSymbol` BaseObjectsV1MarketSymbol, required
        - `assetSymbol` string: Underlying asset symbol, e.g. `"BTC"`. Matched case-insensitively and trimmed.
        - `quoteSymbol` string: Quote symbol, e.g. `"PERP"`. Technically optional, but omitting it looks up a market named exactly by `assetSymbol` alone (e.g. `"BTC"`) rather than `"BTC-PERP"`, which will not resolve to any real market. In practice, always set this.
  - `startTime` string, date-time
  - `endTime` string, date-time
  - `limit` integer: Accepted but currently ignored by the server; no limit is applied.
  - `interval` string: Candle interval. Supported values: `1S`, `1`, `60`, `1D`, `1W`, `1M`.

## Response `200`

Success

- PriceServiceV1GetHistoricalPricesResponse
  - `prices` BaseObjectsV1Price[]: Always empty. This endpoint returns data via `priceCandleSticks` instead.
    - `marketId` string, int64: On-chain market identifier.
    - `marketName` string: Same value as `symbol` on this object (both are set from whichever selector form the request used — see `symbol`).
    - `symbol` string: Echoes back however the market was identified in the request: the bare asset symbol (e.g. `"BTC"`) if the request used `market_symbol`, or the full market name (e.g. `"BTC-PERP"`) if the request used `market_id`. `marketName` always mirrors this same value.
    - `price` number, float: Current price in USD.
    - `volume24h` number, float: 24-hour trading volume in the market's quote units.
    - `priceChange24h` number, float: 24-hour price change, as a percentage.
    - `timestamp` string, date-time
    - `source` string: Price feed source
  - `totalCount` integer: Always `0`. Not populated by this endpoint.
  - `priceCandleSticks` BaseObjectsV1CandleStick[]: OHLC candles for the requested market and time range.
    - `timestamp` string, date-time
    - `open` number, float: Opening price for this interval, in USD.
    - `high` number, float: Highest price during this interval, in USD.
    - `low` number, float: Lowest price during this interval, in USD.
    - `close` number, float: Closing price for this interval, in USD.
    - `mid` number, float: Always `0`. Not currently populated by `GetHistoricalPrices`.
    - `volume` integer: Always `0`. Not currently populated by `GetHistoricalPrices`.

---

[API](https://skmtc.dev/fairground/apis/fairground-fi-api.md) - [All operations](https://skmtc.dev/fairground/apis/fairground-fi-api/llms.txt) - [OpenAPI document](https://skmtc.dev/fairground/apis/fairground-fi-api/revisions/be66e6dc0ac0?raw)
