Steemit API + Python: Calculate Your Steemit Spending!
Another discussion with @themarkymark, another DIY Seemit report! ;)
We were trying to figure out if I was over-spending on my Steemit activities.
I have a tendency to get carried away with spending money, physical or crypto. Had I gone overboard with my SBD investment?
Using the approximately accurate math ( reward * 0.75 / 2 ) we can roughly determine the SBD I get back from an article.
payout=(( Amount(post["pending_payout_value"]).amount * 0.75) /2)
Therefore we can see what the actual reward was or forthcoming reward might be.
payout = (Amount(post["total_payout_value"]).amount - Amount(post["curator_payout_value"]).amount)
How do we tell how much I spent?
Code
from steem import Steem
s = Steem()
import time, random, os
rposts = s.get_account_history('makerhacks',-1,10000)
total = 0
for post in rposts:
operation = post[1]['op'][0]
if operation == "transfer":
if post[1]['op'][1]['from'] == "makerhacks" and not post[1]['op'][1]['to'] == "themarkymark":
print( post[1]['op'][1]['to'] + "\t\t\t" + str( post[1]['op'][1]['amount'] ))
total = total + float(post[1]['op'][1]['amount'].replace(' SBD',''))
print ("\n\n" + str(total) + " SBD \n\n\n")
This gets 10,000 transfers where I sent from my account but NOT to @themarkymark (because that would have been a loan repayment - yes, he is my Steem loan shark ;) ).
Obviously you would need your own Steemit details and logic there.
Maybe, my solution is helpful:
https://steemit.com/steemdev/@holger80/how-to-estimate-the-real-pending-post-payout-by-subtracting-bought-votes
I used my script to calculate the sum of your last 46 posts (fixed version):
Sum for the last 46 posts:
Payout: 563.78 SBD and 122.95 SP
483.77 SBD used for buying votes
Remaining: 80.01 SBD and 122.95 SP
The estimated real value gained per post in SBD (including SP) is 4.870881
Cool :)
So what's the conclusion ? Are you overspending ?
Unclear 😂
@themarkymark used a database approach and says not, when I use the "* 0.75 / 2" calculation I find I've overspent slightly but potentially ahead depending on actual curation rewards and the 10% your WP plugin takes on my syndicated posts :)
We don't take 10% of the sbd so it should be fine :D It's only 10% of the steem power.
Ahhh good to know :)
I'm working on steemit analyzers with the python library, although some API functions seem to be no-op, like
get_account(user)['comment_count']
as comments are counted as posts.
Thank you for sharing this code snippet!
Your post had been curated by the @buildawhale & @ipromote team and mentioned here:
https://steemit.com/curation/@buildawhale/buildawhale-curation-digest-02-09-18
Keep up the good work and original content, everyone appreciates it!
Useful code, Thank you
You got a 2.07% upvote from @postpromoter courtesy of @makerhacks!
Want to promote your posts too? Check out the Steem Bot Tracker website for more info. If you would like to support the development of @postpromoter and the bot tracker please vote for @yabapmatt for witness!
Where are you reading the user's credentials from?
I know you said :"Obviously you would need your own Steemit details and logic there.", but just curious how you passed your credentials.
Thanks nice article.