def test_copy(self):
     amount = Amount("1", self.symbol)
     self.dotest(amount.copy(), 1, self.symbol)
 def test_properties(self):
     amount = Amount("1", self.symbol)
     self.assertEqual(amount.amount, 1.0)
     self.assertEqual(amount.symbol, self.symbol)
     self.assertIsInstance(amount.asset, Asset)
     self.assertEqual(amount.asset["symbol"], self.symbol)
Esempio n. 3
0
def contribution(row, status):
    """Convert row to dictionary, only selecting values we want."""
    contribution = Contribution(row)
    url = contribution.url

    if url == "":
        return

    database_contribution = constants.DB.contributions.find_one({"url": url})

    if contribution.staff_pick.lower() == "yes":
        staff_picked = True
    else:
        staff_picked = False

    try:
        review_date = parse(contribution.review_date)
    except Exception:
        review_date = datetime(1970, 1, 1)

    if ((datetime.now() - review_date).seconds > 561600
            and status != "unreviewed"):
        return

    total_payout = 0

    # Check if post deleted
    try:
        comment = Comment(url)
    except Exception:
        return

    try:
        if database_contribution["comment_url"]:
            comment_url = database_contribution["comment_url"]
        else:
            if contribution.review_status == "Pending":
                for reply in comment.get_replies():
                    if reply.author == contribution.moderator:
                        review_date = reply["created"]
                        comment_url = reply.permlink
                        break
                else:
                    review_date = datetime(1970, 1, 1)
                    comment_url = ""
            else:
                comment_url = ""
    except:
        comment_url = ""

    # Calculate total (pending) payout of contribution
    if comment.time_elapsed() > timedelta(days=7):
        total_payout = Amount(comment.json()["total_payout_value"]).amount
    else:
        total_payout = Amount(comment.json()["pending_payout_value"]).amount

    # Get votes, comments and author
    votes = comment.json()["net_votes"]
    comments = comment.json()["children"]
    author = comment.author

    # Add status for unvoted and pending
    if contribution.vote_status == "Unvoted":
        status = "unvoted"
    elif contribution.vote_status == "Pending":
        status = "pending"

    try:
        utopian_vote = Vote(f"{comment.authorperm}|utopian-io").sbd
    except Exception:
        voted_on = False
        utopian_vote = 0

    if utopian_vote:
        voted_on = True
    else:
        voted_on = False

    # Check for when contribution not reviewed
    if contribution.score == "":
        score = None
    else:
        try:
            score = float(contribution.score)
        except Exception:
            score = None

    # Create contribution dictionary and return it
    new_contribution = {
        "moderator": contribution.moderator.strip(),
        "author": author,
        "review_date": review_date,
        "url": url,
        "repository": contribution.repository,
        "category": contribution.category,
        "staff_picked": staff_picked,
        "picked_by": contribution.picked_by,
        "status": status,
        "score": score,
        "voted_on": voted_on,
        "total_payout": total_payout,
        "total_votes": votes,
        "total_comments": comments,
        "utopian_vote": utopian_vote,
        "created": comment["created"],
        "title": comment.title,
        "review_status": contribution.review_status.lower(),
        "comment_url": comment_url,
        "beneficiaries_set": beneficiary_set(comment),
        "is_vipo": author in VIPO_LIST,
        "valid_age": valid_age(comment)
    }

    return new_contribution
Esempio n. 4
0
            # print("start_index %d" % start_index)
            # ops = []
            #

            ops = accountTrx[account_trx_name].get_all(
                op_types=["transfer", "delegate_vesting_shares"])
            if len(ops) == 0:
                continue

            if ops[-1]["op_acc_index"] < start_index - start_index_offset:
                continue
            for op in ops:
                if op["op_acc_index"] < start_index - start_index_offset:
                    continue
                if stop_index is not None and formatTimeString(
                        op["timestamp"]) > stop_index:
                    continue
                json_op = json.loads(op["op_dict"])
                json_op["index"] = op["op_acc_index"] + start_index_offset
                if account_name != "steembasicincome" and json_op[
                        "type"] == "transfer":
                    if float(Amount(json_op["amount"],
                                    steem_instance=stm)) < 1:
                        continue
                    if json_op["memo"][:8] == 'https://':
                        continue

                pah.parse_op(json_op, parse_vesting=parse_vesting)

        print("transfer script run %.2f s" % (time.time() - start_prep_time))
