2 Python Scripts for SteemData to get a list of all SteemPower Delegators or Delegatees for a specific Account.

in #steemdata7 years ago

Hello Steemit,

have you ever asked from where other Steemians with a high Vote-Weight got their SteemPower delegated?


Image Credit Pixabay

SteemData

I developed 2 python scripts for SteemData by @furion to find answers to this question. All you need is to install @furions steemdata python libarys, for details check https://steemdata.com/guide.

delegator.py - To which Accounts were SteemPower delegated?

In case you want to know, to which accounts a certain account has delegated SteemPower, just use the delegator.py script:

from steemdata import SteemData
from collections import Counter
import sys

s = SteemData()

delegations = s.Operations.find( {
    '$and': [
        {'type' : 'delegate_vesting_shares'},
        {'delegator': sys.argv[1]}
    ]
} )             

delegation_map = dict()

for delegation in delegations:
    delegatee = str(delegation['delegatee'])
    vestings = delegation['vesting_shares']
    amount = vestings['amount']
    delegation_map[delegatee] = amount

i=1

for key in sorted(delegation_map):
    if delegation_map[key] > 0:
        print('|' + str(i) + '|' + key + '|' + str(delegation_map[key])+ '|')
        i += 1

Copy the script into a new text file called delegator.py and save it. You can run the script from the command line and provide an account name.

# python3 delegator.py twinner

The script will output a list of all accounts that got a SteemPower delegation from the given account name. In this example it is the current list of my SP-delegations I did 4 weeks ago to support new german users.

NumberAccountDelegated Vests
1acid78941666.666667
2adamicelli1040622.916667
3addictedtophotos1010416.666667
4adelheid1040625.0
5ahinga1027817.805383
6alexmicrocontrol1040618.75
7alexvan3093750.0
8angrezi1040625.0
9arbeitssuchend1033171.84265
10argekunst1005977.083333
11artemisia1019887.5
12artpoet66302.277433
13austrobot999597.916667
14beatminister890755.693582
15beers200000.0
16besteulz834285.416667
17biggi910343.6853
18bluchr1040625.0
19bluepeaches1040625.0
20blueperegrina985416.666667
21brickster1027883.333333
22brotagnist1040595.833333
23bussdee1040625.0
24chancenbuffet1040625.0
25cobalus2939129.166667
26cornflakes1034161.490683
27creative-life1030493.75
28dehenne1019712.5
29denniskoray871910.973085
30derboersennerd997766.666667
31detlev538820.833333
32dswigle1024675.0
33earnfast1040625.0
34eisenbart1033708.074534
35elainetheinsane921950.310559
36elbiasto1040625.0
37enidan1040625.0
38ergeko982062.111801
39ethnoly265050.0
40felix.herrmann759575.0
41flauschi1040393.75
42flauwy952561.076605
43fraenk536456.25
44germancook1022083.333333
45geschichten313027.083333
46hausbau1040625.0
47hintenberg485052.083333
48ilsignore1040625.0
49irrer-ivan1034097.308489
50jamjamfood942710.416667
51jan-bensky1040625.0
52jeanpi1908937025.0
53jensm851005110.416667
54jogi1040622.916667
55kochmaster728620.833333
56konsumkind1040625.0
57kranoras4129366.666667
58laloelectrix891697.916667
59lcshaft881287.5
60lexcited1040625.0
61liboriotv737500.0
62ligrev429704.166667
63lillliputt1038077.083333
64liyopa1040625.0
65louisa989583.333333
66mabre1040625.0
67maikegrell586079.166667
68maltombo1040625.0
69manonlescaut1037500.0
70marcelloblanco872045.833333
71markdaniel1040625.0
72martin.the.chef565656.25
73matzep1040625.0
74me-do625000.0
75melaniemd1040625.0
76miketr1041666.666667
77mkt1040625.0
78moneyrace4050070.320579
79nacktepoesie1040625.0
80nexanymo1035262.5
81nicoletta4075979.166667
82nuoviso320645.833333
83nutschiii983333.333333
84olli01031040625.0
85ophelion957725.0
86patriciarok988160.416667
87pawos3566675.0
88pipurilla3606543.950362
89pluemacher1040625.0
90psywalker3761991.726991
91quocvietle983333.333333
92redtravels3475243.75
93ridi20720254.658385
94rizatr1040625.0
95rootingrobert1040625.0
96roused1018189.583333
97rushpictures800045.833333
98sabine-reichert929166.666667
99skrzypietz920308.333333
100speedygonzales983208.333333
101spirits4you1039618.75
102stateless1040625.0
103steemchiller514583.333333
104steemigonzales1040379.166667
105steemornot1039727.083333
106steinzeit990758.333333
107talaslegraps1040625.0
108talaxy609483.333333
109tamy3798081.25
110tatjana.lackner724470.833333
111thecoach932469.979296
112themediumone1040622.916667
113thepe789675.0
114tryto1037412.5
115twinkleberry4050070.320579
116tzap901040625.0
117vandaze1040339.583333
118wolfoftrading1032056.25

