# APR correlation calculation

## 1. **Pool APR**

We have integrated the calculation of the pool's APR into our statistics service, and now you can directly obtain these data through the statistics interface.

**Pool Info API**

* Mainnet:  <https://api-sui.cetus.zone/v2/sui/swap/count&#x20>;
* Testnet:  <https://api-sui.devcetus.com/v2/sui/swap/count&#x20>;

There are three type apr you can get.

* 24 h: data.pools\[x].apr\_24h
* 7 day: data.pools\[x].apr\_7day
* 30 day: data.pools\[x].apr\_30day

## 2. **Position APR**

1.We use the `estPositionAPRWithMultiMethod` method in the SDK to calculate the multi coefficient `m`, and the parameters passed to this method come from the Cetus statistics interface. 2. Use coefficient `m` multiply the reward APRs respectively and then add them together.

```typescript
export function estPositionAPRWithMultiMethod(
  lowerUserPrice: number,
  upperUserPrice: number,
  lowerHistPrice: number,
  upperHistPrice: number
) {}
```

&#x20;**Param explanation**

* lowerUserPrice and upperUserPrice are the price of one position.
* lowerHistPrice and upperHistPrice are come from the cetus statistics interface.

**Price Statistics API**

* Mainnet: [ ](https://api-sui.cetus.zone/v2/sui/contract/price)<https://api-sui.cetus.zone/v2/sui/contract/price>
* Testnet:  <https://api-sui.devcetus.com/v2/sui/contract/price>

lowerHistPrice and upperHistPrice come from data.list\[x].data\[x].\
there are three types `before_24_h_xx 、` `before_7_d_xx` and `before_30_d_xx.`

```json
{
"is_forward": true,
"swap_account": "0x06f18e7826ee6c6d5bdc29ab3bed659d5dcd319cc184a008ce06b118f015cee4",
"data": [
            {
                "key": "now_contract_price",
                "value": "0.9992102901095463005800349572310369144473236243054765866662672742"
            },
            {
                "key": "now_contract_price_highest",
                "value": "0.9992102901095463005800349572310369144473236243054765866662672742"
            },
            {
                "key": "now_contract_price_lowest",
                "value": "0.9992102901095463005800349572310369144473236243054765866662672742"
            },
            {
                "key": "before_24_h_contract_price",
                "value": "0.9992102901095463005800349572310369144473236243054765866662672742"
            },
            {
                "key": "before_24_h_contract_price_highest",
                "value": "0.9992102901095463005800349572310369144473236243054765866662672742"
            },
            {
                "key": "before_24_h_contract_price_lowest",
                "value": "0.9992102901095463005800349572310369144473236243054765866662672742"
            },
            {
                "key": "before_7_d_contract_price",
                "value": "0.9992102901095463005800349572310369144473236243054765866662672742"
            },
            {
                "key": "before_7_d_contract_price_highest",
                "value": "0.9992102901095463005800349572310369144473236243054765866662672742"
            },
            {
                "key": "before_7_d_contract_price_lowest",
                "value": "0.9992102901095463005800349572310369144473236243054765866662672742"
            },
            {
                "key": "before_30_d_contract_price",
                "value": "0.9992102901095463005800349572310369144473236243054765866662672742"
            },
            {
                "key": "before_30_d_contract_price_highest",
                "value": "0.9999999999999999999972756370986134019159358813153087168627718612"
            },
            {
                "key": "before_30_d_contract_price_lowest",
                "value": "0.9992102901095463005800349572310369144473236243054765866662672742"
            }
        ],
    "ticks": {
        "now": {
        "lower": 68800,
        "upper": 69200,
        "raw_lower": 69073,
        "raw_upper": 69073
        },
        "day": {
        "lower": 68800,
        "upper": 69200,
        "raw_lower": 69073,
        "raw_upper": 69073
        },
        "week": {
        "lower": 68800,
        "upper": 69200,
        "raw_lower": 69073,
        "raw_upper": 69073
        },
        "month": {
        "lower": 68800,
        "upper": 69200,
        "raw_lower": 69073,
        "raw_upper": 69081
        }
    }
},
```

The pool rewards apr come from the above mentioned pool info API,  `data.pools[x].rewarder_apr`.


---

# Agent Instructions: 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:

```
GET https://cetus-1.gitbook.io/cetus-developer-docs/developer/via-sdk/features-available/apr-correlation-calculation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
