If everyone who login coogger.com join in the curation trail of coogger.up, how much is the reward per content?

in coogger •  last month



Repositories

What Will I Learn?

In this tutorial, we will calculate the total power of the users who login coogger.com, where we will find the maximum value that we can have on the curation trail, therefore, we will find the maximum value that we can have in the curation trail.

  • You will learn to get users from coogger.com with coogger-python
  • You will learn to calculate the users voting value with steem-python

Requirements

  • Python 3.6
  • steem-python
  • coogger-python

Difficulty

  • Intermediate

Tutorial Contents

Make sure that all the required libraries are installed correctly before you begin.
Let's first write a function that calculates the vote value.

It is necessary to inform a few subjects before starting.

What is coogger.up?

Github:

https://github.com/coogger/coogger.up
Coogger.up is a upvote bot for the coogger ecosystem.

When shared any content any communities on coogger and if it gets approved from coogger ( or other communities moderators) moderators, users will get upvotes from users that have allowed cooggerup settings in the settings section.

How to join curation trail of coogger.up bot


1.PNG


How to calculate vote value?

In short, it can be calculated using a formula such as

rshares * reward_share * price_of_steem


We include the required classes and libraries in our project.



from steem import Steem
from steem.amount import Amount
from steem.account import Account
from steem.converter import Converter

Our function name is get_vote_value and it receive two parameters.

  • username
  • weight / 0 to 100

Let's call our steem class to take account and reward_fund information, it should be as follows.

steem = Steem()
account = steem.get_account(username)
reward_fund = steem.get_reward_fund()

Let's calculate reward_share.

recent_claims = reward_fund["recent_claims"]
reward_balance = Amount(reward_fund["reward_balance"]).amount
reward_share = reward_balance / float(recent_claims)

Second let's take price_of_steem value

price_of_steem = Amount(steem.get_current_median_history_price()["base"]).amount

And finally, let's calculate total rshares

vests = Amount(account['vesting_shares']).amount
delegated_vests = Amount(account['delegated_vesting_shares']).amount
received_vests = Amount(account['received_vesting_shares']).amount
current_vests = float(vests) - float(delegated_vests) + float(received_vests)
convert = Converter()
steem_power = convert.vests_to_sp(current_vests)
rshares = convert.sp_to_rshares(sp=steem_power, vote_pct=weight*100)

Final state of function.

projects/utils.py

from steem import Steem
from steem.amount import Amount
from steem.account import Account
from steem.converter import Converter

def get_vote_value(username, weight=100):
    steem = Steem()
    account = steem.get_account(username)
    reward_fund = steem.get_reward_fund()
    recent_claims = reward_fund["recent_claims"]
    reward_balance = Amount(reward_fund["reward_balance"]).amount
    reward_share = reward_balance / float(recent_claims)
    price_of_steem = Amount(steem.get_current_median_history_price()["base"]).amount
    vests = Amount(account['vesting_shares']).amount
    delegated_vests = Amount(account['delegated_vesting_shares']).amount
    received_vests = Amount(account['received_vesting_shares']).amount
    current_vests = float(vests) - float(delegated_vests) + float(received_vests)
    convert = Converter()
    steem_power = convert.vests_to_sp(current_vests)
    rshares = convert.sp_to_rshares(sp=steem_power, vote_pct=weight*100)
    return round(rshares * reward_share * price_of_steem, 4)

Now let's write our second function named get_users

This function will take all users who have login coogger.com.

We included the required class in the project and this function receive one parameter name api_key.

Note :

The api_key is a key required to access the coogger data and can only be given to the administrator.

soon I will set the public key.

api_key is set to "api_key" on the local computer.

projects/project.py

from coogger.user import UserFilterApi
from utils import get_vote_value

There are description availables in codes.

def get_users(api_key="api_key"):
    user_filter_api = UserFilterApi(api_key)
    # We connection the coogger with api key.
    while True:
        # We create the loop to receive other pages data
        user_filter_api.filter()
        # The empty filter allows us to get all users data.
        users = user_filter_api.results
        # we got user data.
        next_page = user_filter_api.next
        # we got the next page data, and if there is no next page, it returns None.
        for user in users:
            yield user.username
            # return username of users
        if next_page:
            # if next page already axist,
            user_filter_api.node = next_page
            # We must change the node with next_page data
        else:
            # if next page doesn't exist, we must break the while lood
            break


if __name__ == '__main__':
    total_vote_value = 0
    for username in get_users():
        vote_value = get_vote_value(username)
        print(f"@{username} >> {vote_value}")
        total_vote_value += vote_value
    print("total_vote_value >> :",total_vote_value)

