____  ___    _  _     _   _ _____     _______
 / ___|/ _ \  | || |   | | | |_ _\ \   / / ____|
| |  _| | | | | || |_  | |_| || | \ \ / /|  _|
| |_| | |_| | |__   _| |  _  || |  \ V / | |___
 \____|\___/     |_|   |_| |_|___|  \_/  |_____|

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

Quick'n dirty python script for fetching your account balance

BY: @oscarp | CREATED: July 15, 2016, 3:50 p.m. | VOTES: 20 | PAYOUT: $15.04 | [ VOTE ]

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

>$ 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.

TAGS: [ #steem ] [ #script ] [ #balance ] [ #python ]

Replies

@geoffrey | July 15, 2016, 4:18 p.m. | Votes: 2 | [ VOTE ]

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

@kefkius | July 15, 2016, 7 p.m. | Votes: 2 | [ VOTE ]

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

@oscarp | July 17, 2016, 4:50 p.m. | Votes: 0 | [ VOTE ]

Well done!

[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>