> For the complete documentation index, see [llms.txt](https://docs.quipuswap.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.quipuswap.com/smart-contracts/dex-2.0/dexcore-contract/on-chain-views-overview/get_cumulative_prices.md).

# get\_cumulative\_prices

This on-chain view returns cumulative prices and last timestamp of its calculation for a liquidity pool (pair). Also can return a list of cumulative prices for a list of liquidity pools.

### Call parameters

```pascaligo
type token_id_t         is nat

type cum_prices_req_t   is token_id_t

list(cum_prices_req_t)
```

| Field               | Type               | Description                                         |
| ------------------- | ------------------ | --------------------------------------------------- |
| cum\_prices\_req\_t | token\_id\_t (nat) | Pair ID for which you need to get cumulative prices |

### Return type

```pascaligo
type token_id_t         is nat

type cum_prices_t       is [@layout:comb] record [
  last_block_timestamp    : timestamp;
  token_a_price_cml       : nat;
  token_b_price_cml       : nat;
]

type cum_prices_req_t   is token_id_t

type cum_prices_res_t   is [@layout:comb] record [
  request                 : cum_prices_req_t;
  cumulative_prices       : cum_prices_t;
]

list(cum_prices_res_t)
```

#### cum\_prices\_t

<table><thead><tr><th>Field</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td>last_block_timestamp</td><td>timestamp</td><td>Last timestamp of cumulative prices calculation</td></tr><tr><td>token_a_price_cml</td><td>nat</td><td>Cumulative price of token A</td></tr><tr><td>token_b_price_cml</td><td>nat</td><td>Cumulative price of token B</td></tr></tbody></table>

#### cum\_prices\_res\_t

| Field              | Type                            | Description                |
| ------------------ | ------------------------------- | -------------------------- |
| request            | cum\_prices\_req\_t (nat)       | Cumulative prices request  |
| cumulative\_prices | [cum\_prices\_t](#cum_prices_t) | Cumulative prices response |

### Usage

{% tabs %}
{% tab title="🌮 Taquito" %}

```javascript
const dexCoreAddress = "KT1...";
const params = [0, 1, 15];
const viewCaller = "tz1...";
const dexCore = await tezos.contract.at(dexCoreAddress);
const cumulativePrices = await dexCore.contract.contractViews.get_cumulative_prices(params).executeView({ viewCaller: viewCaller });
```

{% endtab %}
{% endtabs %}

### Errors

* `108` - pair (pool) with the specified `token_id` not listed.


---

# 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://docs.quipuswap.com/smart-contracts/dex-2.0/dexcore-contract/on-chain-views-overview/get_cumulative_prices.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.
