beem.account module

class beem.account.Account(account, full=True, lazy=False, steem_instance=None)

Bases: beem.blockchainobject.BlockchainObject

This class allows to easily access Account data

Parameters:
  • account_name (str) – Name of the account
  • steem_instance (beem.steem.Steem) – Steem instance
  • lazy (bool) – Use lazy loading
  • full (bool) – Obtain all account data including orders, positions, etc.
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 it’s corresponding functions.

from beem.account import Account
account = Account("test")
print(account)
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().

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 active)
  • 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
approvewitness(witness, account=None, approve=True, **kwargs)

Approve a witness

Parameters:
  • witnesses (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 steem.amount.Amount.

balances
cancel_transfer_from_savings(request_id, account=None)

Cancel a withdrawal from ‘savings’ account. :param str request_id: Identifier for tracking or cancelling the withdrawal :param str account: (optional) the source account for the transfer if not default_account

claim_reward_balance(reward_steem='0 STEEM', reward_sbd='0 SBD', reward_vests='0 VESTS', account=None)

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_sbd or reward_vests. Args:

reward_steem (string): Amount of STEEM you would like to claim. reward_sbd (string): Amount of SBD you would like to claim. reward_vests (string): Amount of VESTS you would like to claim. account (string): The source account for the claim if not default_account is used.
convert(amount, account=None, request_id=None)

Convert SteemDollars to Steem (takes one week to settle) :param float amount: number of VESTS to withdraw :param str account: (optional) the source account for the transfer if not default_account :param str request_id: (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

delegate_vesting_shares(to_account, vesting_shares, account=None)

Delegate SP to another account. Args:

to_account (string): Account we are delegating shares to (delegatee). vesting_shares (string): Amount of VESTS to delegate eg. 10000 VESTS. account (string): 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 active)
  • 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:
  • witnesses (list) – list of Witness name or id
  • account (str) – (optional) the account to allow access to (defaults to default_account)
ensure_full()
follow(other, what=['blog'], account=None)

Follow/Unfollow/Mute/Unmute another account’s blog :param str other: Follow this account :param list what: List of states to follow.

['blog'] means to follow other, [] means to unfollow/unmute other, ['ignore'] means to ignore other, (defaults to ['blog'])
Parameters:account (str) – (optional) the account to allow access to (defaults to default_account)
getSimilarAccountNames(limit=5)

Returns limit similar accounts with name as array

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. :param int index: first number of transactions to

return
Parameters:
  • 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_votes(account=None)

Returns all votes that the account has done

get_balance(balances, symbol)

Obtain the balance of a specific Asset. This call returns instances of steem.amount.Amount.

get_balances()
get_bandwidth()

Returns used and allocated bandwidth

get_blog(entryId=0, limit=100, raw_data=False, account=None)
get_blog_account(account=None)
get_blog_entries(entryId=0, limit=100, raw_data=False, account=None)
get_conversion_requests(account=None)

get_owner_history

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_feed(entryId=0, limit=100, raw_data=False, account=None)
get_follow_count(account=None)
get_followers(raw_name_list=True)

Returns the account followers as list

get_following(raw_name_list=True)

Returns who the account is following as list

get_muters(raw_name_list=True)

Returns the account muters as list

get_mutings(raw_name_list=True)

Returns who the account is muting as list

get_owner_history(account=None)
get_recharge_time(voting_power_goal=100)

Returns the account voting power recharge time in minutes

get_recharge_time_str(voting_power_goal=100)

Returns the account recharge time

get_recharge_timedelta(voting_power_goal=100)

Returns the account voting power recharge time as timedelta object

get_recovery_request(account=None)
get_reputation()

Returns the account reputation

get_steem_power(onlyOwnSP=False)

Returns the account steem power

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_voting_power(with_regeneration=True)

Returns the account voting power

get_voting_value_SBD(voting_weight=100, voting_power=None, steem_power=None)

Returns the account voting value in SBD

get_withdraw_routes(account=None)

Returns 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’]
Example::

from beem.account import Account from beem.blockchain import Blockchain from datetime import datetime acc = Account(“test”) max_op_count = acc.virtual_op_count() # Returns the 100 latest operations for h in acc.history(start=max_op_count-100, stop=max_op_count, use_block_num=False):

