Viewing a response to: @steempytutorials/how-to-calculate-a-post-s-total-rewards-using-steem-python
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: 
author | veleje |
---|---|
permlink | re-steempytutorials-how-to-calculate-a-post-s-total-rewards-using-steem-python-20180120t194505785z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"image":["https://steemitimages.com/DQmTK9z8AL4V4FD3SaDABV9YsFUjRukJwa3oD8FBSy7EAQX/0019_py_question_reward_fund.png"],"app":"steemit/0.1"} |
created | 2018-01-20 19:45:06 |
last_update | 2018-01-20 19:46:06 |
depth | 1 |
children | 3 |
last_payout | 2018-01-27 19:45:06 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.342 HBD |
curator_payout_value | 0.048 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 310 |
author_reputation | 490,220,361,761 |
root_title | "Part 9: How To Calculate A Post's Total Rewards Using Steem-Python" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,938,577 |
net_rshares | 34,537,680,620 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
juliank | 0 | 13,781,728,984 | 1% | ||
veleje | 0 | 10,800,567,088 | 100% | ||
amikphoto | 0 | 9,955,384,548 | 100% |
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.
author | amosbastian |
---|---|
permlink | re-veleje-re-steempytutorials-how-to-calculate-a-post-s-total-rewards-using-steem-python-20180120t201201375z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"links":["https://github.com/steemit/steem-python/blob/master/steem/amount.py"],"app":"steemit/0.1"} |
created | 2018-01-20 20:12:00 |
last_update | 2018-01-20 20:13:18 |
depth | 2 |
children | 1 |
last_payout | 2018-01-27 20:12:00 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.144 HBD |
curator_payout_value | 0.036 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 439 |
author_reputation | 174,473,586,900,705 |
root_title | "Part 9: How To Calculate A Post's Total Rewards Using Steem-Python" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,943,324 |
net_rshares | 16,240,485,077 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
veleje | 0 | 9,632,367,992 | 100% | ||
amosbastian | 0 | 6,608,117,085 | 100% |
I see, thank you! This example here shows better what is going on, nice, now I have two options!
author | veleje |
---|---|
permlink | re-amosbastian-re-veleje-re-steempytutorials-how-to-calculate-a-post-s-total-rewards-using-steem-python-20180120t205125482z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"app":"steemit/0.1"} |
created | 2018-01-20 20:51:24 |
last_update | 2018-01-20 20:51:24 |
depth | 3 |
children | 0 |
last_payout | 2018-01-27 20:51:24 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 96 |
author_reputation | 490,220,361,761 |
root_title | "Part 9: How To Calculate A Post's Total Rewards Using Steem-Python" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,949,765 |
net_rshares | 0 |
There are no silly questions! I will let @amosbastian tackle this one though as he wrote this tutorial
author | juliank |
---|---|
permlink | re-veleje-re-steempytutorials-how-to-calculate-a-post-s-total-rewards-using-steem-python-20180120t195608098z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"users":["amosbastian"],"app":"steemit/0.1"} |
created | 2018-01-20 19:56:09 |
last_update | 2018-01-20 19:56:09 |
depth | 2 |
children | 0 |
last_payout | 2018-01-27 19:56:09 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.078 HBD |
curator_payout_value | 0.024 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 102 |
author_reputation | 117,823,071,447,502 |
root_title | "Part 9: How To Calculate A Post's Total Rewards Using Steem-Python" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 30,940,564 |
net_rshares | 9,410,934,245 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
veleje | 0 | 9,410,934,245 | 100% |