How to Remind Yourself Where You Delegated Your Steem Power Using Python

Words
68
Reading
1 min
Listen
Play
8y

This post contains a Python script that uses the classes in the steem-python library and prints out to whom and how much a user has delegated their Steem Power. Python scripts can be run from the command line or inside of the IDLE that comes with Python.

Tips on installing and using steem-python on an Apple or Linux computer
Download and install steem-python
Download and install Python

# Find out to whom and how much SP a user delegates

from steem import Steem
from steem.amount import Amount
from steem.converter import Converter
s=Steem()
c=Converter()

# Substitute another username for 'numberjocky'.  Be sure to put it in quotes.

userName = 'numberjocky'

# Retrieve "steem per mvests" using the Converter object

stmPerMVests = c.steem_per_mvests()

# Get the delegating records of the user

delegatingRecords = s.get_vesting_delegations(userName,-1,100)

# Loop over the records and print out information

for record in delegatingRecords:
    delegaTee = record['delegatee']
    vestsDelegated = Amount(record['vesting_shares']).amount
    spDelegated = vestsDelegated/1000000*stmPerMVests
    print("%s delegates %.3f SP to %s" % (userName,spDelegated,delegaTee))

Enjoy!

How to Remind Yourself Where You Delegated Your Steem Power Using P... | Ecency