print(h)

b = Blockchain() max_block = b.get_current_block_num() # Returns the account operation inside the last 100 block. This can be empty. for h in acc.history(start=max_block-100, stop=max_block, use_block_num=True):

print(h)

start_time = datetime(2018, 3, 1, 0, 0, 0) stop_time = datetime(2018, 4, 1, 0, 0, 0) # Returns the account operation from 1.4.2018 back to 1.3.2018 for h in acc.history(start=start_time, stop=stop_time):

print(h)
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’]
Example::

from beem.account import Account from beem.blockchain import Blockchain from datetime import datetime acc = Account(“test”) max_op_count = acc.virtual_op_count() # Returns the 100 latest operations for h in acc.history_reverse(start=max_op_count, stop=max_op_count-100, use_block_num=False):

print(h)

b = Blockchain() max_block = b.get_current_block_num() # Returns the account operation inside the last 100 block. This can be empty. for h in acc.history_reverse(start=max_block, stop=max_block-100, use_block_num=True):

print(h)

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 for h in acc.history_reverse(start=start_time, stop=stop_time):

print(h)
interest()

Caluclate interest for an account :param str account: Account name to get interest for

is_fully_loaded

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

json()
mute(mute, account=None)

Mute another account :param str mute: Mute this account :param str account: (optional) the account to allow access

to (defaults to default_account)
name

Returns the account name

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

reward_balances
saving_balances
set_withdraw_vesting_route(to, percentage=100, account=None, auto_vest=False)

Set up a vesting withdraw route. When vesting shares are withdrawn, they will be routed to these accounts based on the specified weights. :param str to: Recipient of the vesting withdrawal :param float percentage: The percent of the withdraw to go

to the ‘to’ account.
Parameters:
  • account (str) – (optional) the vesting account
  • auto_vest (bool) – Set to true if the from account should receive the VESTS as VESTS, or false if it should receive them as STEEM. (defaults to False)
sp
total_balances
transfer(to, amount, asset, memo='', 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
  • account (str) – (optional) the source account for the transfer if not default_account
transfer_from_savings(amount, asset, memo, request_id=None, to=None, account=None)

Withdraw SBD or STEEM from ‘savings’ account. :param float amount: STEEM or SBD amount :param float asset: ‘STEEM’ or ‘SBD’ :param str memo: (optional) Memo :param str request_id: (optional) identifier for tracking or cancelling the withdrawal :param str to: (optional) the source account for the transfer if not default_account :param str account: (optional) the source account for the transfer if not default_account

transfer_to_savings(amount, asset, memo, to=None, account=None)

Transfer SBD or STEEM into a ‘savings’ account. :param float amount: STEEM or SBD amount :param float asset: ‘STEEM’ or ‘SBD’ :param str memo: (optional) Memo :param str to: (optional) the source account for the transfer if not default_account :param str account: (optional) the source account for the transfer if not default_account

transfer_to_vesting(amount, to=None, account=None, **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
type_id = 2
unfollow(unfollow, account=None)

Unfollow/Unmute another account’s blog :param str unfollow: Unfollow/Unmute this account :param str account: (optional) the account to allow access

to (defaults to default_account)
update_account_profile(profile, account=None)

Update an account’s meta data (json_meta) :param dict json: The meta data to use (i.e. use Profile() from

account.py)
Parameters:account (str) – (optional) the account to allow access to (defaults to default_account)
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)
virtual_op_count(until=None)

Returns the number of individual account transactions

vp
withdraw_vesting(amount, account=None)

Withdraw VESTS from the vesting account. :param float amount: number of VESTS to withdraw over a period of 104 weeks :param str account: (optional) the source account for the transfer if not default_account

class beem.account.Accounts(name_list, batch_limit=100, steem_instance=None)

Bases: beem.account.AccountsObject

Obtain a list of accounts

Parameters:steem_instance (steem) – Steem() instance to use when accesing a RPC
class beem.account.AccountsObject

Bases: list

printAsTable()
print_summarize_table(tag_type='Follower', return_str=False, **kwargs)