beem.account

class beem.account.Account(account, full=True, lazy=False, blockchain_instance=None, **kwargs)

Bases: beem.blockchainobject.BlockchainObject

This class allows to easily access Account data

Parameters:
  • account (str) – Name of the account
  • blockchain_instance (Steem/Hive) – Hive or Steem instance
  • lazy (bool) – Use lazy loading
  • full (bool) – Obtain all account data including orders, positions, etc.
  • hive_instance (Hive) – Hive instance
  • steem_instance (Steem) – Steem instance
Returns:

Account data

Return type:

dictionary

Raises:

beem.exceptions.AccountDoesNotExistsException – if account does not exist

Instances of this class are dictionaries that come with additional methods (see below) that allow dealing with an account and its corresponding functions.

>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("gtg", blockchain_instance=stm)
>>> print(account)
<Account gtg>
>>> print(account.balances) 

Note

This class comes with its own caching function to reduce the load on the API server. Instances of this class can be refreshed with Account.refresh(). The cache can be cleared with Account.clear_cache()

allow(foreign, weight=None, permission='posting', account=None, threshold=None, **kwargs)

Give additional access to an account by some other public key or account.

Parameters:
  • foreign (str) – The foreign account that will obtain access
  • weight (int) – (optional) The weight to use. If not define, the threshold will be used. If the weight is smaller than the threshold, additional signatures will be required. (defaults to threshold)
  • permission (str) – (optional) The actual permission to modify (defaults to posting)
  • account (str) – (optional) the account to allow access to (defaults to default_account)
  • threshold (int) – (optional) The threshold that needs to be reached by signatures to be able to interact
approvewitness(witness, account=None, approve=True, **kwargs)

Approve a witness

Parameters:
  • witness (list) – list of Witness name or id
  • account (str) – (optional) the account to allow access to (defaults to default_account)
available_balances

List balances of an account. This call returns instances of beem.amount.Amount.

balances

Returns all account balances as dictionary

blog_history(limit=None, start=-1, reblogs=True, account=None)

Stream the blog entries done by an account in reverse time order.

Note

RPC nodes keep a limited history of entries for the user blog. Older blog posts of an account may not be available via this call due to these node limitations.

Parameters:
  • limit (int) – (optional) stream the latest limit blog entries. If unset (default), all available blog entries are streamed.
  • start (int) – (optional) start streaming the blog entries from this index. start=-1 (default) starts with the latest available entry.
  • reblogs (bool) – (optional) if set True (default) reblogs / resteems are included. If set False, reblogs/resteems are omitted.
  • account (str) – (optional) the account to stream blog entries for (defaults to default_account)

blog_history_reverse example:

from beem.account import Account
from beem import Steem
from beem.nodelist import NodeList
nodelist = NodeList()
nodelist.update_nodes()
stm = Steem(node=nodelist.get_hive_nodes())
acc = Account("steemitblog", blockchain_instance=stm)
for post in acc.blog_history(limit=10):
    print(post)
cancel_transfer_from_savings(request_id, account=None, **kwargs)

Cancel a withdrawal from ‘savings’ account.

Parameters:
  • request_id (str) – Identifier for tracking or cancelling the withdrawal
  • account (str) – (optional) the source account for the transfer if not default_account
change_recovery_account(new_recovery_account, account=None, **kwargs)

Request a change of the recovery account.

Note

It takes 30 days until the change applies. Another request within this time restarts the 30 day period. Setting the current recovery account again cancels any pending change request.

Parameters:
  • new_recovery_account (str) – account name of the new recovery account
  • account (str) – (optional) the account to change the recovery account for (defaults to default_account)
claim_reward_balance(reward_steem=0, reward_sbd=0, reward_hive=0, reward_hbd=0, reward_vests=0, account=None, **kwargs)

Claim reward balances. By default, this will claim all outstanding balances. To bypass this behaviour, set desired claim amount by setting any of reward_steem/``reward_hive, reward_sbd/``reward_hbd or reward_vests.

Parameters:
  • reward_steem (str) – Amount of STEEM you would like to claim.
  • reward_hive (str) – Amount of HIVE you would like to claim.
  • reward_sbd (str) – Amount of SBD you would like to claim.
  • reward_hbd (str) – Amount of HBD you would like to claim.
  • reward_vests (str) – Amount of VESTS you would like to claim.
  • account (str) – The source account for the claim if not default_account is used.
comment_history(limit=None, start_permlink=None, account=None)

Stream the comments done by an account in reverse time order.

Note

