Estimate curation reward before voting

I'm currently interested in Steemit curation. I play around with stuff, experiment and try different approaches. One thing I keep asking myself is “How much will I earn if I upvote this post right now and it will eventually become worth X?”

seer-crystal-ball.jpg
(image source)

It proved to be a surprisingly hard question to answer! API makes all kinds of things available at whim, but you're out all by yourself to figure out what to do with them. It seems I'm the first guy trying to do this after hard fork 19, so googling didn't help much. I had to literally dig into Steem source code to understand how rewards are actually calculated. I hope this post will be a good starting point for someone trying to wrap their head around post-HF19 curation rewards calculation.

Following snippet of code estimates curation reward for upvoting, provided that at the time of reward distribution post will be worth given amount of SP. It takes into account penalty for early upvoting (30 minutes after publication), as well as voter's possibly depleted voting power. It should be up-to-date with Hard Fork 19 that affected curation. I used Steem sources as a reference.

Good luck apprehending this mess :)

https://gist.github.com/teo-nyx/3e2a3fba7fdda7b681600e2a67dff220

Documentation for libs used can be found here:
Steem.js: https://github.com/steemit/steem-js
Moment.js: https://momentjs.com

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now
Logo
Center