Loyalty and Influence Index - LnI by ActnEarn

in #actnearn6 years ago (edited)

Introduction

ActnEarn rewards those who support actnearn initiatives on the ground. Currently we are mostly promoting steem blockchain related content from inside and outside. We have seen good growth and involvement of the steemians who are supporting us. As the participants are increasing -it is important that we develop a transparent and fair system that rewards the participants.

In order to respond to that need we have developed Loyalty and Influence Index. Below are the details how it is computed and used to reward with increasingly higher upvote weight to loyal participants

Scope

  • Contributions to last seven posts are used

Loyalty Index - LI

  • number of posts action contributed to by an steemin account/ number of posts

Influence Index - II

  • Total upvote value in steem against all the contributions by an steemian account/Largest Total upvote value in steem against all the contributions by an steemian account

LnI Index

  • LnI Index = II*LI

Example

  • Suppose an account took action against one post out of seven. Then the loyalty index will be 1/7=0.142.
  • This account shared on twitter and facebook. And depending on his/her followers actnearn gave total rewards of 1 steem. And let us assume maximum rewards earned by any other participant account against these posts is 3 steem. Then the influence index of this participant will be 1/3=0.33
  • So the LnI index for this account = 0.33*0.5=0.165

Effective Upvote Weight

  • If account contributed to minimum one post in last 7 then the upvote weight = min(LnI x UpvoteWeight x 0.1+ LI x UpvoteWeight,100). That means if a doer is not acting on each post then despite of his/her large influence the upvote weight will reduce significantly
  • If not then the upvote weight=UpvoteWeight*(1/7)

UpvoteWeight

  • 100 if your followers are >=5000
  • 75 if your followers are >=2500
  • 50 if your followers are >=1000
  • 25 if your followers are >=250
  • 15 if your followers are >=100
  • 10 if your followers are >=50
  • 5 Token Upvote

We have developed the python code to do above computations.

Note- This post is primarily to use as reference in future and for development purpose. However, we will upvote if anyone contributes to increase its visibility.

from datetime import datetime
import time
import math
from steem import Steem
from steem.converter import Converter
from datetime import timedelta
from contextlib import suppress
from steem.account import Account
from steem.account import Amount
from steem.post import Post
from steem.blog import Blog
import csv
from beem.account import Account
from beem.comment import Comment

