comment_vote_divider = conf_setup["comment_vote_divider"] accountTrx = {} for account in accounts: if account == "steembasicincome": accountTrx["sbi"] = AccountTrx(db, "sbi") else: accountTrx[account] = AccountTrx(db, account) print("sbi_update_member_db: last_cycle: %s - %.2f min" % (formatTimeString(last_cycle), (datetime.utcnow() - last_cycle).total_seconds() / 60)) print("last_paid_post: %s - last_paid_comment: %s" % (formatTimeString(last_paid_post), formatTimeString(last_paid_comment))) if last_cycle is None: last_cycle = datetime.utcnow() - timedelta(seconds = 60 * 145) confStorage.update({"last_cycle": last_cycle}) elif (datetime.utcnow() - last_cycle).total_seconds() > 60 * share_cycle_min: new_cycle = (datetime.utcnow() - last_cycle).total_seconds() > 60 * share_cycle_min current_cycle = last_cycle + timedelta(seconds=60 * share_cycle_min) print("Update member database, new cycle: %s" % str(new_cycle)) # memberStorage.wipe(True) member_accounts = memberStorage.get_all_accounts() data = trxStorage.get_all_data() data = sorted(data, key=lambda x: (datetime.utcnow() - x["timestamp"]).total_seconds(), reverse=True) # Update current node list from @fullnodeupdate
last_cycle = conf_setup["last_cycle"] share_cycle_min = conf_setup["share_cycle_min"] sp_share_ratio = conf_setup["sp_share_ratio"] rshares_per_cycle = conf_setup["rshares_per_cycle"] upvote_multiplier = conf_setup["upvote_multiplier"] last_paid_post = conf_setup["last_paid_post"] last_paid_comment = conf_setup["last_paid_comment"] print("last_cycle: %s - %.2f min" % (formatTimeString(last_cycle), (datetime.utcnow() - last_cycle).total_seconds() / 60)) if last_cycle is None: last_cycle = datetime.utcnow() - timedelta(seconds = 60 * 145) confStorage.update({"last_cycle": last_cycle}) elif True: # doing same maintanence data = trxStorage.get_all_data() data = sorted(data, key=lambda x: (datetime.utcnow() - x["timestamp"]).total_seconds(), reverse=True) # data = sorted(data, key=lambda x: (datetime.utcnow() - x["timestamp"]).total_seconds(), reverse=True) key_list = [] key = keyStorage.get("steembasicincome", "memo") if key is not None: key_list.append(key["wif"]) #print(key_list) nodes = NodeList() try: nodes.update_nodes() except: print("could not update nodes") stm = Steem(keys=key_list, node=nodes.get_nodes())
try: share_type = op["share_type"] sponsor = op["sponsor"] sponsee = json.loads(op["sponsee"]) shares = op["shares"] share_age = 0 if isinstance(op["timestamp"], str): timestamp = formatTimeString(op["timestamp"]) else: timestamp = op["timestamp"] except: print("error at: %s" % str(op)) if False: #reset last cycle print("reset last cycle") confStorage.update({ "last_cycle": last_cycle - timedelta(seconds=60 * share_cycle_min) }) if False: # reset management shares print("Reset all mgmt trx data") trxStorage.delete_all("mgmt") shares_sum = 0 total_mgnt_shares_sum = 0 mngt_shares_sum = 0 share_mngt_round = 0 for account in mgnt_shares: share_mngt_round += mgnt_shares[account] start_index = 0 for op in data: if op["status"] == "Valid": share_type = op["share_type"] if share_type.lower() not in [
last_delegation_check = delegation_timestamp[acc] elif last_delegation_check is None: last_delegation_check = delegation_timestamp[acc] # if acc in delegation_shares and delegation_shares[acc] > 0: # continue print(acc) leased = transferStorage.find(acc, account) if len(leased) == 0: delegation_shares[acc] = delegation_account[acc] shares = int(delegation_account[acc] / sp_share_ratio) trxStorage.update_delegation_shares(account, acc, shares) continue delegation_leased[acc] = delegation_account[acc] trxStorage.update_delegation_state(account, acc, "Delegation", "DelegationLeased") print("set delegration from %s to leased" % acc) dd = delegation for d in dd: sum_sp += dd[d] dd = delegation_leased for d in dd: sum_sp_leased += dd[d] dd = delegation_shares for d in dd: sum_sp_shares += dd[d] print("%s: sum %.6f SP - shares %.6f SP - leased %.6f SP" % (account, sum_sp, sum_sp_shares, sum_sp_leased)) confStorage.update({"last_delegation_check": last_delegation_check})
last_delegation_check = conf_setup["last_delegation_check"] minimum_vote_threshold = conf_setup["minimum_vote_threshold"] accountTrx = {} for account in accounts: if account == "steembasicincome": accountTrx["sbi"] = AccountTrx(db, "sbi") else: accountTrx[account] = AccountTrx(db, account) print("last_cycle: %s - %.2f min" % (formatTimeString(last_cycle), (datetime.utcnow() - last_cycle).total_seconds() / 60)) if last_cycle is None: last_cycle = datetime.utcnow() - timedelta(seconds=60 * 145) confStorage.update({"last_cycle": last_cycle}) elif False: # doing same maintanence data = trxStorage.get_all_data() data = sorted(data, key=lambda x: (datetime.utcnow() - x["timestamp"]).total_seconds(), reverse=True) # data = sorted(data, key=lambda x: (datetime.utcnow() - x["timestamp"]).total_seconds(), reverse=True) key_list = [] key = keyStorage.get("steembasicincome", "memo") if key is not None: key_list.append(key["wif"]) #print(key_list) nodes = NodeList() try: nodes.update_nodes()