ROA calculation

I try to calculate the ROA of our Pool based on the Pool Data I get from the blockfrost Pool History Endpoint: https://cardano-mainnet.blockfrost.io/api/v0/pools/<poolID>/history/
But I’am not sure my calculation is right.
The Basic calculation looks like this:

let allIncome = rewards + fees;
let fixedFee = 340;

if (allIncome < fixedFee) 
  { fixedFee = allIncome }

allIncome = allIncome - fixedFee
const distributedrewards = allIncome - allIncome * margin_cost

const ROI = (distributedrewards / (activeStake - activePledge)) * epochsPerYear * 100

Am I doing it right ?

1 Like

Have look at this Cardano Reward Calculator - Dynamic Strategies

1 Like

thnx @tomdx that’s a great resource.
But from what I understand it’s primary meant to calculate the prjected future rewards.
What I try is to simple calculate ROI based on historic Data from previous Epochs.

1 Like

I think there is one mistake in your script. Pledge is also awarded with rewards. So you dont need to substract it from the active stake. Besides of that i think it looks good.

2 Likes

If you want a historical ROI to date rather than a projection you could simply query Cardano DB sync for all the blocks (UTXO) that produced rewards from your pool and sum them?

Something like this maybe:

select
  sum(reward.amount) as total_lovelace
from reward 
  inner join pool_hash on reward.pool_id = <your pool hash id here>
where reward.epoch_no > 239 -- 240 was first epoch of 2021
2 Likes

Cool thnx - that was uncertain about that point.

1 Like