Esempio n. 5
0
        trx_id = ops["trx_id"]
        if trx_id == "0000000000000000000000000000000000000000":
            trx_id = "virtual_id_" + ops["_id"]

        if limit_to_year and not year_reached and timestamp[:4] == str(
                current_year):
            if has_fork and hard_fork_reached:
                year_reached = True
            elif has_fork:
                year_reached = False
            else:
                year_reached = True
            if year_reached:
                if symbol_amount > 0:
                    amount = Amount(symbol_amount,
                                    symbol,
                                    blockchain_instance=stm)
                    data = add_deposit(data,
                                       "%d-01-01 00:00:00" % current_year,
                                       amount,
                                       description="Virtual transfer to %d" %
                                       current_year)
                if backed_symbol_amount > 0:
                    amount = Amount(backed_symbol_amount,
                                    backed_symbol,
                                    blockchain_instance=stm)
                    data = add_deposit(data,
                                       "%d-01-01 00:00:00" % current_year,
                                       amount,
                                       description="Virtual transfer to %d" %
                                       current_year)
Esempio n. 6
0
        block = ops["block"]
        timestamp = ops["timestamp"].replace("T", " ")
        trx_id = ops["trx_id"]
        if trx_id == "0000000000000000000000000000000000000000":
            trx_id = "virtual_id_" + ops["_id"]

        if limit_to_year and not year_reached and timestamp[:4] == str(
                current_year):
            if has_fork and hard_fork_reached:
                year_reached = True
            elif has_fork:
                year_reached = False
            else:
                year_reached = True
            if year_reached and symbol_amount > 0:
                amount = Amount(symbol_amount, symbol, blockchain_instance=stm)
                data = add_deposit(data,
                                   "%d-01-01 00:00:00" % current_year,
                                   amount,
                                   description="Virtual transfer to %d" %
                                   current_year)

        if limit_to_year and not next_year_reached and timestamp[:4] == str(
                current_year + 1):
            year_reached = True
            next_year_reached = False
            if symbol_amount > 0:
                amount = Amount(symbol_amount, symbol, blockchain_instance=stm)
                data = add_withdrawal(data,
                                      "%d-01-01 00:00:00" % (current_year + 1),
                                      amount,
Esempio n. 7
0
    def update_delegation(self, op, delegated_in=None, delegated_out=None):
        """ Updates the internal state arrays

            :param datetime timestamp: datetime of the update
            :param Amount/float own: vests
            :param dict delegated_in: Incoming delegation
            :param dict delegated_out: Outgoing delegation
            :param Amount/float steem: steem
            :param Amount/float sbd: sbd

        """

        self.timestamp = op["timestamp"]

        new_deleg = dict(self.delegated_vests_in)
        if delegated_in is not None and delegated_in:
            if delegated_in['amount'] == 0 and delegated_in[
                    'account'] in new_deleg:
                self.new_delegation_record(op["index"],
                                           delegated_in['account'],
                                           delegated_in['amount'],
                                           op["timestamp"],
                                           share_type="RemovedDelegation")
                del new_deleg[delegated_in['account']]
            elif delegated_in['amount'] > 0:
                self.new_delegation_record(op["index"],
                                           delegated_in['account'],
                                           delegated_in['amount'],
                                           op["timestamp"],
                                           share_type="Delegation")
                new_deleg[delegated_in['account']] = delegated_in['amount']
            else:
                self.new_delegation_record(op["index"],
                                           delegated_in['account'],
                                           delegated_in['amount'],
                                           op["timestamp"],
                                           share_type="RemovedDelegation")
        self.delegated_vests_in = new_deleg

        new_deleg = dict(self.delegated_vests_out)
        if delegated_out is not None and delegated_out:
            if delegated_out['account'] is None:
                # return_vesting_delegation
                for delegatee in new_deleg:
                    if new_deleg[delegatee]['amount'] == delegated_out[
                            'amount']:
                        del new_deleg[delegatee]
                        break

            elif delegated_out['amount'] != 0:
                # new or updated non-zero delegation
                new_deleg[delegated_out['account']] = delegated_out['amount']

                # skip undelegations here, wait for 'return_vesting_delegation'
                # del new_deleg[delegated_out['account']]

        self.delegated_vests_out = new_deleg

        delegated_sp_in = {}
        for acc in self.delegated_vests_in:
            vests = Amount(self.delegated_vests_in[acc])
            delegated_sp_in[acc] = str(self.steem.vests_to_sp(vests))
        delegated_sp_out = {}
        for acc in self.delegated_vests_out:
            vests = Amount(self.delegated_vests_out[acc])
            delegated_sp_out[acc] = str(self.steem.vests_to_sp(vests))

        if self.path is None:
            return
Esempio n. 8
0
 def test_order(self):
     order = Order(Amount("2 SBD"), Amount("1 STEEM"))
     self.assertTrue(repr(order) is not None)
Esempio n. 9
0
    def parse_transfer_in_op(self, op):
        amount = Amount(op["amount"], steem_instance=self.steem)
        share_type = "Standard"
        index = op["index"]
        account = op["from"]
        timestamp = op["timestamp"]
        sponsee = {}
        processed_memo = ascii(op["memo"]).replace('\n', '').replace(
            '\\n', '').replace('\\', '')
        if len(processed_memo) > 2 and (
                processed_memo[0] == '#' or processed_memo[1] == '#'
                or processed_memo[2] == '#') and account == "steembasicincome":
            if processed_memo[1] == '#':
                processed_memo = processed_memo[1:-1]
            elif processed_memo[2] == '#':
                processed_memo = processed_memo[2:-2]
            memo = Memo(account, op["to"], steem_instance=self.steem)
            processed_memo = ascii(memo.decrypt(processed_memo)).replace(
                '\n', '')

        shares = int(amount.amount)
        if processed_memo.lower().replace(',', '  ').replace('"', '') == "":
            self.new_transfer_record(index, processed_memo, account, account,
                                     json.dumps(sponsee), shares, timestamp)
            return
        [sponsor, sponsee, not_parsed_words,
         account_error] = self.memo_parser.parse_memo(processed_memo, shares,
                                                      account)
        if amount.amount < 1:
            data = {
                "index": index,
                "sender": account,
                "to": self.account["name"],
                "memo": processed_memo,
                "encrypted": False,
                "referenced_accounts": sponsor + ";" + json.dumps(sponsee),
                "amount": amount.amount,
                "amount_symbol": amount.symbol,
                "timestamp": timestamp
            }
            self.transactionStorage.add(data)
            return
        if amount.symbol == self.steem.sbd_symbol:
            share_type = self.steem.sbd_symbol

        sponsee_amount = 0
        for a in sponsee:
            sponsee_amount += sponsee[a]

        if sponsee_amount == 0 and not account_error and True:
            sponsee_account = self.get_highest_avg_share_age_account()
            sponsee = {sponsee_account: shares}
            print("%s sponsers %s with %d shares" %
                  (sponsor, sponsee_account, shares))
            self.new_transfer_record(index,
                                     processed_memo,
                                     account,
                                     sponsor,
                                     json.dumps(sponsee),
                                     shares,
                                     timestamp,
                                     share_type=share_type)
            self.memberStorage.update_avg_share_age(sponsee_account, 0)
            self.member_data[sponsee_account]["avg_share_age"] = 0
            return
        elif sponsee_amount == 0 and not account_error:
            sponsee = {}
            message = op["timestamp"] + " to: " + self.account[
                "name"] + " from: " + sponsor + ' amount: ' + str(
                    amount) + ' memo: ' + processed_memo + '\n'
            self.new_transfer_record(index,
                                     processed_memo,
                                     account,
                                     sponsor,
                                     json.dumps(sponsee),
                                     shares,
                                     timestamp,
                                     status="LessOrNoSponsee",
                                     share_type=share_type)
            return
        if sponsee_amount != shares and not account_error and True:
            sponsee_account = self.get_highest_avg_share_age_account()
            sponsee_shares = shares - sponsee_amount
            if sponsee_shares > 0 and sponsee_account is not None:
                sponsee = {sponsee_account: sponsee_shares}
                print("%s sponsers %s with %d shares" %
                      (sponsor, sponsee_account, sponsee_shares))
                self.new_transfer_record(index,
                                         processed_memo,
                                         account,
                                         sponsor,
                                         json.dumps(sponsee),
                                         shares,
                                         timestamp,
                                         share_type=share_type)
                self.memberStorage.update_avg_share_age(sponsee_account, 0)
                self.member_data[sponsee_account]["avg_share_age"] = 0
                return
            else:
                sponsee = {}
                self.new_transfer_record(index,
                                         processed_memo,
                                         account,
                                         sponsor,
                                         json.dumps(sponsee),
                                         shares,
                                         timestamp,
                                         status="LessOrNoSponsee",
                                         share_type=share_type)
                return
        elif sponsee_amount != shares and not account_error:
            message = op["timestamp"] + " to: " + self.account[
                "name"] + " from: " + sponsor + ' amount: ' + str(
                    amount) + ' memo: ' + ascii(op["memo"]) + '\n'
            self.new_transfer_record(index,
                                     processed_memo,
                                     account,
                                     sponsor,
                                     json.dumps(sponsee),
                                     shares,
                                     timestamp,
                                     status="LessOrNoSponsee",
                                     share_type=share_type)

            return
        if account_error:
            message = op["timestamp"] + " to: " + self.account[
                "name"] + " from: " + sponsor + ' amount: ' + str(
                    amount) + ' memo: ' + ascii(op["memo"]) + '\n'
            self.new_transfer_record(index,
                                     processed_memo,
                                     account,
                                     sponsor,
                                     json.dumps(sponsee),
                                     shares,
                                     timestamp,
                                     status="AccountDoesNotExist",
                                     share_type=share_type)

            return

        self.new_transfer_record(index,
                                 processed_memo,
                                 account,
                                 sponsor,
                                 json.dumps(sponsee),
                                 shares,
                                 timestamp,
                                 share_type=share_type)
Esempio n. 10
0
    def parse_transfer_out_op(self, op):
        amount = Amount(op["amount"], steem_instance=self.steem)
        index = op["index"]
        account = op["from"]
        timestamp = op["timestamp"]
        encrypted = False
        processed_memo = ascii(op["memo"]).replace('\n', '').replace(
            '\\n', '').replace('\\', '')
        if len(processed_memo) > 2 and (
                processed_memo[0] == '#' or processed_memo[1] == '#'
                or processed_memo[2] == '#') and account == "steembasicincome":
            if processed_memo[1] == '#':
                processed_memo = processed_memo[1:-1]
            elif processed_memo[2] == '#':
                processed_memo = processed_memo[2:-2]
            memo = Memo(account, op["to"], steem_instance=self.steem)
            processed_memo = ascii(memo.decrypt(processed_memo)).replace(
                '\n', '')
            encrypted = True

        if amount.amount < 1:
            data = {
                "index": index,
                "sender": account,
                "to": op["to"],
                "memo": processed_memo,
                "encrypted": encrypted,
                "referenced_accounts": None,
                "amount": amount.amount,
                "amount_symbol": amount.symbol,
                "timestamp": timestamp
            }
            self.transactionOutStorage.add(data)
            return
        if amount.symbol == self.steem.sbd_symbol:
            # self.trxStorage.get_account(op["to"], share_type="SBD")
            shares = -int(amount.amount)
            if "http" in op["memo"] or self.steem.steem_symbol not in op[
                    "memo"]:
                data = {
                    "index": index,
                    "sender": account,
                    "to": op["to"],
                    "memo": processed_memo,
                    "encrypted": encrypted,
                    "referenced_accounts": None,
                    "amount": amount.amount,
                    "amount_symbol": amount.symbol,
                    "timestamp": timestamp
                }
                self.transactionOutStorage.add(data)
                return
            trx = self.trxStorage.get_SBD_transfer(
                op["to"],
                shares,
                formatTimeString(op["timestamp"]),
                SBD_symbol=self.steem.sbd_symbol)
            sponsee = json.dumps({})
            if trx:
                sponsee = trx["sponsee"]
            self.new_transfer_record(op["index"],
                                     processed_memo,
                                     op["to"],
                                     op["to"],
                                     sponsee,
                                     shares,
                                     op["timestamp"],
                                     share_type="Refund")
            # self.new_transfer_record(op["index"], op["to"], "", shares, op["timestamp"], share_type="Refund")
            data = {
                "index": index,
                "sender": account,
                "to": op["to"],
                "memo": processed_memo,
                "encrypted": encrypted,
                "referenced_accounts": sponsee,
                "amount": amount.amount,
                "amount_symbol": amount.symbol,
                "timestamp": timestamp
            }
            self.transactionOutStorage.add(data)
            return

        else:
            data = {
                "index": index,
                "sender": account,
                "to": op["to"],
                "memo": processed_memo,
                "encrypted": encrypted,
                "referenced_accounts": None,
                "amount": amount.amount,
                "amount_symbol": amount.symbol,
                "timestamp": timestamp
            }
            self.transactionOutStorage.add(data)
            return
Esempio n. 11
0
]
sp_dist = {}
acc_dist = {}

