Skip to content

Balance

Hugh Jeremy edited this page Jan 19, 2019 · 4 revisions

Documentation > Balance

A Balance represents the sum total value of all Entries party to an Account.

Properties

.session - Session

The Session used to initialise this Balance


.entity - Entity

The Entity to which the Account described by this Balance belongs.


.time - datetime

The time at which this Balance holds. Transactions before this time are included, and those after are excluded.

Example: datetime.datetime(2019, 1, 18, 21, 4, 43, 557821)


.account - Account

The Account that this Balance describes. Retrieving the .account property causes a new synchronous call to the API, the Balance object only stores a reference to the Account ID (the .account_id property), not the whole Account object.


.account_id - int

The integer ID of the Account that this Balance describes.

Example: 42


.denomination - Denomation

The denominating unit of this Balance, either a GlobalUnit or a CustomUnit. Retrieving the .denomination property will cause a synchronous call to the API.


.is_recursive - bool

An assertion that this is not a RecursiveBalance

Example: False


.generated_time - datetime

The time at which this Balance object was generated.

Example: datetime.datetime(2019, 1, 18, 21, 4, 43, 557821)


.global_unit_id - Optional[int]

The integer identifier of the GlobalUnit denominating this Balance, if any.

Example: 5


.custom_unit_id - Optional[int]

The integer identifier of the CustomUnit denominating this Balance, if any.

Example: None


.page - int

The integer number of the page of all potential Ledger data that this Ledger instance presents.

Example: 1

Methods

classmethod .retrieve() -> Balance

Return a new Balance instance.

Parameters

  1. entity - Entity
  2. account - Account
  3. balance_time - Optional[datetime]
  4. denomination - Optional[Denomination]

Example

balance = Balance.retrieve(
  entity=mega_corp,
  account=cash_account
)
print(balance.magnitude)

Clone this wiki locally