nucypher / nuit

NuCypher Staking UI
GNU General Public License v3.0
4 stars 8 forks source link

The ROI estimator #34

Closed vepkenez closed 2 years ago

vepkenez commented 3 years ago

Currently this is the code that calculates ROI.

const calcROI = (amount, duration) => {
    const dailyRewardMultiplier = (.05 * duration + 13.4) // based on plotting actual historical yield from known min stakes.
    const dailyMinNU = dailyRewardMultiplier * duration
    const apr = (365/duration * dailyMinNU / MIN_STAKE) * 100
    const net = dailyMinNU * amount / MIN_STAKE
    return { apr, net }
}
Screen Shot 2021-04-27 at 09 14 45 Screen Shot 2021-04-27 at 09 14 34

Can these be improved upon? Or should we just modify that coefficient (.05 * duration + 13.4) from time to time based on staked NU. (this creates perfect results if calibrated to real world values)

cygnusv commented 3 years ago

Here's a pseudo-code formula for computing rewards for next period. It assumes we know the locked value, which is the total amount of NU committed in the network to current period. Other known value is the period_issuance = 7,017,566.353.

kappa = 0.5*(1+min(duration, 52)/52)
share = stake / locked
next_rewards = share * kappa * period_issuance

With today's locked value locked = 549.30e6, and a 15000 stake, next periods rewards are 97.65865035631013 for a stake duration of 1 week, and 191.6320686237029 for 52 weeks.

What about ROI? Well, this depends on many factors about the staker and the network overall. A very simplistic assumption is to assume that the locked value will remain the same during the year. In that case, the yearly ROI with re-staking off would be duration*next_rewards/stake, and with re-staking 1 - (1+next_rewards/stake)**duration. Note that the latter is overly simplified as the assumption that locked remains the same is not consistent with this staker re-staking, but it can be an acceptable approximation. With current numbers and duration = 52 weeks, ROI with restaking OFF/ON is 66.43% and 93.5% respectively; for duration = 4 weeks, ROI with restaking OFF/ON is 5.11% and 5.21% respectively.

vepkenez commented 3 years ago

![Uploading Screen Shot 2021-05-15 at 09.02.45.png…]()