top_idle = []

for i in intervals:
    sp_dist[i] = 0
    acc_dist[i] = 0

sp_excluded = 0

for acc in accounts:

    sys.stdout.write("%s\r" % acc['name'])
    sp = (Amount(acc['vesting_shares']) +
          Amount(acc['received_vesting_shares']) -
          Amount(acc['delegated_vesting_shares'])).amount / \
          1e6 * steem_per_mvests

    if len(sys.argv) > 1 and acc['name'] in exclude:
        sp_excluded += sp
        continue

    lv_date = acc['last_vote_time']
    days = (cur_date - lv_date).days
    if days > 365 and sp > 1000:
        top_idle.append({'name': acc['name'], 'sp': sp})
    for i in intervals:
        if days < i:
            sp_dist[i] += sp / 1e6
Esempio n. 12
0
        db = dataset.connect(databaseConnector)
        trxStorage = TransferTrx(db)

        for account in other_accounts:
            account = Account(account, steem_instance=stm)
            cnt = 0

            start_index = trxStorage.get_latest_index(account["name"])
            if start_index is not None:
                start_index = start_index["op_acc_index"] + 1
                print("account %s - %d" % (account["name"], start_index))
            data = []
            for op in account.history(start=start_index,
                                      use_block_num=False,
                                      only_ops=["transfer"]):
                amount = Amount(op["amount"])
                virtual_op = op["virtual_op"]
                trx_in_block = op["trx_in_block"]
                if virtual_op > 0:
                    trx_in_block = -1
                memo = ascii(op["memo"])
                d = {
                    "block": op["block"],
                    "op_acc_index": op["index"],
                    "op_acc_name": account["name"],
                    "trx_in_block": trx_in_block,
                    "op_in_trx": op["op_in_trx"],
                    "virtual_op": virtual_op,
                    "timestamp": formatTimeString(op["timestamp"]),
                    "from": op["from"],
                    "to": op["to"],
Esempio n. 13
0
    def update_account_hist(self):
        if self.hist_account is None:
            return        
        votes = []
        daily_curation = 0
        daily_author_SP = 0
        daily_author_SBD = 0
        daily_author_STEEM = 0
        self.append_account_hist()
        
        new_op_found = False
        
        start_block = self.account_hist_info["start_block"]
        if start_block == 0:
            first_call = True
            b = Blockchain()
            start_block = b.get_current_block_num() - 20 * 60 * 24 * 7
            self.account_hist_info["start_block"] = start_block
        else:
            first_call = False

        ops = self.db.load_account_hist(start_block)
     
        for op in ops:
            if op["block"] < start_block:
                # last_block = op["block"]
                continue

            start_block = op["block"]
            new_op_found = True
            tray_item = None
            op_timedelta = formatTimedelta(addTzInfo(datetime.utcnow()) - addTzInfo(op["timestamp"]))
            op_local_time = addTzInfo(op["timestamp"]).astimezone(tz.tzlocal())
            # print("Read %d" % op["index"])
            self.accountHistTableWidget.insertRow(0)
            self.accountHistTableWidget.setItem(0, 4, QTableWidgetItem(str(op_local_time)))
            if op["type"] == "vote":
                
                
                if op["voter"] == self.hist_account["name"]:
                    self.accountHistTableWidget.setItem(0, 0, QTableWidgetItem("Vote"))
                    self.accountHistTableWidget.setItem(0, 1, QTableWidgetItem(op["author"]))
                    
                elif op["weight"] >= 0:
                    self.accountHistTableWidget.setItem(0, 0, QTableWidgetItem("Vote Post"))
                    self.accountHistTableWidget.setItem(0, 1, QTableWidgetItem(op["voter"]))
                    tray_item = "%s - %s (%.2f %%) vote %s" % (op["type"], op["voter"], op["weight"] / 100, op["permlink"])
                else:
                    self.accountHistTableWidget.setItem(0, 0, QTableWidgetItem("Dowvote Post"))
                    self.accountHistTableWidget.setItem(0, 1, QTableWidgetItem(op["voter"]))
                    # hist_item.setToolTip(0, op["permlink"])
                    tray_item = "%s - %s (%.2f %%) downvote %s" % (op["type"], op["voter"], op["weight"] / 100, op["permlink"])
                
                
                self.accountHistTableWidget.setItem(0, 2, QTableWidgetItem("%.2f %%" % (op["weight"] / 100)))
                
            elif op["type"] == "curation_reward":
                self.accountHistTableWidget.setItem(0, 0, QTableWidgetItem(op["type"]))
                
                curation_reward = self.stm.vests_to_sp(Amount(op["reward"], steem_instance=self.stm))
                self.accountHistTableWidget.setItem(0, 1, QTableWidgetItem("%.3f HP" % curation_reward))
                self.accountHistTableWidget.setItem(0, 2, QTableWidgetItem(construct_authorperm(op["comment_author"], op["comment_permlink"])))
                hist_item = "%s - %s - %.3f HP for %s" % (op_local_time, op["type"], curation_reward, construct_authorperm(op["comment_author"], op["comment_permlink"]))
                tray_item = "%s - %.3f HP for %s" % (op["type"], curation_reward, construct_authorperm(op["comment_author"], op["comment_permlink"]))
            elif op["type"] == "author_reward":
                self.accountHistTableWidget.setItem(0, 0, QTableWidgetItem(op["type"]))
                sbd_payout = (Amount(op["sbd_payout"], steem_instance=self.stm))
                steem_payout = (Amount(op["steem_payout"], steem_instance=self.stm))
                sp_payout = self.stm.vests_to_sp(Amount(op["vesting_payout"], steem_instance=self.stm))
                
                hist_item = "%s - %s - %s %s %.3f SP for %s" % (op_local_time, op["type"], str(sbd_payout), str(steem_payout), sp_payout, op["permlink"])
                tray_item = "%s - %s %s %.3f SP for %s" % (op["type"], str(sbd_payout), str(steem_payout), sp_payout, op["permlink"])
            elif op["type"] == "custom_json":
                self.accountHistTableWidget.setItem(0, 0, QTableWidgetItem(op["type"]))
                self.accountHistTableWidget.setItem(0, 1, QTableWidgetItem(op["json_id"]))
                json_data = QTableWidgetItem(op["json"])
                json_data.setToolTip(op["json"])
                self.accountHistTableWidget.setItem(0, 2, json_data)
                hist_item = "%s - %s - %s" % (op_local_time, op["type"], op["id"])
                tray_item = "%s - %s" % (op["type"], op["json_id"])
            elif op["type"] == "transfer":
                self.accountHistTableWidget.setItem(0, 0, QTableWidgetItem(op["type"]))
                hist_item = "%s - %s - %s from %s" % (op_local_time, op["type"], str(Amount(op["amount"], steem_instance=self.stm)), op["from"])
                tray_item = "%s - %s from %s" % (op["type"], str(Amount(op["amount"], steem_instance=self.stm)), op["from"])
            elif op["type"] == "comment":
                
                
                if op["parent_author"] != "":
                    comment_type = "comment"
                    hist_item = "%s - comment on %s - %s from %s" % (op_local_time, construct_authorperm(op["parent_author"], op["parent_permlink"]), op["title"], op["author"])
                    tray_item = "comment from %s: %s on %s" % (op["author"], op["body"][:100], op["title"])
                    self.accountHistTableWidget.setItem(0, 0, QTableWidgetItem(op["type"]))
                    self.accountHistTableWidget.setItem(0, 1, QTableWidgetItem(op["author"]))
                    body = QTableWidgetItem(op["body"])
                    body.setToolTip(op["body"])
                    self.accountHistTableWidget.setItem(0, 2, body)
                else:
                    comment_type = "post"
                    hist_item = "%s - post - %s from %s" % (op_local_time, op["title"], op["author"])
                    tray_item = "post from %s: %s" % (op["author"], op["title"])
                self.accountHistTableWidget.setItem(0, 0, QTableWidgetItem(comment_type))
            elif op["type"] == "producer_reward":
                self.accountHistTableWidget.setItem(0, 0, QTableWidgetItem(op["type"]))
                self.accountHistTableWidget.setItem(0, 1, QTableWidgetItem(" %.3f HP" % float(self.stm.vests_to_sp(Amount(op["vesting_shares"])))))
                hist_item = "%s - %s" % (op_local_time, op["type"])
                tray_item = "%s - %.3f HP" % (op["type"], float(self.stm.vests_to_sp(Amount(op["vesting_shares"]))))               
            else:
                self.accountHistTableWidget.setItem(0, 0, QTableWidgetItem(op["type"]))
                hist_item = "%s - %s" % (op_local_time, op["type"])
                tray_item = "%s" % (op["type"])
            
            if self.accountHistNotificationCheckBox.isChecked() and not first_call and tray_item is not None:
                self.tray.showMessage(self.hist_account["name"], tray_item)

        if new_op_found:
            self.account_hist_info["start_block"] = start_block
            
            for op in ops:
                if op["type"] == "vote":
                    if op["voter"] == self.hist_account["name"]:
                        continue
                    votes.append(op)
                elif op["type"] == "curation_reward":
                    curation_reward = self.stm.vests_to_sp(Amount(op["reward"], steem_instance=self.stm))
                    daily_curation += curation_reward
                elif op["type"] == "author_reward":
                    sbd_payout = (Amount(op["sbd_payout"], steem_instance=self.stm))
                    steem_payout = (Amount(op["steem_payout"], steem_instance=self.stm))
                    sp_payout = self.stm.vests_to_sp(Amount(op["vesting_payout"], steem_instance=self.stm))
                    daily_author_SP += sp_payout
                    daily_author_STEEM += float(steem_payout)
                    daily_author_SBD += float(sbd_payout)        
        
            
            reward_text = "Curation reward (last 24 h): %.3f HP\n" % daily_curation
            reward_text += "Author reward (last 24 h):\n"
            reward_text += "%.3f HP - %.3f HIVE - %.3f HBD" % (daily_author_SP, (daily_author_STEEM), (daily_author_SBD))
            self.text2.setText(reward_text)