> For the complete documentation index, see [llms.txt](https://magma-finance-1.gitbook.io/magma-developer-sdk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://magma-finance-1.gitbook.io/magma-developer-sdk/clmm_contract/23.apr-correlation-calculation.md).

# 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://magmafinance.io/api/v2/sui/swap/count>

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

## 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 Magma 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
) {}
```

Param explanation

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

Price Statistics API

* Mainnet: <https://magmafinance.io/api/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`.

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