Skip to content

Commit 7c77625

Browse files
author
John White
authored
Merge pull request #53 from aaroncox/rshares_fix
Corrected sp_to_rshares math
2 parents 2eaed3d + 085870e commit 7c77625

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

steem/converter.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,16 @@ def sp_to_rshares(self, sp, voting_power=10000, vote_pct=10000):
5959
# calculate our account voting shares (from vests), mine is 6.08b
6060
vesting_shares = int(self.sp_to_vests(sp) * 1e6)
6161

62+
# get props
63+
props = self.steemd.get_dynamic_global_properties()
64+
65+
# determine voting power used
66+
used_power = int((voting_power * vote_pct) / 10000);
67+
max_vote_denom = props['vote_power_reserve_rate'] * (5*60*60*24) / (60*60*24);
68+
used_power = int((used_power + max_vote_denom - 1) / max_vote_denom)
69+
6270
# calculate vote rshares
63-
power = (((voting_power * vote_pct) / 10000) / 200) + 1
64-
rshares = (power * vesting_shares) / 10000
71+
rshares = ((vesting_shares * used_power) / 10000)
6572

6673
return rshares
6774

0 commit comments

Comments
 (0)