You are viewing a single comment's thread from:

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

in #utopian-io7 years ago (edited)

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

Sort:  

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

I see, thank you!
This example here shows better what is going on, nice, now I have two options!

There are no silly questions! I will let @amosbastian tackle this one though as he wrote this tutorial

Coin Marketplace

STEEM 0.16
TRX 0.12
JST 0.026
BTC 56792.41
ETH 2444.34
BNB 487.19
SBD 2.39