def curation_stats(self): trailing_24hr_t = time.time() - datetime.timedelta( hours=24).total_seconds() trailing_7d_t = time.time() - datetime.timedelta( days=7).total_seconds() reward_24h = 0.0 reward_7d = 0.0 for event in self.history2(filter_by="curation_reward", limit=2000): if parser.parse(event['timestamp'] + "UTC").timestamp() > trailing_7d_t: reward_7d += parse_payout(event['op']['reward']) if parser.parse(event['timestamp'] + "UTC").timestamp() > trailing_24hr_t: reward_24h += parse_payout(event['op']['reward']) reward_7d = self.converter.vests_to_sp(reward_7d) reward_24h = self.converter.vests_to_sp(reward_24h) return { "24hr": reward_24h, "7d": reward_7d, "avg": reward_7d / 7, }
def get_balances(self): my_account_balances = self.steem.get_balances(self.name) return { "steem": parse_payout(my_account_balances["balance"]), "sbd": parse_payout(my_account_balances["sbd_balance"]), "vests": parse_payout(my_account_balances["vesting_shares"]), }
def avg_payout_per_post(self, skip=1, max_posts=10): total_payout = 0 blog = self.get_blog()[skip:max_posts + skip] for post in blog: total_payout += parse_payout(post['total_payout_reward']) if len(blog) == 0: return 0 return total_payout / len(blog)
def number_of_winning_posts(self, skip=1, payout_requirement=300, max_posts=10): winning_posts = 0 blog = self.get_blog()[skip:max_posts + skip] for post in blog: total_payout = parse_payout(post['total_payout_reward']) if total_payout >= payout_requirement: winning_posts += 1 nt = namedtuple('WinningPosts', ['winners', 'blog_posts']) return nt(winning_posts, len(blog))
def number_of_winning_posts(self, skip=1, payout_requirement=300, max_posts=10): winning_posts = 0 blog = self.get_blog()[skip:max_posts + skip] for post in blog: total_payout = parse_payout(post['total_payout_reward']) if total_payout >= payout_requirement: winning_posts += 1 return winning_posts, len(blog)
def avg_witness_price(self, take=10): price_history = self.steem.rpc.get_feed_history()['price_history'] return np.mean( [parse_payout(x['base']) for x in price_history[-take:]])
def get_sp(self): vests = int(parse_payout(self.get_props()['vesting_shares'])) return self.converter.vests_to_sp(vests)
def steem_per_mvests(self): info = self.steem.rpc.get_dynamic_global_properties() return ( parse_payout(info["total_vesting_fund_steem"]) / (parse_payout(info["total_vesting_shares"]) / 1e6) )
def payout(self): return parse_payout(self['total_payout_reward'])
from pprint import pprint from steemtools.base import Account from steemtools.helpers import parse_payout, is_comment # get all posts from August account = Account("furion") START_DATE = "2016-08-01T00:00:00" END_DATE = "2016-09-01T00:00:00" # get posts and comments from August Account.filter_by_date(account.history(filter_by="comment"), START_DATE, END_DATE) # get just the titles of only posts from August print([ x['op']['title'] for x in Account.filter_by_date(account.history( filter_by="comment"), START_DATE, END_DATE) if not is_comment(x['op']) ]) for event in Account("furion").history(filter_by=["transfer"]): transfer = event['op'] if transfer['to'] == "null": print("$%.1f :: %s" % (parse_payout(transfer['amount']), transfer['memo']))