RPC nodes keep a limited history of user comments for the user feed. Older comments may not be available via this call due to these node limitations.

Parameters:
  • limit (int) – (optional) stream the latest limit comments. If unset (default), all available comments are streamed.
  • start_permlink (str) – (optional) start streaming the comments from this permlink. start_permlink=None (default) starts with the latest available entry.
  • account (str) – (optional) the account to stream comments for (defaults to default_account)

comment_history_reverse example:

from beem.account import Account
from beem import Steem
from beem.nodelist import NodeList
nodelist = NodeList()
nodelist.update_nodes()
stm = Steem(node=nodelist.get_hive_nodes())
acc = Account("ned", blockchain_instance=stm)
for comment in acc.comment_history(limit=10):
    print(comment)
convert(amount, account=None, request_id=None)

Convert SteemDollars to Steem (takes 3.5 days to settle)

Parameters:
  • amount (float) – amount of SBD to convert
  • account (str) – (optional) the source account for the transfer if not default_account
  • request_id (str) – (optional) identifier for tracking the conversion`
curation_stats()

Returns the curation reward of the last 24h and 7d and the average of the last 7 days

Returns:Account curation
Return type:dictionary

Sample output:

{
    '24hr': 0.0,
    '7d': 0.0,
    'avg': 0.0
}
delegate_vesting_shares(to_account, vesting_shares, account=None, **kwargs)

Delegate SP to another account.

Parameters:
  • to_account (str) – Account we are delegating shares to (delegatee).
  • vesting_shares (str) – Amount of VESTS to delegate eg. 10000 VESTS.
  • account (str) – The source account (delegator). If not specified, default_account is used.
disallow(foreign, permission='posting', account=None, threshold=None, **kwargs)

Remove additional access to an account by some other public key or account.

Parameters:
  • foreign (str) – The foreign account that will obtain access
  • permission (str) – (optional) The actual permission to modify (defaults to posting)
  • account (str) – (optional) the account to allow access to (defaults to default_account)
  • threshold (int) – The threshold that needs to be reached by signatures to be able to interact
disapprovewitness(witness, account=None, **kwargs)

Disapprove a witness

Parameters:
  • witness (list) – list of Witness name or id
  • account (str) – (optional) the account to allow access to (defaults to default_account)
ensure_full()

Ensure that all data are loaded

estimate_virtual_op_num(blocktime, stop_diff=0, max_count=100, min_index=None)

Returns an estimation of an virtual operation index for a given time or blockindex

Parameters:
  • blocktime (int, datetime) – start time or start block index from which account operation should be fetched
  • stop_diff (int) – Sets the difference between last estimation and new estimation at which the estimation stops. Must not be zero. (default is 1)
  • max_count (int) – sets the maximum number of iterations. -1 disables this (default 100)
utc = pytz.timezone('UTC')
start_time = utc.localize(datetime.utcnow()) - timedelta(days=7)
acc = Account("gtg")
start_op = acc.estimate_virtual_op_num(start_time)

b = Blockchain()
start_block_num = b.get_estimated_block_num(start_time)
start_op2 = acc.estimate_virtual_op_num(start_block_num)
acc = Account("gtg")
block_num = 21248120
start = t.time()
op_num = acc.estimate_virtual_op_num(block_num, stop_diff=1, max_count=10)
stop = t.time()
print(stop - start)
for h in acc.get_account_history(op_num, 0):
    block_est = h["block"]
print(block_est - block_num)
feed_history(limit=None, start_author=None, start_permlink=None, account=None)

Stream the feed entries of an account in reverse time order.

Note

RPC nodes keep a limited history of entries for the user feed. Older entries may not be available via this call due to these node limitations.

Parameters:
  • limit (int) – (optional) stream the latest limit feed entries. If unset (default), all available entries are streamed.
  • start_author (str) – (optional) start streaming the replies from this author. start_permlink=None (default) starts with the latest available entry. If set, start_permlink has to be set as well.
  • start_permlink (str) – (optional) start streaming the replies from this permlink. start_permlink=None (default) starts with the latest available entry. If set, start_author has to be set as well.
  • account (str) – (optional) the account to get replies to (defaults to default_account)

comment_history_reverse example:

from beem.account import Account
from beem import Steem
from beem.nodelist import NodeList
nodelist = NodeList()
nodelist.update_nodes()
stm = Steem(node=nodelist.get_hive_nodes())
acc = Account("ned", blockchain_instance=stm)
for reply in acc.feed_history(limit=10):
    print(reply)
follow(other, what=['blog'], account=None)

Follow/Unfollow/Mute/Unmute another account’s blog

Note

what can be one of the following on HIVE:

blog, ignore, blacklist, unblacklist, follow_blacklist, unfollow_blacklist, follow_muted, unfollow_muted

Parameters:
  • other (str/list) – Follow this account / accounts (only hive)
  • what (list) – List of states to follow. ['blog'] means to follow other, [] means to unfollow/unmute other, ['ignore'] means to ignore other, (defaults to ['blog'])
  • account (str) – (optional) the account to allow access to (defaults to default_account)
getSimilarAccountNames(limit=5)

Deprecated, please use get_similar_account_names

get_account_bandwidth(bandwidth_type=1, account=None)
get_account_history(index, limit, order=-1, start=None, stop=None, use_block_num=True, only_ops=[], exclude_ops=[], raw_output=False)

Returns a generator for individual account transactions. This call can be used in a for loop.

Parameters:
  • index (int) – first number of transactions to return
  • limit (int) – limit number of transactions to return
  • start (int, datetime) – start number/date of transactions to return (optional)
  • stop (int, datetime) – stop number/date of transactions to return (optional)
  • use_block_num (bool) – if true, start and stop are block numbers, otherwise virtual OP count numbers.
  • only_ops (array) – Limit generator by these operations (optional)
  • exclude_ops (array) – Exclude thse operations from generator (optional)
  • batch_size (int) – internal api call batch size (optional)
  • order (int) – 1 for chronological, -1 for reverse order
  • raw_output (bool) – if False, the output is a dict, which includes all values. Otherwise, the output is list.

Note

only_ops and exclude_ops takes an array of strings: The full list of operation ID’s can be found in beembase.operationids.ops. Example: [‘transfer’, ‘vote’]

get_account_posts(sort='feed', limit=20, account=None, observer=None, raw_data=False)

Returns account feed

get_account_votes(account=None, start_author='', start_permlink='', limit=1000, start_date=None)

Returns all votes that the account has done

Return type:list
>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("beem.app", blockchain_instance=stm)
>>> account.get_account_votes()  
get_balance(balances, symbol)

Obtain the balance of a specific Asset. This call returns instances of beem.amount.Amount. Available balance types:

  • “available”
  • “saving”
  • “reward”
  • “total”
Parameters:
  • balances (str) – Defines the balance type
  • symbol (str, dict) – Can be “SBD”, “STEEM” or “VESTS
>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("beem.app", blockchain_instance=stm)
>>> account.get_balance("rewards", "HBD")
0.000 HBD
get_balances()

Returns all account balances as dictionary

Returns:Account balances
Return type:dictionary

Sample output:

{
    'available': [102.985 STEEM, 0.008 SBD, 146273.695970 VESTS],
    'savings': [0.000 STEEM, 0.000 SBD],
    'rewards': [0.000 STEEM, 0.000 SBD, 0.000000 VESTS],
    'total': [102.985 STEEM, 0.008 SBD, 146273.695970 VESTS]
}
get_bandwidth()

Returns used and allocated bandwidth

Return type:dictionary

Sample output:

{
    'used': 0,
    'allocated': 2211037
}
get_blog(start_entry_id=0, limit=100, raw_data=False, short_entries=False, account=None)

Returns the list of blog entries for an account

Parameters:
  • start_entry_id (int) – default is 0
  • limit (int) – default is 100
  • raw_data (bool) – default is False
  • short_entries (bool) – when set to True and raw_data is True, get_blog_entries is used istead of get_blog
  • account (str) – When set, a different account name is used (Default is object account name)
Return type:

list

>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("steemit", blockchain_instance=stm)
>>> account.get_blog(0, 1)
[<Comment @steemit/firstpost>]
get_blog_authors(account=None)

Returns a list of authors that have had their content reblogged on a given blog account

Parameters:account (str) – When set, a different account name is used (Default is object account name)
Return type:list
>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("gtg", blockchain_instance=stm)
>>> account.get_blog_authors() 
get_blog_entries(start_entry_id=0, limit=100, raw_data=True, account=None)

Returns the list of blog entries for an account

Parameters:
  • start_entry_id (int) – default is 0
  • limit (int) – default is 100
  • raw_data (bool) – default is False
  • account (str) – When set, a different account name is used (Default is object account name)
Return type:

list

>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("steemit", blockchain_instance=stm)
>>> entry = account.get_blog_entries(0, 1, raw_data=True)[0]
>>> print("%s - %s - %s" % (entry["author"], entry["permlink"], entry["blog"]))
steemit - firstpost - steemit
get_conversion_requests(account=None)

Returns a list of SBD conversion request

Parameters:account (str) – When set, a different account is used for the request (Default is object account name)
Return type:list
>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("beem.app", blockchain_instance=stm)
>>> account.get_conversion_requests()
[]
get_creator()

Returns the account creator or None if the account was mined

get_curation_reward(days=7)

Returns the curation reward of the last days days

Parameters:days (int) – limit number of days to be included int the return value
get_downvote_manabar()

Return downvote manabar

get_downvoting_power(with_regeneration=True)

Returns the account downvoting power in the range of 0-100%

Parameters:with_regeneration (bool) – When True, downvoting power regeneration is included into the result (default True)
get_effective_vesting_shares()

Returns the effective vesting shares

get_escrow(escrow_id=0, account=None)

Returns the escrow for a certain account by id

Parameters:
  • escrow_id (int) – Id (only pre appbase)
  • account (str) – When set, a different account is used for the request (Default is object account name)
Return type:

list

>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("beem.app", blockchain_instance=stm)
>>> account.get_escrow(1234)
[]
get_expiring_vesting_delegations(after=None, limit=1000, account=None)

Returns the expirations for vesting delegations.

Parameters:
  • after (datetime) – expiration after (only for pre appbase nodes)
  • limit (int) – limits number of shown entries (only for pre appbase nodes)
  • account (str) – When set, a different account is used for the request (Default is object account name)
Return type:

list

>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("beem.app", blockchain_instance=stm)
>>> account.get_expiring_vesting_delegations()
[]
get_feed(start_entry_id=0, limit=100, raw_data=False, short_entries=False, account=None)

Returns a list of items in an account’s feed

Parameters:
  • start_entry_id (int) – default is 0
  • limit (int) – default is 100
  • raw_data (bool) – default is False
  • short_entries (bool) – when set to True and raw_data is True, get_feed_entries is used istead of get_feed
  • account (str) – When set, a different account name is used (Default is object account name)
Return type:

list

>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("steemit", blockchain_instance=stm)
>>> account.get_feed(0, 1, raw_data=True)
[]
get_feed_entries(start_entry_id=0, limit=100, raw_data=True, account=None)

Returns a list of entries in an account’s feed

Parameters:
  • start_entry_id (int) – default is 0
  • limit (int) – default is 100
  • raw_data (bool) – default is False
  • short_entries (bool) – when set to True and raw_data is True, get_feed_entries is used istead of get_feed
  • account (str) – When set, a different account name is used (Default is object account name)
Return type:

list

>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("steemit", blockchain_instance=stm)
>>> account.get_feed_entries(0, 1)
[]
get_follow_count(account=None)
get_follow_list(follow_type, starting_account=None, limit=100, raw_name_list=True)

Returns the follow list for the specified follow_type (Only HIVE with HF >= 24)

Parameters:follow_type (list) – follow_type can be blacklisted, follow_blacklist muted, or follow_muted
get_followers(raw_name_list=True, limit=100)

Returns the account followers as list

get_following(raw_name_list=True, limit=100)

Returns who the account is following as list

get_manabar()

Return manabar

get_manabar_recharge_time(manabar, recharge_pct_goal=100)

Returns the account mana recharge time in minutes

Parameters:
  • manabar (dict) – manabar dict from get_manabar() or get_rc_manabar()
  • recharge_pct_goal (float) – mana recovery goal in percentage (default is 100)
get_manabar_recharge_time_str(manabar, recharge_pct_goal=100)

Returns the account manabar recharge time as string

Parameters:
  • manabar (dict) – manabar dict from get_manabar() or get_rc_manabar()
  • recharge_pct_goal (float) – mana recovery goal in percentage (default is 100)
get_manabar_recharge_timedelta(manabar, recharge_pct_goal=100)

Returns the account mana recharge time as timedelta object

Parameters:
  • manabar (dict) – manabar dict from get_manabar() or get_rc_manabar()
  • recharge_pct_goal (float) – mana recovery goal in percentage (default is 100)
get_muters(raw_name_list=True, limit=100)

Returns the account muters as list

get_mutings(raw_name_list=True, limit=100)

Returns who the account is muting as list

get_notifications(only_unread=True, limit=100, raw_data=False, account=None)

Returns account notifications

Parameters:
  • only_unread (bool) – When True, only unread notfications are shown
  • limit (int) – When set, the number of shown notifications is limited (max limit = 100)
  • raw_data (bool) – When True, the raw data from the api call is returned.
  • account (str) – (optional) the account for which the notification should be received to (defaults to default_account)
get_owner_history(account=None)

Returns the owner history of an account.

Parameters:account (str) – When set, a different account is used for the request (Default is object account name)
Return type:list
>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("beem.app", blockchain_instance=stm)
>>> account.get_owner_history()
[]
get_rc()

Return RC of account

get_rc_manabar()

Returns current_mana and max_mana for RC

get_recharge_time(voting_power_goal=100, starting_voting_power=None)

Returns the account voting power recharge time in minutes

Parameters:
  • voting_power_goal (float) – voting power goal in percentage (default is 100)
  • starting_voting_power (float) – returns recharge time if current voting power is the provided value.
get_recharge_time_str(voting_power_goal=100, starting_voting_power=None)

Returns the account recharge time as string

Parameters:
  • voting_power_goal (float) – voting power goal in percentage (default is 100)
  • starting_voting_power (float) – returns recharge time if current voting power is the provided value.
get_recharge_timedelta(voting_power_goal=100, starting_voting_power=None)

Returns the account voting power recharge time as timedelta object

Parameters:
  • voting_power_goal (float) – voting power goal in percentage (default is 100)
  • starting_voting_power (float) – returns recharge time if current voting power is the provided value.
get_recovery_request(account=None)

Returns the recovery request for an account

Parameters:account (str) – When set, a different account is used for the request (Default is object account name)
Return type:list
>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("beem.app", blockchain_instance=stm)
>>> account.get_recovery_request()
[]
get_reputation()

Returns the account reputation in the (steemit) normalized form

get_savings_withdrawals(direction='from', account=None)

Returns the list of savings withdrawls for an account.

Parameters:
  • account (str) – When set, a different account is used for the request (Default is object account name)
  • direction (str) – Can be either from or to (only non appbase nodes)
Return type:

list

>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("beem.app", blockchain_instance=stm)
>>> account.get_savings_withdrawals()
[]
get_similar_account_names(limit=5)

Returns limit account names similar to the current account name as a list

Parameters:limit (int) – limits the number of accounts, which will be returned
Returns:Similar account names as list
Return type:list

This is a wrapper around beem.blockchain.Blockchain.get_similar_account_names() using the current account name as reference.

get_steem_power(onlyOwnSP=False)

Returns the account steem power

get_tags_used_by_author(account=None)

Returns a list of tags used by an author.

Parameters:account (str) – When set, a different account is used for the request (Default is object account name)
Return type:list
get_token_power(only_own_vests=False, use_stored_data=True)

Returns the account Hive/Steem power (amount of staked token + delegations)

Parameters:
  • only_own_vests (bool) – When True, only owned vests is returned without delegation (default False)
  • use_stored_data (bool) – When False, an API call returns the current vests_to_token_power ratio everytime (default True)
get_vesting_delegations(start_account='', limit=100, account=None)

Returns the vesting delegations by an account.

Parameters:
  • account (str) – When set, a different account is used for the request (Default is object account name)
  • start_account (str) – delegatee to start with, leave empty to start from the first by name
  • limit (int) – maximum number of results to return
Return type:

list

>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("beem.app", blockchain_instance=stm)
>>> account.get_vesting_delegations()
[]
get_vests(only_own_vests=False)

Returns the account vests

Parameters:only_own_vests (bool) – When True, only owned vests is returned without delegation (default False)
get_vote(comment)

Returns a vote if the account has already voted for comment.

Parameters:comment (str, Comment) – can be a Comment object or a authorpermlink
get_vote_pct_for_SBD(sbd, post_rshares=0, voting_power=None, steem_power=None, not_broadcasted_vote=True)

Returns the voting percentage needed to have a vote worth a given number of SBD.

If the returned number is bigger than 10000 or smaller than -10000, the given SBD value is too high for that account

Parameters:sbd (str, int, amount.Amount) – The amount of SBD in vote value
get_vote_pct_for_vote_value(token_units, post_rshares=0, voting_power=None, token_power=None, not_broadcasted_vote=True)

Returns the voting percentage needed to have a vote worth a given number of Hive/Steem token units

If the returned number is bigger than 10000 or smaller than -10000, the given SBD value is too high for that account

Parameters:token_units (str, int, amount.Amount) – The amount of HBD/SBD in vote value
get_voting_power(with_regeneration=True)

Returns the account voting power in the range of 0-100%

Parameters:with_regeneration (bool) – When True, voting power regeneration is included into the result (default True)
get_voting_value(post_rshares=0, voting_weight=100, voting_power=None, token_power=None, not_broadcasted_vote=True)

Returns the account voting value in Hive/Steem token units

get_voting_value_SBD(post_rshares=0, voting_weight=100, voting_power=None, steem_power=None, not_broadcasted_vote=True)

Returns the account voting value in SBD

get_withdraw_routes(account=None)

Returns the withdraw routes for an account.

Parameters:account (str) – When set, a different account is used for the request (Default is object account name)
Return type:list
>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("beem.app", blockchain_instance=stm)
>>> account.get_withdraw_routes()
[]
has_voted(comment)

Returns if the account has already voted for comment

Parameters:comment (str, Comment) – can be a Comment object or a authorpermlink
history(start=None, stop=None, use_block_num=True, only_ops=[], exclude_ops=[], batch_size=1000, raw_output=False)

Returns a generator for individual account transactions. The earlist operation will be first. This call can be used in a for loop.

Parameters:
  • start (int, datetime) – start number/date of transactions to return (optional)
  • stop (int, datetime) – stop number/date of transactions to return (optional)
  • use_block_num (bool) – if true, start and stop are block numbers, otherwise virtual OP count numbers.
  • only_ops (array) – Limit generator by these operations (optional)
  • exclude_ops (array) – Exclude thse operations from generator (optional)
  • batch_size (int) – internal api call batch size (optional)
  • raw_output (bool) – if False, the output is a dict, which includes all values. Otherwise, the output is list.

Note

only_ops and exclude_ops takes an array of strings: The full list of operation ID’s can be found in beembase.operationids.ops. Example: [‘transfer’, ‘vote’]

acc = Account("gtg")
max_op_count = acc.virtual_op_count()
# Returns the 100 latest operations
acc_op = []
for h in acc.history(start=max_op_count - 99, stop=max_op_count, use_block_num=False):
    acc_op.append(h)
len(acc_op)
100
acc = Account("test")
max_block = 21990141
# Returns the account operation inside the last 100 block. This can be empty.
acc_op = []
for h in acc.history(start=max_block - 99, stop=max_block, use_block_num=True):
    acc_op.append(h)
len(acc_op)
0
acc = Account("test")
start_time = datetime(2018, 3, 1, 0, 0, 0)
stop_time = datetime(2018, 3, 2, 0, 0, 0)
# Returns the account operation from 1.4.2018 back to 1.3.2018
acc_op = []
for h in acc.history(start=start_time, stop=stop_time):
    acc_op.append(h)
len(acc_op)
0
history_reverse(start=None, stop=None, use_block_num=True, only_ops=[], exclude_ops=[], batch_size=1000, raw_output=False)

Returns a generator for individual account transactions. The latest operation will be first. This call can be used in a for loop.

Parameters:
  • start (int, datetime) – start number/date of transactions to return. If negative the virtual_op_count is added. (optional)
  • stop (int, datetime) – stop number/date of transactions to return. If negative the virtual_op_count is added. (optional)
  • use_block_num (bool) – if true, start and stop are block numbers, otherwise virtual OP count numbers.
  • only_ops (array) – Limit generator by these operations (optional)
  • exclude_ops (array) – Exclude thse operations from generator (optional)
  • batch_size (int) – internal api call batch size (optional)
  • raw_output (bool) – if False, the output is a dict, which includes all values. Otherwise, the output is list.

Note

only_ops and exclude_ops takes an array of strings: The full list of operation ID’s can be found in beembase.operationids.ops. Example: [‘transfer’, ‘vote’]

acc = Account("gtg")
max_op_count = acc.virtual_op_count()
# Returns the 100 latest operations
acc_op = []
for h in acc.history_reverse(start=max_op_count, stop=max_op_count - 99, use_block_num=False):
    acc_op.append(h)
len(acc_op)
100
max_block = 21990141
acc = Account("test")
# Returns the account operation inside the last 100 block. This can be empty.
acc_op = []
for h in acc.history_reverse(start=max_block, stop=max_block-100, use_block_num=True):
    acc_op.append(h)
len(acc_op)
0
acc = Account("test")
start_time = datetime(2018, 4, 1, 0, 0, 0)
stop_time = datetime(2018, 3, 1, 0, 0, 0)
# Returns the account operation from 1.4.2018 back to 1.3.2018
acc_op = []
for h in acc.history_reverse(start=start_time, stop=stop_time):
    acc_op.append(h)
len(acc_op)
0
interest()

Calculate interest for an account

Parameters:account (str) – Account name to get interest for
Return type:dictionary

Sample output:

{
    'interest': 0.0,
    'last_payment': datetime.datetime(2018, 1, 26, 5, 50, 27, tzinfo=<UTC>),
    'next_payment': datetime.datetime(2018, 2, 25, 5, 50, 27, tzinfo=<UTC>),
    'next_payment_duration': datetime.timedelta(-65, 52132, 684026),
    'interest_rate': 0.0
}
is_fully_loaded

Is this instance fully loaded / e.g. all data available?

Return type:bool
json()
json_metadata
list_all_subscriptions(account=None)

Returns all subscriptions

mark_notifications_as_read(last_read=None, account=None)

Broadcast a mark all notification as read custom_json

Parameters:
  • last_read (str) – When set, this datestring is used to set the mark as read date
  • account (str) – (optional) the account to broadcast the custom_json to (defaults to default_account)
mute(mute, account=None)

Mute another account

Parameters:
  • mute (str) – Mute this account
  • account (str) – (optional) the account to allow access to (defaults to default_account)
name

Returns the account name

posting_json_metadata
print_info(force_refresh=False, return_str=False, use_table=False, **kwargs)

Prints import information about the account

profile

Returns the account profile

refresh()

Refresh/Obtain an account’s data from the API server

rep

Returns the account reputation

reply_history(limit=None, start_author=None, start_permlink=None, account=None)

Stream the replies to an account in reverse time order.

Note

RPC nodes keep a limited history of entries for the replies to an author. Older replies to an account may not be available via this call due to these node limitations.

Parameters:
  • limit (int) – (optional) stream the latest limit replies. If unset (default), all available replies are streamed.
  • start_author (str) – (optional) start streaming the replies from this author. start_permlink=None (default) starts with the latest available entry. If set, start_permlink has to be set as well.
  • start_permlink (str) – (optional) start streaming the replies from this permlink. start_permlink=None (default) starts with the latest available entry. If set, start_author has to be set as well.
  • account (str) – (optional) the account to get replies to (defaults to default_account)

comment_history_reverse example:

from beem.account import Account
acc = Account("ned")
for reply in acc.reply_history(limit=10):
    print(reply)
reward_balances
saving_balances
set_withdraw_vesting_route(to, percentage=100, account=None, auto_vest=False, **kwargs)

Set up a vesting withdraw route. When vesting shares are withdrawn, they will be routed to these accounts based on the specified weights.

Parameters:
  • to (str) – Recipient of the vesting withdrawal
  • percentage (float) – The percent of the withdraw to go to the ‘to’ account.
  • account (str) – (optional) the vesting account
  • auto_vest (bool) – Set to true if the ‘to’ account should receive the VESTS as VESTS, or false if it should receive them as STEEM. (defaults to False)
setproxy(proxy='', account=None)

Set the witness and proposal system proxy of an account

Parameters:
  • proxy (str or Account) – The account to set the proxy to (Leave empty for removing the proxy)
  • account (str or Account) – The account the proxy should be set for
sp

Returns the accounts Steem Power

total_balances
tp

Returns the accounts Hive/Steem Power

transfer(to, amount, asset, memo='', skip_account_check=False, account=None, **kwargs)

Transfer an asset to another account.

Parameters:
  • to (str) – Recipient
  • amount (float) – Amount to transfer
  • asset (str) – Asset to transfer
  • memo (str) – (optional) Memo, may begin with # for encrypted messaging
  • skip_account_check (bool) – (optional) When True, the receiver account name is not checked to speed up sending multiple transfers in a row
  • account (str) – (optional) the source account for the transfer if not default_account

Transfer example:

from beem.account import Account
from beem import Hive
active_wif = "5xxxx"
stm = Hive(keys=[active_wif])
acc = Account("test", blockchain_instance=stm)
acc.transfer("test1", 1, "HIVE", "test")
transfer_from_savings(amount, asset, memo, request_id=None, to=None, account=None, **kwargs)

Withdraw SBD or STEEM from ‘savings’ account.

Parameters:
  • amount (float) – STEEM or SBD amount
  • asset (float) – ‘STEEM’ or ‘SBD’
  • memo (str) – (optional) Memo
  • request_id (str) – (optional) identifier for tracking or cancelling the withdrawal
  • to (str) – (optional) the source account for the transfer if not default_account
  • account (str) – (optional) the source account for the transfer if not default_account
transfer_to_savings(amount, asset, memo, to=None, account=None, **kwargs)

Transfer SBD or STEEM into a ‘savings’ account.

Parameters:
  • amount (float) – STEEM or SBD amount
  • asset (float) – ‘STEEM’ or ‘SBD’
  • memo (str) – (optional) Memo
  • to (str) – (optional) the source account for the transfer if not default_account
  • account (str) – (optional) the source account for the transfer if not default_account
transfer_to_vesting(amount, to=None, account=None, skip_account_check=False, **kwargs)

Vest STEEM

Parameters:
  • amount (float) – Amount to transfer
  • to (str) – Recipient (optional) if not set equal to account
  • account (str) – (optional) the source account for the transfer if not default_account
  • skip_account_check (bool) – (optional) When True, the receiver account name is not checked to speed up sending multiple transfers in a row
type_id = 2
unfollow(unfollow, account=None)

Unfollow/Unmute another account’s blog

Parameters:
  • unfollow (str) – Unfollow/Unmute this account
  • account (str) – (optional) the account to allow access to (defaults to default_account)
update_account_jsonmetadata(metadata, account=None, **kwargs)

Update an account’s profile in json_metadata using the posting key

Parameters:
  • metadata (dict) – The new metadata to use
  • account (str) – (optional) the account to allow access to (defaults to default_account)
update_account_keys(new_password, account=None, **kwargs)

Updates all account keys

This method does not add any private keys to your wallet but merely changes the public keys.

Parameters:
  • new_password (str) – is used to derive the owner, active, posting and memo key
  • account (str) – (optional) the account to allow access to (defaults to default_account)
update_account_metadata(metadata, account=None, **kwargs)

Update an account’s profile in json_metadata

Parameters:
  • metadata (dict) – The new metadata to use
  • account (str) – (optional) the account to allow access to (defaults to default_account)
update_account_profile(profile, account=None, **kwargs)

Update an account’s profile in json_metadata

Parameters:
  • profile (dict) – The new profile to use
  • account (str) – (optional) the account to allow access to (defaults to default_account)

Sample profile structure:

{
    'name': 'Holger',
    'about': 'beem Developer',
    'location': 'Germany',
    'profile_image': 'https://c1.staticflickr.com/5/4715/38733717165_7070227c89_n.jpg',
    'cover_image': 'https://farm1.staticflickr.com/894/26382750057_69f5c8e568.jpg',
    'website': 'https://github.com/holgern/beem'
}
from beem.account import Account
account = Account("test")
profile = account.profile
profile["about"] = "test account"
account.update_account_profile(profile)
update_memo_key(key, account=None, **kwargs)

Update an account’s memo public key

This method does not add any private keys to your wallet but merely changes the memo public key.

Parameters:
  • key (str) – New memo public key
  • account (str) – (optional) the account to allow access to (defaults to default_account)
verify_account_authority(keys, account=None)

Returns true if the signers have enough authority to authorize an account.

Parameters:
  • keys (list) – public key
  • account (str) – When set, a different account is used for the request (Default is object account name)
Return type:

dictionary

>>> from beem.account import Account
>>> from beem import Hive
>>> from beem.nodelist import NodeList
>>> nodelist = NodeList()
>>> nodelist.update_nodes()
>>> stm = Hive(node=nodelist.get_hive_nodes())
>>> account = Account("steemit", blockchain_instance=stm)
>>> print(account.verify_account_authority(["STM7Q2rLBqzPzFeteQZewv9Lu3NLE69fZoLeL6YK59t7UmssCBNTU"])["valid"])
False
virtual_op_count(until=None)

Returns the number of individual account transactions

Return type:list
vp

Returns the account voting power in the range of 0-100%

withdraw_vesting(amount, account=None, **kwargs)

Withdraw VESTS from the vesting account.

Parameters:
  • amount (float) – number of VESTS to withdraw over a period of 13 weeks
  • account (str) – (optional) the source account for the transfer if not default_account
class beem.account.Accounts(name_list, batch_limit=100, lazy=False, full=True, blockchain_instance=None, **kwargs)

Bases: beem.account.AccountsObject

Obtain a list of accounts

Parameters:
  • name_list (list) – list of accounts to fetch
  • batch_limit (int) – (optional) maximum number of accounts to fetch per call, defaults to 100
  • blockchain_instance (Steem/Hive) – Steem() or Hive() instance to use when accessing a RPCcreator = Account(creator, blockchain_instance=self)
class beem.account.AccountsObject

Bases: list

printAsTable()
print_summarize_table(tag_type='Follower', return_str=False, **kwargs)
beem.account.extract_account_name(account)