delegatee.py - From where got an Account SteemPower delegated?

In case you want to know, from where an account got SteemPower delegated, just use the delegatee.py script:

from steemdata import SteemData
from collections import Counter
import sys

s = SteemData()

delegations = s.Operations.find( {
    '$and': [
        {'type' : 'delegate_vesting_shares'},
        {'delegatee': sys.argv[1]}
    ]
} )             

delegation_map = dict()

for delegation in delegations:
    delegator = str(delegation['delegator'])
    vestings = delegation['vesting_shares']
    amount = vestings['amount']
    delegation_map[delegator] = amount

i=1

for key in sorted(delegation_map):
    if delegation_map[key] > 0:
        print('|' + str(i) + '|' + key + '|' + str(delegation_map[key])+ '|')
        i += 1

Copy the script into a new text file called delegatee.py and save it. You can run the script from the command line and provide an account name.

# python3 delegatee.py minnowsupport

In this example the script will output a list of all accounts that delegated SteemPower to @minnowsupport project by @aggroed.

NumberAccountDelegated Vests
1adrianobalan206917.617596
2agr8buzz24820.824672
3alexvan1039918.355446
4alphacore4135.383314
5ariane10332.674856
6ausbitbank2070650.598418
7benjojo186348907.260027
8buzzbeergeek206940.7942
9captain-nemo206940.7942
10chrissymchavez22415.0
11cosimo28933.102466
12crazybgadventure20679.029737
13crimsonclad26949.0
14cryptobeard10347.510802
15cryptofixer62056.810942
16cryptopie20665.477667
17danielsaori426754.0
18dber1033307.837437
19diebaasman103379.867576
20digitalking10340.348026
21discordiant103385.208857
22dogeking20663.208582
23drwom206734.831158
24dswigle41351.235236
25ejemai20688.898957
26eliel20680.915714
27errymil103470.399999
28ethical-ai1050000.0
29eturnerx1033175.881365
30everybitmatters103470.3971
31exavier104949.0
32fingersik63106.0
33gnocdepatat155087.294461
34gringalicious206801.353693
35grocko20680.663536
36groundcontrol20680.592689
37gyanibilli207998.115079
38haushinka20691.167768
39hitmeasap206949.787772
40hypexals-spiral209618.0
41iamjustincscott10300.0
42isaac.rodebush2067953.346083
43jaredcwillis206831.415654
44jassennessaj31021.086522
45jedau1033128.741758
46jeffjagoe208877.211049
47jesse2you51723.959573
48jocra1034414.986604
49joeyrocketfilms413680.411198
50jraysteem20668.229739
51jrhughes60949.0
52justcallmemyth103837.0
53kid4life20665.673503
54kryptokayden20685.732016
55krystle212746.0
56lances1034596.92104
57leyargoz10335.388685
58livingwaters20677.393856
59luke-skywalker41366.23758
60manishmike1041382.506787
61matthewtiii207998.115079
62michelios2066658.529673
63moataz20689.626635
64morph20678.623159
65natra207998.115079
66necrophagist103470.3971
67neoxian10342075.0
68netuoso208984.686182
69nicnas208402.0
70nnnhhh206944.220255
71omar-hesham6202.834833
72paulag20689.712247
73pisolutionsmru103999.057539
74pratikchordia20680.861517
75r0nd0n207000.0
76raserrano10332.833146
77raymonjohnstone1035641.0
78realm20683.977777
79revelim20676.352879
80ribalinux82701.999676
81robertdurst1022990.0
82romantic44132.896869
83rufaz20800.115079
84sammosk20672.049093
85sandstorm1034731.807862
86satfit62061.432543
87shawnfishbit206915.959014
88shellyduncan206852.185497
89siddartha162152.913824
90siersod103470.3971
91snubbermike2179988.115079
92somethingsubtle206906.540316
93soundwavesphoton20689.583829
94starke51666.726901
95stay9n050998.115079
96steemblake41374.801918
97steemface9429.0
98sulev2069407.942
99surprisebit20689.712247
100swelker10124801.998226
101tamaralovelace103442.140673
102tech-trends20689.797861
103theblindsquirl206949.787772
104timcliff7233186.126111
105touchman2296131.218686
106tremendospercy206833.788368
107uniwhisp1034419.26668
108v4vapid1034703.971
109vallesleoruther20663.588915
110venuspcs2079980.115079
111vj130960000.679363

Thank you for reading!

In case you are interested in the delagtions of other accounts, just leave a comment and I will post it there.

Sort:  

cool script, great job looking more good stuff from ur side man

This post received a 4.2% upvote from @randowhale thanks to @abbasfxtm! For more information, click here!

Tolle Arbeit. Man muss mal von ganzen Herzen einfach mal Danke sagen. Was du für mich und hunderte andere machst und getan hast, all die Unterstützung !!! Sowas ist nicht selbstverständlich mein Freund. # header

