Function calculate_hpr_given_apr

Source
pub fn calculate_hpr_given_apr(
    apr: I256,
    position_duration: FixedPoint<U256>,
) -> Result<I256>
Expand description

Calculate the holding period return (HPR) given a non-compounding, annualized rate (APR).

Since the rate is non-compounding, we calculate the hpr as:

\text{hpr} = \text{apr} \cdot t

where $t$ is the holding period, in units of years. For example, if the holding period is 6 months, then $t=0.5$.