Quick'n dirty python script for fetching your account balance

5년 전

Here goes a quick'n dirty python script for fetching your account balance converted to a fiat currency.

$ python steem_balance.py dan
Steem balance
Steem vests: 9891.00M (7371712.54 euros)
Steem: 0.437 (1.49 euros)
Steem Dollars: 3.000 (2.69 euros)
Total: 7371716.72 euros

It requires python 3, lxml and requests.

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:  trending

Nice. I forked it and made currency an argument. The word 'euro' is still used in variable names though, for the sake of quickness and dirtiness.

$ python steem_balance.py -u dan -c usd
Steem balance
Steem vests: 9891.00M (7963087.82 usd)
Steem: 0.437 (1.61 usd)
Steem Dollars: 3.000 (3.00 usd)
Total: 7963092.43 usd


Well done!

Very nice. I noticed coinm.get_price() can be called with True as the second input, and the output is converted to dollars. Though it still is hardcoded to report "euros" in print_balance.

My fellow Americans, just change line 43 to:
ratio_steem_fiat = coinm.get_price('STEEM',True)

If you're running it in linux, and don't feel like manually finding and replacing the 'euros', run this command in a terminal in the folder with the script:

sed -i -- 's/euros/Dollars/g' steem_balance.py