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

  • Testnet: https://api-sui.devcetus.com/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

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.

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 cetus statistics interface.

Price Statistics API

  • Mainnet: 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.

{
"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.

Last updated