> For the complete documentation index, see [llms.txt](https://docs.42.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.42.space/for-developers/rest-api-alpha/markets/get-price-history.md).

# Get price history

GET /api/v1/market-data/prices/history

## Get price history

> Returns a historical price series for a single outcome token — the last traded price, step-held between trades (built from the outcome's on-chain trades). Every mode includes the market seed's carried-forward bootstrap price before the outcome's first genuine trade, so young markets chart a line from market open. Two modes:\
> \*\*Duration mode\*\* (default): control the lookback with \`duration\` (bucket size is chosen for you); \`start\_ts\` filters results after fetch.\
> \*\*Range mode\*\* (pass \`interval\`): step-fills buckets at the given interval over the explicit \`\[start\_ts, end\_ts]\` window for zoomable line charts. The first point is anchored from the last trade (or seed) before \`start\_ts\` (so adjacent windows connect) or, if the market did not exist yet, the series begins at the seed. A window that would exceed \~10k buckets is rejected unless \`changes\_only=true\`.\
> \*\*changes\_only auto mode\*\* (\`changes\_only=true\`): returns the real price change points for the window (\`start\_ts\`/\`end\_ts\`, or \`end\_ts\`−\`duration\` if no \`start\_ts\`); \`interval\` is ignored. Resolution scales with trade density — sparse outcomes return exact change points, very active outcomes read the close price from a pre-aggregated bucket so the chart stays cheap and renderable. Capped at \`fidelity\` else \~1000 points.\
> Use \`fidelity\` in either mode to cap the number of points (downsampled if exceeded).

```json
{"openapi":"3.1.1","info":{"title":"FortyTwo Read API","version":"1.0"},"tags":[{"description":"GET /api/v1/market-data/prices/history","name":"get-price-history"}],"servers":[{"url":"https://rest.ft.42.space/"}],"paths":{"/api/v1/market-data/prices/history":{"get":{"description":"Returns a historical price series for a single outcome token — the last traded price, step-held between trades (built from the outcome's on-chain trades). Every mode includes the market seed's carried-forward bootstrap price before the outcome's first genuine trade, so young markets chart a line from market open. Two modes:\n**Duration mode** (default): control the lookback with `duration` (bucket size is chosen for you); `start_ts` filters results after fetch.\n**Range mode** (pass `interval`): step-fills buckets at the given interval over the explicit `[start_ts, end_ts]` window for zoomable line charts. The first point is anchored from the last trade (or seed) before `start_ts` (so adjacent windows connect) or, if the market did not exist yet, the series begins at the seed. A window that would exceed ~10k buckets is rejected unless `changes_only=true`.\n**changes_only auto mode** (`changes_only=true`): returns the real price change points for the window (`start_ts`/`end_ts`, or `end_ts`−`duration` if no `start_ts`); `interval` is ignored. Resolution scales with trade density — sparse outcomes return exact change points, very active outcomes read the close price from a pre-aggregated bucket so the chart stays cheap and renderable. Capped at `fidelity` else ~1000 points.\nUse `fidelity` in either mode to cap the number of points (downsampled if exceeded).","tags":["get-price-history"],"summary":"Get price history","parameters":[{"schema":{"type":"string"},"description":"Market contract address","name":"market","in":"query","required":true},{"schema":{"type":"string"},"description":"Outcome token ID (provide token_id or outcome_index, not both)","name":"token_id","in":"query"},{"schema":{"type":"integer"},"description":"Outcome index, 0-based (provide token_id or outcome_index, not both)","name":"outcome_index","in":"query"},{"schema":{"type":"string","enum":["1s","10s","1m","3m","30m","2h","6h","12h","1d"]},"description":"Bucket interval (range mode, changes_only=false). IGNORED when changes_only=true — that mode auto-picks resolution by trade density.","name":"interval","in":"query"},{"schema":{"type":"string","enum":["1h","4h","24h","7d","30d","90d","180d","1y","all"]},"description":"Lookback duration (duration mode, default 24h)","name":"duration","in":"query"},{"schema":{"type":"integer"},"description":"End unix timestamp (default: now)","name":"end_ts","in":"query"},{"schema":{"type":"integer"},"description":"Range mode: window start (required). Duration mode: filters results after fetch.","name":"start_ts","in":"query"},{"schema":{"type":"integer"},"description":"Max data points returned — downsamples if the window contains more","name":"fidelity","in":"query"},{"schema":{"type":"boolean"},"description":"Return only step edges — drop flat gap-filled buckets where price/payout/collateral/minted_quantity are unchanged (default false; for step-rendered charts)","name":"changes_only","in":"query"}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"$ref":"#/components/schemas/internal_handler.PriceHistoryResponse"}}}},"400":{"description":"Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ft_market-service-v2_pkg_api.ErrorResponse"}}}},"404":{"description":"Not Found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ft_market-service-v2_pkg_api.ErrorResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ft_market-service-v2_pkg_api.ErrorResponse"}}}}}}}},"components":{"schemas":{"internal_handler.PriceHistoryResponse":{"description":"Historical price series.","type":"object","properties":{"history":{"type":"array","items":{"$ref":"#/components/schemas/internal_handler.PriceHistoryPoint"}},"outcomeName":{"type":"string"}}},"internal_handler.PriceHistoryPoint":{"description":"One point on the price line. `p` is the last traded price at/at-or-before","type":"object","properties":{"collateral":{"type":"number"},"mintedQuantity":{"type":"number"},"p":{"type":"number"},"payout":{"type":"number"},"t":{"type":"integer"},"v":{"type":"number"}}},"ft_market-service-v2_pkg_api.ErrorResponse":{"type":"object","properties":{"code":{"type":"integer"},"error":{"type":"string"},"message":{"type":"string"}}}}}}
```


---

# 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.42.space/for-developers/rest-api-alpha/markets/get-price-history.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.
