create account

RE: Part 9: How To Calculate A Post's Total Rewards Using Steem-Python by amosbastian

View this thread on: hive.blogpeakd.comecency.com

Viewing a response to: @veleje/re-steempytutorials-how-to-calculate-a-post-s-total-rewards-using-steem-python-20180120t194505785z

· @amosbastian · (edited)
$0.18
It's because `Amount` is a class in `steem-python` that splits a string like "10 SBD" into `amount`(10) and `asset` (SBD) as you can see [here](https://github.com/steemit/steem-python/blob/master/steem/amount.py).  The `float()` function just converts a number or a string into a float! If you really wanted you could do `recent_claims = float(reward_fund["reward_balance"].split()[0])` instead, but it's easier to just use `Amount` class.
👍  ,
properties (23)
authoramosbastian
permlinkre-veleje-re-steempytutorials-how-to-calculate-a-post-s-total-rewards-using-steem-python-20180120t201201375z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https://github.com/steemit/steem-python/blob/master/steem/amount.py"],"app":"steemit/0.1"}
created2018-01-20 20:12:00
last_update2018-01-20 20:13:18
depth2
children1
last_payout2018-01-27 20:12:00
cashout_time1969-12-31 23:59:59
total_payout_value0.144 HBD
curator_payout_value0.036 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length439
author_reputation174,473,586,900,705
root_title"Part 9: How To Calculate A Post's Total Rewards Using Steem-Python"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,943,324
net_rshares16,240,485,077
author_curate_reward""
vote details (2)
@veleje ·
I see, thank you!
This example here shows better what is going on, nice, now I have two options!
properties (22)
authorveleje
permlinkre-amosbastian-re-veleje-re-steempytutorials-how-to-calculate-a-post-s-total-rewards-using-steem-python-20180120t205125482z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-01-20 20:51:24
last_update2018-01-20 20:51:24
depth3
children0
last_payout2018-01-27 20:51:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length96
author_reputation490,220,361,761
root_title"Part 9: How To Calculate A Post's Total Rewards Using Steem-Python"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,949,765
net_rshares0