Amen to that!

great script ! Its amazing what people do here to make data transparent ! Thanks for that !

Ich finde es einfach großartig, wie du Neulinge, sei es durch das Delegieren von Steempower, großzügige Upvotes oder sonstige Hilfestellungen unterstützt!

This is a really good tool! Thanks for sharing!
I will try it and explore :D

Upvoted and followed!

Thanks for sharing this scrript
As Always great and useful post
Keep the good work
Have a great and sunny day

Interesting
There is a post to check one's account delegation status:
https://steemit.com/lolitest/@elautomatico/sp-delegation-toolbox-20170725

Hehe, nice.

I used some logic just like this on the https://mspdelegator.herokuapp.com website to get the list of delegators for the @minnowsupport account.

It is always cool to see the different languages of the same type of script

Interesting! Thank you!

Das sind leider böhmische Dörfer für mich, auf jeden Fall ganz toll, wie du die Anfänger hier (wie auch mich) so großartig unter die Arme greifst. Vielen, vielen Dank!

Vielen Dank für diesen hilfreichen Post und deine Upvotes! Die Unterstützung bedeutet mir (und wahrscheinlich allen anderen auch) sehr viel. Aller Anfang ist schwer und bei so einer tollen Community, die sich gegenseitig unterstützt, macht es alles so viel mehr Spaß.

interessantes, sehr hildreiches Script ! Ist Python zum access der API besonders geeignet oder laufen solche Scripts ebenso gut mit PHP ? Wie sieht es mit der Datenmenge aus ? Viele Fragen :)
Bin am ueberlegen, ebenfalls Daten aus der API aufzubereiten, da ich das einfach nur klasse finde, solche Daten den Usern auf Steemt zur Verfügung zu stellen. Thumbs up und DANKE !

So wie ich es verstanden habe ist in der Steemdata python API schon ein MongoDB Treiber mit eingebunden, den man bei anderen Programmiersprachen noch manuell installieren müsste. Aber PHP oder Javascript sollten auch kein Problem darstellen.

@twinner you are my hero!!! :D :D

As an totally clueless newbie, one day I noticed you had generously delegated power to me. I was surprised and a bit overwhelmed. I didn't know what to do with it, so my approach was to very carefully look for posts that impressed me and upvote them.

Question: From your perspective as the granter, how would like the grantee to use the delegated power? Vote like crazy, vote cautiously, sit on it, or something else? What would be most beneficial for you?

Vote whatever you want :-)

Ich hatte mich irgendwann gewundert warum ich plötzlich so viel SteemPower hatte. Hab es aber erst vor paar Tagen bemerkt, dass ich dir das zu verdanken habe. Lieben Dank.

Wirklich wieder einmal mehr eine grandiose Arbeit, die du für die Steemit-Community geleistet hast @twinner (:

Vielen Dank dafür! Auch wenn du mir jetzt persönlich die Freude daran genommen hast, mühselig selber herauszufinden, wem ich meine delegierten SP zu verdanken haben (kommst ja eh nur du in Frage) :D

Very helpful. I hope someday soon such kind of data can be pulled by every user via simple frontend-features...

I hope it too.

Very interesting. Resteemed :-)

Thank you very much @lichtblick :-)

This is a good concept @twinner hwoever for those with enough to delegate..Hope to join soon

I have no idea what you are talking about, but you get my upvote, because of your support. My name is on that list! Juhuu! Thank You!!!

any ideas?

telesti@starship:~/python$ python3 ./delegator.py enki74
Traceback (most recent call last):
  File "./delegator.py", line 1, in <module>
    from steemdata import SteemData
ImportError: No module named 'steemdata'
telesti@starship:~/python$ ./delegator.py enki74
from: can't read /var/mail/steemdata
from: can't read /var/mail/collections
^C./delegator.py: line 5: syntax error near unexpected token `('
./delegator.py: line 5: `s = SteemData()'

Hi enki74,

you need to install steemdata python libs first

pip install -U steemdata

See https://steemdata.com/guide

Nice work its really helpful and finger tips data.

Good article full of knowledge.

Wow! You did good post my friend @twinner and interesting article! Look on my post! I posting very interesting cool journey to the pool! It's very cool : https://steemit.com/travel/@bugavi/super-tusa-in-the-pool-journey-to-the-pool-from-bugavi-swim-with-me

upvote and like it

Upvoted and RESTEEMED :)

thanks, exactly what i was looking for!

und danke fuer die delgation nochmal, habe bald schon fast genug eigene SP um den power slider aus eigener Kraft nutzen zu duerfen! Melde mich wenn's soweit ist.

Tolle Post twinner und Vielen Dank für den Ratschlag bei meine Post über Liechtenstein @johnadams

Great work, thank you. And great explanation.

I could just run that script in any computer and get the results? Does it need a specific operating system (linux, maybe)? does it need a direct connection to a specific server?

Nice scripts. Can you also show the date of the delegations?