graphenecommon.aio.account module

class graphenecommon.aio.account.Account(*args, **kwargs)

Bases: graphenecommon.aio.blockchainobject.BlockchainObject, graphenecommon.account.Account

This class allows to easily access Account data

Parameters:
  • account_name (str) – Name of the account
  • blockchain_instance (instance) – instance to use when accesing a RPC
  • full (bool) – Obtain all account data including orders, positions, etc.
  • lazy (bool) – Use lazy loading
  • full – Obtain all account data including orders, positions, etc.
Returns:

Account data

Return type:

dictionary

Raises:

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 aio.account import Account
account = await Account("init0")
print(account)

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 await Account.refresh().

balance(symbol)

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

balances

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

blacklist(account)

Add an other account to the blacklist of this account

ensure_full()
history(first=0, last=0, limit=-1, only_ops=[], exclude_ops=[])

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

Parameters:
  • first (int) – sequence number of the first transaction to return (optional)
  • last (int) – sequence number of the last transaction to return (optional)
  • limit (int) – limit number of transactions to return (optional)
  • only_ops (array) – Limit generator by these operations (optional)
  • exclude_ops (array) – Exclude these operations from generator (optional).
… note::
only_ops and exclude_ops takes an array of strings: The full list of operation ID’s can be found in operationids.py. Example: [‘transfer’, ‘fill_order’]
nolist(account)

Remove an other account from any list of this account

refresh()

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

upgrade()

Upgrade account to life time member

whitelist(account)

Add an other account to the whitelist of this account

class graphenecommon.aio.account.AccountUpdate(data, *args, **kwargs)

Bases: graphenecommon.account.AccountUpdate

This purpose of this class is to keep track of account updates as they are pushed through by notify.Notify.

Instances of this class are dictionaries and take the following form:

… code-block: js

{‘id’: ‘2.6.29’,
‘lifetime_fees_paid’: ‘44261516129’, ‘most_recent_op’: ‘2.9.0’, ‘owner’: ‘1.2.29’, ‘pending_fees’: 0, ‘pending_vested_fees’: 16310, ‘total_core_in_orders’: ‘6788845277634’, ‘total_ops’: 0}
account

In oder to obtain the actual account.Account from this class, you can use the account attribute.