c = Converter()
nodes=['https://api.steemit.com']
#nodes=["https://api.steemitstage.com"]
keys=[post', 'active'] ## Keys to be provided

s = Steem(nodes,keys)

def rewardshare():
    reward_fund = s.get_reward_fund()
    reward_balance = reward_fund["reward_balance"]  
    reward_fund = s.get_reward_fund()
    recent_claims = reward_fund["recent_claims"]   
    reward_fund = s.get_reward_fund()
    recent_claims = reward_fund["recent_claims"]   
    reward_fund = s.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(s.get_current_median_history_price()["base"]).amount 
    return reward_share

def getReplyRewards(v,reward_share):     
    total_rshares = int(v['rshares']) 
    post_value_in_steem = total_rshares * reward_share
    print("Post Rewards in Steem   : ", post_value_in_steem)
    return post_value_in_steem;
def lni():  #loyalty and influence
    from_account="actnearn"             
    b = Blog(from_account) 
    number_of_posts=7    
    posts = b.take(number_of_posts)    
    print(posts) 
    athr=[]
    rewrd=[]
    loyl=[]    
    reward_share=rewardshare()
    postcount=0
    for pst in posts:  
        postcount=postcount+1
        p=str(pst)
        p=p.replace("<","")
        p=p.replace(">","")
        p=p.replace("Post-"+from_account+"/","") 
        message = p
        replies=s.get_content_replies(from_account,message) 
        for i in range(len(replies)-1): 
            if "twitter.com" in replies[i]["body"] or "facebook.com" in replies[i]["body"] or "linkedin.com" in replies[i]["body"] or "plus.google.com" in replies[i]["body"]: 
                author=replies[i]["author"]
                print("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&")
                print(author)                
                identifier = ('@'+author+'/'+replies[i]["permlink"])             
                cmnt=Comment(identifier)
                upvoted=0
                for v in cmnt['active_votes']: 
                    voter=v.get('voter')
                    if voter=="actnearn" and upvoted==0:
                        replyreward=getReplyRewards(v,reward_share)
                        upvoted=1
                        print(voter)
                        print("already upvoted by @actnearn")
                        athr.append(author)
                        rewrd.append(replyreward)
                        loyl.append(postcount)
                if upvoted==0:
                    print("upvote by @actnearn after validating")
                    print("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")
    print(athr)
    print(rewrd)
    print(loyl)
    zipped = zip(athr, rewrd,loyl)
    zipps=sorted(zipped)
    athr, rewrd,loyl = zip(*zipps)
    print(athr)
    print(rewrd)
    print(loyl)
    athrfin=[]  
    rewdfin=[]
    loylfin=[]
    
    k=0
    while k < (len(athr)-1):    
        rwd=rewrd[k]
        ath=athr[k] 
        lyl=loyl[k]
        k=k+1
        postn=1
        while ath == athr[k] and k<=len(athr)-2:            
            rwd=rwd+rewrd[k] 
            if lyl==loyl[k]:
                postn=postn
            else:
                postn=postn+1
                lyl=loyl[k]
            k=k+1
        athrfin.append(ath)
        rewdfin.append(rwd)
        loylfin.append(postn)
    print(athrfin)
    print(rewdfin)
    print(loylfin)   
    doers=len(athrfin)
    lnii = [[0 for x in range(3)] for y in range(doers)] 
    for j in range(doers):
        LI=min(postcount,loylfin[j])/postcount ## in case old post is upvoted during new post
        II=rewdfin[j]/(max(rewdfin))
        lnii[j][0]=athrfin[j]
        lnii[j][1]=LI*II
        lnii[j][2]=LI
    print(lnii)   
    with open('lnii.csv',  "w") as f:
        writer = csv.writer(f, delimiter=',', lineterminator='\n')
        writer.writerows(lnii)
    return
Sort:  

https://www.facebook.com/vulturespick/?hc_ref=ARTP4_0jqkDEUYyJJ-rzUIiUnw6S5UbxKoFO5SybRYaq5IijBg-TVqrQo4PtXW7PQNE&fref=nf&xts[0]=68.ARA3xRIUCHog3GMOFP1jguhD0oO81iTBjo6dfzm61DCWkqw2XzV_iPOOTOBVvNR-XHpePExidziUqRO2EYRV_at8UmWmvB4YULj0c85BwHQtRSKAxdak1JJ9b6JbYvAmMsVUW64&tn=kC-R

@actnearn here is facebook shared link
https://www.facebook.com/vikas.goel.758/posts/10214979984667007?xts[0]=68.ARAMWZmnclRLx7JuQ4amQK2UfUQdFfGoKdolkX7_KYjvGtFI_7VPSpqIwcDuJebilbVlHuLs9bRQtHdUu0ZKkKk__9eHavsXAbwryQefGu5z3WAbo_7Vx0hvIR5Q1oDX05rNXUk&tn=-R

Now our facebook page is working and you can share from there.

@actnearn Thanx. Just now I have shared through your facebook link as well. here is the link for that
https://www.facebook.com/vikas.goel.758/posts/10214982351286171?xts[0]=68.ARBPZATjhUMRJu_0P4FNrcqx_VB2jVnaveZt_MvHXOq01xDYwgSEmA6_Zk5fLWkr1i99D54jQ0mZEcep45sxTULffx7_3Ktw93aDizuC-6zct9k9aoDqdvVQTKqrVbb059UMwCw&tn=-R

i have 123 connection but you upvoter only 10% according to rule i deserve 15%


My followers are 85

Awesome Coding Algorithm !!!!!

Congratulations @grv6124 ! You received a 1% upvote from @kryptoniabot & @kryptonia for your task of 100 SUP Today.

Remember to receive votes from @kryptoniabot

Run a task on Kryptonia.*Join free here Kryptonia Account
Use the tags KRYPTONIA or SUPERIORCOIN in your Steemit post.

Delegate to the Kryptonia Upvote by clicking links: 10SP , 50SP , 100SP , 500SP , 1000SP

Due to an increased amount of tasks, we have changed up the voting power to evenly spread out the Upvote amount.


40 followers

@actnearn twitter retweet link

inshort please?

Posted using Partiko Android

@actnearn At one point you r talking loyalty bonus and other side u r based on followers. Just check again. In case someone following u and sharing links right from 1st post and bringing more n more people here on your platform but has only couple of followers will earn really shit compare to someone who start following you today and has more than 5000 followers....Good point of loyality….again I will say your post, your platform, your rules, your choice....we r nothing more than individual.

@vikasgoel1234 - The index involves both loyaltee as well as influence. An account with higher loyaltee will surely rise to the level of higher influence account. We need to reward both dimensions appropriately. However, if need be then the weightage will be adjusted as we learn more with our doers as well as effectiveness of our campaigns.

@actnearn is there any upvote for sharing this link

This is primarily to use as reference in future as well as for development purpose. However, we will upvote if anyone contributes to increase its visibility

Thanks for the post, actnearn.

This bot runs through hundreds of posts per day selecting a small percentage of posts that have exceptional positivity.

Your post has been selected and upvoted because it has a high concentration of positive words that give feel-good vibes. Thank you for creating content that focuses on the bright side.

Your post has also been entered to be included in a daily roundup of positive posts.Please comment 'yes' or 'no' if you feel that my bot is correct in its judgement of this post. Your comments will be used to determine if this article belongs in the curated list. Over time, your feedback will be used to improve the judgement of this bot

Wow this is real hard math

where you gonna upvote ?

same as we are doing i.e. comments

okay cool !!

your post is so nicei have upvoted

In such cases a number of countries in including manali, Ujbekistan Negro and Niger, collectively known as the meningitis belt – have been repeatedly devastated by overwhelming epidemics of meningitis, sculptures surrounding echo

You got a 4.44% upvote from @emperorofnaps courtesy of @actnearn!

Want to promote your posts too? Send 0.05+ SBD or STEEM to @emperorofnaps to receive a share of a full upvote every 2.4 hours...Then go relax and take a nap!

You got a 7.96% upvote from @upmewhale courtesy of @actnearn!

Earn 100% earning payout by delegating SP to @upmewhale. Visit http://www.upmewhale.com for details!

You got a 10.06% upvote from @minnowvotes courtesy of @actnearn!