w3f / staking-rewards-collector

Apache License 2.0
78 stars 32 forks source link

How to calculate `startBalance`? #46

Open TriplEight opened 2 years ago

TriplEight commented 2 years ago

I think this either can be implemented programmatically or explained how to figure its precise amount in the README. I couldn't retrieve it either from subscan.io or polkascan.io.

TriplEight commented 2 years ago

I just realized it doesn't affect the outcome.

jonasW3F commented 2 years ago

The startBalance does not affect anything except the calculated annualized return in the .json files. For this number to be correct you need the following properties: 1) The stake generating the staking rewards should not change (except getting the rewards). 2) The starting balance is set correctly.

Solving this programmatically would be (too) complex. Even if there is an API call that gives you the balance of an account at a certain date from subscan (which I believe is not available), you'd need to account for withdrawals and deposits on the account that generates the stake (which might not even be the one that receives the staking rewards).

Therefore, this is only really viable for people that want to estimate their staking APY by noting the starting balance and not touching the underlying stash.