Hmm, your code seems to give some correct information maybe? It's not the same as the one PeakD and Hive.Blog give tho.
I just voted and it was 0.16, and I just requested the info from your code and the console log result was 0.1979
Vote value: 0.1979061971029384
I also had to modify from console.info to console.log
Anyway, I'm unsure why this inaccuracy happens! PeakD's estimate on my vote size is 0.157 | 0.16
I think this discrepancy comes from two things:
Please note that my code by default calculates the Vote Value as if you had 100% Voting Power.
If you want to check your CURRENT vote value, with the Voting Power that you have at the moment, use
getUserVoteValue({ username: 'cryptosharon', fullVotingPower: false })
.As far as I understand, most of the services do not follow the formula from the documentation. The formula clearly specifies to provide the
base
price from thecondenser_api.get_current_median_history_price
call:If you check the response from that API call, it is currently
base: "0.894 HBD"
. That's what I use to calculate, but I find that if I provide1.0
as the base value, and not that value, the estimated values will be much closer to the ones given by services such as PeakD or hivestats.io. I don't know why that is, though, that those services do it differently than it is in the documentation.