Skip to content

Account

Hugh Jeremy edited this page Mar 27, 2019 · 16 revisions

Documentation > Account

An Account is collection of related economic activity. For example, an Account might represent a bank account, income from a particular client, or entity equity. Many Accounts together compose an Entity.

Accounts themselves are composed of Transactions, and the sum of constituent transactions yield an Account Balance.

The Accounts that compose an Entity may be viewed together as part of the Tree.

Properties

.id_ - int

An identifier for this account, unique within an Entity. Note the trailing underscore, necessary to prevent clobbering of Python's inbuilt id property.

Example: 42


.session - Session

The Session used to initialise this Account


.entity - Entity

The Entity of which this Account is a member


.name - str

A friendly name for this Account

Example: "Subscription revenue"


.am_type - Type

The Amatino type of the Account, one of .asset, .liability, .income, .expense or .equity

Example: Type.income


.parent_id - Optional[int] (int or None)

The identifier of this Account's parent, if there is one

Example: 154


.parent - Optional[Account] (Account or _None_)

The parent of this Account, if it has one


.global_unit_id - Optional[int] (int or None)

The identifier of this Account's denominating Global Unit, or none if this Account is denominated by a Custom Unit

Example: 5


.custom_unit_id - Optional[int] (int or None)

The identifier of this Account's denominating Custom Unit, or none if this Account is denominated by a Global Unit

Example: none


.denomination - Denomination

The denominating unit of this Account, either a GlobalUnit or a CustomUnit.

Example: See Denomination


.counterPartyEntityId - Optional[str] (str or None)

The identifier of an Entity identified as a counter-party to this Account, if any

Example: None


.description - str

Friendly description of this Account

Example: "Sweet loot from accounting API subscriptions"


.color - Color

Hex colour value associated with this Account, stored in an instance of Color

Example: See Color

Methods

classmethod .create() -> Account

Create a new Account

Parameters

  1. entity: Entity
  2. name: str
  3. am_type: AMType
  4. denomination: Denomination
  5. description: Optional[str]
  6. parent: Optional[Account]
  7. counter_party: Optional[Entity]
  8. color: Optional[Color]

Example

cash_on_hand = Account.create(
  entity=mega_corp,
  description='Cash on hand',
  am_type=AMType.asset,
  denomination=USD
)

classmethod .retrieve() -> Account

Retrieve an existing Account.

Parameters

  1. entity: Entity
  2. account_id: int

Example

cash_on_hand = Account.retrieve(
  entity=mega_corp,
  account_id=42
)

.update() -> Account

Update this Account with new metadata. NB: The Account instance is not updated in place. A new instance of Account is returned, containing the prescribed changes.

All parameters are optional. Any parameter that you do not provide will be assigned the existing Account value.

Parameters

  1. name: Optional[str]
  2. am_type: Optional[AMType]
  3. parent: Optional[Account]
  4. description: Optional[str]
  5. denomination: Optional[Denomination]
  6. counterparty: Optional[Entity]
  7. color: Optional[Color]

Example

updated_account = cash_on_hand.update(
  description='An updated, Mk 2.0, revised, epic description'
)

.delete()

Not yet implemented.

Clone this wiki locally