Closed kingsofcoms closed 6 years ago
Tried
from steem.account import Account
account = Account("manuelcho12") print("VP: %s" % account.voting_power()) print("SP: %s" % account.sp())
Got this error:
VP: 94.13
Traceback (most recent call last):
File "steemapp.py", line 5, in
You get this from the Account object. You have to take into account SP delgated to you and SP you have delegated to get the active SP. I don't think there is an out of the box function. See below. I have used rstrip to remove VESTS from the string. I haven't checked, but there might be a converter function that can simplify it, but the concept stays the same.
allSP = float(account.get('vesting_shares').rstrip(' VESTS'))
delSP = float(account.get('delegated_vesting_shares').rstrip(' VESTS'))
recSP = float(account.get('received_vesting_shares').rstrip(' VESTS'))
activeSP = account.converter.vests_to_sp(allSP - delSP + recSP)```
thank you for the workaround. account.get_balances() also gets total vests but have to use json and to convert total vests to SP.
I've looked over at https://steem.readthedocs.io/en/latest/ and i couldn't find anything. Is it possibe?
all i got was sp_to_rshares(sp, voting_power=10000, vote_pct=10000)
Parameters: sp (number) – Steem Power voting_power (int) – voting power (100% = 10000) vote_pct (int) – voting participation (100% = 10000)