create account

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

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

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

· @veleje · (edited)
$0.39
Probably silly question, from someone new to Python, how come we can't use the same code for 'recent_claims' that we used for 'reward_balance' - code in second line:

![0019_py_question_reward_fund.png](https://steemitimages.com/DQmTK9z8AL4V4FD3SaDABV9YsFUjRukJwa3oD8FBSy7EAQX/0019_py_question_reward_fund.png)
👍  , ,
properties (23)
authorveleje
permlinkre-steempytutorials-how-to-calculate-a-post-s-total-rewards-using-steem-python-20180120t194505785z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"image":["https://steemitimages.com/DQmTK9z8AL4V4FD3SaDABV9YsFUjRukJwa3oD8FBSy7EAQX/0019_py_question_reward_fund.png"],"app":"steemit/0.1"}
created2018-01-20 19:45:06
last_update2018-01-20 19:46:06
depth1
children3
last_payout2018-01-27 19:45:06
cashout_time1969-12-31 23:59:59
total_payout_value0.342 HBD
curator_payout_value0.048 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length310
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,938,577
net_rshares34,537,680,620
author_curate_reward""
vote details (3)
@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
@juliank ·
$0.10
There are no silly questions! I will let @amosbastian tackle this one though as he wrote this tutorial
👍  
properties (23)
authorjuliank
permlinkre-veleje-re-steempytutorials-how-to-calculate-a-post-s-total-rewards-using-steem-python-20180120t195608098z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["amosbastian"],"app":"steemit/0.1"}
created2018-01-20 19:56:09
last_update2018-01-20 19:56:09
depth2
children0
last_payout2018-01-27 19:56:09
cashout_time1969-12-31 23:59:59
total_payout_value0.078 HBD
curator_payout_value0.024 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length102
author_reputation117,823,071,447,502
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,940,564
net_rshares9,410,934,245
author_curate_reward""
vote details (1)