Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Documentation > Transaction
A Transaction is an exchange of value between two or more Accounts. For example, the raising of an invoice, the incrurring of a liability, or the receipt of a payment. Many Transactions together, each touching the same Account, form an Account Ledger, and the cumulative sum of the Transactions form an Account Balance.
Transactions are composed of Entries, each of which includes a debit or credit (The fundamental Sides). The sum of all debits and credits in all the Entries that compose a Transaction must always equal zero.
Transactions may be retrieved and created in arbitrary units, either a Global Units or Custom Units. Amatino will transparently handle all unit conversions. For example, a Transaction could be created in Australian Dollars, touch an Account denominated in Pounds Sterling, and be retrieved in Bitcoin.
.session - Session
The underlying credentials used to retrieve this Transaction instance
.entity - Entity
The Entity which this Transaction describes
.time - datetime
The time at which this Transaction was or is to be executed
.description - str
A human-friendly description of this Transaction
'Recognise receipt of sweet loot'
.entries - List[Entry]
A list Entry instances that comprise this Transaction
.global_unit_id - Optional[int]
The integer identifier of the GlobalUnit that denominates this Transaction, if any
.customer_unit_id - Optional[int]
The integer identifier of the CustomUnit that denominations this Transaction, if any
.denomination - Denomination
.create() -> Transaction
Return a new Transaction, created using the supplied parameters
- session: Session
- entity: Entity
- time: datetime
- entries: List[Entry]
- denomination: Denomination
- description: Optional[str]
transaction = Transaction.create( session=session, entity=mega_corp, time=datetime.utcnow(), entries=[ Entry(Side.debit, Decimal(10), asset_account), Entry(Side.credit, Decimal(5), liability_account), Entry(Side.credit, Decimal(5), another_account) ] denomination=USD )
.retrieve() -> Transaction
Return an existing Transaction.
Note that a Denomination is required - A Transaction may touch Accounts with heterogenous denominations, a circumstance under which default behaviour would be non-deterministic. Therefore, you are required to explicitly provide the denomination with which you wish to view the Transaction. You can get a convenient reference to
Account and other
transaction = Transaction.retrieve( session=session, entity=mega_corp, id_=458923, denomination=USD )
.update() -> Transaction
Return an updated Transaction. NB: The Transaction instance is not updated in place. The updated Transaction is returned.
All parameters are optional. Those that you do not supply will be set to existing values.
- time: Optional[datetime]
- entries: Optional[List[Entry]]
- denomination: Optional[Denomination]
- description: Optional[str]
updated_transaction = existing_transaction.update( description='New, fancier description', time=datetime.utcnow() )
.delete() -> None:
None after destroying this Transaction, such that it will be no longer included in any view of this Entity's accounting information.