RE: RE: HiveFest 7, It's Over - My Take
You are viewing a single comment's thread from:

RE: HiveFest 7, It's Over - My Take

Words
29
Reading
1 min
Listen
Play
4y

to avoid a comment going under the dust level and paying ZERO, what is the minimum amount of vests it requires?

oh... maybe I can help with that!

from beem import Steem
from beem.nodelist import NodeList
from beem.amount import Amount

nodelist = NodeList()
nodelist.update_nodes()
hivenodes = nodelist.get_nodes(hive=True)
hiveaccess = Steem(node=hivenodes, no_broadcast=True)

def getRsharesForRewardValue(hiveaccess, targetreward):
    try:
        rewardsfund = hiveaccess.get_reward_funds()
        rewards = float(Amount(rewardsfund["reward_balance"]).amount)/float(rewardsfund["recent_claims"])
        medianhistory = hiveaccess.get_current_median_history()
        price = float(Amount(medianhistory["base"]).amount)/float(Amount(medianhistory["quote"]).amount)
        tclaims = int(targetreward/(rewards*price))
        rshares = int(tclaims)
    except Exception as inst:
        print("hiveaccess OP ERROR on calculating rshares for target reward value")
        print(type(inst))
        print(inst.args)
        return False
    else:
        return rshares

def getVestsRequiredForReward(hiveaccess, reward):
    try:
        power = 100
        weight = 100
        rshares = getRsharesForRewardValue(hiveaccess, reward)
        vests = (rshares+50000000)/(2*(49+(power*weight)))
    except Exception as inst:
        print("hiveaccess OP ERROR on calculating vests required for target reward")
        print(type(inst))
        print(inst.args)
        return False
    else:
        return vests

def vestsToHP(hiveaccess, vests):
    try:
        HP = hiveaccess.vests_to_sp(vests)
    except Exception as inst:
        print("hiveaccess OP ERROR on converting vests")
        print(type(inst))
        print(inst.args)
        return False
    else:
        return HP

vests = getVestsRequiredForReward(hiveaccess, 0.02)
HP = vestsToHP(hiveaccess, vests)

print("To generate a dust-save reward of $0.02 with a 100% upvote you will need:")
print(str(int(vests))+" Vests ("+str(round(HP, 3))+" HP)")

cheers

@fraenk: to avoid a comment | Ecency