Skip to content

Tree Node

Hugh Jeremy edited this page Mar 18, 2019 · 6 revisions

Documentation > TreeNode

A Tree Node is a specialised view of an Account. It provides a recursive and individual balance for an Account. You will never interact with Tree Nodes' directly, instead you will receive lists of Tree Nodes as components of requests for Trees, Positions, and Performances.

Tree Nodes are recursive objects that may contain other Tree Nodes, depending on whether the Account in question has any children.

Trees, Positions, and Performances describe entire Entities. The User from whose perspective you retrieve a Tree, Position, or Performance may not have read access to every Account in the Entity. In such cases, Tree Nodes describing Accounts to which a User does not have read access will be returned with null in their balance fields, and a generic AMType in place of the actual Account name.

Properties

.session - Session

The Session used to initialise the higher-order object that owns this TreeNode


.entity - Entity

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


.account_id - int

The integer identifier of the Account this TreeNode describes.

Example: 42


.account - Account

The Account that this TreeNode describes. Initial access to the .account property causes a new synchronous call to the API. Subsequence accesses return cached data.

Example: See Account


.depth - int

The number of levels into the hierarchy at which the Account this TreeNode describes sits. Top level accounts are 1.

Example: 2


.account_balance - Decimal

The sum total of all Transactions party to the Account this TreeNode describes, as at the date of the higher-order object that controls this TreeNode.

Example: `Decimal('1142')


.recursive_balance - Decimal

The sum total of all Transactions party to the Account this TreeNode describes, and all of the children of that Account.

Example: Decimal('4211')


.name - str

The string name of the Account this TreeNode describes.

Example: Current Assets


.am_type - AMType

The AMType of the Account this TreeNode describes, one of asset, liability, equity, income, or expense.

Example: AMType.asset


.children - List[TreeNode]

A recursive list of TreeNodes describing the children of the Account this TreeNode describes. It said Account has no children, the list will be empty.


.has_children - bool

True if the Account this TreeNode describes has any children. When True, you can expect that the list in .children is not empty.

Example: True

You can’t perform that action at this time.