I was asked about an easier solution for my bid bot bot.
Here is it:
Bit Bod Checker
Quite self explanatory.
Just add more bots into the list and you will get the output, if it is ok to bid on them.
I included already my bot, @microbot, and @buildawhale for you in it.
import datetime
import time
import os
from dateutil import parser
from steem import Steem
from steem.account import Account
from steem.amount import Amount
print(time.strftime("%a, %d %b %Y %H:%M:%S +0000",time.localtime()),flush=True)
s = Steem()
botlist = [{'username':'microbot',
'vote_thr':130, # 144 Minutes bid window, when do you want to place your bet? x Minutes
'bet_amount':0.01 # Amount to bet on bot in SBD
},
{'username':'buildawhale',
'vote_thr':130,
'bet_amount':2.5
}
]
rwl = s.get_reward_fund('post')
rc = int(rwl['recent_claims'])
rb = float(rwl['reward_balance'].split(' ')[0])
for bb in botlist:
print(bb)
username = bb['username']
bet_amount= bb['bet_amount']
vote_thr = bb['vote_thr']
now = parser.parse(str(datetime.datetime.utcnow())+' UTC')
maccount = Account(username,s)
last_vote = parser.parse(maccount['last_vote_time']+' UTC')
if now-last_vote > datetime.timedelta(minutes=vote_thr):
print('It is time to bid on ',username)
mvs = float(maccount['vesting_shares'].split(' ')[0])+float(maccount['received_vesting_shares'].split(' ')[0])-float(maccount['delegated_vesting_shares'].split(' ')[0])
mvs1 = mvs * 20000
click = (mvs1 * rb / rc)
base_price = s.get_current_median_history_price()["base"]
fct = Amount(base_price).amount
hrs = maccount.history_reverse(filter_by='transfer')
total_bid = 0.0
for x in hrs:
mytime = parser.parse(x['timestamp']+' UTC')
if mytime<last_vote:
break
if x['to'] == username:
tr = float(x['amount'].split(' ')[0])
total_bid += tr
roi = click*fct*bet_amount/(total_bid+(bet_amount))
print(username,' Bot click is worth: '+str(click*fct)+' SBD')
print('Currently your invest of '+str(bet_amount)+' SBD would give you a return of '+str(roi)+' SBD')
Have fun!:)