Words
16
Reading
1 min
Listen
Play
4y
I see I see... well, this might come in handy:
def getActiveVests(hiveaccess, accountname):
try:
account = Account(accountname, steem_instance=hiveaccess)
allVests = float(account.get("vesting_shares"))
delegatedVests = float(account.get("delegated_vesting_shares"))
receivedVests = float(account.get("received_vesting_shares"))
activeVests = allVests - delegatedVests + receivedVests
except Exception as inst:
print("hiveaccess OP ERROR on fetching account active VESTS")
print(type(inst))
print(inst.args)
return False
else:
return activeVests
def getVotingPower(hiveaccess, accountname):
try:
account = Account(accountname, steem_instance=hiveaccess)
except Exception as inst:
print("hiveaccessOP ERROR on get_account")
print(type(inst))
print(inst.args)
return False
else:
votingpower = (account.vp)*100
if votingpower > 10000:
votingpower = 10000
return votingpower
def getVoteWeightForRshares(hiveaccess, username, rshares):
try:
vests = getActiveVests(hiveaccess, username)
power = getVotingPower(hiveaccess, username)
weight = (rshares+50000000-98*vests)/(2*vests*power)
except Exception as inst:
print("hiveaccess OP ERROR on calculating vote-weight for target rshares")
print(type(inst))
print(inst.args)
return False
else:
return weight*100
those will require to also from beem.account import Account first
RE: HiveFest 7, It's Over - My Take