Result :

UsernameVote Value
@hakancelik$0.0165
@ibrahimsmngl$0.0007
@postdestek$0.0007
@pars11$0.0187
@coogger$0.0025
@haikalisifa$0.0006
@efsane60$0.0037
@yataydeli$0.0027
@steemit-turkey$0.0626
@alisari$0.0006
@bkatipoglu1$0.0007
@lutfibasdas$0.0007
@sorucevap$0.0064
@baristutakli$0.0002
@kompela14$0.0139
@dangerux$0.0029
@saiddemir$0.0002
@lastozgur$0.0055
@juanunix$0.0007
@abasifreke$0.007
@captainsailor$0.0028
@ugurarslanboga$0.0019
@wisex$0.0004
@famil$0.0021
@burakdogusoy$0.0042
@ms10398$0.027
@gokhan83kurt$0.0313
@varolleng$0.0007
@tykee$0.0158
@hasiz$0.0007
@ilkeryilmaz$0.0011
@teaminfo$0.0019
@sedatcelik$0.0015
@amico$0.0095
@hsynterkr$0.0386
@pamukcu12$0.0016
@batuhoca$0.0021
@trbtc$0.0022
@ewuoso$0.004
@itsravi$0.0037
@vmirag$0.0041
@onderakcaalan$0.0051
@windofrebel$0.0007
@ruen$0.0036
@lightshield$0.002
@eyupyusuf$0.0009
@kagantrky$0.0092
@mahsumclkblk$0.0007
@damla$0.0208
@burcunurdogusoy$0.0007
@freetissues$0.0266
@alfromswarm$0.0007
@blingtendo$0.0021
@rishi556$0.0422
@steemkitchen$0.0894
@gilabola.mania$0.0007
@albertocotua$0.0019
@bahagia-arbi$0.0316
@mrchef111$0.0385
@dragraff$0.0038
@mrscwin$0.0007
@lizelle$0.0314
@bitbase$0.001
@braaiboy$0.037
@joyrobinson$0.0069
@avizor$0.0269
@greatwarrior79$0.0019
@coogger.wallet$0.0002
@coogger.pay$0.0001
@ngocbich$0.0042
@princessmewmew$0.2384
@sigilmancy$0.0017
@kamtasia$0.0007
@chris.geese$0.0007
@immanuel94$0.1555
@bozz$0.0335
@murattatar$0.0408
@thomaskatan$0.0027
@mehmetcelik$0.0001
@hendersonp$0.0172
@verhp11$0.0393
@jesse5th$0.0
@kantzone$0.0007
@drsensor$0.0049
@enisshkurti$0.0433
@sinzzer$0.0274
total_vote_value$1.3031000000000001

As you can see, if all users who login coogger.com join in coogger.up's curation trail, they can get a prize of $1.3.

Thank you for reading

Proof of Work Done

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Thank you for your contribution.
After reviewing your tutorial we suggest the following:

  • Your choice for the title is not as clear as needed to reflect the correct content of the tutorial.In the title put keywords of what you will teach in the tutorial.

  • In the result it was not necessary to put a large list. Just a few sample lines.

Overall your tutorial is quite intuitive and interesting. Thank you for your work.
Looking forward to your upcoming tutorials.

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

·

Thank you for reviewing and your advise.

·

Thank you for your review, @portugalcoin!

So far this week you've reviewed 1 contributions. Keep up the good work!

·

Thank you for your review, @portugalcoin!

So far this week you've reviewed 1 contributions. Keep up the good work!


You have received an upvote from coogger.up and all the users that have joined the trail with you that has available upvote power.

Join the coogger.up bot's curation trail in the settings on coogger.com or other community web site for more support and reward from Coogger Ecosystem.

Delegations with SteemConnect

Coogger ecosystem needs your help, coogger.pay bot rewards split between all sponsors with 5% beneficiaries and the sponsors are rewarded by voting with one vote per week.

25 SP50 SP100 SP150 SP200 SP
500 SP1000 SP1200 SP1500 SP2000 SP

Addresses of coogger project

Thank you for supporting coogger community that is part of the Coogger Ecosystem.

Contact us on Discord

Congratulations @hakancelik! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

Award for the number of upvotes received

Click on the badge to view your Board of Honor.
If you no longer want to receive notifications, reply to this comment with the word STOP

Do not miss the last post from @steemitboard:

SteemitBoard - Witness Update

Support SteemitBoard's project! Vote for its witness and get one more award!

Hi @hakancelik!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Hey, @hakancelik!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!