pub fn calculate_hpr_given_apy(
apy: I256,
position_duration: FixedPoint<U256>,
) -> Result<I256>
Expand description
Calculate the holding period return (HPR) given a compounding, annualized rate (APY).
Since the rate is compounding, we calculate the hpr as:
\text{hpr} = (1 + \text{apy})^{t} - 1
where $t$
is the holding period, in units of years. For example, if the
holding period is 6 months, then $t=0.5$
.