RE: Part 13: Upvote Posts In Batches Based On Current Voting Power With Steem-Python
Hey, I guess there are a few things that could be improved.
A dict is not a queue and not ordered. This means that the voter will not necessarily vote the posts in the same order they were added to the dict. If you want to maintain the order, use OrderedDict, list or multiprocessing.queue. If you're fine with any order, then calling it a "queue" is a little misleading.
For the VP calculation: .seconds
will give wrong results if the time difference is larger than a day. Use .total_seconds()
instead. voting_power()
as shown here returns a string for <100% and an integer for =100%. Things like starting the voter at >80% VP for example get nasty with this implementation.
Additionally, you should really look into the datetime
package. Converting a timediff to string to extract hours and minutes is not the most elegant way :)