Exemple #1
0
    config_file = 'config.json'
    if not os.path.isfile(config_file):
        raise Exception("config.json is missing!")
    else:
        with open(config_file) as json_data_file:
            config_data = json.load(json_data_file)
        # print(config_data)
        accounts = config_data["accounts"]
        databaseConnector = config_data["databaseConnector"]
        databaseConnector2 = config_data["databaseConnector2"]
        mgnt_shares = config_data["mgnt_shares"]

    start_prep_time = time.time()
    db2 = dataset.connect(databaseConnector2)
    db = dataset.connect(databaseConnector)
    transferStorage = TransferTrx(db)
    # Create keyStorage
    trxStorage = TrxDB(db2)
    keyStorage = KeysDB(db2)
    memberStorage = MemberDB(db2)
    # accountStorage = MemberHistDB(db)
    confStorage = ConfigurationDB(db2)
    transactionStorage = TransactionMemoDB(db2)

    transferMemosStorage = TransferMemoDB(db2)

    accountStorage = AccountsDB(db2)
    accounts = accountStorage.get()
    accounts_data = accountStorage.get_data()
    other_accounts = accountStorage.get_transfer()
Exemple #2
0
    print("sbi_check_delegation: last_cycle: %s - %.2f min" %
          (formatTimeString(last_cycle),
           (datetime.utcnow() - last_cycle).total_seconds() / 60))

    if last_cycle is not None and (datetime.utcnow() - last_cycle
                                   ).total_seconds() > 60 * share_cycle_min:

        nodes = NodeList()
        try:
            nodes.update_nodes()
        except:
            print("could not update nodes")
        stm = Steem(node=nodes.get_nodes())
        set_shared_steem_instance(stm)

        transferStorage = TransferTrx(db)
        trxStorage = TrxDB(db2)
        memberStorage = MemberDB(db2)

        # Update current node list from @fullnodeupdate

        delegation = {}
        sum_sp = {}
        sum_sp_shares = {}
        sum_sp_leased = {}
        account = "steembasicincome"
        delegation = {}
        delegation_shares = {}
        sum_sp = 0
        sum_sp_leased = 0
        sum_sp_shares = 0
Exemple #3
0
            start_index += 1
            last_block = op["block"]
            last_trx = trx_in_block
            data.append(d)
            if cnt % 1000 == 0:
                print(op["timestamp"])
                accountTrx[account_name].add_batch(data)
                data = []
            cnt += 1
        if len(data) > 0:
            print(op["timestamp"])
            accountTrx[account_name].add_batch(data)
            data = []

    # Create keyStorage
    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"]
Exemple #4
0
                    "type": op["type"],
                    "op_dict": json.dumps(op)
                }
                data.append(d)
                if cnt % 1000 == 0:
                    print(op["timestamp"])
                    accountTrx[account_name].add_batch(data)
                    data = []
                cnt += 1
            if len(data) > 0:
                print(op["timestamp"])
                accountTrx[account_name].add_batch(data)
                data = []

    # Create keyStorage
    trxStorage = TransferTrx(db)

    if not trxStorage.exists_table():
        trxStorage.create_table()
    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"]):