create account

RE: Daily Steem-Python Challenge #8, Win 1 Steem! by maxg

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

Viewing a response to: @steempytutorials/daily-steem-python-challenge-8-win-1-steem

· @maxg ·
$0.19
Code: https://gist.github.com/maxwellgerber/f6b8cfd861228e28f8a57f8887e3a0e8
👍  , ,
properties (23)
authormaxg
permlinkre-steempytutorials-daily-steem-python-challenge-8-win-1-steem-20180120t204958942z
categorycontest
json_metadata{"tags":["contest"],"links":["https://gist.github.com/maxwellgerber/f6b8cfd861228e28f8a57f8887e3a0e8"],"app":"steemit/0.1"}
created2018-01-20 20:49:57
last_update2018-01-20 20:49:57
depth1
children5
last_payout2018-01-27 20:49:57
cashout_time1969-12-31 23:59:59
total_payout_value0.150 HBD
curator_payout_value0.036 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length76
author_reputation5,859,582,764,121
root_title"Daily Steem-Python Challenge #8, Win 1 Steem!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,949,539
net_rshares16,684,236,538
author_curate_reward""
vote details (3)
@amosbastian · (edited)
Just tested it and there are some tiny errors, but if you fix them, then it works as specified! Go, go, go, if you are quick you can still win!
properties (22)
authoramosbastian
permlinkre-maxg-re-steempytutorials-daily-steem-python-challenge-8-win-1-steem-20180121t140830906z
categorycontest
json_metadata{"tags":["contest"],"app":"steemit/0.1"}
created2018-01-21 14:08:30
last_update2018-01-21 14:11:18
depth2
children3
last_payout2018-01-28 14:08:30
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_length143
author_reputation174,473,586,900,705
root_title"Daily Steem-Python Challenge #8, Win 1 Steem!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id31,114,994
net_rshares0
@emrebeyler ·
$0.06
😇
👍  
properties (23)
authoremrebeyler
permlinkre-amosbastian-re-maxg-re-steempytutorials-daily-steem-python-challenge-8-win-1-steem-20180121t142713754z
categorycontest
json_metadata{"tags":["contest"],"app":"steemit/0.1"}
created2018-01-21 14:27:12
last_update2018-01-21 14:27:12
depth3
children0
last_payout2018-01-28 14:27:12
cashout_time1969-12-31 23:59:59
total_payout_value0.048 HBD
curator_payout_value0.012 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1
author_reputation448,535,049,068,622
root_title"Daily Steem-Python Challenge #8, Win 1 Steem!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id31,119,215
net_rshares5,341,674,648
author_curate_reward""
vote details (1)
@maxg ·
$0.07
Cleaned and updated!
There was one pretty big error with how I was calculating voting power. The voting power param set on the account object is your VP at the last time you voted. So you need to do some math with the last vote time to figure out your current real voting power.
```
def calc_vote_power(account):
    vp = account['voting_power']
    last = datetime.strptime(account['last_vote_time'], "%Y-%m-%dT%H:%M:%S")
    diff = datetime.utcnow().timestamp() - last.timestamp()
    return (vp + 1e4 * diff / 432e3) / 10000
```
I actually had to find this one by going through the source code for [steemnow](https://www.steemnow.com/@maxg)
![](https://steemitimages.com/DQmZF75n9KMfq6sjwQ385bvk4DZQtezCW3kvBBs2f5A1kkt/image.png)
Other than that it was just import errors and the like :P
👍  
properties (23)
authormaxg
permlinkre-amosbastian-re-maxg-re-steempytutorials-daily-steem-python-challenge-8-win-1-steem-20180121t164425662z
categorycontest
json_metadata{"tags":["contest"],"image":["https://steemitimages.com/DQmZF75n9KMfq6sjwQ385bvk4DZQtezCW3kvBBs2f5A1kkt/image.png"],"links":["https://www.steemnow.com/@maxg"],"app":"steemit/0.1"}
created2018-01-21 16:44:24
last_update2018-01-21 16:44:24
depth3
children1
last_payout2018-01-28 16:44:24
cashout_time1969-12-31 23:59:59
total_payout_value0.054 HBD
curator_payout_value0.018 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length790
author_reputation5,859,582,764,121
root_title"Daily Steem-Python Challenge #8, Win 1 Steem!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id31,148,541
net_rshares6,821,979,169
author_curate_reward""
vote details (1)
@amosbastian ·
O wow, I didn't know that about voting power! I just sent you the STEEM, congratulations!
properties (22)
authoramosbastian
permlinkre-maxg-re-amosbastian-re-maxg-re-steempytutorials-daily-steem-python-challenge-8-win-1-steem-20180121t183625316z
categorycontest
json_metadata{"tags":["contest"],"app":"steemit/0.1"}
created2018-01-21 18:36:24
last_update2018-01-21 18:36:24
depth4
children0
last_payout2018-01-28 18:36: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_length89
author_reputation174,473,586,900,705
root_title"Daily Steem-Python Challenge #8, Win 1 Steem!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id31,171,230
net_rshares0
@juliank ·
Again on point! Just about to go over the code from the challenge from yesterday and you have already submitted another ;)
👍  
properties (23)
authorjuliank
permlinkre-maxg-re-steempytutorials-daily-steem-python-challenge-8-win-1-steem-20180120t213722734z
categorycontest
json_metadata{"tags":["contest"],"app":"steemit/0.1"}
created2018-01-20 21:37:21
last_update2018-01-20 21:37:21
depth2
children0
last_payout2018-01-27 21:37:21
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_length122
author_reputation117,823,071,447,502
root_title"Daily Steem-Python Challenge #8, Win 1 Steem!"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id30,956,990
net_rshares749,512,889
author_curate_reward""
vote details (1)