-
Notifications
You must be signed in to change notification settings - Fork 2
Ledger
Documentation > Ledger
A Ledger is a list of Transactions from the perspective of a particular Account. Ledgers are ordered by Transaction time, and include a running Account Balance for every line.
You can request Ledgers in arbitrary Global or Custom Units, not just the native unit of the target Account. If you request a Ledger in a unit other than the target Account native unit, Amatino will compute and return unrealised gains and losses.
Amatino will return a maximum total of 1,000 Ledger Rows per retrieval request. If the Ledger you define spans more than 1,000 rows, it will be broken into pages you can retrieve separately.
Ledger complies with the Python Sequence protocol, meaning you can iterate over constituent LedgerRows, call len(), and access elements by subscript.
.session - Session
The Session used to initialise this Ledger
.entity - Entity
The Entity of which this the data described in this Ledger are members
The integer identifier of the Account this Ledger describes
Example: 420
.account - Account
The Account that this Ledger describes.
.denomination - Denomation
The denominating unit of this Ledger, either a GlobalUnit or a CustomUnit
The earliest Transaction time presented by this Ledger.
The latest Transactiontime presented by thisLedger.
An assertion that this is not a RecursiveLedger
Example: False
The time at which this Ledger object was generated.
The integer identifier of the GlobalUnit denominating this Ledger, if any.
Example: 5
The integer identifier of the CustomUnit denominating this Ledger, if any.
Example: None
The integer number of the page of all potential Ledger data that this Ledger instance presents.
Example: 1
The integer number of pages that in total cover all potential Ledger data meeting the parameters supplied
.order - LedgerOrder
The order in which [LedgerRows] are presented in this Ledger instance, either youngest first or oldest first.
Example: LedgerOrder.YOUNGEST_FIRST
.rows - List[LedgerRow]
A list of LedgerRow instances describing all the Transactions satisfying the parameters supplied to this Ledger
Return a new Ledger instance.
- entity - Entity
- account - Account
- order - LedgerOrder (Defaults to
.YOUNGEST_FIRST) - page - int (Defaults to
1) - start_time - Optional[datetime]
- end_time - Optional[datetime]
- denomination - Optional[Denomination]
ledger = Ledger.retrieve(
entity=mega_corp,
account=cash_account
)
for row in ledger:
print(row.balance)